prove that $\displaystyle E[X-E(X)]^2 = E(X^2)-[E(X)]^2 $
$\displaystyle E\left( {\left[ {X - E(X)} \right]^2 } \right) = E\left( {X^2 - 2XE\left( X \right) + E^2 \left( X \right)} \right)$$\displaystyle = E\left( {X^2 } \right) - 2E\left( X \right)E\left( X \right) + E^2 \left( X \right) = E\left( {X^2 } \right) - E^2 \left( X \right)$