MathemagiciansLibraryExplorationsDeep Dives
← Mathematics · Lower Secondary
MathematicsLower Secondary

Range and interquartile range — measuring spread

L4.1 — Statistical MeasuresLecture 2 of 2~2670 words

Same average, different players

A cricket coach must choose one of two batters for an important match. Here are the runs each one scored in their last seven innings. The two players and their scores are invented for this lecture.

Work out the averages from the last lecture. Each list adds up to 315 runs, so each player's mean is runs per innings. Sort the lists, and each median is also 45. By every average you know, the two players are the same.

0153045607590runs in one inningsmean 45 for bothArjunKemar
Each dot is one innings. Arjun's seven scores sit in a tight clump between 44 and 46. Kemar's scores are near 0 or near 90, with one score of 45. The dashed line is the mean, 45, for both players.

The picture tells a different story. Arjun scores about 45 every time. Kemar either fails almost at once or scores nearly 90. An average cannot see this difference, because it describes only the centre of the data. The last lecture promised the other half of the picture. Here it is: spread, which measures how far the values are scattered around the centre.

Stop and think

The team needs about 40 more runs to win. Which player should the coach send in? Would your answer change if the team needed 85 runs?

Show the answer

For 40 runs, Arjun. He has scored more than 40 in every one of his seven innings. Kemar scored 3 runs or fewer in three of his seven innings.

For 85 runs, the answer changes. Arjun has never scored more than 46, so he is very unlikely to reach 85. Kemar scored 88 or more in three of his seven innings. He is the only one who might win the match. The averages could not help with either decision. The spread decided both.

The range: the distance from the smallest to the largest

The simplest measure of spread is the range.

The range

range = largest value − smallest value

The range is one number: the distance between the two ends of the data.

For Arjun, the range is runs. For Kemar, it is runs. A small range means the values are close together. A large range means they are far apart. So the range already separates the two players clearly.

The range is quick to find. It also has one serious weakness. It uses only two values, the smallest and the largest. Every value between them is ignored. This means that one unusual value can change the range completely.

Try this before you read on. Look at the two sets of numbers in the next question and decide which one is more spread out.

Predict — which set is more spread out?

Set P: 1, 10, 10, 10, 10, 10, 10, 10, 19. Set Q: 2, 4, 6, 8, 10, 12, 14, 16, 18. Both have a mean of 10. Which set is more spread out? Choose one.

The two sets drawn as dot plots. Set P has range 18 but IQR 0. Set Q has range 16 but IQR 10.

05101520Set PSet Q
Set P: seven of its nine values are 10, with one value at each end. Set Q: nine values spaced evenly from 2 to 18.

Your eyes say that Set Q is more spread out. Its values cover the whole interval. Set P is almost all 10s. But the range says the opposite, because the two lonely values 1 and 19 make Set P's range bigger. We need a measure that looks at where most of the data is, and ignores the extreme ends.

Quartiles: cutting the data into four equal parts

You already know how to cut sorted data into two halves: the median is the middle value. The idea now is to cut each half in half again. This gives four parts, called quarters, with the same number of values in each. The three cutting points are the quartiles.

About a quarter of the values are below , half are below the median, and three quarters are below . The words "quartile" and "quarter" come from the same root, meaning a fourth part.

Here is the method for a list. Sort the values first. Find the median. Then split the list into a lower half and an upper half.

Why leave the median out when is odd? Because the median is the boundary between the halves, not a member of either. If you put it into both halves, the middle value is counted twice. Then the two halves together have one value more than the data, and the quarters are no longer equal.

Look at nine sorted values: 4, 7, 8, 12, 15, 18, 20, 23, 25. The median is the 5th value, 15. The lower half is 4, 7, 8, 12, with median . The upper half is 18, 20, 23, 25, with median .

478121518202325Q₁ = 7.5Q₃ = 21.5median 152 values2 values2 values2 valuesIQR = 21.5 − 7.5 = 14
The quartiles cut the nine sorted values into four quarters of two values each, with the median 15 alone in the middle. The interquartile range is the width of the middle half, from to .

The interquartile range: the width of the middle half

Between and lie the middle half of the values. The width of this middle half is the measure we wanted.

The interquartile range (IQR)

IQR = upper quartile − lower quartile =

The IQR is the width of the middle half of the data.

For the nine values above, the IQR is . The range is . Notice that the IQR is smaller. It always is, or at most equal, because and lie inside the data.

Now return to Sets P and Q. In Set P, the lower half is 1, 10, 10, 10 and the upper half is 10, 10, 10, 19. Both quartiles are 10, so the IQR is . In Set Q, and , so the IQR is 10. The IQR agrees with your eyes.

That is it. That is the whole idea. The IQR throws away the top quarter and the bottom quarter of the data, and measures what is left. An extreme value can sit only in the top or bottom quarter, so it cannot stretch the IQR. Like the median, the IQR is resistant. The range is sensitive, like the mean.

