M5.7.2 Chapter 2

Variance and standard deviation

Two groups both have a mean of 7. How can I measure how spread out each group is?

Your guess

Pick one before you read on. It is fine to be wrong.

Your guess
  • You picked A. Read on. At the end, the chapter comes back to your guess.

  • You picked B. Read on. At the end, the chapter comes back to your guess.

  • You picked C. Read on. At the end, the chapter comes back to your guess.

By the end you can

  • Find the variance and standard deviation of a data set
  • Find the variance of a random variable
  • Say how adding to or multiplying every value changes the spread

The mean says where the middle of a data set is. It says nothing about how far the values are scattered round it. Group A and group B in the question have the same mean, yet they are very different. We need a number for spread.

Start with the distance of each value from the mean. We call x minus the mean the deviation of x. Some deviations are negative and some positive, and they always add to 0, so their sum says nothing. For group A they are −5, −3, 0, 2 and 6, and −5 − 3 + 0 + 2 + 6 = 0.

Squaring fixes this. A squared deviation is never negative, and a value far from the mean gives a much larger square than a value near it. The variance is the mean of the squared deviations: σ² = Σ(x − μ)² ÷ n. The standard deviation σ is the square root of the variance. It is in the same unit as the data, so it is a typical distance from the mean.

Draw it first

Draw a square on each deviation

  1. A number line named value with the data 2, 4, 7, 9 and 13 as dots and a dashed line named mean 7. Step 1 shows the dots and the mean line. Step 2 draws on each dot a square whose side is the distance of the dot from the mean. Each square is written with its area: 25, 9, 4 and 36. The dot at 7 has no square.02468101214mean 7value

    1 Mark the data on a number line, and mark the mean, 7, with a dashed line.

  2. A number line named value with the data 2, 4, 7, 9 and 13 as dots and a dashed line named mean 7. Step 1 shows the dots and the mean line. Step 2 draws on each dot a square whose side is the distance of the dot from the mean. Each square is written with its area: 25, 9, 4 and 36. The dot at 7 has no square.02468101214259436mean 7value

    2 On each value draw a square whose side runs from the value to the mean. A value 5 away from 7 gives a square of area 5 × 5 = 25.

The variance is the mean area of these squares, and the standard deviation is the side of a square with that mean area. Now do the sum in steps.

Worked example

Find the variance and the standard deviation of 2, 4, 7, 9 and 13.

  1. The mean is (2 + 4 + 7 + 9 + 13) ÷ 5 = 35 ÷ 5 = 7.
  2. The deviations are −5, −3, 0, 2 and 6. They add to 0, as they must.
  3. Square them: 25, 9, 0, 4 and 36.
  4. Add the squares: 25 + 9 + 0 + 4 + 36 = 74.
  5. The variance is 74 ÷ 5 = 14.8.
  6. The standard deviation is √14.8 = 3.85, to 3 significant figures.

Answer: The variance is 14.8 and the standard deviation is 3.85.

A number line named value with the data 2, 4, 7, 9 and 13 as dots and a dashed line named mean 7. On each dot except 7 a square stands, written with its area: 25, 9, 4 and 36.02468101214259436mean 7value
The squares for group A. Their areas add to 74. The mean area is 74 ÷ 5 = 14.8, which is the variance.

The same sum for group B, 6, 7, 7, 7, 8, gives squares 1, 0, 0, 0 and 1. They add to 2, so the variance is 2 ÷ 5 = 0.4 and the standard deviation is 0.63. Group B is much less spread out, and now a number says so.

Squaring every deviation by hand is slow. There is a shorter form. Expand (x − μ)² = x² − 2μx + μ². Add this over all n values: Σx² − 2μΣx + nμ². Since Σx = nμ, this is Σx² − 2nμ² + nμ² = Σx² − nμ². Divide by n and the result is σ² = Σx² ÷ n − μ². In words: the mean of the squares, minus the square of the mean.

Check with group A. The squares of the values are 4, 16, 49, 81 and 169, which add to 319. So σ² = 319 ÷ 5 − 7² = 63.8 − 49 = 14.8. It agrees. The short form works from a frequency table too: use Σfx² for Σx², and the total frequency for n.

A table with the heads x, f, fx and fx². The rows read 1, 2, 2 and 2; 2, 5, 10 and 20; 3, 8, 24 and 72; 4, 4, 16 and 64; 5, 1, 5 and 25; and a last row total, 20, 57 and 183.xffxfx²122225102038247244166451525total2057183
The column fx² is each value squared, then times its frequency. The last row holds the totals the sum needs.

