The median is the middle value of a dataset when sorted in ascending order. For an odd-count set, it is the single center element; for an even-count set, it is the average of the two center elements. Unlike the mean, the median is resistant to outliers, making it preferred for skewed distributions such as income or housing prices. Enter numbers separated by commas, spaces, or line breaks.
Median vs. Mean: When to Use Which
- Mean (average) sums all values and divides by count. It is sensitive to outliers: adding a single $10 million salary to a group of $50k salaries drastically raises the mean.
- Median takes the middle value after sorting. That $10 million outlier shifts the median by at most one position, leaving it nearly unchanged.
- Use the mean when data is roughly symmetric (exam scores, temperature readings). Use the median when data is skewed or contains outliers (income, housing prices, response times).
How Quartiles Divide the Data
Quartiles split a sorted dataset into four equal parts. Q1 (the 25th percentile) is the median of the lower half, Q3 (the 75th percentile) is the median of the upper half, and Q2 is the overall median. The interquartile range (IQR = Q3 - Q1) measures the spread of the central 50% of values and is used in box plots and outlier detection (values beyond 1.5 x IQR from Q1 or Q3 are often flagged).
Finding the Median Step by Step
- Sort all values from smallest to largest.
- If the count is odd, the median is the value at position (n+1)/2. Example: in {3, 7, 9}, the median is 7.
- If the count is even, the median is the average of the values at positions n/2 and n/2+1. Example: in {3, 7, 9, 15}, the median is (7+9)/2 = 8.
- This calculator performs the sort and selection automatically for any input size.
FAQ
Q: How do you find the median of an even number of values?
A: Sort the values, then average the two middle ones. For example, the set {2, 5, 8, 12} has middle values 5 and 8, so the median is (5 + 8) / 2 = 6.5.
Q: What is the difference between Q1 and the median?
A: Q1 (first quartile) is the median of the lower half of the data and marks the 25th percentile. The overall median is Q2 and marks the 50th percentile. Q1 tells you the value below which 25% of the data falls.
Q: When is the median a better summary than the mean?
A: Whenever the dataset is skewed or contains outliers. Median household income, for instance, better represents a typical household than mean income, which is pulled upward by a small number of very high earners.