Let $X$ be a nonnegative random variable such that $E(X^2)<\infty$. Show that, for all $0\leq x<EX$, $$P(X>x)\geq\frac{(E(X)-x)^2}{E(X^2)}.$$
I tried to write $E(X)=\int XdP$ and use Cauchy Schwartz, but didn't get very far. Then I tried to take the derivative with respect to $x$ on both side. But that doesn't go well either. Any hints/ideas?
Write $E(X-x) \le E[(X-x)\cdot\mathbf{1}_{X>x}]$ and use Cauchy-Schwarz to bound the RHS. Expand $E(X-x)^2=E(X^2) - 2x E(X) +x^2$ to see that it does not exceed $E(X^2)$. QED.