Worked example

The table gives the scores of 20 learners in a quiz. Find the mean, the variance and the standard deviation.

  1. Add the columns. The total frequency is n = 20, Σfx = 57 and Σfx² = 183.
  2. The mean is 57 ÷ 20 = 2.85.
  3. The variance is Σfx² ÷ n − mean² = 183 ÷ 20 − 2.85² = 9.15 − 8.1225 = 1.0275.
  4. To 3 significant figures the variance is 1.03.
  5. The standard deviation is √1.0275 = 1.01, to 3 significant figures.

Answer: The mean is 2.85, the variance is 1.03 and the standard deviation is 1.01.

A random variable has a variance too. It is the mean of the squared deviations, with each weighted by its probability: Var(X) = E((X − μ)²). The same working as above turns this into Var(X) = E(X²) − [E(X)]², where E(X²) = Σ x² P(X = x). Find E(X) first.

A table with the heads x, P(x), xP(x) and x²P(x). The rows read 0, 0.1, 0 and 0; 1, 0.3, 0.3 and 0.3; 2, 0.4, 0.8 and 1.6; 3, 0.2, 0.6 and 1.8; and a last row total, 1, 1.7 and 3.7.xP(x)xP(x)x²P(x)00.10010.30.30.320.40.81.630.20.61.8total11.73.7
P(x) is short for P(X = x). The totals of the last two columns are E(X) and E(X²).

Worked example

X takes the values 0, 1, 2 and 3 with probabilities 0.1, 0.3, 0.4 and 0.2. Find Var(X) and the standard deviation.

  1. E(X) = 0 × 0.1 + 1 × 0.3 + 2 × 0.4 + 3 × 0.2 = 1.7.
  2. E(X²) = 0 × 0.1 + 1 × 0.3 + 4 × 0.4 + 9 × 0.2 = 0.3 + 1.6 + 1.8 = 3.7.
  3. Var(X) = E(X²) − [E(X)]² = 3.7 − 1.7² = 3.7 − 2.89 = 0.81.
  4. The standard deviation is √0.81 = 0.9.

Answer: Var(X) = 0.81 and the standard deviation is 0.9.

Now change every value. Suppose Y = aX + b. Every value is multiplied by a and then moved by b. The mean follows: E(Y) = aE(X) + b. But moving every value by b does not change how far they are from each other, so b does not change the spread. Multiplying by a stretches each distance by a, so each squared deviation grows by a². Therefore Var(aX + b) = a² Var(X), and the standard deviation is |a| times as big.

Two bar charts with the same four probabilities, 0.1, 0.3, 0.4 and 0.2. The upper chart is for x, with bars at 0, 1, 2 and 3, the heading P(X = x), and a marker named mean 1.7. The lower chart is for y, on the same number line from 0 to 11, with bars at 2, 5, 8 and 11, the heading P(Y = y), and a marker named mean 7.1. The lower bars stand three times as far apart as the upper bars.P(X = x)00.501234567891011xmean 1.7P(Y = y)00.501234567891011ymean 7.1
Y = 3X + 2. The bars keep their heights. The values are three times as far apart and the mean moves from 1.7 to 7.1.

Worked example

In a quiz, X is the number of correct answers, with E(X) = 1.7 and Var(X) = 0.81. A learner scores Y = 3X + 2 points, with 3 points for each correct answer and 2 for taking part. Find E(Y), Var(Y) and the standard deviation of Y.

  1. E(Y) = 3 × E(X) + 2 = 3 × 1.7 + 2 = 7.1.
  2. The 2 does not change the spread. The 3 does: Var(Y) = 3² × Var(X) = 9 × 0.81 = 7.29.
  3. The standard deviation of Y is √7.29 = 2.7.
  4. Check: 3 × 0.9 = 2.7, where 0.9 is the standard deviation of X.

Answer: E(Y) = 7.1, Var(Y) = 7.29 and the standard deviation of Y is 2.7.

One note on the divisor. Some courses divide by n − 1 instead of n when the data is a sample taken from a larger group, to estimate the variance of the whole group. Many calculators have a key for each. This book divides by n, and a question says which to use.

See it three ways

With things

Five people stand on a line at the marks 2, 4, 7, 9 and 13 metres. Each marks a square on the ground, with one side along the line from where they stand to the mark 7.

