How Do You Calculate Variance? A Simple Explanation With Real Examples

Bar chart of the values 4, 8, 6 and 10 with a dashed line at their mean of 7, showing a sum of squared deviations of 20.

Two data sets can have exactly the same average and still look completely different. One stays close to that average; the other swings far above and below it. Variance is the number that captures that difference. This guide walks through the calculation one step at a time with real numbers, so the formula becomes something you can use rather than something you memorise.

What Is Variance?

Variance measures how far the values in a data set typically are from their mean, using squared distances. A small variance means the values sit close together; a large one means they are spread out. Without it, two data sets with the same mean can look deceptively alike.

Step 1: Find the Mean

Every variance calculation starts with the mean: add the values and divide by how many there are.

We will use the data set 4, 8, 6, 10. The sum is 28 and there are four values, so the mean is 28 / 4 = 7. Every later step measures distances from this point.

Step 2: Find Each Deviation From the Mean

Subtract the mean from each value. Values above the mean give positive deviations, values below it give negative ones.

For our data the deviations are −3, 1, −1 and 3. They add up to 0, which is always true for deviations from the mean and is a handy check that the mean is right.

Step 3: Square the Deviations

Because the deviations always add up to zero, averaging them tells you nothing. Squaring each one makes every term positive, so values below the mean and above it both add to the total.

Step 4: Add the Squares and Divide

ValueDeviationSquared deviation
4−39
811
6−11
1039
Total020

The sum of squares is 9 + 1 + 1 + 9 = 20. What you divide it by depends on what the four numbers represent:

  • If they are the whole group you care about, divide by n = 4. The population variance is σ² = 20 / 4 = 5.
  • If they are a sample from a larger group, divide by n − 1 = 3. The sample variance is s² = 20 / 3 ≈ 6.667.

Taking the square root gives the standard deviation: σ = √5 ≈ 2.236, or s ≈ 2.582 for the sample version.

The Shortcut Formula

You can get the same sum of squares without working out each deviation: square every value, add them up, and subtract the square of the total divided by n. For our data, 16 + 64 + 36 + 100 = 216, and 216 − 28² / 4 = 216 − 196 = 20, the same as before. The guide on calculating variance without every deviation covers this in detail.

How to Check Your Answer

  • The deviations should add up to zero (allowing for rounding). If they do not, recheck the mean.
  • Work the sum of squares out both ways: the deviation method and the shortcut formula should agree.
  • Variance can never be negative. A negative answer means an arithmetic slip somewhere.

What the Number Tells You

A low variance means the values are consistent, which is usually what you want from a manufacturing process or a measuring instrument. A high variance means they are scattered. Because the deviations are squared, values far from the mean add much more than values close to it, so one unusual number can raise the variance a lot.

Using a Calculator

For more than a handful of numbers, doing this by hand is slow and easy to get wrong. The variance calculator does every step for you, shows the working so you can check it, and gives both the sample and population results.

Summary

Find the mean, subtract it from each value, square the results, add them up, and divide by n for a population or n − 1 for a sample. After working through it by hand a couple of times, the formula stops looking mysterious.

Back to Blog