\begin{align}V(X)&=\sum_x(x-E(X))^2P(x)\tag{1}\\V(X)&=E([X-E(X)]^2)\tag{2}\\E(X)&=\sum_xxP(X=x)\tag{3}\end{align}
Can someone please explain me how I derive equation (2) from equation (1)? I would expect this to be based on equation (3), but in (3) both multipliers are x (i.e., x multiplied by P(x)), while in equation (1) there are different multipliers.
Thanks!