# Sum of Squared Deviations from Mean

## Theorem

Let $S = \set {x_1, x_2, \ldots, x_n}$ be a set of real numbers.

Let $\overline x$ denote the arithmetic mean of $S$.

Then:

$\ds \sum_{i \mathop = 1}^n \paren {x_i - \overline x}^2 = \sum_{i \mathop = 1}^n \paren {x_i^2 - \overline x^2}$

### Corollary 1

$\ds \sum_{i \mathop = 1}^n \paren {x_i - \overline x}^2 = \sum_{i \mathop = 1}^n x_i^2 - n \overline x^2$

### Corollary 2

$\ds \sum_{i \mathop = 1}^n \paren {x_i - \overline x}^2 = \sum_{i \mathop = 1}^n x_i^2 - \frac 1 n \paren {\sum_{i \mathop = 1}^n x_i}^2$

## Proof 1

For brevity, let us write $\ds \sum$ for $\ds \sum_{i \mathop = 1}^n$.

Then:

 $\ds \sum \paren {x_i - \overline x}^2$ $=$ $\ds \sum \paren {x_i - \overline x} \paren {x_i - \overline x}$ $\ds$ $=$ $\ds \sum x_i \paren {x_i - \overline x} - \overline x \sum \paren {x_i - \overline x}$ Summation is Linear $\ds$ $=$ $\ds \sum x_i \paren {x_i - \overline x} - 0$ Sum of Deviations from Mean $\ds$ $=$ $\ds \sum x_i \paren {x_i - \overline x} + 0$ $\ds$ $=$ $\ds \sum x_i \paren {x_i - \overline x} + \overline x \sum \paren {x_i - \overline x}$ Sum of Deviations from Mean $\ds$ $=$ $\ds \sum \paren {x_i + \overline x} \paren {x_i - \overline x}$ Summation is Linear $\ds$ $=$ $\ds \sum \paren {x_i^2 - \overline x^2}$

$\blacksquare$

## Proof 2

In this context, $x_1, x_2, \ldots, x_n$ are instances of a discrete random variable.

Hence the result Variance as Expectation of Square minus Square of Expectation can be applied:

$\var X = \expect {X^2} - \paren {\expect X}^2$

which means the same as this but in the language of probability theory.

$\blacksquare$