# Is $\ln\{E[f(x)]\}$ equal to $E\{\ln[f(x)]\}$? [duplicate]

Is the logarithm of an expectation the same as the expectation of the logarithm?

• A special case of this statement, if true, would be "the arithmetic mean of positive numbers always equals their geometric mean." That contradicts a very well known inequality: see en.wikipedia.org/wiki/…. – whuber May 29 '19 at 17:58

## 2 Answers

No, it's not true. For a counter-example, we have Jensen's inequality, which implies $$f(E[X])\geq E[f(X)]$$, for concave functions, in which $$\log x$$ is also concave as in your case.

Or, for a concrete example, take $$X\in\{1,2\}$$ with equal probability. $$\log(E[X])=\log(3/2)$$ while $$E[\log(X)]=\frac{1}{2}\log 2$$, which are not equal.

• +1, note that the inequality is strict when $f(x)$ is strictly concave (unless $X$ is degenerate). – knrumsey May 29 '19 at 16:57
• @knrumsey The idea's correct, but it's not quite that simple. Consider the case where $X$ is a Uniform variable, for instance and $f$ is linear on $[0,1]$ but strictly concave outside that range. – whuber May 29 '19 at 17:56
• @whuber, I don't see that as a counterexample to my statement. The function that you posit is not strictly concave. I agree it's not the "whole picture" however. Consider the function $f(x) = x^2 I(x > 0)$. This function is not strictly concave, but the inequality will still be strict for a Uniform variable. – knrumsey May 29 '19 at 19:35
• @knrumsey That's part of my point: sometimes the inequality will be strict, sometimes not, even when $f$ is strictly concave in the sense of being strictly concave somewhere. It sounds like you intended it to be strictly concave everywhere, which is fine now that your meaning is clear. – whuber May 29 '19 at 19:42

No by Jensen's inequality we have $$\log(\mathbb{E}[X])\geq \mathbb{E}[\log(X)]$$ as $$\log(\cdot)$$ is a concave function.