MathJax TeX Test Page
The definition of a moment is the product of distance and some other value. For example, in physics, the first moment of force is torque, which equals $rF$. If you have a system of angular forces, you take the sum of all of the $rF$'s.
In statistics, it's very similar. The first moment is the mean:
$$E(x) = \sum_{i=1}^n p_ix_i $$
Here is the second moment:
$$E(x^2) = \sum_{i=1}^n p_ix_i^2 $$
It turns out both of the above are very useful, as this is variance:
$$Var(X) = \sum_{i=1}^n p_i(x_i - \mu)^2$$
To think about why that makes sense, imagine the probabilities were uniform, meaning $p(x_i)=\frac{1}{n}$, making the variance equal to
$$\frac{1}{n}\sum_{i=1}^n{(x_i - \mu)^2}$$
Now, let's return to the formula above:
$$Var(X) = \sum_{i=1}^n p_i(x_i - \mu)^2$$
Note that the mean = $\mu = E(X)$
$$=\sum_{i=1}^n p_i(x_i^2 - 2\mu{}x_i + \mu^2)$$
$$=\sum_{i=1}^n p_ix_i^2 -2\mu\sum_^n p_ix_i + \mu^2\sum_^n p_i$$
$$=E(X^2) - 2\mu E(X) + \mu = E(X^2) - 2E(X)^2 + E(X)^2$$
$$=E(X^2) - E(X)^2$$