Algebra 1

Variance of a data set

Every value in a data set sits some distance above or below the mean. How can all those distances be rolled into one number, when the ones above and the ones below cancel out?

Where you are 3 in Standard deviation

Why this exists

The Mean says where the middle of a data set is. It says nothing about how far the values stray from that middle. Two paper planes might both average 10 m a throw, one landing between 9 and 11 m every time and the other anywhere from 3 to 17 m. One number for that spread lets the two be compared.

The natural start is each value’s distance from the mean, with a sign, and then the average of those. That fails at once: these signed distances always add to 0, so their average is always 0, whatever the data. The signs have to go. Taking absolute values gives the mean absolute deviation (MAD), the mean distance of the values from their mean. Squaring gives the variance. Squares are much easier to handle in algebra than absolute values, and the square root of the variance, the standard deviation, is the measure of spread used throughout statistics.

Definition

The deviation of a value x is how far it sits from the mean \bar{x}, with a sign:

\text{deviation} = x - \bar{x}

A value above the mean has a positive deviation, a value below it a negative one, and a value equal to the mean has deviation 0.

The variance of a data set of n values is the mean of the squared deviations: square each value’s deviation, add the squares, and divide by n. It is written \sigma^2, read “sigma squared”:

\sigma^2 = \frac{\text{sum of the squared deviations}}{n}

With the values named x_1, x_2, \ldots, x_n, the same statement in symbols is

\begin{aligned} \sigma^2 = \tfrac{1}{n}\big[\, &(x_1 - \bar{x})^2 + (x_2 - \bar{x})^2 \\ &+ \cdots + (x_n - \bar{x})^2 \,\big] \end{aligned}

The variance is measured in the square of the data’s unit. Its square root, \sigma, is the standard deviation (Standard deviation), which is back in the data’s own unit.

Intuition

Figure 1 shows Dmitri’s five throws of a paper plane (made-up data): 7, 9, 10, 12 and 12 meters, with mean 10 m. Each throw has its own row. On each row a square joins the throw to the mean, with side equal to the throw’s distance from the mean, so its area is the squared deviation.

mean 10 deviation 9 −3 1 −1 0 0 4 2 4 2 6 7 8 9 10 11 12 13 distance of a throw (m)
Figure 1Each throw’s square has the throw’s distance from the mean as its side, so its area is the squared deviation. The variance is the mean area, \displaystyle \frac{18}{5} = 3.6 square meters.

The variance is the mean area of the squares: \displaystyle \frac{9 + 1 + 0 + 4 + 4}{5} = 3.6 square meters.

The picture shows two things. A throw 3 m from the mean has a square of area 9, nine times the square of a throw 1 m out, so values far from the mean count for much more than near ones. And the squares are areas: 3.6 is in square meters, not meters, so it is not itself a distance. Its square root is.

Results

  • Deviations from the mean add to 0, for every data set.
  • The variance is never negative, and it is 0 exactly when every value is equal.
  • Units. If the data are in some unit, the variance is in that unit squared: meters give square meters, dollars give dollars squared, seconds give square seconds. The standard deviation \displaystyle \sigma = \sqrt{\sigma^2} is in the data’s unit.
Why it is true

Deviations add to 0. The mean is the sum divided by n, so the sum of the values is n\bar{x}. Reorder and regroup the deviations (the commutative and associative properties of addition) so the values come together and the n copies of \bar{x} come together:

\begin{aligned} &(x_1 - \bar{x}) + (x_2 - \bar{x}) + \cdots + (x_n - \bar{x}) \\ &= (x_1 + x_2 + \cdots + x_n) - n\bar{x} \\ &= n\bar{x} - n\bar{x} = 0 \end{aligned}

The deviations above the mean exactly balance those below, which is why averaging the raw deviations tells nothing and the signs must be removed first.

Never negative, and 0 only when all values are equal. Each squared deviation is a square, so it is 0 or positive, and a sum of such numbers divided by n is 0 or positive. That sum is 0 only if every square is 0, that is, only if every value equals the mean. The other way round, if every value is the same number c, the mean is c and every deviation is 0.

Units. A deviation is the difference of two measurements, so it carries the data’s unit, and squaring it multiplies the unit by itself.

Worked examples

Example 1

A first variance

Dmitri throws a paper plane five times. The distances in meters (made-up data) are 7, 9, 10, 12, 12. Find the variance.

Solution

The mean is \displaystyle \bar{x} = \frac{7 + 9 + 10 + 12 + 12}{5} = \frac{50}{5} = 10 m. A table keeps the work in order: each value, its deviation, then the square of the deviation.