Finally, the batters. Arjun's sorted scores are 44, 44, 45, 45, 45, 46, 46. The median is 45, the lower half is 44, 44, 45 and the upper half is 45, 46, 46. So , and his IQR is 2. Kemar's sorted scores are 0, 0, 3, 45, 88, 89, 90. His lower half is 0, 0, 3 and his upper half is 88, 89, 90. So , and his IQR is 89. Same centre, but the middle half of Kemar's scores is about 45 times as wide as Arjun's.

The most common mistake with quartiles is in the splitting. Find it in the working below.

Spot the error — a student finds the IQR

One line of this working contains the mistake. Tap the line you think is wrong.

A student found the IQR of 2, 4, 5, 8, 10, 13, 15, 16, 21 like this. The mistake is in the third line.

  1. Sorted list (9 values): 2, 4, 5, 8, 10, 13, 15, 16, 21. Correct.
  2. Median = 5th value = 10. Correct.
  3. Lower half: 2, 4, 5, 8, 10. Upper half: 10, 13, 15, 16, 21. Wrong: the median 10 has been put into both halves. The halves should be 2, 4, 5, 8 and 13, 15, 16, 21.
  4. and . These follow from the wrong halves. The correct values are and .
  5. IQR = 15 − 5 = 10. The correct IQR is .

Notice that every line after the mistake was done correctly. The student's arithmetic was fine. The error was in the idea of where the halves end. That is why the reason for leaving out the median matters more than the rule.

One more note. When is even, some courses and calculators use a slightly different rule for the quartiles, and the answers can differ a little. The idea is the same in every rule: and cut off the bottom quarter and the top quarter. Follow the rule your course uses.

Worked examples

Worked Example 1 — An odd number of values

Find the range and the IQR of 4, 7, 8, 12, 15, 18, 20, 23, 25.

The list is already sorted. Range = .

There are 9 values, an odd number. The median is the 5th value, 15. Leave it out of both halves.

Lower half: 4, 7, 8, 12. Its median is , so .

Upper half: 18, 20, 23, 25. Its median is , so .

IQR = .

Check: two values (4 and 7) are below , and two values (23 and 25) are above . Each quarter holds two values, as it should.

Worked Example 2 — An even number of values

Find the range and the IQR of 11, 14, 17, 21, 25, 30, 33, 38.

Range = .

There are 8 values, an even number. The median falls between the 4th and 5th values: . The list splits exactly into two halves of four.

Lower half: 11, 14, 17, 21, so .

Upper half: 25, 30, 33, 38, so .

IQR = .

Check: the IQR (16) is smaller than the range (27), and both quartiles lie between the smallest and largest values.

Worked Example 3 — One bad day

Mei recorded how many minutes her journey to school took on 11 days. These times are invented for this lecture.

12, 35, 15, 18, 14, 20, 16, 13, 17, 19, 14

The 35 was the day the bus broke down. Find the range and the IQR. Then find them again with 21 in place of 35.

Sort first: 12, 13, 14, 14, 15, 16, 17, 18, 19, 20, 35. Range = minutes.

There are 11 values, so the median is the 6th value, 16. Lower half: 12, 13, 14, 14, 15, so . Upper half: 17, 18, 19, 20, 35, so . IQR = minutes.

With 21 in place of 35, the range becomes minutes. But the upper half is now 17, 18, 19, 20, 21, and its middle is still 19. So the IQR is still 5 minutes.

One unusual day changed the range from 9 to 23. It did not change the IQR at all. If Mei wants to describe a normal journey, the IQR is the honest measure. If she wants to know how late she could possibly be, the range answers that question.

Worked Example 4 — Comparing two machines

Two machines fill bags of rice that should hold 500 g. A worker weighs eight bags from each machine. The data are invented for this lecture.

Machine A: 498, 501, 499, 502, 500, 497, 503, 500

Machine B: 500, 493, 507, 499, 501, 510, 492, 500

Which machine is better? Compare the centre and the spread.

Machine A sorted: 497, 498, 499, 500, 500, 501, 502, 503. Median = . , , so the IQR is 3 g.

Machine B sorted: 492, 493, 499, 500, 500, 501, 507, 510. Median = 500. , , so the IQR is 8 g.

Write the comparison in two sentences, one for the centre and one for the spread. Centre: both medians are 500 g, so a typical bag from either machine holds the right amount. Spread: Machine A's IQR (3 g) is smaller than Machine B's (8 g), so Machine A fills its bags more consistently.

So Machine A is better. A customer who buys from Machine B is more likely to get a bag that is noticeably light.

Three traps

Trap 1 — Writing the range as "from … to …"

For Kemar's scores, "the range is 0 to 90" is not the range. The range is one number, the distance between the ends: . The same is true for the IQR. It is the width , not the two quartiles written next to each other.

Trap 2 — Finding quartiles from an unsorted list

The quartiles, like the median, are about order. For 8, 1, 12, 4, 10, 6, 3, the middle of the list as written is 4, which is not the median. Sort first, every time: 1, 3, 4, 6, 8, 10, 12. Then the median is 6, and .

