I am studying the Jensen inequality for convexity:
Let $X$ be a random variable. If $g$ is a convex function, then $E(g(X)) \ge g(E(X))$. If $g$ is a concave function, then $E(g(X)) \le g(E(X))$. In both cases, the only way that equality can hold is if there are constants $a$ and $b$ such that $g(X) = a + bX$ with probability $1$.
Then I am given a proof for this:
If $g$ is convex, then all lines that are tangent to $g$ lie below $g$ (see Figure 10.1). In particular, let $\mu = E(X)$, and consider the tangent line at the point $(\mu, g(\mu))$. (If $g$ is differentiable at $\mu$ then the tangent line is unique; otherwise, choose any tangent line at $\mu$.) Denoting this tangent line by $a + bx$, we have $g(x) \ge a + bx$ for all $x$ by convexity, so $g(X) \ge a + bX$. Taking the expectation of both sides,
$$E(g(X)) \ge E(a + bX) = a + bE(X) = a + b \mu = g(\mu) = g(E(X)),$$
as desired. If $g$ is concave, then $h = -g$ is convex, so we can apply what we just proved to $h$ to see that the inequality for $g$ is reversed from the convex case.
Lastly, assume that equality holds in the convex case. Let $Y = g(X) - a - bX$. Then $Y$ is a nonnegative r.v. with $E(Y) = 0$, so $P(Y = 0) = 1$ (even a tiny nonzero chance of $Y > 0$ occurring would make $E(Y) > 0$). So equality holds if and only if $P(g(X) = a + bX) = 1$. For the concave case, we can use the same argument with $Y = a + bX - g(X)$. $\blacksquare$
The last part of this proof is where I got confused:
Lastly, assume that equality holds in the convex case. Let $Y = g(X) - a - bX$. Then $Y$ is a nonnegative r.v. with $E(Y) = 0$, so $P(Y = 0) = 1$ (even a tiny nonzero chance of $Y > 0$ occurring would make $E(Y) > 0$). So equality holds if and only if $P(g(X) = a + bX) = 1$. For the concave case, we can use the same argument with $Y = a + bX - g(X)$.
It is my understanding that this last part of the proof is to show that the equality $E(g(X)) = g(E(X))$ only holds if there are constants $a$ and $b$ such that $g(X) = a + bX$ with probability $1$, which is why it begins with the assumption that equality holds in the convex case. However, there are a couple of points that I am confused about:
Why it is valid to assume that $Y$ is a nonnegative r.v. (although, it is clear to me why $E(Y) = 0$, based on the parts of the proof that came before this part).
Why is it that $E(Y) = 0$ implies that $P(Y = 0) = 1$?
Why is it that even a tiny nonzero chance of $Y > 0$ occurring would make $E(Y) > 0$?
Thank you.