Expected value of an expected value

There are some things you can cancel in yours.

$(E((E(X)))^{2}=(E(X))^{2}$, since the expected value of an expected value is just that. It stops being random once you take one expected value, so iteration doesn't change.

Furthermore, $-E(2XE(X))=-2E(XE(X))=-2E(X)E(X)$ The first step here is just a constant factoring. For the same reason, in the second step, we see that $E(X)$ was actually a constant at this point, not random at all, so it can be factored out as well.


Your intermediate step is correct. All you need to realize is that $E(X)$ is a number, not a random variable, so you can treat it like any other constant, like $2$ or $4$. That is, $E(Y \cdot E(X)) = E(X) E(Y)$, just as you would write $E(Y \cdot 2) = 2 E(Y)$.


$E(X^2-2XE(X)+(E(X))^2)=E(X^2)-E(2XE(X))+E((E(X))^2)$

$=E(X^2)-E(X)E(2X)+(E(X))^2$.

The second term is such because $E(X)$ is a constant, and the expectation of a constant is the constant itself (same for the last term ($E(X))^2$)

$=E(X^2)-2(E(X))^2+(E(X))^2=E(X^2)-(E(X))^2$