throw xdeviation x - 10squared deviation
7-39
9-11
1000
1224
1224
sum018

The deviations add to 0, as they must, which checks the mean. The squared deviations add to 18 and there are 5 values, so the variance is \displaystyle \sigma^2 = \frac{18}{5} = 3.6 square meters. These are the squares of Figure 1.

Example 2

A mean that is not a whole number

Agathe throws a plane of a different design four times: 3, 4, 6, 9 meters (made-up data). Find the variance.

Solution

The mean is \displaystyle \frac{3 + 4 + 6 + 9}{4} = \frac{22}{4} = 5.5 m. Keep it exact: a rounded mean would make every deviation slightly wrong.

throw xdeviation x - 5.5squared deviation
3-2.56.25
4-1.52.25
60.50.25
93.512.25
sum021

The variance is \displaystyle \frac{21}{4} = 5.25 square meters. Agathe’s throws are more spread out around their mean than Dmitri’s, and the larger variance says so.

Example 3

Same MAD, different variance

A bakery weighs four loaves from its morning batch and four from its afternoon batch, in grams (made-up data). Morning: 497, 499, 501, 503. Afternoon: 496, 500, 500, 504. Find the MAD and the variance of each batch.

Morning batch 494 496 498 500 502 504 506 Afternoon batch 494 496 498 500 502 504 506 mass of a loaf (g)
Figure 2Two batches of four loaves with the same mean and the same MAD. The afternoon batch has two loaves further out, and its variance is larger.
Solution

Both batches total 2000 g, so both means are \displaystyle \frac{2000}{4} = 500 g.

Morning: the deviations are -3, -1, 1, 3. The distances 3, 1, 1, 3 give \displaystyle \text{MAD} = \frac{8}{4} = 2 g. The squares 9, 1, 1, 9 add to 20, so the variance is \displaystyle \frac{20}{4} = 5 \text{g}^2.

Afternoon: the deviations are -4, 0, 0, 4. The distances 4, 0, 0, 4 give \displaystyle \text{MAD} = \frac{8}{4} = 2 g. The squares 16, 0, 0, 16 add to 32, so the variance is \displaystyle \frac{32}{4} = 8 \text{g}^2.

The MAD cannot tell the batches apart; the variance can. Absolute values count a distance of 4 as 4, only a third more than 3. Squares count it as 16 against 9, nearly twice as much. So the afternoon batch, with two loaves further out, has the larger variance. Neither measure is wrong; the variance simply weighs values far from the center more heavily.

Example 4

One loaf out of line

Every one of the six loaves Thomasina weighs on Monday is exactly 800 g. On Tuesday five loaves are 800 g and one is 806 g. Find the variance on each day (made-up data).

Solution

Monday: the mean is 800 g, every deviation is 0, every square is 0, and the variance is 0 \text{g}^2. With no spread at all, 0 is the only possible variance.

Tuesday: the mean is \displaystyle \frac{5 \times 800 + 806}{6} = \frac{4806}{6} = 801 g. The mean has moved, so the five ordinary loaves now have deviation -1 and the heavy loaf has deviation 5. The squares are five 1s and one 25, adding to 30, so the variance is \displaystyle \frac{30}{6} = 5 \text{g}^2. The one heavy loaf supplies 25 of the 30: a single value far from the rest can carry most of a variance.

Example 5

Units, and why the square root

The variance of Dmitri’s throws in Example 1 is 3.6 square meters. (a) Find the variance if the throws are recorded in centimeters. (b) Take the square root of the variance in meters and in centimeters, and compare.

Solution

(a) The values are 700, 900, 1000, 1200, 1200 cm, with mean 1000. The deviations are -300, -100, 0, 200, 200, and the squares 90000, 10000, 0, 40000, 40000 add to 180000. The variance is \displaystyle \frac{180000}{5} = 36000 \text{cm}^2. That is 10000 times 3.6, not 100 times. Each deviation in centimeters is 100 times the same deviation in meters, so each square is 100^2 = 10000 times larger, just as 1 \text{ m}^2 = 10000 \text{ cm}^2. The variance changes with the unit the way an area does, because it is measured in squared units. What happens to the variance when every value is shifted or rescaled in general is the subject of Shifting and rescaling a data set.

(b) \displaystyle \sqrt{3.6} \approx 1.90 m and \displaystyle \sqrt{36000} \approx 190 cm: the same length in two units. A number of square meters cannot be pictured as a distance from the mean; its square root can, and it is in the data’s own unit. That square root is the standard deviation.

