Basic level

Mean, median and mode

Three answers to one question: which single number best describes a whole data set. The mean shares the total out evenly, the median stands exactly in the middle, and the mode points at the most frequent value — and which one you pick can change the conclusion.

Before you start

This topic builds on earlier ideas. Before you start, it's worth working through the lessons below — they'll make everything click:

All formulas

  • Arithmetic mean

    xˉ=x1+x2++xnn\bar{x} = \frac{x_1 + x_2 + \dots + x_n}{n}

    the sum of all the data divided by how many there are

  • Total from the mean

    x1+x2++xn=nxˉx_1 + x_2 + \dots + x_n = n \cdot \bar{x}

    this is how a missing value is recovered when the mean is known

  • Median — an odd sample

    Me=x(n+12)(n odd)\mathrm{Me} = x_{\left(\frac{n+1}{2}\right)} \quad (n \ \text{odd})

    once sorted, it is exactly the middle number

  • Median — an even sample

    Me=x(n2)+x(n2+1)2(n even)\mathrm{Me} = \frac{x_{\left(\frac{n}{2}\right)} + x_{\left(\frac{n}{2}+1\right)}}{2} \quad (n \ \text{even})

    the mean of the two middle values

  • Mode

    Mo=the value with the highest frequency\mathrm{Mo} = \text{the value with the highest frequency}

    the number that occurs most often — there may be none at all

  • Weighted mean

    xˉw=w1x1+w2x2++wkxkw1+w2++wk\bar{x}_w = \frac{w_1 x_1 + w_2 x_2 + \dots + w_k x_k}{w_1 + w_2 + \dots + w_k}

    every value counts as many times as its weight says

A data set is usually a long list of numbers, and the question is always the same: in one number — what does it look like? Descriptive statistics gives three answers, and each measures something different. All three are worth knowing, because the gap between them is often the whole point of a problem.

The arithmetic mean

The mean is the sum of all the data divided by how many there are:

xˉ=x1+x2++xnn\bar{x} = \frac{x_1 + x_2 + \dots + x_n}{n}

The symbol xˉ\bar{x} is read "x bar". The idea is one of sharing out: if everyone had the same, everyone would have exactly the mean.

Find the mean of 12, 7, 9, 8, 14.

A second, equally useful formula follows straight from the first — multiply both sides by nn:

x1+x2++xn=nxˉx_1 + x_2 + \dots + x_n = n \cdot \bar{x}

Knowing the mean means knowing the total. That is all it takes to recover a missing number.

The mean of five numbers is 8. Four of them are 6, 9, 10 and 5. What is the fifth?

A frequency diagram

Instead of writing every observation out, you can show how many times each value occurs. Here is the spread of test grades in a class of 24:

012345670246810gradestudents136842x̄ ≈ 3.71grade count
The height of a bar is the number of students with that grade. The vertical guide stands where the mean falls.

The mean of such a diagram is found by multiplying every grade by its frequency:

xˉ=11+23+36+48+54+6224=89243.71\bar{x} = \frac{1 \cdot 1 + 2 \cdot 3 + 3 \cdot 6 + 4 \cdot 8 + 5 \cdot 4 + 6 \cdot 2}{24} = \frac{89}{24} \approx 3.71

That is already a weighted mean, with the frequencies as the weights:

xˉw=w1x1+w2x2++wkxkw1+w2++wk\bar{x}_w = \frac{w_1 x_1 + w_2 x_2 + \dots + w_k x_k}{w_1 + w_2 + \dots + w_k}

The ordinary arithmetic mean is its special case — the one where every weight is the same.

Notice one thing: 3.713.71 is not a real grade at all. A mean need not belong to the data set, and usually does not.

The median

The median is the middle value of the data once it is sorted. The sorting is part of the recipe, not decoration — without it the "middle" number means nothing.

For an odd sample size there is a single middle:

Me=x(n+12)\mathrm{Me} = x_{\left(\frac{n+1}{2}\right)}

For an even one there are two, so we average them:

Me=x(n2)+x(n2+1)2\mathrm{Me} = \frac{x_{\left(\frac{n}{2}\right)} + x_{\left(\frac{n}{2}+1\right)}}{2}
Find the median of 7, 2, 9, 4, 5 and of 10, 3, 6, 8.

The mode

The mode is the value that occurs most often. On a frequency diagram you can see it immediately — it is the tallest bar. In the class drawn above the mode is the grade 44: eight students got it.

The mode is the only one of the three measures that need not exist:

  • when every value occurs once, there is no mode;
  • when two values share the highest frequency, there are two (a bimodal set).

It has one advantage the others lack: it works where the data are not numbers at all. The commonest shoe size or the commonest car colour is a mode, and nobody can average colours.

When the mean misleads

Take a company of seven and their salaries, in thousands:

