I have the following question:
Let $X$ be a random variable, prove that for any real number $a$, $$\mathrm{Var}(X) \le E[(X-a)^2].$$
The question gives a hint by saying:
Write $\mathrm{Var}(X) = E[(X-a-(E[X]-a)^2)$.
So I thought about just expanding the LHS:
\begin{align*} E[(X-a)^2] &= E[X^2 - 2aX - a^2] \\ &=E[X^2] - 2aE[X] - a^2 \end{align*} Since $a$ is a constant $E[a^2]= a^2$.
I did not see anything obvious so I did the same thing to the RHS:
\begin{align*} \mathrm{Var}(X) &= E[(X - a - (E[X] - a))^2] \\ &= E[X] - E[a] -E[(E[X])^2 - aE[X] +a^2] \\ &= E[X] - a - (E[X])^2 - aE[X]+a^2 \end{align*}
But now I am stuck because I feel like a did a ton of algebra, and don't know how to proceed. Any help on to get unstuck (or if I misinterpreted something) would be greatly appreciated.
We know that $\operatorname{Var}(X) = E[X^2] - E^2[X]$. Let's see how can we massage $E[(X - a)^2]$:
\begin{eqnarray} E[(X - a)^2] &=& \\ &=& E[X^2 - 2 a E[X] + a^2] \\ &=& a^2 - 2aE[X] + E[X^2] \\ &=& (a - E[X])^2 + E[X^2] - E^2[X] \\ &=& (a - E[X])^2 + \operatorname{Var}(X) \end{eqnarray}
This concludes the proof :)