Harmonic Mean Calculator
The harmonic mean is the reciprocal of the arithmetic mean of the reciprocals. It is the right average wherever a quantity is expressed 'per unit' of something else: hours per kilometer (speed), currency per item (unit cost), price per unit of earnings (P/E), and output per hour (productivity). For measurements like these the arithmetic mean is systematically wrong.
The classic example is a round trip: a car that drives out at 60 km/h and returns over the same road at 40 km/h averages 48 km/h, not 50, because it spends more time on the slow leg. Alongside the harmonic mean this calculator also reports the arithmetic and geometric means, confirms the AM ≥ GM ≥ HM inequality numerically, produces the weighted harmonic mean from optional weights, and shows each value's reciprocal contribution in a table.
Harmonic Mean Formulas
Definition: HM = n / Σ(1/xᵢ) = n / (1/x₁ + 1/x₂ + … + 1/xₙ) Equivalent form: 1/HM = (1/n) · Σ(1/xᵢ) Weighted: HM_w = Σwᵢ / Σ(wᵢ/xᵢ) For two values: HM = 2·x₁·x₂ / (x₁ + x₂) Round-trip speed: v̄ = 2·v₁·v₂ / (v₁ + v₂) Inequality: HM ≤ GM ≤ x̄ (all xᵢ > 0) Relation: GM² = x̄ · HM (exact equality for n = 2)
HARMEAN in Excel, 1/mean(1/x) in R, and the Harmonic Mean statistic in the SPSS Means menu all return the same result. The weighted form is identical to dividing the total quantity by the total cost or total time in per-unit measurements.
How to Calculate
- Type the rates or speeds you want to average into the box; every one of them must be positive.
- If the quantity over which each value applies differs (different distances, different amounts), fill in the weights box in the same order.
- Compare the harmonic mean with the arithmetic mean; the gap between them shows how spread out the values are.
- Check the table of reciprocals to see which observation contributes most to the denominator: the smallest value is always the dominant one.
- Sanity-check the result: the harmonic mean must always fall between the smallest and largest value, and below the arithmetic mean.
- State clearly which mean you used when reporting; for speed and unit-cost tables this distinction changes the result entirely.
Worked Examples
Average speed of a round trip
For a car driving out at 60 km/h and back at 40 km/h over the same road, the reciprocals sum to 1/60 + 1/40 = 0.041667, so the harmonic mean is 2 / 0.041667 = 48.0000 km/h. The arithmetic mean of 50 km/h is the wrong answer; the geometric mean is 48.9898, which confirms the ordering HM ≤ GM ≤ AM.
Number of values (n): 2 · Harmonic mean (HM): 48.0000 · Sum of the reciprocals Σ(1/xᵢ): 0.041667
Averaging price/earnings ratios
For the P/E ratios of four stocks the reciprocals sum to 0.213889, so the harmonic mean is 4 / 0.213889 = 18.7013. The arithmetic mean of 21.0000 sits 2.2987 points above it; for 'price per unit of earnings' ratios such as P/E, the harmonic mean is the correct index-level average.
Number of values (n): 4 · Harmonic mean (HM): 18.7013 · Sum of the reciprocals Σ(1/xᵢ): 0.213889
Weighted average unit price
If 1,000, 1,500, and 2,000 TL were spent at three stations charging 42, 45, and 48 TL per liter, then Σw = 4,500 and Σ(w/x) = 98.809524 liters, so the weighted harmonic mean is 4,500 / 98.809524 = 45.5422 TL per liter. The weighted arithmetic mean returns 45.6667 TL and thus overstates the average price actually paid per liter.
Number of values (n): 3 · Weighted harmonic mean: 45.5422 · Sum of the weights (Σwᵢ): 4,500