I'm trying to use linearity of expectation, but I seem to be failing somewhere. So if we expand the squared expression:
$$(X-E[X])^2 = (X-E[X])(X-E[X]) = X^2 - 2XE[X] + E^2[X]$$
So we have:
$$E[X^2 - 2XE[X] + E^2[X]]$$
Would the linearity of expectation applied to this be:
$$E[X^2 - 2XE[X] + E^2[X]] = E[X^2] - 2E[XE[X]] + E[E^2[X]]$$
Or is it not possible to use with this equation? How can I show that the two expressions in the title are equivalent to each other?
Let $E(X)=\mu$. Note that $\mu$ is a constant.
Now, $E[X^2-2XE(X) + E^2(X)]$
$= E[X^2-2\mu X+\mu^2]$
$=E(X^2) - 2\mu E(X)+\mu^2$
$=E(X^2)-2\mu^2+\mu^2$
$=E(X^2)-\mu^2$
$=E(X^2)-E^2(X)$