How to Calculate Population Variance vs. Sample Variance Without Confusion
Two almost identical formulas, one small difference in the denominator, and an answer that changes just enough to matter. The difference between population and sample variance confuses students and professionals alike. The arithmetic is easy; the confusion is about which formula applies. This guide explains how to decide, and why the denominator differs.
The One Difference
Both formulas start the same way: find the mean, subtract it from each value, square the results and add them up to get the sum of squares. They differ only in the last step:
- Population variance (σ²): divide the sum of squares by n.
- Sample variance (s²): divide the sum of squares by n − 1.
Worked Example: Same Numbers, Both Formulas
Six people’s ages: 21, 25, 19, 30, 22, 27.
| Age | Deviation from 24 | Squared |
|---|---|---|
| 21 | −3 | 9 |
| 25 | 1 | 1 |
| 19 | −5 | 25 |
| 30 | 6 | 36 |
| 22 | −2 | 4 |
| 27 | 3 | 9 |
| Total | 0 | 84 |
The mean is 144 / 6 = 24 and the sum of squares is 84.
- If these six people are a whole book club and you only want to describe that club, the data is a population: σ² = 84 / 6 = 14.
- If they are six shoppers stopped in a street survey and you want to say something about all shoppers, the data is a sample: s² = 84 / 5 = 16.8.
Same numbers, different question, different answer.
When to Use Population Variance
Use it only when your data contains every member of the group you are describing: a complete census, every student in one classroom, every item in a batch that was inspected in full. See the population variance calculator for more examples.
When to Use Sample Variance
Use it whenever your data is a subset of a larger group you want to draw conclusions about. That covers most surveys, experiments and quality checks, because measuring everyone is rarely possible. The sample variance calculator works through this case.
Why Sample Variance Divides by n − 1
Deviations in a sample are measured from the sample’s own mean, which always sits in the middle of that particular sample. That makes the squared deviations a little smaller, on average, than they would be if measured from the true population mean. Dividing by n − 1 instead of n enlarges the result by exactly enough to remove that bias on average. Statisticians call the result an unbiased estimator, and n − 1 the degrees of freedom.
How to Decide
Ask: “Is my data everyone I want to talk about, or only some of them?” If anyone in the group you care about is missing from the data, it is a sample.
The Symbols
σ² (sigma squared) is population variance and s² is sample variance. Similarly σ is the population standard deviation and s the sample one. Seeing the symbol tells you which formula a textbook or paper used.
The Mistake to Watch For
Using the population formula on sample data understates the spread. In the example above it gives 14 instead of 16.8, about 17% too small. The gap shrinks as n grows (with 100 values the two answers differ by about 1%), so the mistake matters most for small samples.
Summary
Divide by n when you have the whole group and want to describe it; divide by n − 1 when you have a sample and want to estimate the spread of the larger group. The variance calculator shows both results side by side, so you can see the difference for your own data.