I am looking at a proof that $\text{Var}(X)= E((X - EX)^2) = E(X^2) - (E(X))^2$
$E((X - EX)^2) =$
$E(X^2 - 2XE(X) + (E(X))^2) =$
$E(X^2) - 2E(X)E(X) + (E(X))^2)$
I can't see how the second line can be equal to the third line. I would have had the following for the third line -
$E(X^2) - E(2XE(X)) + E((E(X))^2))$
Which seems very messy... There must be something I am not understanding about the properties of expected values?
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.