Trap 3 — Confusing spread with size

The values 101, 102, 103 are large, but they are hardly spread at all: the range is 2. The values 1, 50, 99 are smaller, but very spread: the range is 98. Spread measures distances between values, not how big the values are. If you add 100 to every value in a data set, the average goes up by 100, but the range and the IQR do not change.

Try it yourself

Work each one on paper first. Open a hint only when you are stuck.

  1. Find the range and the IQR of 5, 9, 2, 8, 6, 3, 7.

    Hint 1

    Sort the values first. There are 7 values, an odd number.

    Hint 2

    Sorted: 2, 3, 5, 6, 7, 8, 9. The median is 6. Leave it out, and find the middle of 2, 3, 5 and of 7, 8, 9.

    Full answer

    Sorted: 2, 3, 5, 6, 7, 8, 9. Range = .

    Median = 4th value = 6. Lower half 2, 3, 5, so . Upper half 7, 8, 9, so . IQR = .

    Check: one value is below and one value is above , so the quarters are equal. ✓

  2. Ten students timed how long they could hold their breath, in seconds: 31, 24, 28, 35, 22, 40, 27, 30, 26, 33. Find the median, the range and the IQR.

    Hint 1

    There are 10 values, an even number, so the list splits exactly into two halves of five.

    Hint 2

    Sorted: 22, 24, 26, 27, 28, 30, 31, 33, 35, 40. Each half has five values, so each quartile is the 3rd value of its half.

    Full answer

    Sorted: 22, 24, 26, 27, 28, 30, 31, 33, 35, 40.

    Median = seconds. Range = seconds.

    Lower half 22, 24, 26, 27, 28, so . Upper half 30, 31, 33, 35, 40, so . IQR = seconds.

    Check: the IQR (7) is less than the range (18), and the median (29) lies between and . ✓

  3. A data set has smallest value 12 and range 30. Its lower quartile is 18 and its IQR is 15. Find the largest value and the upper quartile. Could the median be 40?

    Hint 1

    Each measure is a subtraction. Turn each one around.

    Hint 2

    largest = smallest + range, and . Then think about where the median must lie.

    Full answer

    Largest value = . Upper quartile = .

    The median cannot be 40. The median is the middle of the data, so it always lies between and . Here it must be between 18 and 33.

    Check: ✓ and ✓.

  4. Write down seven whole numbers that have a range of 10 and an IQR of 0. Then explain why no data set can have an IQR bigger than its range.

    Hint 1

    An IQR of 0 means and are equal. What must the middle values look like?

    Hint 2

    With seven values, is the 2nd value and is the 6th value. Make the 2nd to the 6th values all the same, then place the two ends 10 apart.

    Full answer

    One answer: 0, 5, 5, 5, 5, 5, 10. Range = . The median is 5. Lower half 0, 5, 5 gives . Upper half 5, 5, 10 gives . IQR = 0. (Any list whose 2nd to 6th values are equal, with ends 10 apart, works.)

    The IQR can never be bigger than the range. can never be smaller than the smallest value, and can never be bigger than the largest value. So the distance from to fits inside the distance from the smallest to the largest value.

    Check: the range (10) is at least the IQR (0). ✓

The bigger idea

Here are real data. The table below gives the mean temperature of each month, averaged over the 30 years 1991 to 2020, for Singapore and for New Delhi in India. The values are from the Tokyo Climate Center of the Japan Meteorological Agency.

CityMonthly mean temperatures (°C), January to December
Singapore26.8, 27.3, 27.9, 28.2, 28.6, 28.5, 28.2, 28.1, 28.0, 27.9, 27.2, 26.8
New Delhi13.9, 17.6, 22.9, 29.1, 32.7, 33.3, 31.5, 30.4, 29.6, 26.2, 20.5, 15.6

The two cities have similar averages. The mean of the twelve values is about 27.8 °C for Singapore and about 25.3 °C for New Delhi. But the spreads are very different. Singapore's range is 1.8 °C and its IQR is 0.95 °C. New Delhi's range is 19.4 °C and its IQR is 11.9 °C.

101520253035monthly mean temperature in °CSingaporeNew Delhimiddle half 27.25 to 28.2middle half 19.05 to 30.95
Each dot is one month. The tinted band covers the middle half of the months, from to . Singapore's band is less than 1 °C wide. New Delhi's is almost 12 °C wide.

The average alone would make the two cities sound alike. The spread tells you that one city has almost the same weather all year, while the other has a cool winter and a very hot summer. A traveller packing clothes needs the spread more than the average.

This is true in many fields. A doctor checks whether a patient's blood pressure is steady, not only its average. An engineer checks how much the parts from a machine vary, as in Worked Example 4. In the 1800s, the British scientist Francis Galton suggested a simple method. Rank a group in order, then read off the values a quarter, a half and three quarters of the way along. These are what we now call the quartiles and the median. Later you will draw the quartiles as box plots, which let you compare whole groups at a glance.

Key concepts in this lesson