Wiki defines variance as follows. I have a question on the expansion which I will point out.
$$ Var(X) = E[(X - E[X])^2] = E[X^2 - 2XE[X] + E[X]^2] $$
I'm assuming $E[X - Y] = E[X] - E[Y]$ applies next. Is this true? Also, does anyone know how $-2E[X]E[X]$ is derived in the next term?
$$ Var(X) = E[X^2] - 2E[X]E[X] + E[X]^2 = E[X^2] - E[X]^2 $$
$\def\E{\operatorname{\mathsf E}}$When $c$ is a constant $\E(c X)=c\E(X)$. Well, $\E(X)$ is a constant so $\E\bigl(\E(X)X\bigr)=\E(X)\E\bigl(X\bigr)$.
Similarly $\E(\E(X)^2)=\E(X^2)$ because $\E(X^2)$ is a constant and of course when $c$ is a constant, then $\E(c)=c$.
$$\begin{align} \E\big((X-\E(X))^2\big) &= \E\bigl(X^2-2\E(X)X+\E(X)^2\bigr) \\ &=\E(X^2)-\E\bigl(2\E(X)X\bigr)+\E(\E(X)^2) \\ &=\E(X^2)-2\E(X)\E(X)+\E(X)^2 \\ &=\E(X^2)-2\E(X)^2+\E(X)^2 \\ &=\E(X^2)-\E(X)^2 \end{align}$$