Example 6

Working backwards from a variance

Mirela’s three throws are 10 - d, 10 and 10 + d meters, with d > 0, and their variance is 6 square meters. Find d and the three throws.

Solution

The mean is \displaystyle \frac{(10 - d) + 10 + (10 + d)}{3} = \frac{30}{3} = 10, since the ds cancel. The deviations are -d, 0 and d, with squares d^2, 0 and d^2, so

\sigma^2 = \frac{2d^2}{3} = 6

Multiplying both sides by \displaystyle \frac{3}{2} gives d^2 = 9, so d = 3 or d = -3, and d > 0 leaves d = 3. The throws are 7, 10, 13 m. Check: the squares 9, 0, 9 add to 18, and \displaystyle \frac{18}{3} = 6.

Boundaries

  • The variance needs quantitative data, numbers whose differences mean something. It has no meaning for categories, and none for number labels such as shirt numbers.
  • The units are squared, so the variance is not a typical distance from the mean. A variance of 3.6 square meters does not say a typical throw is 3.6 m from the mean; for a distance, take the square root.
  • This lesson divides by n, treating the data as the whole group of interest.
  • The mean must be exact. Rounding it before finding the deviations changes the answer, and the deviations stop adding to 0.
  • The variance is pulled up hard by a value far from the rest (Example 4), so read it next to a plot of the data.

Where this goes next

The square root of the variance is the standard deviation, the main measure of spread in statistics (Standard deviation). Computing a standard deviation by hand extends the table of this lesson to take that root, and also treats data that are a sample from a larger group, where the divisor changes. Interpreting a standard deviation reads the result in the units of the setting. The MAD stays useful for comparing groups, as in Comparing two populations: the gap between means in MADs. Later the same idea, the mean squared distance from the mean, is defined for Random variables, with each value weighted by its probability.

Exercises

Computing a variance

All data are made up. Find the mean and the variance.

  1. 2, 4, 6, 8, 10
  2. 1, 3, 3, 5, 8
  3. Orlando’s paper plane throws: 11, 13, 14, 15, 17 meters.
  4. Fitzgerald’s five loaves: 395, 398, 400, 401, 406 grams.
  5. 3, 5, 8, 10
  6. 0, 4, 4, 5, 7, 10. Give the variance as a fraction and as a decimal to two places.

Deviations, MAD and variance

  1. For 12, 15, 20, 21, list the deviations from the mean, show that they add to 0, and find the variance.
  2. A data set has five values. Four of the deviations from the mean are -4, -1, 0, 2. Find the fifth deviation and the variance.
  3. Set R is 5, 7, 9, 11, 13 and set S is 3, 9, 9, 9, 15. Find the MAD and the variance of each. Which measure tells the sets apart?
  4. Dmitri’s five throws were 7, 9, 10, 12, 12 m. His sixth throw lands exactly 10 m away. Find the new variance, and explain why it went down.

Units and working backwards

  1. The variance of Orlando’s throws in Exercise 3 is 4 square meters. What is it in square centimeters? What is the standard deviation in meters and in centimeters?
  2. Five values have mean 20. Four of them are 18, 19, 21, 24. Find the fifth value and the variance.
  3. Two values are 4 and x, with x > 4, and their variance is 9. Find x.
  4. Three values are 10 - d, 10 and 10 + d, with d > 0, and their variance is 24. Find d and the three values.

Reasoning

  1. Show that for any data set x_1, x_2, \ldots, x_n with mean \bar{x}, the deviations from the mean add to 0.
  2. Explain why a variance is never negative, and why it is 0 only when every value is equal.
  3. A report on the loaves in Exercise 4 gives their variance, 13.2 \text{g}^2, and adds “so a typical loaf is 13.2 g from the mean”. Explain what is wrong, and give a better number for a typical distance.
