Answers · The mathematics underneath
Why does variance square the deviations instead of just averaging how far each value is from the mean?
In shortVariance squares deviations because signed deviations cancel to zero, and squares remove the sign while allowing the algebra, scaling and addition rules that absolute distances do not.
Variance squares the deviations because the signed deviations from the mean always cancel to zero, and squaring removes the sign in a form that can be expanded and combined. It is not merely a trick to hide the sign: the square is what makes the variance computable in one pass and what gives it the scaling and addition rules used everywhere else.
The definition is an average of squared distances from the expectation, not an average of distances. The square root brings the result back to the original units, which is why the standard deviation is reported and the variance is calculated with.
Why the signed average fails
Take three equally likely values 0, 2 and 10. The expectation is . The deviations are , and , and their average is . That is not an accident of this example. Since is the weighted balance point, positive and negative deviations cancel exactly for every distribution.
A spread measure therefore has to discard the sign before averaging. Taking absolute values gives 4, 2 and 6, whose average is . Taking squares gives 16, 4 and 36, whose average is , about 18.67. The square root of is about 4.32, which is in the original units and is the standard deviation.
| value | deviation from 4 | squared deviation | absolute deviation |
|---|---|---|---|
| 0 | -4 | 16 | 4 |
| 2 | -2 | 4 | 2 |
| 10 | +6 | 36 | 6 |
| average | 0 | 56/3 | 4 |
The natural suspicion is that squaring is arbitrary, since absolute value also removes the sign. That suspicion is right about one thing: squaring is a choice, and mean absolute deviation is a legitimate measure of spread. It is wrong to conclude that the choice is only cosmetic. Absolute value is piecewise linear. It has a corner at zero, it does not differentiate cleanly there, and it does not expand. A square does all three. For two quantities and , expands into , and expectation is linear, so each term can be handled separately. There is no comparable expansion for . That is why variances can be pushed through sums, limits and derivatives, and mean absolute deviations cannot be handled in the same way.
What squaring buys
The expansion is not decoration. It turns a two-pass calculation into a one-pass calculation: keep a running total of the values and a running total of their squares, then subtract the square of the average from the average of the squares. For the three values above, the average of the squares is , the square of the average is , and the difference is , the same variance. That is how the variance is actually computed.
Squares also give clean rules. Shifting every value by a constant leaves deviations unchanged, so variance is unchanged. Multiplying every value by a constant multiplies every deviation by , so the variance is multiplied by . For 0, 2 and 10 the variance is ; doubling to 0, 4 and 20 gives deviations , and , squared deviations 64, 16 and 144, and variance , which is 4 times . For unrelated quantities, variances add: . If they are related, a covariance term appears.
Where it stops being automatic
Mean absolute deviation is not wrong. It answers a different question: what is the typical distance from the centre, with every unit of distance counted equally. Variance answers a question in which distance is squared, so a value ten units out contributes one hundred times as much as a value one unit out. If the far outcome is merely rare but not especially costly, that weighting can be misleading. If it is a service outage, a financial loss or an engineering failure, the weighting is often exactly right.
Variance also needs a finite second moment. A distribution with sufficiently heavy tails can have an infinite variance while its mean absolute deviation is finite, and then the standard deviation is not a useful summary at all. The familiar statements that about two thirds of the weight lies within one standard deviation are statements about the bell shape, not about variance in general. The universal bound is much weaker: the weight more than standard deviations from the mean is at most , so more than two standard deviations holds at most of the weight and more than five at most . For a heavy tailed quantity those bounds may be the only honest error bar available.
Worth keeping
- Signed deviations from the mean always average to zero, so any measure of spread must remove the sign before averaging.
- Squaring removes the sign and expands, which is why variance can be computed as the average of the squares minus the square of the average.
- Variance is in squared units, so its square root is the number to report in the original units.
Where this goes next
This question is one step of Chance, Spread and What to Expect, a course that works through its subject from the beginning. The page that teaches this part of it is How Far From Expected, and it reads the whole way through whether or not you have an account.
What an account changes is the practice: problems standing under every idea, marked with a reason rather than a tick, in a copy of the course that is yours.
Read that pageThe whole courseOther questions people ask about this
- What is the difference between variance and standard deviation?They measure the same spread: variance is the average squared distance from the mean, standard deviation is its square root, so you report the standard deviation and calculate with the variance.
- Why does a test for a rare disease give so many false positives if the test is accurate?A positive result means the test fired, not that you are likely to be ill; when the disease is rare, healthy people vastly outnumber ill ones, so a small false-alarm rate on them swamps the few true cases.
- What does expected value actually mean if I never actually get that number?It is a weighted average over all possible outcomes, not a prediction of the outcome you will see; it can be a number no single result ever takes.
- Why does the average of many random draws get closer to the expected value as I take more?Averaging divides by the number of draws, so the spread of the average shrinks with the square root of that number; no draw ever compensates for earlier ones.
- How do you make a vague claim precise enough to tell whether it's true?Fix what is being talked about, what is asserted, which cases are covered and the cut-off, then name an observation that would prove it false.
- How do you find the parabola that best fits a function near a point?Match the function's height, slope and bending at the chosen point; those three conditions single out exactly one parabola.