3, 4, 4, 5, 5, 6, 223,\ 4,\ 4,\ 5,\ 5,\ 6,\ 22
01234567804812162024personthousandsx̄ = 7Me = 5salary
A single extreme value pushes the mean above what six of the seven earn. The median stays where the middle of the data really is.

Both measures:

xˉ=3+4+4+5+5+6+227=497=7,Me=5\bar{x} = \frac{3 + 4 + 4 + 5 + 5 + 6 + 22}{7} = \frac{49}{7} = 7, \qquad \mathrm{Me} = 5

"People here earn 7 thousand on average" is true and misleading at the same time: six out of seven earn less. The reason is simple — the mean uses the size of every number, so one extreme value drags it across. The median sees only order: if the boss earned 220 thousand instead of 22, the median would still be 5.

That is the whole reason salaries, house prices and waiting times are reported as medians rather than means.

Three measures on one drawing

A dot plot shows it best, with one dot per observation. Take the set 2, 3, 3, 4, 132,\ 3,\ 3,\ 4,\ 13:

0246810121401234valuecountMe = 3x̄ = 5data
Four observations sit close together, the fifth far away. The median and the mode stay in the thick of the data; the mean drifts towards the outlier.

For this set:

xˉ=2+3+3+4+135=255=5,Me=3,Mo=3\bar{x} = \frac{2 + 3 + 3 + 4 + 13}{5} = \frac{25}{5} = 5, \qquad \mathrm{Me} = 3, \qquad \mathrm{Mo} = 3

The gap between the mean and the median is information in itself: it says the data is skewed and that an outlier is sitting somewhere in it.

Which measure to use

measurewhat it measureswhen it is good
meanthe "shared out evenly" levelsymmetric data, no extremes
medianthe middle of the sorted datadata with outliers
modethe most frequent valuecategories, non-numeric data

The honest thing is to quote two of them. If the mean and the median are close, the data is reasonably symmetric; if they are far apart, neither one alone describes anything.

Exercises

The five kinds of question match the five things this lesson teaches. A prompt starting with xˉ\bar{x} and a colon asks for the mean of the data that follows. A prompt of the form xˉ=8\bar{x} = 8 with an x inside the data asks for the missing value — use the total nxˉn \cdot \bar{x}. The Median and Mode prompts give the data in random order, so the first step is always to sort it. Every answer is a number; with an even sample the median may end in a half — type it, for instance 6.5.

Practice

Work through a set of exercises — they get harder as you go. At the end you'll see your score and the mistakes worth reviewing.

Exercise 1 of 8Score: 0
x̄: 11, 10, 4, 17, 3

Common mistakes

  • A median without sorting — the middle number of an unsorted list is not the median, just an arbitrary value.
  • Dropping the half — with an even sample the median often ends in .5, and rounding it to something "nicer" is wrong.
  • Dividing by the wrong count — divide by the number of observations, not by the number of distinct values.
  • Taking the mode to be the largest value — the mode is the most frequent one, not the biggest.
  • Confusing the measures — "average" in everyday speech often means the median; a problem asks for whatever it names.
  • Trusting the mean alone — in a set with an outlier the mean describes the data worse than the median does.

Formula card

Topic: Mean, median and mode

  • Arithmetic mean

    xˉ=x1+x2++xnn\bar{x} = \frac{x_1 + x_2 + \dots + x_n}{n}

    the sum of all the data divided by how many there are

  • Total from the mean

    x1+x2++xn=nxˉx_1 + x_2 + \dots + x_n = n \cdot \bar{x}

    this is how a missing value is recovered when the mean is known

  • Median — an odd sample

    Me=x(n+12)(n odd)\mathrm{Me} = x_{\left(\frac{n+1}{2}\right)} \quad (n \ \text{odd})

    once sorted, it is exactly the middle number

  • Median — an even sample

    Me=x(n2)+x(n2+1)2(n even)\mathrm{Me} = \frac{x_{\left(\frac{n}{2}\right)} + x_{\left(\frac{n}{2}+1\right)}}{2} \quad (n \ \text{even})

    the mean of the two middle values

  • Mode

    Mo=the value with the highest frequency\mathrm{Mo} = \text{the value with the highest frequency}

    the number that occurs most often — there may be none at all

  • Weighted mean

    xˉw=w1x1+w2x2++wkxkw1+w2++wk\bar{x}_w = \frac{w_1 x_1 + w_2 x_2 + \dots + w_k x_k}{w_1 + w_2 + \dots + w_k}

    every value counts as many times as its weight says

012345670246810gradestudents136842x̄ ≈ 3.71grade count
A frequency diagram of test grades: the bar above each grade shows how many students got it. The vertical guide stands where the mean falls, x̄ ≈ 3.71 — where no real grade exists at all.
01234567804812162024personthousandsx̄ = 7Me = 5salary
The salaries of seven people, in thousands. The mean (7) sits above what six of the seven earn, because one extreme value pulls it up; the median (5) describes this company more honestly.

Frequently asked questions

Related articles