B Binance · The world's largest crypto exchangeBinance Sign up → AD OKX OKX · A leading global crypto exchangeOKX Sign up → AD
📐 Math Basics · Lesson 8 / 10

Statistics: Mean, Median, and Variance

When you sum up data in a single number, you have to look at both "where the middle is" and "how spread out it is." If you look only at the mean, you miss half the story.

⏱ About 20 min ✍️ 4 practice questions 🔁 Unlimited drills Updated 2026-10-08
🎯 By the end of this lesson you can
  • Find the mean, median, and mode, and say which situations each one suits
  • Calculate deviations, variance, and standard deviation step by step
  • Explain the difference between population variance (dividing by n) and sample variance (dividing by n − 1)
  • Compare how an outlier affects the mean and the median

1.Three Values That Describe the Middle

The mean is the sum of all the values divided by how many there are. It tells you how much each would get if everything were shared out equally. The median is the value in the very middle when the values are lined up in order of size; if there is an even number of values, you use the mean of the two middle values. The mode is the value that appears most often.

The three can differ even for the same data, and you should pick one based on what you want to know. The mode tells a shoe store which size to stock the most of; the median better represents "a typical person's income"; and the mean is right for calculations that divide up a total (such as usage per person).

Mean = (sum of the values) ÷ (number of values)
Median = the middle value after sorting by size (for an even count, the mean of the two middle values)
ExampleFind the mean, median, and mode of the data 2, 4, 4, 4, 5, 5, 7, 9.
  1. Step 1: Mean: the sum is 2 + 4 + 4 + 4 + 5 + 5 + 7 + 9 = 40 and the count is 8, so 40 ÷ 8 = 5.
  2. Step 2: Median: the data are already in order. With 8 values, it is the mean of the 4th and 5th values, 4 and 5: (4 + 5) ÷ 2 = 4.5.
  3. Step 3: Mode: 4 appears the most, 3 times. The mode is 4.
  4. Check: Subtract the mean of 5 from each value to get the deviations −3, −1, −1, −1, 0, 0, 2, 4; they add up to 0. If the deviations sum to 0, the mean is correct.
AnswerMean 5, median 4.5, mode 4

2.The Mean of Means Is Not the Mean: Weighted Averages

When you know the means of two groups and want the overall mean, adding the two means and dividing by 2 is usually wrong. That only works when the two groups have the same number of people. If the sizes differ, the mean of the larger group should have more influence on the overall mean.

The right method is to go back to the definition of the mean. Recover each group's total as "mean × number of people," add them all up, and divide by the total number of people. A mean found this way, by multiplying each value by its weight (number of people, mass, time, and so on), is called a weighted average. A grade point average where courses carry different credits, and an average purchase price where you bought different quantities at different times, are both weighted averages.

Weighted average = (value₁ × weight₁ + value₂ × weight₂ + …) ÷ (weight₁ + weight₂ + …)
ExampleClass A's 20 students have a mean score of 80, and Class B's 30 students have a mean score of 70. What is the mean score of all 50 students in the two classes?
  1. Step 1: Recover each class's total score: Class A 80 × 20 = 1,600 points, Class B 70 × 30 = 2,100 points.
  2. Step 2: Overall total 1,600 + 2,100 = 3,700 points; total students 20 + 30 = 50.
  3. Step 3: Overall mean = 3,700 ÷ 50 = 74 points.
  4. Step 4: A common mistake: (80 + 70) ÷ 2 = 75 points. It misses that the mean is pulled toward Class B (70 points), which has more students.
  5. Check: 74 points lies between the two class means and is closer to the 70 of the larger Class B. 74 × 50 = 3,700, so the total matches too.
Answer74 points

3.Spread: The Same Mean Doesn't Mean the Same Data

Here are test scores from two classes. Class A's five students scored 70, 70, 70, 70, 70, and Class B's five students scored 50, 60, 70, 80, 90. Both classes have a mean of 70, but they are completely different classes. In Class A everyone is similar, while Class B has big differences in ability. Variance and standard deviation put this difference into numbers.

