Median of data

Ask a class of 25 students for their test marks and one careless answer — a stray 2 or a genius 98 — can drag the average mark far from what "most" students actually scored. The median dodges this problem entirely: line every value up in order and simply point to the one sitting in the middle. It ignores how big or small the extreme values are and cares only about their position, which is exactly why it survives outliers that would distort the mean. This chapter, "Tales by Dots and Lines," treats the median as a recap-and-extend of the middle-value idea students already met, now paired deliberately with the mean so the two can be computed side by side and compared. The real skill being tested is not just finding the median but knowing when it, rather than the mean, is the more honest way to describe a data set.

The core insight

The median is the middle value of data arranged in order — the value at position n+12\frac{n+1}{2} for odd nn, or the mean of the two middle values for even nn — and because it depends only on position, not magnitude, it stays close to "typical" even when a few values are extreme outliers.

The core idea

Step 0 — sort first, always. The median only makes sense once the data is arranged in ascending (or descending) order. Picking the value in the middle position of an unsorted list is meaningless — sorting is not optional, it is the first and unavoidable step.

Odd number of observations. If there are nn observations and nn is odd, there is a single value exactly in the middle of the ordered list, at position n+12\frac{n+1}{2} counting from either end.

Median=value at position n+12(n odd)\text{Median} = \text{value at position } \dfrac{n+1}{2} \qquad (n \text{ odd})

where: nn is the total number of observations after sorting, and the position is counted starting from 1 at either end of the ordered list.

Even number of observations. If nn is even, there is no single middle value — there are two values tied for the centre, at positions n2\frac{n}{2} and n2+1\frac{n}{2}+1. The median is defined as their average.

Median=(value at position n2)+(value at position n2+1)2(n even)\text{Median} = \dfrac{\left(\text{value at position }\tfrac{n}{2}\right) + \left(\text{value at position }\tfrac{n}{2}+1\right)}{2} \qquad (n \text{ even})

where: the two "middle positions" are always n2\frac{n}{2} and the very next one, n2+1\frac{n}{2}+1; the median itself need not be a value that actually occurs in the data.

Why outliers barely move it. The median formula only ever looks at where a value sits after sorting, never at how big it is. Stretch the largest value in a data set from 21 to 2100 — the median does not budge, because that value is still simply "the last one" in the order. The mean, by contrast, is a sum divided by count, so every unit added to any single value shifts the mean directly. This single structural difference is why the median is called a resistant (or robust) measure of central tendency, while the mean is not.

Figure
A number line showing five ordered marks with the middle value highlighted as the median
Sorted marks: the middle value is the median 9 12 15 median 18 21 Two values on each side; the third value in the ordered list is the median

Median vs mean, side by side. When data is fairly evenly spread with no extreme values, the mean and median usually land close together — one is not obviously "better" than the other. Once a data set has one or two values much larger or smaller than the rest, the mean is pulled toward those extremes while the median stays near where most of the data actually sits, making it the more representative "typical" value. This is the comparison the chapter wants you to make explicitly for every data set, not just calculate both numbers mechanically.

Where this shows up outside the textbook. Reports on "typical" income, house prices or city rents almost always quote the median rather than the mean, precisely because a handful of very high earners or very expensive properties would otherwise inflate the mean far above what most people actually experience. Recognising this pattern — a data set with a long tail of unusually large values, and a headline number that quotes the median — is a direct real-world echo of the salary example worked through below.

Derivation ALocating the median position for any n

The goal, spelled out precisely, is this: given only the count nn of observations in a sorted data set (never mind what the actual values are), determine the exact rule that tells you which position, or which pair of positions, holds the median, and why the odd and even cases genuinely need different rules rather than one formula covering both.

Step 1. Picture the ordered list as nn dots in a row, numbered by position 1,2,3,…,n1, 2, 3, \dots, n from left to right. "The middle" means the position with an equal number of dots on either side of it.

Step 2. Suppose nn is odd. Then n−1n-1 is even, so it splits perfectly into two equal halves of n−12\frac{n-1}{2} dots each, with exactly one dot left over sitting between them. That leftover dot is at position n−12+1=n+12\frac{n-1}{2}+1 = \frac{n+1}{2}, which is why the odd-case formula is n+12\frac{n+1}{2}, not n2\frac{n}{2}.

