Sample vs Population Variance
Both formulas measure spread. They differ in one place, the number you divide by, and picking the wrong one is the most common variance mistake.
By the VarianceCalc team · Updated
Open the variance calculatorThe two formulas side by side
| Population | Sample | |
|---|---|---|
| Symbol | σ² (sigma squared) | s² |
| Formula | Σ(x − μ)² / N | Σ(x − x̄)² / (n − 1) |
| Divide by | Number of values | Number of values minus one |
| Use when | You have the whole group | You have part of a bigger group |
| Excel | VAR.P | VAR.S |
The top half of both formulas, the sum of squared deviations, is identical. Only the denominator changes. For the data set 2, 4, 4, 4, 5, 5, 7, 9 the sum of squares is 32, so the population variance is 32 / 8 = 4 and the sample variance is 32 / 7 ≈ 4.571.
A quick decision checklist
Ask yourself these questions in order:
- Do I want to draw conclusions about anyone or anything not in my data?If yes, use sample variance.
- Could I have collected more data from the same source? More survey respondents, more readings, more days. If yes, your data is a sample.
- Is my data literally every member of the group, and I only care about that group? Only then use population variance.
If you are still unsure, choose sample. Using the population formula on a sample understates the spread, which makes results look more certain than they are. Using the sample formula on a full population overstates it only slightly.
Examples
| Situation | Use | Why |
|---|---|---|
| Heights of 40 students measured to estimate the average height of all teenagers | Sample | The 40 stand in for a much larger group. |
| Exam marks of all 28 students in your class, reported only for that class | Population | Nobody is missing and you are not generalising. |
| Response times from 1,000 website visits last week | Sample | You care about future visits too. |
| Goals scored in every match of a finished league season | Population | The season is complete and is the thing being described. |
| Weights of 12 bags pulled from today's production run | Sample | The bags represent the whole run. |
Note the class example: the same 28 marks become a sample the moment you use them to talk about "students at this school" or "students who take this exam". The choice depends on the question you are asking, not on the numbers themselves.
Why n − 1? A proof you can check by hand
A sample's own mean is always the point that minimises the squared distances to that sample. The true population mean is somewhere else, so measuring distances from the sample mean makes the spread look a little smaller than it really is. Dividing by a smaller number,n − 1, pushes the estimate back up by exactly the right amount on average. This adjustment is called Bessel's correction.
Here is a small case where you can see it work. Take a population of just three values,1, 2, 3. Its mean is 2 and its true variance is ((1 − 2)² + 0² + (3 − 2)²) / 3 = 2/3 ≈ 0.667.
Now list every possible sample of two values drawn with replacement (there are nine) and compute the variance of each one both ways:
| Sample | Sample mean | Sum of squares | ÷ n (= 2) | ÷ n − 1 (= 1) |
|---|---|---|---|---|
| 1, 1 | 1 | 0 | 0 | 0 |
| 1, 2 | 1.5 | 0.5 | 0.25 | 0.5 |
| 1, 3 | 2 | 2 | 1 | 2 |
| 2, 1 | 1.5 | 0.5 | 0.25 | 0.5 |
| 2, 2 | 2 | 0 | 0 | 0 |
| 2, 3 | 2.5 | 0.5 | 0.25 | 0.5 |
| 3, 1 | 2 | 2 | 1 | 2 |
| 3, 2 | 2.5 | 0.5 | 0.25 | 0.5 |
| 3, 3 | 3 | 0 | 0 | 0 |
| Average | 2 | 0.333 | 0.667 |
Dividing by n gives an average estimate of 1/3, half the true value of 2/3. Dividing by n − 1 gives an average of exactly 2/3. Any single sample can still be off, but across all possible samples the n − 1 version hits the true variance on the nose. That property is what statisticians mean by an unbiased estimator.
How big is the difference?
Sample variance always equals population variance multiplied by n / (n − 1). That factor shrinks quickly as the data grows:
| n | n / (n − 1) | Sample variance is larger by |
|---|---|---|
| 2 | 2.000 | 100% |
| 5 | 1.250 | 25% |
| 10 | 1.111 | 11.1% |
| 30 | 1.034 | 3.4% |
| 100 | 1.010 | 1.0% |
| 1,000 | 1.001 | 0.1% |
With small data sets, typical of homework, lab work and pilot studies, the choice changes the answer a lot. With thousands of values it barely matters.
One value is a special case
With a single value, n − 1 is zero, so sample variance is undefined: one observation tells you nothing about how much a group varies. Population variance of a single value is 0. The variance calculator explains this instead of returning an error, and lets you switch modes with one click to compare both answers on your own data.
Frequently asked questions
When should I use population variance?
Only when your data contains every member of the group you want to describe and you are not generalising beyond it, for example the final scores of every player in a completed season.
When should I use sample variance?
Whenever your data is a subset and you want to say something about a larger group: survey answers, lab measurements, a batch of products pulled from a production line. It is the right default when you are unsure.
Does the difference matter for large data sets?
Less and less. Sample variance is the population formula multiplied by n / (n − 1). At n = 100 the two differ by about 1%, and at n = 1,000 by about 0.1%.
Is sample standard deviation unbiased too?
Not quite. Dividing by n − 1 makes the sample variance unbiased, but taking the square root reintroduces a small downward bias in the standard deviation. For most practical purposes it is ignored.
Keep learning
- What Is Variance?What variance measures, how to read it, and where it shows up in grades, investing and quality control.
- How to Calculate VarianceThe five-step method by hand, with a fully worked example and the mistakes to avoid.
- The Variance Formula ExplainedEvery symbol in σ² and s², the shortcut formula, and the formula for grouped (frequency) data.
- Variance in Excel, Google Sheets, Python and RWhich function to use (VAR.S, VAR.P, statistics.variance, var) and the defaults that catch people out.
- Standard Deviation CalculatorSample and population standard deviation, how it relates to variance, and how to interpret it.
- Percent Variance CalculatorVariance between two numbers, such as budget vs actual, as an amount and a percentage.