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.
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 Mark the data on a number line, and mark the mean, 7, with a dashed line.
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.
- The mean is (2 + 4 + 7 + 9 + 13) ÷ 5 = 35 ÷ 5 = 7.
- The deviations are −5, −3, 0, 2 and 6. They add to 0, as they must.
- Square them: 25, 9, 0, 4 and 36.
- Add the squares: 25 + 9 + 0 + 4 + 36 = 74.
- The variance is 74 ÷ 5 = 14.8.
- 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.
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.
Worked example
The table gives the scores of 20 learners in a quiz. Find the mean, the variance and the standard deviation.
- Add the columns. The total frequency is n = 20, Σfx = 57 and Σfx² = 183.
- The mean is 57 ÷ 20 = 2.85.
- The variance is Σfx² ÷ n − mean² = 183 ÷ 20 − 2.85² = 9.15 − 8.1225 = 1.0275.
- To 3 significant figures the variance is 1.03.
- 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.
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.
- E(X) = 0 × 0.1 + 1 × 0.3 + 2 × 0.4 + 3 × 0.2 = 1.7.
- E(X²) = 0 × 0.1 + 1 × 0.3 + 4 × 0.4 + 9 × 0.2 = 0.3 + 1.6 + 1.8 = 3.7.
- Var(X) = E(X²) − [E(X)]² = 3.7 − 1.7² = 3.7 − 2.89 = 0.81.
- 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.
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.
- E(Y) = 3 × E(X) + 2 = 3 × 1.7 + 2 = 7.1.
- The 2 does not change the spread. The 3 does: Var(Y) = 3² × Var(X) = 9 × 0.81 = 7.29.
- The standard deviation of Y is √7.29 = 2.7.
- 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
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.
- 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.
- Find the mean. Then write each value minus the mean, and square it.
- Add the squares and divide by the number of people. That is the variance. Its square root is the standard deviation.
- 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.
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.
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?
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.
What is the variance of 1, 3, 5 and 7?
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.
Lengths in a set have standard deviation 4 cm. Every length is changed to mm. What is the variance of the lengths in 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.
The standard deviation of a data set is 0. What must be true?
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.
For a random variable, E(X) = 3 and E(X²) = 11. What is Var(X)?
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.
X has variance 4. Y = 2X + 5. What is Var(Y)?
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.
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)?
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.
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.
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.
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.
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.
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.