Linearity of maximum function in expectation I was solving an exercise for a probability theory course and stumbled upon the following problem.
Given a continuous random variable $X$, and $\max(a,b) = a$ if $a > b$ and $b$ otherwise, is
$$
E[\max(X, 0)] = \max(E[X], 0)
$$
true in general?

This is false for any random variable $X$ taking both positive and negative values, and true whenever $X$ is either strictly non-negative or strictly non-positive.
It is clear that if $X$ is strictly non-negative, then both the left and right hand side of your equation equal $\mathbb{E}[X] = 0$. Similarly if $X$ is strictly non-positive, then both sides equal zero. Therefore assume otherwise.
In general we have the following:
$$ \mathbb{E}[X] = P(X > 0)\mathbb{E}[X | X > 0] + P(X < 0)\mathbb{E}[X | X < 0] $$
$$ \mathbb{E}[\max(X,0)] = P(X>0)\mathbb{E}[X|X>0].$$
Since $P(X < 0) \not = 0$, we have that $P(X < 0)\mathbb{E}[X|X<0]$ is negative. Thus
$$ \mathbb{E}[\max(X,0)] > \mathbb{E}[X]$$
and also
$$ \mathbb{E}[\max(X,0)] > 0 $$
because $P(X > 0) > 0$ and $\mathbb{E}[X|X>0] > 0$.
Therefore we get the general statement that
$$ \mathbb{E}[\max(X,0)] > \max(\mathbb{E}[X],0)$$
whenever $P(X > 0) \not = 0$ and $P(X < 0) \not = 0$.
