Median

The middle value of a sorted dataset — resistant to outliers in a way the mean is not.

Finding the median — the middle value of sorted data
Sorted:24579
1234567891024579median = 5mean = 5.4
Definition

The median is the middle value of a dataset when the values are sorted from smallest to largest.

  • Odd number of values: the median is the value exactly in the middle.
  • Even number of values: the median is the average of the two middle values.
Odd count

Dataset: 3, 7, 9, 12, 20 (already sorted)

Five values — the middle one is the 3rd: median = 9

Even count

Dataset: 4, 6, 10, 15

Four values — average the 2nd and 3rd:

median=6+102=8\text{median} = \frac{6 + 10}{2} = 8
Always sort first

The median is only meaningful after sorting. {9,3,12}\{9, 3, 12\} has median 9, not 3.

Try it

Find the median of: 5, 1, 8, 3, 6, 2.

Solution

Sorted: 1, 2, 3, 5, 6, 8. Two middle values: 3 and 5. Median =3+52=4= \frac{3+5}{2} = 4.

Related concepts