As a picture

A number line named position in m, areas in m² with the data 2, 4, 7, 9 and 13 as dots and a dashed line named mean 7. On each dot except 7 a square stands, written with its area in m²: 25, 9, 4 and 36.02468101214259436mean 7position in m, areas in m²

In words

The variance is the mean area of the squares. The standard deviation is the side of a square with that mean area.

In symbols

σ² = Σ(x − μ)² ÷ n = 74 m² ÷ 5 = 14.8 m², and σ = √14.8 m² = 3.85 m.

Try it

Measure the spread of hand spans

You need: a ruler in centimetres, five or six people, a pencil and paper.

  1. Each person spreads a hand wide. Measure from the tip of the thumb to the tip of the little finger, in cm. Write the values down.
  2. Find the mean. Then write each value minus the mean, and square it.
  3. Add the squares and divide by the number of people. That is the variance. Its square root is the standard deviation.
  4. Now write every span in mm, by multiplying by 10, and do the sum again.

What you will see: The standard deviation in mm is 10 times the one in cm. The variance in mm² is 100 times the one in cm². A spread of 2 cm and a spread of 20 mm are the same spread.

If you cannot try it, this is what happens.
Two tables. The first has the heads x, x − 20 and square. Its rows read 17 cm, −3 cm and 9 cm²; 19 cm, −1 cm and 1 cm²; 20 cm, 0 cm and 0 cm²; 22 cm, 2 cm and 4 cm²; 22 cm, 2 cm and 4 cm²; and a last row total, 0 cm and 18 cm². The second has the heads spread, in cm and in mm. Its rows read variance, 3.6 cm² and 360 mm²; sd, 1.9 cm and 19 mm.xx − 20square17 cm−3 cm9 cm²19 cm−1 cm1 cm²20 cm0 cm0 cm²22 cm2 cm4 cm²22 cm2 cm4 cm²total0 cm18 cm²spreadin cmin mmvariance3.6 cm²360 mm²sd1.9 cm19 mm

A wrong idea many people have

The mean of the deviations measures the spread.

Why it feels right: A deviation is a distance from the mean, so the mean of the distances looks like the typical distance.

The test that breaks it: Take 2, 4, 7, 9 and 13. The deviations are −5, −3, 0, 2 and 6. They add to 0, so their mean is 0. But the values are clearly not all the same.

What is true: The deviations always add to 0, because the values above the mean balance the values below. Squaring each deviation first removes the signs, so the mean of the squares measures spread.

A wrong idea many people have

If I add 5 to every value, the standard deviation goes up by 5.

Why it feels right: Every value gets bigger, so the numbers seem to spread out more.

The test that breaks it: Add 5 to 2, 4, 7, 9 and 13 to get 7, 9, 12, 14 and 18. The new mean is 12. The deviations are −5, −3, 0, 2 and 6, the same as before, so the variance is still 14.8.

What is true: Adding the same number moves all the values and the mean together, so the distances between them do not change. Only multiplying changes the spread: the standard deviation is multiplied by the size of the multiplier.

Key words

spread
how far the values of a data set are scattered round their mean.
deviation
a value minus the mean. The deviations of a set always add to 0.
variance
the mean of the squared deviations, σ² = Σ(x − μ)² ÷ n = Σx² ÷ n − μ².
standard deviation
the square root of the variance. It has the same unit as the data.

Back to your guess

The answer is A: Group A, 2, 4, 7, 9, 13, is more spread out, because its values lie further from 7.

Group A is far more spread out. Its values lie 5, 3, 0, 2 and 6 away from the mean, while the values of group B lie only 1, 0, 0, 0 and 1 away. The mean cannot show this. This chapter makes a number that can: the standard deviation.

Check yourself

