Proof of analogue of the Cauchy-Schwarz inequality for random variables The Cauchy-Schwarz inequality tells us that for two vectors $u$ and $v$ in an inner product space,
$$\lvert (u,v)\rvert \leq \lVert u\rVert \lVert v \rVert$$
with the equality holding iff one vector is a constant multiplier of the other. 
Prove the analogue of the Cauchy-Schwarz inequality for random variables:   
$$\lvert E[XY]\rvert \leq \sqrt{E[X^2]} \sqrt{E[Y^2]}$$
(Hint: Use the fact that $E[ (\alpha X + Y)^2 ] \geq 0$ for all real (constants) $\alpha$)
 A: There is some debate about whether or not the mapping $(X, Y) \mapsto E[XY]$ defines an inner product. If it does, then your result follows from the standard Cauchy-Schwarz inequality in general inner product spaces.
But, even if it's correct, this approach is rather a cop-out, and could easily be regarded as circular reasoning.
To avoid the circular reasoning, just adapt any proof of the Cauchy-Schwarz inequality. A few of them are given on this wikipedia page.
Here is one such proof: As your hint says, we know that $E[(kX+Y)^2] \ge 0$, for any real $k$. Expanding this, we get:
$$k^2E[X^2] + 2kE[XY] + E[Y^2] \ge 0$$
Let's regard this as a quadratic in $k$. It is non-negative for all $k$, so it has at most one real root, so its discriminant (the $b^2 - 4ac$ thing) must be $\le 0$. In other words
$$ (2E[XY])^2 - 4E[X^2]E[Y^2] \le 0$$
and the result follows immediately.
Note that I didn't prove the statement about when equality occurs. In fact, I don't think this statement is true, as WimC's comment pointed out.
A: Look at the following two expectations:
$$E[(aX+bY)^2]=a^2E[X^2] + b^2E[Y^2] + 2abE[XY] \ge 0$$
$$E[(aX-bY)^2]=a^2E[X^2] + b^2E[Y^2] - 2abE[XY] \ge 0$$
Now let $a^2=E[Y^2]$ and $b^2=E[X^2]$. This gives
$$ 2abE[XY] \ge -2a^2b^2$$
$$ 2abE[XY] \le 2a^2b^2$$
Dividing by $2ab$ results in
$$ -\sqrt{E[X^2]} \sqrt{E[Y^2]} \le E[XY] \le \sqrt{E[X^2]} \sqrt{E[Y^2]}$$
which is equivalent to
$$ |E[XY]| \le \sqrt{E[X^2]} \sqrt{E[Y^2]}$$
A: When $\mathbb EY^2\not=0$, one has
$$
\mathbb EX^2\mathbb EY^2-(\mathbb E XY)^2=\frac{\mathbb E\bigl((\mathbb EY^2) X - (\mathbb E XY) Y\bigr)^2}{\mathbb EY^2}.
$$
