What you'll learn
- What variance and standard deviation measure, and why they are useful.
- How to calculate standard deviation from raw data using sums.
- How to estimate standard deviation from grouped data using midpoints.
- How coding affects the mean, median, variance and standard deviation.
1. Why do we need a measure of spread?
A measure of location tells you where the data is centred. The most common one here is the mean, found by adding all the values and dividing by how many values there are.
A measure of spread tells you how far the values tend to be from the centre. Two data sets can have the same mean but feel very different if one is tightly clustered and the other is spread out.

Mean
For values of a variable xxx, the mean is written as xˉ\bar{x}xˉ. If there are nnn values, then
xˉ=∑xn\bar{x}=\frac{\sum x}{n}xˉ=n∑xThe symbol ∑x\sum x∑x means “add all the values of xxx”.
Same mean, different spread
The two data sets below both have three values:
- Set A: 4, 5, 6
- Set B: 1, 5, 9
-
Find the mean of Set A.
xˉ=4+5+63=5\bar{x}=\frac{4+5+6}{3}=5xˉ=34+5+6=5 -
Find the mean of Set B.
xˉ=1+5+93=5\bar{x}=\frac{1+5+9}{3}=5xˉ=31+5+9=5 -
Compare the spread. Set A is close to 5, but Set B has values much further from 5, so Set B has the larger spread.
The big idea
Standard deviation measures the typical distance of the data values from the mean. A larger standard deviation means the data is more spread out.
2. Deviations, variance and standard deviation
A deviation is the signed distance of a value from the mean. For a value xxx, its deviation is x−xˉx-\bar{x}x−xˉ.

There is a problem: the deviations always add to zero. Values above the mean cancel values below the mean. To avoid this, we square the deviations.

Variance and standard deviation
The variance is the mean of the squared deviations:
s2=∑(x−xˉ)2ns^2=\frac{\sum (x-\bar{x})^2}{n}s2=n∑(x−xˉ)2The standard deviation is the square root of the variance:
s=∑(x−xˉ)2ns=\sqrt{\frac{\sum (x-\bar{x})^2}{n}}s=n∑(x−xˉ)2Because variance uses squared deviations, its units are squared. For example, if heights are measured in cm, variance is in cm². Standard deviation is usually easier to interpret because it is back in the original units.
The efficient formula
In AS-Level questions, it is usually quicker to use:
s2=∑x2n−xˉ2s^2=\frac{\sum x^2}{n}-\bar{x}^2s2=n∑x2−xˉ2Then take the square root to find sss.
Forgetting the square root
The formula ∑x2n−xˉ2\frac{\sum x^2}{n}-\bar{x}^2n∑x2−xˉ2 gives the variance. To get the standard deviation, you must square root your answer.
Raw data: running times
Six athletes ran a race in the following times, in seconds:

45.2, 46.8, 46.0, 46.3, 45.5, 45.0
Find the mean and standard deviation.
-
Let xxx be the time in seconds. Find nnn, ∑x\sum x∑x and ∑x2\sum x^2∑x2.
n=6,∑x=274.8,∑x2=12588.22n=6,\qquad \sum x=274.8,\qquad \sum x^2=12588.22n=6,∑x=274.8,∑x2=12588.22 -
Calculate the mean.
xˉ=274.86=45.8\bar{x}=\frac{274.8}{6}=45.8xˉ=6274.8=45.8 -
Use the variance formula.
s2=12588.226−45.82=0.396666…s^2=\frac{12588.22}{6}-45.8^2=0.396666\ldotss2=612588.22−45.82=0.396666… -
Square root the variance to find the standard deviation.
s=0.396666…=0.630s=\sqrt{0.396666\ldots}=0.630s=0.396666…=0.630 -
Give the answer to 3 significant figures: the standard deviation is 0.630 seconds.
Calculator check
Your calculator’s statistics mode is excellent for checking answers, but still write down key working such as ∑x\sum x∑x, ∑x2\sum x^2∑x2, the mean and the formula substitution.
3. Estimating standard deviation from grouped data
Sometimes data is given in class intervals, such as 140 < height ≤ 150. A frequency tells you how many values are in each class.
When the original values are not listed, you estimate using the midpoint of each class.
Midpoint
The midpoint of a class interval is the value halfway between the lower and upper class boundaries. For example, the midpoint of 140 < h ≤ 150 is 145.

For grouped data, use:
xˉ=∑fx∑f\bar{x}=\frac{\sum fx}{\sum f}xˉ=∑f∑fxand
s2=∑fx2∑f−xˉ2s^2=\frac{\sum fx^2}{\sum f}-\bar{x}^2s2=∑f∑fx2−xˉ2Here, fff is the frequency and xxx is the class midpoint.
Grouped data: plant heights
A gardener records the heights of 50 plants.