Try each one before you look. A wrong answer tells you where to go next.

  1. Two sets of four values both have mean 10. Set P is 9, 10, 10, 11. Set Q is 4, 8, 12, 16. Which statement is true?

    Tap your answer.
    1. Not this one. Repeating the mean makes a set tighter, not looser. The values of P lie at most 1 from the mean, and the values of Q lie up to 6 away. Read this page again. Try another.

    2. Yes, that is right. The variance of P is (1 + 0 + 0 + 1) ÷ 4 = 0.5. The variance of Q is (36 + 4 + 4 + 36) ÷ 4 = 20. So Q is far more spread out.

    3. Not this one. The mean does not fix the spread. Sets with the same mean can be tight or wide, as groups A and B showed. Read this page again. Try another.

    See the answer

    Q has the larger standard deviation, because its values lie further from the mean.

    The variance of P is (1 + 0 + 0 + 1) ÷ 4 = 0.5. The variance of Q is (36 + 4 + 4 + 36) ÷ 4 = 20. So Q is far more spread out.

    • If you chose A: Repeating the mean makes a set tighter, not looser. The values of P lie at most 1 from the mean, and the values of Q lie up to 6 away. Read this page again.
    • If you chose C: The mean does not fix the spread. Sets with the same mean can be tight or wide, as groups A and B showed. Read this page again.
  2. What is the variance of 1, 3, 5 and 7?

    Tap your answer.
    1. Not this one. The squared deviations 9, 1, 1 and 9 add to 20. The variance is their mean, so divide by 4. Read this page again. Try another.

    2. Not this one. That is the standard deviation, √5. The variance is the number before the square root. Read this page again. Try another.

    3. Yes, that is right. The mean is 4. The deviations are −3, −1, 1 and 3, with squares 9, 1, 1 and 9. They add to 20, and 20 ÷ 4 = 5.

    See the answer

    5

    The mean is 4. The deviations are −3, −1, 1 and 3, with squares 9, 1, 1 and 9. They add to 20, and 20 ÷ 4 = 5.

    • If you chose A: The squared deviations 9, 1, 1 and 9 add to 20. The variance is their mean, so divide by 4. Read this page again.
    • If you chose B: That is the standard deviation, √5. The variance is the number before the square root. Read this page again.
  3. Lengths in a set have standard deviation 4 cm. Every length is changed to mm. What is the variance of the lengths in mm²?

    Tap your answer.
    1. Not this one. You multiplied the variance by 10. The standard deviation is multiplied by 10, but the variance is multiplied by 10², which is 100. Read this page again. Try another.

    2. Not this one. You squared the standard deviation but kept the unit cm. In mm every length and every deviation is 10 times bigger. Read this page again. Try another.

    3. Not this one. That is the standard deviation in mm, 4 × 10 = 40 mm. The variance is its square. Read this page again. Try another.

    4. Yes, that is right. The standard deviation in mm is 4 × 10 = 40 mm. The variance is the square of that: 40² = 1600 mm².

    See the answer

    1600 mm²

    The standard deviation in mm is 4 × 10 = 40 mm. The variance is the square of that: 40² = 1600 mm².

    • If you chose A: You multiplied the variance by 10. The standard deviation is multiplied by 10, but the variance is multiplied by 10², which is 100. Read this page again.
    • If you chose B: You squared the standard deviation but kept the unit cm. In mm every length and every deviation is 10 times bigger. Read this page again.
    • If you chose C: That is the standard deviation in mm, 4 × 10 = 40 mm. The variance is its square. Read this page again.
  4. The standard deviation of a data set is 0. What must be true?

    Tap your answer.
    1. Not this one. The values 5, 5, 5 have mean 5 and standard deviation 0. The mean can be any number. Read this page again. Try another.

    2. Yes, that is right. The variance is a mean of squares, so it is 0 only if every square is 0. Then every value equals the mean, so all the values are equal.

    3. Not this one. The values 2 and −2 add to 0, but they lie 2 from the mean, so the standard deviation is 2. Read this page again. Try another.

    See the answer

    Every value in the set is equal.

    The variance is a mean of squares, so it is 0 only if every square is 0. Then every value equals the mean, so all the values are equal.

    • If you chose A: The values 5, 5, 5 have mean 5 and standard deviation 0. The mean can be any number. Read this page again.
    • If you chose C: The values 2 and −2 add to 0, but they lie 2 from the mean, so the standard deviation is 2. Read this page again.
  5. For a random variable, E(X) = 3 and E(X²) = 11. What is Var(X)?

    Tap your answer.
    1. Yes, that is right. Var(X) = E(X²) − [E(X)]² = 11 − 3² = 11 − 9 = 2.

    2. Not this one. You took E(X²) − E(X). The rule squares the mean: E(X²) − [E(X)]². Read this page again. Try another.

    3. Not this one. You added the two numbers. The variance is E(X²) minus the square of E(X). Read this page again. Try another.

    See the answer

    2

    Var(X) = E(X²) − [E(X)]² = 11 − 3² = 11 − 9 = 2.

    • If you chose B: You took E(X²) − E(X). The rule squares the mean: E(X²) − [E(X)]². Read this page again.
    • If you chose C: You added the two numbers. The variance is E(X²) minus the square of E(X). Read this page again.
  6. X has variance 4. Y = 2X + 5. What is Var(Y)?

    Tap your answer.
    1. Not this one. You multiplied the variance by 2. The variance is multiplied by the square of the multiplier, 2² = 4. Read this page again. Try another.

    2. Not this one. You doubled the variance and then added 5. The 5 moves every value and does not change the spread. Read this page again. Try another.

    3. Yes, that is right. Var(aX + b) = a² Var(X). Here a = 2 and b = 5, so Var(Y) = 2² × 4 = 16. The 5 plays no part.

    See the answer

    16

    Var(aX + b) = a² Var(X). Here a = 2 and b = 5, so Var(Y) = 2² × 4 = 16. The 5 plays no part.

    • If you chose A: You multiplied the variance by 2. The variance is multiplied by the square of the multiplier, 2² = 4. Read this page again.
    • If you chose B: You doubled the variance and then added 5. The 5 moves every value and does not change the spread. Read this page again.
  7. From an earlier chapter

    X takes the values 0, 1 and 2. The probabilities of 0 and 1 are 0.3 and 0.5. What is E(X)?

    Tap your answer.
    1. Not this one. That is the mean of the values 0, 1 and 2, as if all were equally likely. Weight each value by its probability. Go to M5.7.1. Try another.

    2. Yes, that is right. The probability of 2 is 1 − 0.3 − 0.5 = 0.2. So E(X) = 0 × 0.3 + 1 × 0.5 + 2 × 0.2 = 0.5 + 0.4 = 0.9.

    3. Not this one. That is the probability of the value 1. Find the missing probability first, then multiply each value by its probability. Go to M5.7.1. Try another.

    See the answer

    0.9

    The probability of 2 is 1 − 0.3 − 0.5 = 0.2. So E(X) = 0 × 0.3 + 1 × 0.5 + 2 × 0.2 = 0.5 + 0.4 = 0.9.

    • If you chose A: That is the mean of the values 0, 1 and 2, as if all were equally likely. Weight each value by its probability. Go to M5.7.1.
    • If you chose C: That is the probability of the value 1. Find the missing probability first, then multiply each value by its probability. Go to M5.7.1.
  8. Find the variance of 3, 5, 6 and 10.

    See the answer

    6.5

    The mean is 24 ÷ 4 = 6. The squared deviations are 9, 1, 0 and 16, which add to 26. The variance is 26 ÷ 4 = 6.5.

  9. For 10 values, Σx = 120 and Σx² = 1500. Find the variance.

    See the answer

    6

    The mean is 120 ÷ 10 = 12. The variance is Σx² ÷ n − mean² = 1500 ÷ 10 − 12² = 150 − 144 = 6.

  10. X takes the values 1, 2, 3 and 4 with probabilities 0.1, 0.2, 0.4 and 0.3. Find Var(X).

    See the answer

    0.89

    E(X) = 0.1 + 0.4 + 1.2 + 1.2 = 2.9. E(X²) = 0.1 + 0.8 + 3.6 + 4.8 = 9.3. Var(X) = 9.3 − 2.9² = 9.3 − 8.41 = 0.89.

  11. X has variance 2.5. Y = 4X − 1. What is Var(Y)?

    See the answer

    40

    Var(aX + b) = a² Var(X) = 4² × 2.5 = 16 × 2.5 = 40. The −1 does not change the spread.

  12. Find the standard deviation of 6, 8, 8, 10 and 13, to 3 significant figures.

    See the answer

    2.37

    The mean is 45 ÷ 5 = 9. The squared deviations are 9, 1, 1, 1 and 16, which add to 28. The variance is 28 ÷ 5 = 5.6, and √5.6 = 2.37.

Keep it

Copy this into your exercise book.

σ² = mean of (x − μ)² = Σx² ÷ n − μ². σ = √σ². Var(X) = E(X²) − [E(X)]². Var(aX + b) = a² Var(X). Adding b changes no spread.

Draw: A number line with five dots, a mean line and a square on each deviation.

Reading with a child? A short page for the adult: what this chapter teaches and three questions to ask.

No internet tomorrow? Save the whole book as one file (1.1 MB). It opens on any phone.