Answers
  1. Mean \displaystyle \frac{30}{5} = 6. Deviations -4, -2, 0, 2, 4; squares 16, 4, 0, 4, 16, sum 40. Variance \displaystyle \frac{40}{5} = 8.
  2. Mean \displaystyle \frac{20}{5} = 4. Deviations -3, -1, -1, 1, 4; squares 9, 1, 1, 1, 16, sum 28. Variance \displaystyle \frac{28}{5} = 5.6.
  3. Mean \displaystyle \frac{70}{5} = 14 m. Deviations -3, -1, 0, 1, 3; squares 9, 1, 0, 1, 9, sum 20. Variance \displaystyle \frac{20}{5} = 4 square meters.
  4. Mean \displaystyle \frac{2000}{5} = 400 g. Deviations -5, -2, 0, 1, 6; squares 25, 4, 0, 1, 36, sum 66. Variance \displaystyle \frac{66}{5} = 13.2 \text{g}^2.
  5. Mean \displaystyle \frac{26}{4} = 6.5. Deviations -3.5, -1.5, 1.5, 3.5; squares 12.25, 2.25, 2.25, 12.25, sum 29. Variance \displaystyle \frac{29}{4} = 7.25.
  6. Mean \displaystyle \frac{30}{6} = 5. Deviations -5, -1, -1, 0, 2, 5; squares 25, 1, 1, 0, 4, 25, sum 56. Variance \displaystyle \frac{56}{6} = \frac{28}{3} \approx 9.33.
  7. Mean \displaystyle \frac{68}{4} = 17. Deviations -5, -2, 3, 4, and -5 - 2 + 3 + 4 = 0. Squares 25, 4, 9, 16, sum 54. Variance \displaystyle \frac{54}{4} = 13.5.
  8. The deviations add to 0 and -4 - 1 + 0 + 2 = -3, so the fifth is 3. Squares 16, 1, 0, 4, 9, sum 30. Variance \displaystyle \frac{30}{5} = 6.
  9. Both means are 9. R: deviations -4, -2, 0, 2, 4, \displaystyle \text{MAD} = \frac{12}{5} = 2.4, variance \displaystyle \frac{40}{5} = 8. S: deviations -6, 0, 0, 0, 6, \displaystyle \text{MAD} = \frac{12}{5} = 2.4, variance \displaystyle \frac{72}{5} = 14.4. Only the variance tells them apart; S has two values far out.
  10. 3 square meters. The mean is still \displaystyle \frac{60}{6} = 10, so the old squares 9, 1, 0, 4, 4 are unchanged and the new throw adds 0: the sum stays 18 and \displaystyle \frac{18}{6} = 3. A value at the mean adds nothing to the squares but one to the count.
  11. 4 \times 10000 = 40000 \text{cm}^2: each deviation in centimeters is 100 times its value in meters, so each square is 100^2 = 10000 times larger, as in Example 5. Standard deviation \displaystyle \sqrt{4} = 2 m, and \displaystyle \sqrt{40000} = 200 cm, the same length.
  12. The five values add to 5 \times 20 = 100 and 18 + 19 + 21 + 24 = 82, so the fifth is 18. Deviations -2, -1, 1, 4, -2, which add to 0; squares 4, 1, 1, 16, 4, sum 26. Variance \displaystyle \frac{26}{5} = 5.2.
  13. x = 10. The mean is \displaystyle \frac{4 + x}{2}, so the deviations are \displaystyle -\frac{x - 4}{2} and \displaystyle \frac{x - 4}{2}, each with square \displaystyle \frac{(x - 4)^2}{4}. Two equal squares divided by 2 give \displaystyle \frac{(x - 4)^2}{4} = 9, so (x - 4)^2 = 36 and x - 4 = 6 since x > 4. Check: 4, 10 have mean 7, squares 9, 9, and \displaystyle \frac{18}{2} = 9.
  14. The mean is 10 and the squares are d^2, 0, d^2, so \displaystyle \frac{2d^2}{3} = 24, d^2 = 36, and d > 0 gives d = 6. The values are 4, 10, 16; check \displaystyle \frac{36 + 0 + 36}{3} = 24.
  15. The mean is the sum divided by n, so x_1 + \cdots + x_n = n\bar{x}. Reordering and regrouping, the sum of the deviations x_1 - \bar{x} up to x_n - \bar{x} is the sum of the values minus n copies of \bar{x}, which is n\bar{x} - n\bar{x} = 0.
  16. Each squared deviation is 0 or positive, so their sum and its mean are 0 or positive. A sum of numbers that are 0 or positive is 0 only when every one is 0, so every value equals the mean, and then all values are equal. If all values equal c, the mean is c and every deviation is 0, so the variance is 0.
  17. The variance is in grams squared, not grams, so 13.2 is not a distance. The square root, \displaystyle \sqrt{13.2} \approx 3.63 g, the standard deviation, is a typical distance in grams. The MAD, \displaystyle \frac{5 + 2 + 0 + 1 + 6}{5} = 2.8 g, is another.
kg1128 · updated 2026-10-10 · CC-BY-SA-4.0