# Sample Standard Deviation In Terms of Sum and Square Sum of Samples

I’m going to derive the formula for the sample standard deviation in terms of the sum and the sum of squares.

Let us start from the formula, ${S}_{N}=\sqrt{\frac{1}{N-1}\sum _{i=1}^{N}\left({x}_{i}-\overline{x}{\right)}^{2}}$ where $\overline{x}=\frac{1}{N}\sum _{i=1}^{N}{x}_{i}$.

Expand the expression inside the summation to obtain: ${S}_{N}^{2}=\frac{1}{N-1}\sum _{i=1}^{N}\left({x}_{i}-\overline{x}{\right)}^{2}=\frac{1}{N-1}\sum _{i=1}^{N}\left({x}_{i}^{2}-2{x}_{i}\overline{x}+{\overline{x}}^{2}\right)$ Now separate terms: ${S}_{N}^{2}=\frac{1}{N-1}\sum _{i=1}^{N}{x}_{i}^{2}-\frac{2\overline{x}}{N-1}\sum _{i=1}^{N}{x}_{i}+\frac{1}{N-1}\sum _{i=1}^{N}{\overline{x}}^{2}$.

Notice $N\overline{x}=\sum _{i=1}^{N}{x}_{i}$. Substituting the left hand side of this equation into the second term and substituting the right hand side of $\sum _{i=1}^{N}{\overline{x}}^{2}=N{\overline{x}}^{2}$ into the third term yields: ${S}_{N}^{2}=\frac{1}{N-1}\sum _{i=1}^{N}{x}_{i}^{2}-\frac{2N{\overline{x}}^{2}}{N-1}+\frac{N{\overline{x}}^{2}}{N-1}$

Hence, ${S}_{N}^{2}=\frac{1}{N-1}\sum _{i=1}^{N}{x}_{i}^{2}-\frac{N}{N-1}{\overline{x}}^{2}$ or ${S}_{N}=\sqrt{\frac{1}{N-1}\sum _{i=1}^{N}{x}_{i}^{2}-\frac{1}{N\left(N-1\right)}\left(\sum _{i=1}^{N}{x}_{i}{\right)}^{2}}$ as desired.