5

This doubt arose when dealing with the typical exercise of calculating the expected grade of a multiple-choice exam answered at random (where each right answer is given $p_1$ points and each wrong answer gets $-p_2$ points).

Let $X \sim \mathrm{Bi}(n,p)$, and consider $h(x)=p_1x -p_2(n-x)= (p_1-np_2)+(p_1+p_2)x$.

In this example, the following equality holds:

$E[h(X)]=h(E[X])$.

My question is: Is this equality always true, for any random variable $X$ and any function $h$? If not, what are some sufficient conditions for it?

For instance: Do the facts of $X$ being a discrete one-dimensional r.v. with finite expected value and $h$ being a linear (i.e., affine) function always imply $E[h(X)]=h(E[X])$?

Vicent
  • 799

1 Answers1

6

In real analysis and probability theory there is an elegant result called Jensen's inequality. What this says is that for any random variable $X$ and a convex function $h$ we have

$$h\left(\mathbb{E} [X]\right) \leq \mathbb{E} \left[ h(X) \right]$$

and the inequality is reversed if $h$ is concave, i.e.

$$h\left(\mathbb{E} [X]\right) \geq \mathbb{E} \left[ h(X) \right]$$

Your question, when do we have $h\left(\mathbb{E} [X]\right) = \mathbb{E} \left[ h(X) \right]$, can then be answered by considering functions that are both concave and convex at the same time. As pointed out, affine functions clearly meet this requirement, since they are the only concave and convex functions everywhere at the same time.

JohnK
  • 20,366
  • 1
    I did not know about this property. Thank you! I'll wait for more answers, just in case, but your answer seems satisfying enough to me. – Vicent Mar 13 '17 at 08:35
  • 1
    But most functions are neither convex nor concave over $\mathcal R$. Are there functions that are neither affine, nor convex or concave over $\mathcal R$, for which $h\left(\mathbb{E} [X]\right) = \mathbb{E} \left[ h(X) \right]$ holds? – Dilip Sarwate Mar 13 '17 at 12:13
  • 2
    @Dilip It's important to be clear about the quantifiers: when $X$ is fixed, the answer is yes; but when $X$ is allowed to vary over all random variables, the answer is no. – whuber Mar 13 '17 at 14:07