Here is how. Find how far each value is from the mean (its deviation). Simply adding the deviations always gives 0, so you square them to make them all positive. The mean of the squared deviations is the variance. Variance is in squared units (points²), which makes it hard to interpret, so you take its square root to return to the original units: that is the standard deviation.

In this lesson, we treat all the data we have as a single population and use the population variance, dividing by n. Class B's deviations are −20, −10, 0, 10, 20; squared, they are 400, 100, 0, 100, 400, which sum to 1,000. 1,000 ÷ 5 = 200 is the variance, and √200 ≈ 14.1 points is the standard deviation. In Class A, all deviations are 0, so both the variance and the standard deviation are 0.

Deviation = value − mean
Population variance = (sum of squared deviations) ÷ n
Standard deviation = √variance

4.Calculating Variance and Standard Deviation by Hand

Let's work through the earlier data 2, 4, 4, 4, 5, 5, 7, 9 from start to finish. Making a table and filling in the cells one by one greatly reduces mistakes.

  • Population variance (divide by n): when the data you have is the entire group you care about. In this example, 4.
  • Sample variance (divide by n − 1): when you estimate the variance of a whole group from a sample drawn from it. In this example, 32 ÷ 7 ≈ 4.57, with a standard deviation ≈ 2.14.
  • When you calculate from a sample, the mean also comes from the sample, so the spread tends to come out a little smaller than it really is; dividing by n − 1 corrects for this.
  • Check first which one Excel, your calculator, or an AI is using. The same data can give different values.
Data 2, 4, 4, 4, 5, 5, 7, 9 (mean 5)
ValueDeviation (value − 5)Deviation²
2−39
4−11
4−11
4−11
500
500
724
9416
Sum032
ExampleFind the population variance and standard deviation of the data above (divide by n).
  1. Step 1: Find the mean, 5 (previous section).
  2. Step 2: Sum of squared deviations: 9 + 1 + 1 + 1 + 0 + 0 + 4 + 16 = 32.
  3. Step 3: Population variance = 32 ÷ 8 = 4.
  4. Step 4: Standard deviation = √4 = 2.
  5. Check: Confirm that the deviations sum to 0: −3 − 1 − 1 − 1 + 0 + 0 + 2 + 4. The sum is 0, so the mean and deviations are correct.
AnswerVariance 4, standard deviation 2
If the data are close to bell-shaped (a normal distribution), roughly 68% of the values fall within the mean ± 1 standard deviation, and about 95% within ± 2 standard deviations. If the shape is not a bell, this rule of thumb doesn't hold.

5.Outliers: One Person Who Shakes the Mean

A value far away from the rest is called an outlier. Because the mean adds up every value, a single outlier pulls it a long way, while the median looks only at order and barely moves. That's why, for data with a few very large values mixed in, such as incomes or house prices, the median represents "typical" better than the mean.

Deleting outliers automatically isn't the answer either. If one is a data entry error, it should be fixed, but if it is a value that really occurred, it may be important information in itself. Look at the mean and median together, and if they differ a lot, take that as a sign of an outlier or a lopsided distribution.

ExampleExample: 5 employees have annual salaries of 3,000, 3,200, 3,500, 3,800, and 4,000 (in units of $10,000). If 1 more person with a salary of 30,000 (same units) joins them, how do the mean and median change?
  1. Step 1: The first 5 people: sum 17,500, mean 17,500 ÷ 5 = 3,500. The median is the 3rd value, 3,500.
  2. Step 2: 6 people: sum 17,500 + 30,000 = 47,500, mean 47,500 ÷ 6 ≈ 7,917.
  3. Step 3: The median of 6 people: in the sorted list 3,000, 3,200, 3,500, 3,800, 4,000, 30,000, it is the mean of the 3rd and 4th values: (3,500 + 3,800) ÷ 2 = 3,650.
  4. Check: Of the 6 people, only 1 earns more than the mean of 7,917. This means the mean is failing to represent "a typical person."
AnswerThe mean jumps more than twofold, from 3,500 to about 7,917, while the median changes only a little, from 3,500 to 3,650

