The median is the middle value of a data set , the value that splits the data into two halves of equal size. For an ungrouped data of n values arranged in increasing order, the median is the ((n+1)/2)th value (if n is odd) or the average of the (n/2)th and (n/2+1)th values (if n is even).
For grouped data, the calculation is more involved. We can't pinpoint a single middle value because each class contains many observations. Instead, we find the median class , the class that contains the (n/2)th observation , and use a formula to estimate where within that class the median lies.
Step 1: Cumulative frequency
Compute the cumulative frequency table. This tells you how many observations fall up to and including each class.
For example:
| Class | f | cf |
|---|
| 0−10 | 4 | 4 |
| 10−20 | 6 | 10 |
| 20−30 | 10 | 20 |
| 30−40 | 5 | 25 |
| 40−50 | 3 | 28 |
Here n=28 and n/2=14.
The median class is the class whose cumulative frequency is the first to be ≥n/2.
For the example, n/2=14. The cumulative frequencies are 4,10,20,… , the first to reach or exceed 14 is 20, which is in the class 20−30. So the median class is 20−30.
Median=L+f(n/2)−F×h,
where:
- L = lower limit of the median class.
- n = total frequency.
- F = cumulative frequency before the median class.
- f = frequency of the median class.
- h = class size.
For the example: L=20,n/2=14,F=10 (cf of class 10−20), f=10,h=10.
Median=20+1014−10×10=20+4=24.
The median is the value at which exactly n/2 observations lie below. The cumulative frequency before the median class accounts for F observations; we need n/2−F more to reach the median position. Within the median class, these n/2−F observations are spread across the class of size h, evenly. So we move ((n/2−F)/f) of the way through the class, starting from its lower limit.
Worked examples
Example 1. Find the median: classes 0−10,10−20,20−30,30−40,40−50 with frequencies 7,10,16,8,9.
cf: 7,17,33,41,50. n=50,n/2=25. First cf≥25 is 33, in class 20−30.
L=20,F=17,f=16,h=10.
Median=20+1625−17×10=20+5=25.
Example 2. Marks of 40 students:
| Marks | 0−10 | 10−20 | 20−30 | 30−40 | 40−50 |
|---|
| f | 5 | 8 | 14 | 7 | 6 |
Find the median.
cf: 5,13,27,34,40. n/2=20. First cf≥20 is 27, in class 20−30. L=20,F=13,f=14,h=10.
Median=20+1420−13×10=20+5=25.
Example 3. Class size 5, classes start at 0. Frequencies: 3,6,9,7,5. Find the median.
Classes: 0−5,5−10,10−15,15−20,20−25. cf: 3,9,18,25,30. n/2=15. First cf≥15: 18. Median class: 10−15. L=10,F=9,f=9,h=5.
Median=10+915−9×5=10+10/3≈13.33.
Example 4. The median of a data with classes 0−10,10−20,20−30,30−40 and frequencies f1,15,25,10 is 24. Find f1 given n=60.
cf: f1,f1+15,f1+40,f1+50=60⇒f1=10.
n/2=30. cf: 10,25,50,60. First ≥30: 50 (in class 20−30). L=20,F=25,f=25,h=10. Median =20+(30−25)/25×10=20+2=22.
But the given median is 24, not 22. So f1=10 doesn't match. Let me re-verify (the question's setup may be designed to yield f1 matching 24): 24=20+(30−(f1+15))/25×10⇒4=(15−f1)/2.5⇒15−f1=10⇒f1=5.
So f1=5, with total =5+15+25+10=55=60. The problem is over-constrained. (This is the kind of detail to be careful with on board exams.)
Example 5. A more-than table gives cumulative frequency: more than 0: 50; more than 10: 46; more than 20: 35; more than 30: 20; more than 40: 5; more than 50: 0. Find the median.
Class frequencies: 50−46=4 (class 0−10), 46−35=11 (10−20), 35−20=15 (20−30), 20−5=15 (30−40), 5 (40−50). Total 50.
cf (less-than form): 4,15,30,45,50. n/2=25. First ≥25: 30, in class 20−30. L=20,F=15,f=15,h=10.
Median=20+1525−15×10=20+20/3=26.67.
Try it yourself
- Find the median: classes 0−10,10−20,20−30,30−40 with frequencies 4,9,7,5.
- Find the median: classes 5−15,15−25,25−35,35−45,45−55 with frequencies 5,7,11,6,4.
- Find the median height (cm): classes 140−150,150−160,160−170,170−180 and frequencies 10,25,15,5.
- The mean of a data is 25 and the mode is 20. Find the median (use empirical relation).
- A data set has total frequency 40 and the median falls in the class 20−30 with L=20,F=15,f=12,h=10. Find the median.
- A frequency table has class size 5 starting at 5. Frequencies 3,6,8,7,4,2. Find the median.
- A less-than table: <10:5,<20:15,<30:30,<40:45,<50:50. Find the median.
- The median of a data set with classes 0−10,10−20,20−30,30−40 is 25. Total frequency is 50 and the median class has frequency 20. The cf before the median class is f0. Find f0.
- Find the median: data given as cumulative frequencies <5:2,<10:6,<15:12,<20:18,<25:22.
- Compare mean, median, and mode for the data: 10,12,15,17,20,22,25,28,30,32.
- The mean is 50 and median is 48. Find the mode (empirical).
- A frequency distribution has classes 0−10,10−20,20−30,30−40 with cumulative frequencies 5,15,30,40. Find the median.
Pitfalls / Insight
(1) Always use the less-than cumulative frequency. If the problem gives a more-than table, first convert it.
(2) The median class is the first class whose cumulative frequency ≥n/2. Not the last class with cf≤n/2 , that would be the previous class.
(3) The class size h must be uniform for the formula to be straightforward. If not, you need to convert to uniform classes.
(4) The median is robust to outliers; the mean is not. If the data has a long tail (skew), the median is often the more "typical" value.
(5) For perfectly symmetric data, mean = median = mode. For right-skewed, mean > median > mode. For left-skewed, mean < median < mode.