The Variance Formula Explained
The variance formula looks dense, but it is four plain instructions written in shorthand. Here is what every symbol means, plus the variations you will meet in textbooks.
By the VarianceCalc team · Updated
Open the variance calculatorThe two core formulas
Population variance:
σ² = Σ(x − μ)² / NSample variance:
s² = Σ(x − x̄)² / (n − 1)What each symbol means
| Symbol | Read as | Meaning |
|---|---|---|
σ² | sigma squared | Population variance |
s² | s squared | Sample variance |
x | x | Each individual value in the data |
μ | mu | Population mean |
x̄ | x bar | Sample mean |
N, n | N, n | Number of values (population, sample) |
Σ | sigma (capital) | Add up everything that follows |
(x − μ) | deviation | How far one value is from the mean |
Read in plain words, the population formula says: take each value, subtract the mean, square the result, add all the squares, and divide by how many values there are. The sample formula says the same thing but divides by one less. Why that one-less matters is covered in sample vs population variance.
The shortcut (computational) formula
Working out every deviation is tedious when the mean is an awkward decimal. Algebra gives an equivalent way to get the sum of squares straight from the raw values:
Σ(x − x̄)² = Σx² − (Σx)² / nYou only need two running totals: the sum of the values and the sum of their squares. For2, 4, 4, 4, 5, 5, 7, 9:
Σx = 40Σx² = 4 + 16 + 16 + 16 + 25 + 25 + 49 + 81 = 232Σx² − (Σx)² / n = 232 − 1600 / 8 = 232 − 200 = 32
That matches the sum of squares from the long method, giving a population variance of 32 / 8 = 4 and a sample variance of 32 / 7 ≈ 4.571.
A caution for spreadsheets and code: the shortcut subtracts two large, nearly equal numbers. With values like 1,000,000.1 and 1,000,000.3, rounding inside the computer can wipe out the real answer or even produce a negative variance. Software that cares about accuracy, including this site's variance calculator, computes the mean first and then sums the squared deviations, which avoids the problem.
Variance from a frequency table
When data comes as values with counts, you do not need to write every value out. Weight each squared deviation by its frequency f:
σ² = Σf(x − μ)² / N where N = Σf and μ = Σfx / NExample: a survey of 10 households counts the number of cars each one owns.
| Cars (x) | Households (f) | fx | x − μ | f(x − μ)² |
|---|---|---|---|---|
| 1 | 2 | 2 | −1.4 | 3.92 |
| 2 | 3 | 6 | −0.4 | 0.48 |
| 3 | 4 | 12 | 0.6 | 1.44 |
| 4 | 1 | 4 | 1.6 | 2.56 |
| Total | 10 | 24 | 8.40 |
The mean is 24 / 10 = 2.4. The population variance is 8.4 / 10 = 0.84 and the sample variance is 8.4 / 9 ≈ 0.933. To check this in the calculator, expand the table into raw values: 1, 1, 2, 2, 2, 3, 3, 3, 3, 4.
Variance from grouped data (class intervals)
If the table gives ranges instead of exact values, such as "10 to 20", use each class's midpoint m in place of x. The result is an estimate, because you are assuming every value sits at the middle of its class.
| Class | Midpoint (m) | f | fm | f(m − μ)² |
|---|---|---|---|---|
| 0–10 | 5 | 3 | 15 | 243 |
| 10–20 | 15 | 5 | 75 | 5 |
| 20–30 | 25 | 2 | 50 | 242 |
| Total | 10 | 140 | 490 |
The estimated mean is 140 / 10 = 14. The estimated population variance is 490 / 10 = 49 (standard deviation 7), and the sample variance is 490 / 9 ≈ 54.44.
Related formulas
- Standard deviation:
σ = √σ²ands = √s². - Coefficient of variation:
CV = σ / μ, the spread relative to the mean. - Variance of a scaled variable:
Var(aX + b) = a² · Var(X). - Sum of independent variables:
Var(X + Y) = Var(X) + Var(Y).
For a slower walk through the arithmetic, seehow to calculate variance.
Frequently asked questions
What is the formula for variance?
Population variance is σ² = Σ(x − μ)² / N and sample variance is s² = Σ(x − x̄)² / (n − 1). Both sum the squared distances from the mean; they differ only in the denominator.
What is the shortcut formula for variance?
The sum of squares can be computed as Σx² − (Σx)² / n, then divided by n or n − 1 as usual. It avoids calculating every deviation, which is handy by hand but can lose precision on a computer.
How do you find variance from a frequency table?
Multiply each squared deviation by its frequency: σ² = Σf(x − μ)² / N, where N = Σf. For a sample, divide by N − 1 instead.
What does the Σ symbol mean?
Σ (capital sigma) means 'add up'. Σ(x − μ)² means: for every value x, subtract the mean, square the result, then add all of those squares together.
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.
- Sample vs Population VarianceWhen to divide by n − 1, a small proof that it works, and a checklist for picking the right one.
- 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.