Step 3. Now suppose nn is even. Splitting nn dots into two equal halves gives n2\frac{n}{2} dots on each side, with no single dot left over — the split falls exactly between two dots, at positions n2\frac{n}{2} and n2+1\frac{n}{2}+1. Neither position alone is "more middle" than the other, so the median is defined as their average, giving equal weight to both.

Step 4. Check the boundary cases. For n=5n=5 (odd), n+12=3\frac{n+1}{2}=3: two values below position 3, two above — correct. For n=6n=6 (even), the middle positions are 62=3\frac{6}{2}=3 and 62+1=4\frac{6}{2}+1=4: two values below position 3, two above position 4, and the two middle ones shared equally — correct. The rule is fully verified for both parities by this counting argument, with no need to test every possible nn separately.

Worked example

Six employees at a small company earn these monthly salaries, in rupees thousand: 25, 28, 30, 32, 35, 200 — the last figure being the owner's much larger salary. Find the median and compare it with the mean.

Step 1. Arrange in ascending order. The list is already sorted: 25, 28, 30, 32, 35, 200.

Step 2. Count the observations. n=6n = 6, which is even, so there are two middle positions: n2=3\frac{n}{2}=3 and n2+1=4\frac{n}{2}+1=4.

Step 3. Identify the two middle values. The 3rd value in the ordered list is 30; the 4th is 32.

Step 4. Average the two middle values.

Median=30+322=31\text{Median} = \dfrac{30+32}{2} = 31

Step 5. Compute the mean for comparison.

Mean=25+28+30+32+35+2006=3506≈58.3\text{Mean} = \dfrac{25+28+30+32+35+200}{6} = \dfrac{350}{6} \approx 58.3

Step 6. Interpret both numbers together. The median is ₹31,000, which sits comfortably among the five ordinary salaries (25 to 35). The mean, ₹58,300, is dragged far above what almost every employee actually earns, purely because the owner's salary of 200 is so much larger than the rest. Here the median is clearly the more honest description of a "typical" employee's pay — exactly the situation the chapter wants you to recognise and explain, not just compute.

Common traps

  • Forgetting to sort first. The position rules only apply to data already arranged in order; picking "the middle number" from an unsorted list gives a meaningless answer.
  • Mixing up the odd and even rules. Always check whether nn is odd or even before applying a formula — using the odd-case single position when nn is even (or vice versa) is the single most common slip.
  • Miscounting the middle position. For odd nn, the position is n+12\frac{n+1}{2}, not n2\frac{n}{2}; for n=5n=5, that is position 3, not 2 or 2.5.
  • Treating mean and median as interchangeable. They usually differ once a data set has outliers — a complete answer says which one better represents "typical" data for that specific situation, not just states both numbers.

Ask the tutor: want a few more median problems, especially ones mixing even and odd counts or hidden outliers?

Why can the median be a number that never actually appears in the data

This happens whenever nn is even, because the median is defined as the average of the two middle values, not either value itself. In the salary example, the sorted list has 30 and 32 as its two middle values, and their average, 31, is the median even though no employee earns exactly ₹31,000. This is completely normal and expected for even-sized data sets — the median is a calculated "midpoint," not necessarily a value drawn from the list.

If the mean and median of a data set are very close to each other, what does that tell me

It's a strong hint that the data is fairly evenly spread, without any values that are dramatically larger or smaller than the rest. When there are no strong outliers pulling the mean away from the bulk of the data, the two measures naturally land near each other, as in the marks example where both worked out to 15. A big gap between mean and median, on the other hand, is a signal to look for outliers.

Is the median always "better" than the mean for describing data

Not always — each has its place. The median is preferred when a data set has outliers or is skewed, because it isn't distorted by extreme values, as with the salary example. But the mean uses every value in the data set and is often more useful when you need a number that reflects the total (for example, total marks divided among students), or when the data has no significant outliers. The chapter's point is to compute both and choose whichever one honestly represents the situation, rather than always defaulting to one.

Before this

Where this leads