Mean, median and mode calculator
Paste your numbers, or values and frequencies from a table. You get every average and measure of spread, how each was found, and a box plot.
- n
- 9
- Mean
- 14.8
- Median
- 15.0
- Mode
- 15
- Range
- 9.00
- Q1
- 12.5
- Q3
- 16.5
- IQR
- 4.00
Show the working
n = 9, Σx = 133, Σx² = 2030
Mean x̄ = Σx ÷ n = 133 ÷ 9 = 14.8
Median: put the 9 values in order; the median is value number (9 + 1) ÷ 2 = 5: 15.0.
Mode: 15 (3 times).
Range = 20 − 11 = 9.00
Quartiles: Q1 = 12.5 and Q3 = 16.5 (the medians of the lower and upper halves, leaving out the median), so IQR = 16.5 − 12.5 = 4.00.
Textbooks use slightly different rules for quartiles; this is the one graphic calculators use. For a large data set or a cumulative frequency graph, the exam may use (n + 1)/4 or n/4: follow your course.
Answers are rounded to 3 significant figures, which is what IB papers ask for unless a question says otherwise.
How to do it by hand
- Mean: add the values and divide by how many there are. From a frequency table, Σfx ÷ Σf.
- Median: put the values in order and take the middle one, the ((n + 1) ÷ 2)th value; with an even number of values, take halfway between the middle two.
- Mode: the value that appears most often. Range: largest minus smallest.
- Quartiles: the medians of the lower and upper halves; the interquartile range is Q₃ − Q₁.
Worked example
A survey asks 25 students how many books they read last month. 0 books: 4 students, 1 book: 7, 2 books: 8, 3 books: 4, 4 books: 2. Find the mean, median and mode.
Solution
n = 25, Σx = 43.0, Σx² = 107
With a frequency table, Σx means Σfx (each value times its frequency) and n = Σf.
Mean x̄ = Σx ÷ n = 43.0 ÷ 25 = 1.72
Median: put the 25 values in order; the median is value number (25 + 1) ÷ 2 = 13: 2.00.
Mode: 2 (8 times).
Range = 4 − 0 = 4.00
Quartiles: Q1 = 1.00 and Q3 = 2.50 (the medians of the lower and upper halves, leaving out the median), so IQR = 2.50 − 1.00 = 1.50.
Textbooks use slightly different rules for quartiles; this is the one graphic calculators use. For a large data set or a cumulative frequency graph, the exam may use (n + 1)/4 or n/4: follow your course.
Answer: Mean 1.72, median 2.00, mode 2
Every number in this example is worked out by the same code as the tool above, and the code is tested against independent results from Python's SciPy library.
Where you need it
| AA SL | Mean, standard deviation, quartiles and outliers from a list or frequency table. |
|---|---|
| AA HL | As SL. |
| AI SL | As AA SL. |
| AI HL | As SL. |
On your calculator
In the exam you use your own calculator, so practise it too. Our guides give the exact keystrokes for the Casio fx-CG50, TI-Nspire CX II and TI-84 Plus CE, with a worked example to check against:
Common mistakes
- Finding the median of the frequencies instead of the values. Count through the frequencies to find where the middle value falls.
- Dividing Σfx by the number of rows instead of the total frequency Σf.
- Giving the mode as the highest frequency (8) rather than the value with that frequency (2 books).
- Forgetting to put the values in order before finding the median or quartiles.
Notes and practice
Questions students ask
Which average should I use?
The mean uses every value but is pulled by extreme values; the median is not affected by them; the mode is the only average for non-numerical data. Say why you chose one when a question asks.
Can a data set have more than one mode?
Yes. If two values are equally the most common, both are modes (bimodal). If every value appears once, there is no mode.
Why do different calculators give different quartiles?
There are several conventions. This tool uses the one graphic calculators use (the medians of the two halves, leaving out the median when n is odd). For a large data set or a cumulative frequency graph, use the method your course teaches.