Sub topic 5
The arithmetic mean and the sum-of-values view
This chapter covers the arithmetic mean and the habit of converting every average statement into a statement about a total. It assumes you are comfortable with fractions, basic algebra and simplifying arithmetic. Later chapters on weighted averages, changes in an average and the assumed-mean shortcut all build on the idea introduced here.
What the mean is
The arithmetic mean (usually just "average") of n numbers is their sum divided by n.
values = [12, 18, 25, 9, 16]
mean = sum(values) / len(values)
print(mean) # 16.0The formula has three parts: the average A, the count n and the sum S. They are linked by one equation:
S = A × n
Any two of them give you the third. Most CAT average questions are this equation in disguise, so the first step is nearly always to ask: what is the total?
| You know | You want | Use |
|---|---|---|
| Sum and count | Average | A = S / n |
| Average and count | Sum | S = A × n |
| Sum and average | Count | n = S / A |
The sum-of-values view
An average hides the individual values, but the total survives. Two groups with the same average and the same size have the same total, even when their members differ.
Suppose the average of 6 numbers is 15. You cannot recover the numbers, but you know their sum is 90. If one number is later found to be 12 instead of 21, the sum drops by 9 to 81, and the new average is 81 / 6 = 13.5.
The method for any average problem has three steps:
- Convert each average into a sum using S = A × n.
- Do the addition or subtraction on the sums.
- Convert back to an average if the question asks for one.
Working with sums keeps the arithmetic additive. Averages themselves do not add or subtract directly, which is the source of most errors in this topic.
Worked example: combining groups
The average age of 8 men is 30 and the average age of 12 women is 25. Find the average age of all 20 people.
- Men's total: 8 × 30 = 240
- Women's total: 12 × 25 = 300
- Combined total: 540
- Combined average: 540 / 20 = 27
men_n, men_avg = 8, 30
women_n, women_avg = 12, 25
total = men_n * men_avg + women_n * women_avg
count = men_n + women_n
print(total / count) # 27.0The answer, 27, lies closer to 25 than to 30 because the larger group has more influence. That observation is a useful sanity check, and it becomes the core of the weighted-average chapter.
Finding a missing value
A common pattern gives the average of several items and asks for one more item needed to reach a target.
The average of a student's marks in 4 tests is 72. What mark in the fifth test raises the average to 75?
- Required total for 5 tests: 75 × 5 = 375
- Current total: 72 × 4 = 288
- Mark needed: 375 − 288 = 87
needed = 75 * 5 - 72 * 4
print(needed) # 87The same structure answers questions such as "what is the age of the teacher if including the teacher raises the average by 2?". You always compute the total after, subtract the total before, and read off the difference.
Averages of regular sequences
Some sequences let you skip the addition entirely. The mean of an evenly spaced list is the middle value, which equals the average of the first and last terms.
- Consecutive integers 1 to n: the mean is (n + 1) / 2, so the sum is n(n + 1) / 2.
- Any arithmetic progression: mean = (first + last) / 2.
- First n odd numbers: the mean is n, so the sum is n².
- First n even numbers: the mean is n + 1, so the sum is n(n + 1).
For example, the average of the multiples of 7 from 14 to 98 is (14 + 98) / 2 = 56. There are (98 − 14) / 7 + 1 = 13 terms, so their sum is 56 × 13 = 728.
terms = list(range(14, 99, 7))
print(len(terms), sum(terms), sum(terms) / len(terms)) # 13 728 56.0Mean versus median and mode
CAT questions occasionally ask about the median or the mode, so keep the three apart.
- The mean is the sum divided by the count. Every value affects it.
- The median is the middle value after sorting. It ignores how far the extremes are.
- The mode is the most frequent value.
In the list 2, 3, 3, 4, platform 18, the mean is 6, the median is 3 and the mode is 3. A single large value pulls the mean up but leaves the median alone. For an evenly spaced list, the mean and median coincide.
Checking an average with bounds
Before you calculate, use two facts to catch mistakes:
- The mean always lies between the smallest and largest values (inclusive).
- If every value is the same, the mean equals that value.
So if five test scores lie between 40 and 90, an answer of 95 for their average must be wrong. A combined average of two groups must lie between the two group averages. This check takes seconds and prevents the common slip of dividing by the wrong count.
Relationship between the mean and the values
The mean is the balance point of the data. The deviations of the values from the mean always add up to zero.
For 4, 8, 15 the mean is 9. The deviations are −5, −1 and +6, which sum to 0.
values = [4, 8, 15]
mean = sum(values) / len(values)
deviations = [v - mean for v in values]
print(mean, deviations, sum(deviations)) # 9.0 [-5.0, -1.0, 6.0] 0.0This fact is the foundation of the assumed-mean shortcut later in the tutorial. It also gives a quick way to find a missing value: if the other deviations from a known mean add up to some amount, the last value must cancel them.
For example, five numbers have a mean of 20. Four of them are 14, 18, 25 and 27. Their deviations are −6, −2, +5 and +7, which sum to +4. The fifth number must deviate by −4, so it is 16.
known = [14, 18, 25, 27]
mean, n = 20, 5
print(mean * n - sum(known)) # 16Both methods give 16. The sum method needs one multiplication and one subtraction. The deviation method works with smaller numbers, which is helpful when the values are large.
Diagram: from average to answer
Common errors
- Averaging averages. Combining group averages without weighting by group size. Always convert to totals first.
- Wrong count. After removing or adding items, the divisor changes. Write the new n before dividing.
- Counting terms in a sequence. The number of terms from a to b with step d is (b − a) / d + 1. Forgetting the "+ 1" is a classic off-by-one slip.
- Mixing up mean and median. The median of an uneven list is not the mean, so do not use (first + last) / 2 unless the list is evenly spaced.
- Averages of rates. Average speed is total distance divided by total time, not the mean of the speeds. The sum-of-values view applies here too, with distance as the total.
A rate example
A car travels 60 km at 30 km/h and the next 60 km at 60 km/h. The average speed is not 45 km/h.
- Time for the first leg: 60 / 30 = 2 hours
- Time for the second leg: 60 / 60 = 1 hour
- Total: 120 km in 3 hours, so the average speed is 40 km/h
legs = [(60, 30), (60, 60)] # (distance, speed)
distance = sum(d for d, s in legs)
time = sum(d / s for d, s in legs)
print(distance / time) # 40.0Practice
Exercise
The average of 7 numbers is 24. If one number, 36, is removed, what is the average of the remaining numbers?
Show answer
The total is 24 × 7 = 168. After removing 36 the total is 132 across 6 numbers. The average is 132 / 6 = 22.
Exercise
The average salary of 15 employees is 40,000. When the manager's salary is included, the average rises to 42,000. What is the manager's salary?
Show answer
The total for 16 people is 42,000 × 16 = 672,000. The total for 15 employees is 40,000 × 15 = 600,000. The manager's salary is 672,000 − 600,000 = 72,000.
Exercise
A cyclist rides uphill 12 km at 6 km/h and returns the same 12 km downhill at 12 km/h. What is the average speed for the whole trip?
Show answer
The uphill time is 12 / 6 = 2 hours and the downhill time is 12 / 12 = 1 hour. The total distance is 24 km in 3 hours, so the average speed is 8 km/h, not 9 km/h.