| Height class in cm | Frequency | Midpoint |
|---|---|---|
| 120 < h ≤ 130 | 5 | 125 |
| 130 < h ≤ 140 | 8 | 135 |
| 140 < h ≤ 150 | 17 | 145 |
| 150 < h ≤ 160 | 14 | 155 |
| 160 < h ≤ 180 | 6 | 170 |
Estimate the mean and standard deviation.
-
Use the midpoints to calculate the totals.
∑f=50,∑fx=7360,∑fx2=1091100\sum f=50,\qquad \sum fx=7360,\qquad \sum fx^2=1091100∑f=50,∑fx=7360,∑fx2=1091100 -
Estimate the mean.
xˉ=736050=147.2\bar{x}=\frac{7360}{50}=147.2xˉ=507360=147.2 -
Estimate the variance.
s2=109110050−147.22=154.16s^2=\frac{1091100}{50}-147.2^2=154.16s2=501091100−147.22=154.16 -
Square root to estimate the standard deviation.
s=154.16=12.4s=\sqrt{154.16}=12.4s=154.16=12.4 -
The estimated standard deviation is 12.4 cm to 3 significant figures.
Using the class end instead of the midpoint
For a class such as 160 < h ≤ 180, use midpoint 170. Do not use 160 or 180 in the standard deviation formula.
If data is given to the nearest unit, such as distances 10–19 miles, think of the class as running from 9.5 to 19.5. The midpoint is still 14.5.

4. Standard deviation with coded data
A coded variable is a transformed version of the original variable. Coding is often used to make numbers smaller and easier to handle.
For example:
x=t−123x=\frac{t-12}{3}x=3t−12This means the coded value is xxx, and the original value is ttt. Rearranging gives:
t=3x+12t=3x+12t=3x+12Adding or subtracting changes location, but not spread. Multiplying changes spread.

Effect of coding
If T=a+bXT=a+bXT=a+bX, then:

- the mean and median are transformed using the same formula;
- the standard deviation is multiplied by ∣b∣|b|∣b∣;
- the variance is multiplied by b2b^2b2.
Coded journey times
The coded journey times, xxx, for 50 people are summarised below.
| Coded time | Frequency |
|---|---|
| 0 < x ≤ 5 | 2 |
| 5 < x ≤ 10 | 8 |
| 10 < x ≤ 15 | 16 |
| 15 < x ≤ 25 | 18 |
| 25 < x ≤ 40 | 6 |
The coding used is:
x=t−123x=\frac{t-12}{3}x=3t−12Estimate the median and standard deviation of the original journey times, ttt.
-
First estimate the median of the coded times. The 25th value lies in the class 10 < x ≤ 15, because the cumulative frequencies are 2, 10, 26, 44, 50.
median of x=10+25−1016×5=14.6875\text{median of }x=10+\frac{25-10}{16}\times 5=14.6875median of x=10+1625−10×5=14.6875 -
Use midpoints to estimate the standard deviation of xxx.
∑f=50,∑fx=820,∑fx2=16500\sum f=50,\qquad \sum fx=820,\qquad \sum fx^2=16500∑f=50,∑fx=820,∑fx2=16500 -
Find the mean and standard deviation of xxx.
xˉ=82050=16.4,sx=1650050−16.42=7.81\bar{x}=\frac{820}{50}=16.4,\qquad s_x=\sqrt{\frac{16500}{50}-16.4^2}=7.81xˉ=50820=16.4,sx=5016500−16.42=7.81 -
Rearrange the coding formula.
t=3x+12t=3x+12t=3x+12 -
Transform the median.
median of t=3(14.6875)+12=56.1\text{median of }t=3(14.6875)+12=56.1median of t=3(14.6875)+12=56.1 -
Transform the standard deviation by multiplying by 3 only.
st=3(7.812…)=23.4s_t=3(7.812\ldots)=23.4st=3(7.812…)=23.4
Adding the shift to the standard deviation
If t=3x+12t=3x+12t=3x+12, the +12 moves every value by the same amount, so it does not increase spread. Multiply the standard deviation by 3 only.
In the exam
-
For raw data, write down nnn, ∑x\sum x∑x and ∑x2\sum x^2∑x2, then use s2=∑x2n−xˉ2s^2=\frac{\sum x^2}{n}-\bar{x}^2s2=n∑x2−xˉ2.
-
For grouped data, use class midpoints and remember your answer is an estimate.
-
For coded data, rearrange the coding formula before converting the median or standard deviation; do not add the shift to the standard deviation.
Check yourself
- Why do we square deviations when finding variance?
- In grouped data, why do we use midpoints rather than class boundaries?
- If t=2x+20t=2x+20t=2x+20 and the standard deviation of xxx is 4.6, what happens to the standard deviation of ttt?
