σ² = Σ(xᵢ − x̄)² / n
Take each value’s distance from the mean, square it, add up the squares and divide by the
count. The variance is the mean of the squared distances. n is the number of values and σ² is read
“sigma squared”. The formula is a definition.
The variance has the wrong unit to be read directly. If the values are in
centimetres, the variance is in square centimetres. That is why it is mostly a step on the way. Its
square root is the standard deviation, which has the same unit as the values.
Worked examples
Eight values. The list 2, 4, 4, 4, 5, 5, 7, 9 has a mean of 5. The distances from 5 are −3, −1, −1,
−1, 0, 0, 2 and 4. Their squares are 9, 1, 1, 1, 0, 0, 4 and 16, which add up to 32. The variance is
32 / 8 = 4.
Why the square is needed. Add the distances without squaring: −3 − 1 − 1 − 1 + 0 + 0 + 2 + 4 = 0.
It always comes to 0, because the mean sits exactly where the deviations on either side cancel. The
square makes every deviation positive.
Common mistakes
- Forgetting to square. The deviations always add up to 0, so the answer is 0 whatever the list.
- Dividing by n − 1 when the question means the whole population, or the other way round. With
n − 1 it is the sample variance, 32 / 7 ≈ 4.57 for the same list.
- Taking the root and calling the result the variance. √4 = 2 is the standard deviation.
Common questions
Why are the deviations squared?
Because otherwise they cancel: the deviations from the mean always add up to 0. Squaring makes them
positive and also lets large deviations count for more than small ones.
Can the variance be negative?
No. It is a sum of squares divided by a positive number. It is 0 only when all the values are equal.
n or n − 1?
n when the values are the whole group you want to describe, such as every pupil in the class. n − 1
when the values are a sample and you want to estimate the variance of a larger group. If the question
does not say, books and courses differ: school textbooks often use n and statistics courses n − 1, so
check which one your course means.