I was going through a statistics text which was showing how finding the sum of squared deviations from the mean in a more efficient manner than the initial formula provided:
\begin{align} S^2 &= \sum_{i=1}^n (x_i -\overline{x})^2 \\ & = \sum_{i=1}^n(x_i^2-2\overline{x}x_i+x)\\ & = \sum_{i=1}^nx_i^2-2\overline{x}\sum_{i=1}^nx_i+n\overline{x}^2 \\ & = \sum_{i=1}^nx_i^2 - n\overline{x}^2 \end{align}
How is step 4 reached from step 3?
Recall that $$\overline{x}=\frac{\sum_{i=1}^{n}x_i}{n}$$
Thus, $$\sum_{i=1}^{n}x_i=n\overline {x}$$
So the final two terms are $-2n\overline {x}^2+n\overline {x}^2=-n\overline {x}^2$.