skip to content

Why is 40 mph, not 45, the average speed of a trip driven 60 mph out and 30 mph back?

level: middleimportance: nice to knowfreq 26%

answer

  1. the definition is total over total
  2. equal distance is not equal time
  3. the slow leg lasts twice as long
  4. average the reciprocals, then flip back
  5. it is the smallest of the three means

basics

~20 s

Equal distances take unequal times, so the slow leg lasts twice as long and dominates the trip. Total distance over total time gives 40 mph, which is the harmonic mean 2 divided by (1/60 + 1/30), not the arithmetic 45.

solid answer

~50 s

Average speed is defined as total distance divided by total time, so the weights are times, not legs. For a one-way distance d, the outbound leg takes `d/60` and the return takes `d/30`, a total of `3d/60 = d/20`. Dividing total distance `2d` by that gives `40` mph, and the d cancels, so the answer does not depend on how long the route is. The arithmetic mean of 45 would be right only if the two speeds were held for equal *times*, not equal distances. The general form is the harmonic mean, `n / sum(1/x_i)`, which here is `2 / (1/60 + 1/30) = 2 / 0.05 = 40`. It is the correct average whenever each rate shares the same numerator — distance per hour, cost per unit — and the quantity that varies is the denominator.

go deeper

for a junior

Know that average speed means total distance divided by total time, and that averaging the two speedometer readings is not the same thing. Working the example with a concrete distance is enough here.

for a middle

Derive it symbolically, show the distance cancelling, and state the harmonic mean formula. Be able to say when the arithmetic mean would instead have been correct.

for a senior

Recognise the pattern outside driving — blended cost per acquisition on equal budgets, aggregate throughput over equal work units — and catch a report that averaged such rates arithmetically.

for a principal

Own why a metric's aggregation form is a design choice: a harmonic blend refuses to let a weak component be masked, which is a statement about incentives as much as arithmetic.

## Go back to the definition Average speed is not the average of the speedometer readings. It is defined as `average speed = total distance / total time` Everything follows from taking that definition seriously. Let the one-way distance be d miles. - Outbound at 60 mph takes `d / 60` hours. - Return at 30 mph takes `d / 30` hours, which is twice as long. - Total time is `d/60 + d/30 = d/60 + 2d/60 = 3d/60 = d/20`. - Total distance is `2d`. - Average speed is `2d / (d/20) = 40` mph. The d cancels, which is worth saying out loud in an interview: the answer is 40 mph for a two-mile trip and for a two-thousand-mile trip alike. ## Why the arithmetic mean is wrong here A mean is a weighted average, and the question is always what carries the weight. In `total distance / total time`, the natural weights on the speeds are the **times spent at them**. The two legs cover equal distances but not equal times: the slow leg occupies two-thirds of the trip clock. An unweighted average of 60 and 30, giving 45, silently assumes the two speeds were held equally long, which is exactly what equal-distance travel rules out. Make the contrast concrete. Drive one hour at 60 mph and one hour at 30 mph: you cover 90 miles in 2 hours, an average of 45 mph — and now the arithmetic mean is correct, because the weights really are equal. **Same two speeds, different average, because the constraint changed from equal distance to equal time.** ## The harmonic mean The harmonic mean of n positive values is `HM = n / (1/x_1 + 1/x_2 + ... + 1/x_n)` equivalently, the reciprocal of the arithmetic mean of the reciprocals. For our trip: `2 / (1/60 + 1/30) = 2 / (0.01667 + 0.03333) = 2 / 0.05 = 40`. The reciprocal structure is the clue to when it applies. A speed is `distance / time`; its reciprocal is `time / distance`, which is the additive quantity when distance is fixed. Averaging reciprocals, then flipping back, is exactly averaging in the units that add. The general rule: **the harmonic mean is the right average for rates whose numerator is held constant and whose denominator varies.** Fixed distance and varying time gives average speed. Fixed budget spent at varying unit prices gives the average price paid per unit. Fixed work item and varying throughput gives the average rate for the batch. If instead the *denominator* is fixed — equal times, equal durations — the arithmetic mean is correct. ## Where the three means sit relative to each other For positive values that are not all identical, the ordering is strict and always the same: `harmonic mean < geometric mean < arithmetic mean` For 30 and 60: harmonic `40`, geometric `sqrt(30 x 60) = sqrt(1800) = 42.4`, arithmetic `45`. All three are equal only when every value is identical. That ordering is a useful memory aid and a useful sanity check: if your computed average speed came out above the arithmetic mean of the speeds, you have made an arithmetic error, and 42.4 appearing in an answer usually means someone reached for the geometric mean out of habit. ## Reading it in the wild The pattern hides in ordinary reporting. - **Cost per acquisition across channels.** If you spent the same budget on each channel, the blended cost per acquisition is the harmonic mean of the channel figures, not their plain average. - **Requests per second across equal-sized batches.** Fixed work, varying rate — the aggregate throughput follows the harmonic form. - **Combining precision and recall.** The F1 score is the harmonic mean of precision and recall, which is why it punishes a model that is excellent on one and poor on the other far more than a plain average would. That last property is the reason the harmonic mean is chosen deliberately rather than by accident: it is dominated by the smallest value. One very slow leg, one very expensive channel, one terrible recall drags the harmonic mean down hard, whereas the arithmetic mean lets a strong counterpart mask it. ## Answering cleanly Give the definition, do the cancellation, state the number, and then generalise: fixed numerator with varying denominator means harmonic mean; fixed denominator means arithmetic. Finish with the equal-time variant to prove you understand the mechanism rather than having memorised a trick answer.

  • What changes if the driver instead spends one hour at 60 mph and one hour at 30 mph?
    The average becomes 45 mph, the plain arithmetic mean. Ninety miles are covered in two hours. With equal times the two speeds genuinely carry equal weight, so the arithmetic mean is correct here; the harmonic form is needed only because equal distances force the slow leg to occupy more of the clock.
  • How do the harmonic, geometric and arithmetic means of the same positive numbers order?
    Harmonic is smallest, geometric is in the middle, arithmetic is largest, with equality only when all the values are identical. For 30 and 60 they are 40, about 42.4, and 45. The harmonic mean is pulled hardest toward the smallest value, which is exactly why it is chosen when a weak component should not be masked.
  • Give another metric where the harmonic mean is the deliberate choice.
    The F1 score, the harmonic mean of precision and recall. Because the harmonic mean is dominated by the smaller input, a model with 0.95 precision and 0.05 recall scores about 0.095 rather than the 0.5 an arithmetic mean would report, so a model that fails badly on one dimension cannot hide behind the other.

Two workers each finish one identical task, one in an hour and one in two. The team's average pace is set by the clock they burned, not by counting each worker once.

saying these in an interview costs you the question

  • Averages the two speeds and answers 45 mph
  • Thinks the answer depends on how far the trip was
  • Cannot say which quantity carries the weight
  • Uses the harmonic mean when the times, not distances, are equal
  • Confuses the harmonic mean with the geometric mean

context