Variance

The range looks only at the two most extreme values. Variance does something far more honest: it asks how far every data point sits from the mean, and averages those distances. It is the workhorse measure of spread.

For data x_1, x_2, \dots, x_n with mean \bar{x}:

\sigma^2 = \frac{1}{n}\sum_{i=1}^{n}\left(x_i - \bar{x}\right)^2.

Each term (x_i - \bar{x}) is a deviation — how far that one point strays from the centre. Variance is the average squared deviation.

Why square? Because raw deviations cancel

It is tempting to just average the deviations themselves. But that always gives zero — the mean sits exactly at the balance point, so the points below it cancel the points above:

\sum_{i=1}^{n}\left(x_i - \bar{x}\right) = 0 \quad\text{always.}

Squaring fixes the sign: a deviation of -3 and one of +3 both contribute 9 instead of cancelling. Squaring also punishes big misses — a point twice as far away contributes four times as much — so variance is especially sensitive to far-flung values.

See it: variance is the average square

The five points share a mean of 7 (the dashed line). Above each point sits a square whose side is that point's distance from the mean, so its area is the squared deviation (x_i - \bar{x})^2. Drag the slider to spread the points out: the squares grow, and the reported variance — their average area — climbs with them.

Notice the point sitting on the mean has a square of side zero: it adds nothing. Only distance from the centre counts.

The units are squared too

Because we squared the deviations, the variance carries squared units. If the data are heights in centimetres, the variance is in \text{cm}^2 — a slightly awkward quantity to interpret. That single inconvenience is exactly what the standard deviation is built to repair.