User:Loadmaster/Variance proof

This article is an extract from → Talk:Standard deviation/Archive 2

= Variance =

Mathematical identity proof
The variance article presents a proof of the standard deviation equivalent formula in terms of E(X). Here is another proof, given in terms of the sample points x$i$.

For the variance (i.e., the square of the standard deviation), assuming a finite population with equal probabilities at all points, we have:
 * $$\sigma^2 = \frac{1}{N}\sum_{i=1}^N(x_i-\overline{x})^2$$

Expanding this, we get:
 * $$\sigma^2 = \frac{1}{N}\left[ (x_1-\overline{x})^2 + (x_2-\overline{x})^2 + \cdots + (x_n-\overline{x})^2 \right]$$

Simplifying, we get:
 * $$\begin{align}

\sigma^2 & = \frac{1}{N}\left[ (x_1^2 - 2x_1\overline{x} + \overline{x}^2) + (x_2^2 - 2x_2\overline{x} +\overline{x}^2) + \cdots + (x_n^2 - 2x_n\overline{x} + \overline{x}^2) \right] \\ & = \frac{1}{N}\left[ x_1^2 + x_2^2 + \cdots + x_n^2 \,-\, 2x_1\overline{x} - 2x_2\overline{x} - \cdots - 2x_n\overline{x} \,+\, \overline{x}^2 + \cdots + \overline{x}^2 \right] \\ & = \frac{1}{N}\left[ x_1^2 + x_2^2 + \cdots + x_n^2 \,-\, 2\overline{x}(x_1 + x_2 + \cdots + x_n) \,+\, N\overline{x}^2 \right] \\ & = \frac{1}{N}\left[ x_1^2 + x_2^2 + \cdots + x_n^2 \right] - 2\overline{x}\frac{1}{N}(x_1 + x_2 + \cdots + x_n) + \overline{x}^2 \\ & = \frac{1}{N}\left( \sum_{i=1}^N x_i^2 \right) - 2\overline{x} \left(\frac{1}{N}\sum_{i=1}^N x_i\right) + \overline{x}^2 \\ & = \frac{1}{N}\left( \sum_{i=1}^N x_i^2 \right) - 2\overline{x}^2 + \overline{x}^2 \\ & = \frac{1}{N}\left( \sum_{i=1}^N x_i^2 \right) - \overline{x}^2 \end{align} $$

Expanding the last term, we get:

\sigma^2 = \frac{1}{N}\sum_{i=1}^N x_i^2 \,-\, \left(\frac{1}{N} \sum_{i=1}^{N} x_i\right)^2 $$

So then for the standard deviation, we get:

\sigma = \sqrt{\frac{1}{N}\sum_{i=1}^N(x_i-\overline{x})^2} = \sqrt{\frac{1}{N} \left(\sum_{i=1}^N x_i^2\right) - \overline{x}^2} = \sqrt{\frac{1}{N} \sum_{i=1}^N x_i^2 - \left(\frac{1}{N} \sum_{i=1}^{N} x_i\right)^2}\;. $$

— Loadmaster (talk) 18:12, 22 February 2013 (UTC)

This can also be written as:

\sigma = \sqrt{ \frac{N \sum_{i=1}^N x_i^2 - \left(\sum_{i=1}^{N} x_i\right)^2}{N^2} }\;. $$