Prove that $\frac1n\sum\limits^n_{i=1}(X_i-\overline{X})^2=\overline{X^2}-\overline{X}^{\ 2}$ 
Prove that $\frac{1}{n}\sum\limits^n_{i=1}(X_i-\overline{X})^2=\overline{X^2}-\overline{X}^{\ 2}$ where $\overline{X}=\frac{1}{n}\sum\limits^n_{i=1}X_i$ and $\overline{X^2}=\frac{1}{n}\sum\limits^n_{i=1}X_i^2$

From the left, I can see that $$\frac{1}{n}\sum^n_{i=1}(X_i-\overline{X})^2=\frac{(X_1-\overline{X})^2+\cdots+(X_n-\overline{X})^2}{n} = \frac{(X_1-\frac{X_1+\cdots+X_n}{n})^2+\cdots+(X_n-\frac{X_1+\cdots+X_n}{n})^2}{n} = \cdots$$
I don't see how we can get to the right. Any suggestions?
 A: Observe
\begin{align}
\frac{1}{n}\sum^n_{i=1}(X_i-\bar X)^2 =&\ \frac{1}{n}\sum^n_{i=1} (X_i^2-2\bar XX_i +\bar X^2)\\
 =&\  \frac{1}{n}\sum^n_{i=1}X_i^2 -2\bar X \frac{1}{n}\left(\sum^n_{i=1}X_i\right)+\bar X^2 \\
=&\  \overline{X^2}-2\bar X^2+\bar X^2 = \overline{X^2}-\bar X^2.
\end{align}
A: \begin{align}
& \sum_{i=1}^n (X_i - \bar X)^2 = \sum_{i=1}^n(X_i^2 - 2X_i \bar X + \bar X^2) \\[10pt]
= {} & \left( \sum_{i=1}^n X_i^2 \right) - \left( \sum_{i=1}^n (2X_i \bar X\,)  \right) + \left( \sum_{i=1}^n \bar X \right) \tag 1
\end{align}
Now observe that as $i$ goes from $1$ to $n$, then $X_i$ changes but $2\bar X$ does not.  Therefore we can write
$$
\sum_{i=1}^n (2X_i \bar X\,) = 2\bar X \sum_{i=1}^n X_i.
$$
and that is equal to
$$
2\bar X\Big( n\bar X \Big) = 2 n \bar X^2.
$$
In the last sum in line $(1)$, the quantity  $\bar X$ does not change at all as $i$ goes from $1$ to $n$, so it is
$$
\sum_{i=1}^n \bar X^2 = \underbrace{\bar X^2 + \cdots + \bar X^2}_{n \text{ terms}} = n \bar X^2.
$$
So the sum in line $(1)$ becomes
$$
\left( \sum_{i=1}^n X_i^2 \right) - 2n \bar X^2 + n \bar X^2.
$$
Then do the obvious simplification and then divide both sides by $n$.
