Statistics
Harmonic mean calculator
The harmonic mean is the right average for rates measured over a fixed amount: speeds over equal distances, prices per unit for equal spending. Enter a list, or switch to the weighted version for unequal distances.
Separate with commas, spaces or new lines.
| x | 1 ÷ x |
|---|---|
| 60 | 0.0166667 |
| 40 | 0.025 |
| 30 | 0.0333333 |
| Σ | 0.075 |
Show the working, step by step
Take the reciprocal of each value.
1 ÷ 60 = 0.0166667 1 ÷ 40 = 0.025 1 ÷ 30 = 0.0333333
Add the reciprocals.
Σ(1 ÷ x) = 0.075
Divide the count, n = 3, by that sum.
HM = n ÷ Σ(1 ÷ x) = 3 ÷ 0.075 = 40
For positive values, harmonic ≤ geometric ≤ arithmetic: 40 ≤ 41.602 ≤ 43.333.
The formulas
Simple: HM = n ÷ Σ(1/x) Weighted: HM = Σw ÷ Σ(w/x)
Take the reciprocal of each value, average the reciprocals, and take the reciprocal of that average. The weighted form does the same with each reciprocal counted w times.
A worked example (the default list)
A car covers three equal stretches at 60, 40 and 30 km/h.
- Reciprocals: 1/60 = 0.016667, 1/40 = 0.025, 1/30 = 0.033333.
- Their sum: 0.075.
- HM = 3 ÷ 0.075 = 40 km/h.
Check it directly with 60 km stretches: the times are 1, 1.5 and 2 hours, so 180 km takes 4.5 hours, which is 40 km/h. The arithmetic mean of the three speeds, 43.33 km/h, would be right only if the car had spent the same time at each speed.
Weighted harmonic mean: unequal distances
Now the stretches are 120 km at 60 km/h, 80 km at 40 km/h and 30 km at 30 km/h (switch the calculator to “Weighted”). Each w ÷ x is the time for that stretch: 2, 2 and 1 hours. The average speed is Σw ÷ Σ(w/x) = 230 ÷ 5 = 46 km/h. The unweighted harmonic mean, 40 km/h, would be right only if the three stretches were the same length.
Which mean to use
| Situation | Right average |
|---|---|
| Speeds over equal distances | Harmonic mean |
| Speeds over equal times | Arithmetic mean |
| Price per kg, same amount of money spent each time | Harmonic mean |
| Price per kg, same quantity bought each time | Arithmetic mean |
| Price-to-earnings ratios of an equal-weighted portfolio | Harmonic mean |
| Growth rates, returns | Geometric mean |
The rule: if the fixed quantity sits in the numerator of the rate (the km in km/h, the money in money per kg), average with the harmonic mean. If it sits in the denominator, use the arithmetic mean.
Harmonic, geometric and arithmetic means
For positive values HM ≤ GM ≤ AM, with equality only when every value is the same. For 60, 40 and 30 they are 40, 41.60 and 43.33. The harmonic mean gives the small values the most influence, which is why a single slow stretch drags an average speed down so much.
Common mistakes
- Averaging speeds arithmetically when the distances are equal. The slow stretch takes longer, so it deserves more influence, and the harmonic mean gives it that.
- Weighting by time in the weighted harmonic mean. Weights must be in the numerator unit of the rate (km for km/h); time weights call for the arithmetic mean.
- Dividing Σ(1/x) by n and stopping there. That is the mean of the reciprocals; the harmonic mean is its reciprocal, n ÷ Σ(1/x).
Common questions
What is the harmonic mean?
The reciprocal of the mean of the reciprocals: HM = n ÷ Σ(1/x). For 60, 40
and 30 the reciprocals add to 0.075, so the harmonic mean is 3 ÷ 0.075 = 40.
Why is average speed a harmonic mean?
Because speed is distance per unit of time, and over equal distances it is the times that add up, not the speeds. Drive 60 km at 40 km/h (1.5 hours) and 60 km back at 60 km/h (1 hour): 120 km in 2.5 hours is 48 km/h, the harmonic mean of 40 and 60. The arithmetic mean, 50 km/h, is wrong.
When do I use the weighted harmonic mean?
When the stretches are not equal. Weight each rate by the quantity in its numerator: speeds
by distance, prices per kilogram by money spent. The formula is
HM = Σw ÷ Σ(w/x). If the weights are in the denominator unit instead (speeds by
time), use the ordinary weighted arithmetic mean.
Can the harmonic mean be used with zero or negative numbers?
No. The reciprocal of 0 is undefined, and a mix of positive and negative values can make Σ(1/x) zero or give a result outside the range of the data. The calculator asks for values greater than zero.
How do I calculate the harmonic mean in Excel?
=HARMEAN(A2:A10) for a plain list. For a weighted harmonic mean, with values in A
and weights in B: =SUM(B2:B10)/SUMPRODUCT(B2:B10/A2:A10).
Related calculators
-
Geometric mean
The average for growth rates and ratios.
-
Weighted mean
The weighted arithmetic mean Σwx ÷ Σw.
-
Arithmetic mean of a series
Direct, short-cut and step-deviation methods.