Median of a Set of Numbers — Definition, Formula & Examples
Median of a Set of Numbers
The median of a set of numbers is the value for which half the numbers are larger and half are smaller. If there are two middle numbers, the median is the arithmetic mean of the two middle numbers.
Note: The median is a good choice to represent the center of a distribution when the distribution is skewed or has outliers.

See also
Key Formula
Median=⎩⎨⎧x2n+12x2n+x2n+1if n is oddif n is even
Where:
- n = The total number of values in the data set
- xi = The value at position i after the data set is sorted in ascending order
Worked Example
Problem: Find the median of the set: 12, 3, 7, 9, 15, 20, 5.
Step 1: Count the number of values in the set.
n=7
Step 2: Arrange the values in ascending order.
3,5,7,9,12,15,20
Step 3: Since n is odd, the median is at position (n + 1) / 2.
Position=27+1=4
Step 4: Identify the value at the 4th position in the sorted list.
Median=9
Answer: The median is 9.
Another Example
This example has an even number of values, so the median requires averaging the two middle numbers — unlike the first example where the set size was odd and had a single middle value.
Problem: Find the median of the set: 42, 18, 35, 27, 50, 10.
Step 1: Count the number of values in the set.
n=6
Step 2: Sort the values from least to greatest.
10,18,27,35,42,50
Step 3: Since n is even, identify the two middle positions: n/2 and n/2 + 1.
Positions=26=3and26+1=4
Step 4: The 3rd value is 27 and the 4th value is 35. Average these two values.
Median=227+35=262=31
Answer: The median is 31.
Frequently Asked Questions
What is the difference between the mean and the median?
The mean is the sum of all values divided by how many values there are, while the median is the middle value after sorting. The mean is sensitive to extreme values (outliers), but the median is not. For example, in the set {1, 2, 3, 4, 100}, the mean is 22 while the median is 3, showing how a single outlier can pull the mean far from the center.
When should you use the median instead of the mean?
Use the median when your data is skewed or contains outliers. For instance, median household income is reported more often than mean household income because a few extremely high earners would inflate the mean and misrepresent what a typical household earns. The median gives a better sense of the 'typical' value in these cases.
Can the median be a number that is not in the original data set?
Yes. When a data set has an even number of values, the median is the average of the two middle numbers, which may not appear in the original set. In the set {10, 20, 30, 40}, the median is 25, even though 25 is not one of the original values.
Median vs. Mean (Arithmetic Mean)
| Median | Mean (Arithmetic Mean) | |
|---|---|---|
| Definition | The middle value of a sorted data set | The sum of all values divided by the count of values |
| Formula | Middle value (odd n) or average of two middle values (even n) | Sum of all values ÷ n |
| Effect of outliers | Resistant — not pulled by extreme values | Sensitive — heavily affected by extreme values |
| When to use | Skewed distributions, data with outliers | Symmetric distributions without extreme outliers |
| Example: {1, 2, 3, 4, 100} | 3 | 22 |
Why It Matters
You encounter the median in statistics courses, standardized tests, and real-world reporting — news articles frequently cite median home prices and median salaries precisely because these measures resist distortion from outliers. Understanding the median also lays the groundwork for more advanced topics like quartiles, percentiles, and box-and-whisker plots, all of which depend on ordering data and locating positional values.
Common Mistakes
Mistake: Forgetting to sort the data before finding the middle value.
Correction: You must arrange the numbers in ascending (or descending) order first. Without sorting, the value you pick from the middle of the list is just the middle entry as originally written, not the true median.
Mistake: Picking one of the two middle numbers instead of averaging them when n is even.
Correction: When the data set has an even number of values, neither middle number alone is the median. You must add the two middle values and divide by 2 to get the correct median.
Related Terms
- Arithmetic Mean — Another measure of center; sum divided by count
- Mean — General term for average, often compared to median
- Mode — The most frequently occurring value in a set
- Outlier — Extreme value that affects the mean but not the median
- Median of a Triangle — A geometry concept — segment from vertex to midpoint
- Median of a Trapezoid — Segment connecting midpoints of the non-parallel sides
