# Jensen's Inequality

I am having trouble with the following proof of Jensen's Inequality. I'll post the statement of the theorem, it's proof, and where I'm having problems:

Let $X$ be a random variable
with $E(X) < \infty$, and let $f : \mathbb{R}\rightarrow\mathbb{R}$ be a convex function. Then
$\begin{equation*}f(E(X))\leq E(f(X))\end{equation*}$ [1]​

where a function is convex if $\forall x_0\in \mathbb{R},\ \exists \lambda \in \mathbb{R}: f(x)\geq \lambda(x-x_0)+f(x_0)$

Proof: Let $f$ be convex and let $\lambda \in \mathbb{R}$ be such that
$f(X)\geq \lambda(x-E(X))+f(E(X))$ [2]​
then
$E(f(x))\geq E(\lambda(x-E(X))+f(E(X)))$ [3]
$=f(E(X))$ [4]​
Q.E.D

As is probably clear from my having problems with this, probability and dealing with expectations isn't my strong point but getting from [3] to [4] isn't looking obvious to me at all since if I expand RHS of [3] (and assume $x$ is meant to be $X$, a typo) then unless I'm wrong I get:

$E(f(X))\geq E(\lambda(X-E(X))+f(E(X)))=E(\lambda(X-E(X)))+E(f(E(X)))$ (using E(g(X)+h(X))=E(h(X))+E(f(X)))
$=\lambda E(X)-E(X)+f(E(X))$ (using E(aX+b)=aE(X)+b and E(a)=a (where a,b are constants))
$=(\lambda-1)E(X)+f(E(X))$
and this isn't [4]
Where am I going wrong?

Last edited: