Two directions of Jensen’s inequality

Let X equal 1 or 4, each with probability one half. Compare E(X2)E(X^2) with (EX)2(EX)^2 and E(log⁡X)E(\log X) with log⁡(EX)\log(EX). Explain the opposite directions.

EX=2.5EX=2.5, E(X2)=8.5E(X^2)=8.5, and (EX)2=6.25(EX)^2=6.25, so the convex square gives 8.5≥6.258.5\ge 6.25. E(log⁡X)=log⁡(4)/2≈0.69315E(\log X)=\log(4)/2\approx 0.69315, while log⁡(EX)=log⁡(2.5)≈0.91629\log(EX)=\log(2.5)\approx 0.91629, so concavity of log reverses the inequality. Both are strict because X is nonconstant and each function has strict curvature over the support.