Variance calculator: sample and population variance with working
Variance is the average of the squared distances from the mean. Divide the sum of squared distances by n − 1 for a sample, or by n for a population. Our variance calculator is part of the Standard Deviation Calculator: enter your data and it gives the variance with the full working, alongside the standard deviation, which is the variance's square root.
Standard Deviation Calculator
Find the standard deviation and variance of any data set
How to find the variance with the calculator
- Open the Standard Deviation Calculator. There is no separate switch for variance: it is always worked out.
- Choose Raw data, Frequency or Grouped, then type or paste your values into the table.
- Under This data is a, choose Sample or Population.
- Read the second result, Sample variance (s²) or Population variance (σ²).
- The working table lists every squared distance, and the third step of the working shows the division that gives the variance.
The variance formula
The top of each fraction is the same: the sum of squared deviations, often shortened to the sum of squares. Only the bottom changes. Use the population formula when your data is the whole group you care about, and the sample formula when it is part of a bigger group. Dividing a sample by n − 1 corrects for the fact that a sample sits closer to its own mean than to the true mean, which would make the variance look too small. The NIST handbook defines it this way.
The shortcut formula for variance
Working out every deviation is slow by hand, especially when the mean is a messy decimal. This version gives the same answer from just Σx and Σx²:
In words, for a population: the mean of the squares minus the square of the mean. Exam questions, especially in A-level Maths, often give you Σx and Σx² instead of the raw data, and then this is the only way in.
Worked examples you can check in the calculator
Example 1: sample variance
Five plants from a tray are measured, in centimetres: 3, 7, 8, 10 and 12. Find the sample variance.
| x | x − x̄ | (x − x̄)² |
|---|---|---|
| 3 | −5 | 25 |
| 7 | −1 | 1 |
| 8 | 0 | 0 |
| 10 | 2 | 4 |
| 12 | 4 | 16 |
| Total 40 | 0 | 46 |
The sample variance is 11.5 cm². Switch the calculator to Population and it shows σ² = 46 ÷ 5 = 9.2 cm² instead. The standard deviation is the square root: s = 3.39 cm.
Example 2: population variance with the shortcut
Find the population variance of 2, 4, 5 and 9. Here n = 4, Σx = 20, so μ = 5, and Σx² = 4 + 16 + 25 + 81 = 126.
The population variance is 6.5. The long way agrees: the deviations are −3, −1, 0 and 4, their squares add to 26, and 26 ÷ 4 = 6.5.
Example 3: variance of a frequency table
16 students picked at random say how many hours they slept last night. Choose Frequency in the calculator and enter each x with its f.
| Hours x | Students f | fx | fx² |
|---|---|---|---|
| 5 | 2 | 10 | 50 |
| 6 | 5 | 30 | 180 |
| 7 | 6 | 42 | 294 |
| 8 | 3 | 24 | 192 |
| Total | 16 | 106 | 716 |
The mean is 106 ÷ 16 = 6.625 hours. It is a sample, so use the sample shortcut:
The sample variance is 0.917 hours² to 3 significant figures. Notice that n is the total of the frequencies, 16, and not the number of rows.
Example 4: variance of a dice roll
A fair dice (die in the US) lands on 1, 2, 3, 4, 5 or 6, each equally likely. These six outcomes are the whole population, so divide by n. The mean is 3.5, the squared deviations are 6.25, 2.25, 0.25, 0.25, 2.25 and 6.25, and they add to 17.5.
As a fraction this is 35/12, a value that comes up again when you meet discrete random variables in statistics.
Try one
Variance vs standard deviation
They carry the same information: the standard deviation is the square root of the variance, and the variance is the standard deviation squared. The difference is the units. Square centimetres and hours² are hard to picture, so to describe spread in words, use the standard deviation. Variance is the one used inside calculations, because variances of independent quantities add together and standard deviations do not. The standard deviation calculator guide covers reading the spread and the empirical rule.
Common mistakes
- Taking a square root at the end. That gives the standard deviation. Variance stops before the root.
- Dividing by the wrong number. n − 1 for a sample, n for a population.
- Squaring the sum instead of summing the squares. Σx² means square each value, then add. (Σx)² means add, then square.
- Forgetting to square the mean in the shortcut formula: it is Σx²/n − μ², not Σx²/n − μ.
- Rounding the mean before using the shortcut. Σx²/n and μ² are often close, so a rounded mean can throw the answer out badly.
- Writing the wrong units. Variance is in the data's units squared.
Common questions
How do you calculate variance step by step?
What is the difference between sample and population variance?
Can variance be negative?
How do I get variance from standard deviation?
Does the calculator work for grouped data?
Revision cards
Read the front, say your answer, then flip to check.
Where to go next
- Solve it
Standard Deviation Calculator
Find the standard deviation and variance of any data set
Open the tool - Test it
AP Statistics
A new exam-style paper every day, with instant marking and a mark scheme
Start today's paper