📌 Key points

  • The mean divides up the total, the median is the middle in order, and the mode is the most common value
  • Data with the same mean can have different spreads; variance and standard deviation measure spread
  • Variance = the mean of the squared deviations; standard deviation = √variance (back in the original units)
  • Population variance divides by n and sample variance by n − 1; say which one you use and use it consistently
  • An outlier shakes the mean a lot but barely moves the median

✍️ Practice questions

Answer first, then open "Answer and explanation".

Q1. Which correctly pairs the median and mean of the data 1, 3, 8, 9, 20?

⭕ Correct

❌ Not quite — see the explanation

Answer and explanation
Answer ① Median 8, mean 8.2

The middle (3rd) value in order is 8. The mean is (1 + 3 + 8 + 9 + 20) ÷ 5 = 41 ÷ 5 = 8.2.

Q2. Find the population variance (dividing by n) of the data 1, 3, 5.

Answer and explanation
Answer 8/3 (about 2.67)

The mean is 3, the deviations are −2, 0, 2, and the squared deviations are 4, 0, 4, summing to 8. 8 ÷ 3 = 8/3 ≈ 2.67, and the standard deviation is √(8/3) ≈ 1.63. The sample variance would be 8 ÷ 2 = 4.

Q3. House price data for a neighborhood includes a few very expensive houses. Which value better represents the "typical house price"?

⭕ Correct

❌ Not quite — see the explanation

Answer and explanation
Answer ② Median

The mean gets pulled up by a few very large values, but the median is the middle in order, so it is barely affected.

Q4. Every student's score was raised by 10 points. What happens to the mean and the standard deviation?

⭕ Correct

❌ Not quite — see the explanation

Answer and explanation
Answer ② The mean goes up by 10 and the standard deviation stays the same

If everyone goes up by the same 10 points, the middle goes up by 10, but how far apart the scores are (the deviations) does not change. So the variance and standard deviation stay the same.

🔁 Unlimited practice

Problems are generated endlessly. Type your answer and press "Check" to have it graded right away, or press "Show solution" to see a step-by-step solution in the same order as the lesson. You can choose the difficulty, and your streak of correct answers is counted.

  • Easy: mean and median
  • Medium: mean, median, and population variance
  • Hard: median, population variance, and standard deviation

These drills are generated in your browser with JavaScript, which is not running right now. Use the examples and practice questions above, then reopen this page with JavaScript turned on.

🤖 Try asking AI like this

Copy a prompt and replace the [ ] parts with your own situation. Don't take the answer on trust — check it against this lesson.

When you want to check a statistics calculation

Find the mean, median, mode, variance, and standard deviation of the data [numbers]. Show it step by step in a table with columns for value, deviation, and deviation², calculate both the population variance (dividing by n) and the sample variance (dividing by n − 1), and label which is which. Also check that the deviations sum to 0.

When you're unsure which average to use

My data is [description of data]. Explain whether the mean or the median is the better summary value to report, along with criteria for judging whether there are outliers. Also tell me if this is a case where I should report both.
References
  • Standard middle and high school math textbook content (measures of center and spread)
  • Standard explanations in introductory statistics textbooks (population variance and sample variance)

Reached every goal above? Mark the lesson complete.

📐 Math Basics

  1. 1Numbers and Operations: Fractions and Decimals Revisited
  2. 2Ratios and Rates: Reading Percentages Correctly
  3. 3Equations: A Balance for Finding Unknown Numbers
  4. 4Functions and Graphs: An Eye for Change
  5. 5Exponents and Logarithms: A World That Grows by Multiplying
  6. 6Geometry Basics: Area and Pythagoras
  7. 7Probability: Putting Numbers on Uncertainty
  8. 8Statistics: Mean, Median, and Variance
  9. 9Reading Data: The Traps in Graphs
  10. 10The Math for Understanding AI
📚 Worth reading
🧠What Generative AI Does and Where It Fails→ ✍️How to Write a Good Prompt→ 🔍Checking AI Answers→ 📚Using AI for Study and Work Without Plagiarism→
← Foundations for the AI Era