Harmonic Mean Calculator — Formula, Speed Examples, and Rate Averaging
Harmonic mean (HM) is n divided by the sum of reciprocals: HM = n / (1/x₁ + 1/x₂ + ⋯ + 1/xₙ). It is the correct average when each value is a rate applied over an equal distance, budget, or unit — such as speeds over equal distances or prices per equal spending. Classic example: traveling 100 km at 30 mph and 100 km at 60 mph — the true average speed is HM = 40 mph, not the arithmetic mean of 45 mph.
Client-side
Rate & reciprocal average
Before you calculate
Harmonic mean (HM) is n divided by the sum of reciprocals: HM = n / (1/x₁ + 1/x₂ + ⋯ + 1/xₙ). It is the correct average when each value is a rate applied over an equal distance, budget, or unit — such as speeds over equal distances or prices per equal spending. Classic example: traveling 100 km at 30 mph and 100 km at 60 mph — the true average speed is HM = 40 mph, not the arithmetic mean of 45 mph.
Best forSpeeds over equal distances, prices per equal budget, productivity rates per equal workload, and any rate where the denominator (distance, dollars, units) is held constant.InputTwo to 30 positive rates or ratios. All values must be greater than zero.OutputHarmonic mean alongside arithmetic and geometric mean, so you can see the magnitude of the rate-distortion effect.
The reciprocal logic behind harmonic mean
HM is the only average that automatically weights each rate by the time or resource it consumes — without requiring you to calculate those weights manually.
Mechanism
HM inverts so you do not have to
At 30 mph over 100 km, you spend 3.33 hours. At 60 mph over 100 km, you spend 1.67 hours. HM automatically gives 30 mph twice the weight of 60 mph because 1/30 = 0.0333 >> 1/60 = 0.0167. You never have to calculate the time weights manually.
Limit
One very small rate collapses HM
If one rate approaches zero (e.g., a vehicle nearly stopped), HM approaches zero regardless of the other rates. For 1 mph and 60 mph: HM = 2/(1 + 1/60) = 1.97 mph — dominated by the 1 mph leg. This is mathematically correct: a near-stop over equal distance makes the average very low.
Finance
Dollar-cost averaging uses harmonic mean
When you invest the same dollar amount each month at different prices, your average cost per unit is the harmonic mean of the prices. Example: invest $100 at $10/share (10 shares) and $100 at $20/share (5 shares) → average cost = $200 / 15 shares = $13.33/share = HM of $10 and $20.
HM versus AM: four situations where the choice matters
Getting the wrong mean here produces a numerically wrong answer — not just a different perspective.
Situation
Input
Best next move
Why
Round trip at two different speeds
100 km at 30 mph, 100 km at 60 mph
HM = 40 mph → 5 hours total
AM = 45 mph would predict 4.44 hours — 33 minutes faster than the real trip.
Driving at two speeds for equal time
30 mph for 1 hour, 60 mph for 1 hour
AM = 45 mph → 90 km total
Equal time, not equal distance: AM is correct here. HM = 40 would be wrong.
Dollar-cost averaging
$100 at $10/share; $100 at $20/share
HM = $13.33/share (15 total shares)
AM of $15 would imply 13.3 shares at $15 = $200, but actual shares purchased = 15.
P/E ratio comparison across companies
P/E ratios: 15, 20, 25
Use GM → 19.57 (ratio scale)
P/E is a ratio, not a rate over equal denominator — geometric mean is more appropriate.
Step-by-step: how to use this calculator correctly
01
Confirm the rates you are averaging apply over an equal denominator: equal distance, equal budget, or equal quantity — not equal time.
02
Enter only positive values. Zero is invalid because the formula uses 1/xᵢ, and 1/0 is undefined.
03
Read HM as the correct equal-unit average. If HM is much lower than AM, a high rate is inflating the arithmetic result.
04
Check: if HM = AM for your data, all rates are identical. If HM << AM, a very large rate is dominating the arithmetic mean.
Round-trip speed: why HM = 40 mph, not 45 mph
Given
A car drives 100 km to a destination at 30 mph and returns 100 km at 60 mph.
Work
HM = 2 / (1/30 + 1/60) = 2 / 0.05 = 40 mph. Travel time: 100/30 + 100/60 = 3.33 + 1.67 = 5 hrs. Average = 200 km / 5 hrs = 40 mph. AM of 45 mph would predict 200/45 = 4.44 hrs — 33 minutes too short.
Result
True average speed = 40 mph (harmonic mean). Arithmetic mean of 45 mph overstates speed and underestimates travel time by 33 minutes.
Takeaway
Use HM whenever the same distance or unit is covered at each rate. Using AM for equal-distance speed averaging always overestimates the average speed.
Harmonic mean versus other rate averages: which is correct?
HM is correct when the denominator (distance, budget, quantity) is equal for each rate. A different method applies when the numerator (time, output) is equal instead.
Method
Best for
Watch for
Example
Harmonic mean
Equal-denominator rates: speeds over equal distances, prices per equal budget, efficiency per equal workload.
All inputs must be positive. Zero makes the formula undefined (1/0).
30 mph and 60 mph over equal distance → HM = 40 mph. Travel time = 200 km / 40 mph = 5 hours ✓.
Arithmetic mean
Equal-numerator rates: speeds observed for equal time, outputs measured over equal time.
Wrong for equal-distance speed problems. AM = 45 mph implies 200 km / 45 = 4.44 hrs — 33 minutes too short.
30 mph for 1 hr and 60 mph for 1 hr → AM = 45 mph is correct (total = 90 km in 2 hrs).
Geometric mean
Ratios and growth factors that multiply: P/E ratios, fold changes, normalized benchmarks.
Does not directly answer rate-per-equal-distance questions.
P/E ratios 15 and 25 → GM = 19.36 (the fair midpoint on a ratio scale).
Weighted mean
Rates with unequal denominators: different distances, different budgets, different quantities.
Weights must accurately reflect the real denominator for each observation.
60 mph for 120 km and 30 mph for 60 km → weighted by distance gives 50 mph.
HM = 40, GM = 42.43, AM = 45 — three different answers for 30 mph and 60 mph
All three means use 30 and 60 as inputs but answer different questions. Only HM = 40 correctly predicts the round-trip travel time when both legs cover equal distance.
HM
40
GM
42.43
AM
45
Harmonic mean calculation flow: invert, sum, invert again
HM = n / (1/x₁ + 1/x₂ + ⋯ + 1/xₙ). For 30 and 60: HM = 2 / (0.0333 + 0.0167) = 2 / 0.05 = 40.
01Invert
Compute 1/xᵢ for each rate: 1/30 = 0.0333, 1/60 = 0.0167.
The equal-denominator rule: when to use harmonic mean
Use HM when the denominator of the rate is fixed for each observation. Speeds over equal distances: use HM. Prices per equal dollar spent: use HM (if you spend $100 at $2.50/unit and $100 at $5.00/unit, you buy 40 + 20 = 60 units, average price = $200/60 = $3.33/unit = HM). Speeds over equal time: use AM (30 mph for 1 hour and 60 mph for 1 hour → AM = 45 mph is correct, because total distance = 90 km in 2 hours).
HM ≤ GM ≤ AM: what the ordering means for your data
For any set of positive values that are not all equal, HM < GM < AM. For 30 and 60: HM = 40, GM = 42.43, AM = 45. The 5 mph gap between HM and AM is not an error — it is the correct difference between the equal-distance rate (HM) and the equal-time rate (AM). The gap grows larger as the ratio between the fastest and slowest rate increases.
Three harmonic mean errors that produce wrong travel times and costs
All three mistakes produce answers that look plausible but are numerically incorrect for equal-denominator rate problems.
Watch for
Using arithmetic mean for equal-distance speeds
AM = 45 mph for {30, 60} over equal distance. Actual trip = 5 hours. AM predicts 4.44 hours — 33 minutes too short. Use HM = 40 mph.
Watch for
Entering a zero rate
Zero makes 1/0 undefined. If a vehicle is stationary for part of an equal-distance leg, the average speed for that leg is undefined — rethink how the distance is segmented.
Watch for
Using HM when time intervals are equal (not distances)
Driving 30 mph and 60 mph for 1 hour each: AM = 45 mph is correct. HM = 40 mph is wrong here — total distance = 90 km in 2 hours = 45 km/hr average.
Keep going
Related calculators and reference guides
Continue with the Statistics hub, compare this result against a related method, or open a guide that covers the same data pattern in more depth.
No. The formula requires 1/xᵢ for each value. Dividing by zero is undefined, and negative rates (e.g., a negative speed) have no physical meaning in ordinary rate-averaging. Remove any zero entries or rethink the rate definition.
Why is harmonic mean lower than arithmetic mean for the same rates?
Because HM weights slower rates more heavily — a slower rate takes proportionally more time or resource per unit than a faster rate. For 30 mph and 60 mph: the car spends twice as long at 30 mph as at 60 mph on an equal-distance trip, so 30 mph dominates the true average. HM = 40 correctly reflects that dominance; AM = 45 does not.
Why is harmonic mean always lower than arithmetic mean?
By the AM-HM inequality, HM ≤ AM for all positive values (equal only when all values are the same). For {30, 60}: HM = 40, AM = 45. The gap exists because HM weights slower rates more heavily — 30 mph gets twice the reciprocal weight of 60 mph.
Can harmonic mean be used for percentage changes or returns?
Not for compounding returns — use geometric mean. HM is appropriate when percentages represent rates over equal spending units, such as dollar-cost averaging. If you invest the same $ amount each period at different prices, your average unit cost is the harmonic mean of the prices.
What happens to HM when one rate is very large?
A very large rate has a very small reciprocal (1/1000 = 0.001), so it barely affects the reciprocal sum. HM stays close to the average of the smaller rates. Example: HM of 10 and 1,000 = 2 / (0.1 + 0.001) = 19.8 — close to 20, not 505.