Harmonic Mean Calculator

Calculate the harmonic mean of a set of positive numbers, with arithmetic mean for comparison — ideal for rates and speeds.

Share this calculator

48

Harmonic mean

50

Arithmetic mean

2

Count

Harmonic mean48
Arithmetic mean50
Minimum40
Maximum60
Count2

Also in Statistics

Means & Averages

Harmonic mean — the correct average for rates and unit ratios

The harmonic mean is the reciprocal of the arithmetic mean of reciprocals. It is the appropriate average whenever values represent rates — speed, price per unit, efficiency — and the denominator (distance, quantity, time) is held constant across observations. The classic example: driving the same distance at 60 mph and 40 mph gives an average speed of the harmonic mean, 48 mph, not the arithmetic mean (50 mph).

The formula and intuition

For n positive values x₁, x₂, …, xₙ, the harmonic mean is HM = n / (1/x₁ + 1/x₂ + … + 1/xₙ). Each value contributes its reciprocal to the sum; the more reciprocals you sum, the smaller the result — so large values have less influence on the harmonic mean than on the arithmetic mean.

Intuitively, the harmonic mean answers "what single rate gives the same total output if applied uniformly?" For the speed example: covering 1 mile at 60 mph takes 1/60 hour; at 40 mph it takes 1/40 hour. Total time = 1/60 + 1/40 = 1/24 hour per mile. Rate = 1/(1/24) / 2 = 24 miles/(hour per mile) / 2 = 48 mph.

Average speed over equal distances

The harmonic mean is the correct average speed when the same distance is covered at different speeds. If you drive 100 km at 60 km/h and return 100 km at 40 km/h, your average speed is HM(60, 40) = 48 km/h. The arithmetic mean (50 km/h) is wrong because you spend more time at the slower speed.

More generally, HM is correct when the numerator is fixed and the denominator varies. Speed = distance/time: if distance is constant and time varies, use the harmonic mean.

Finance: price-to-earnings and portfolio weighting

Analysts computing the average P/E ratio of an equally-weighted portfolio use the harmonic mean. If you invest equal dollar amounts in stocks with P/E ratios of 10, 20, and 40, you buy more shares of the cheaper stock. The resulting portfolio P/E = HM(10, 20, 40) ≈ 18.5, not the arithmetic mean of 23.3.

Similarly, when averaging rates of return expressed as multiples on invested capital (MOIC) across equal-capital investments, the harmonic mean is more appropriate than the arithmetic mean.

Relationship to arithmetic and geometric means

For any set of positive values, HM ≤ GM ≤ AM, with equality only when all values are identical. This ordering is the AM–GM–HM inequality, one of the most fundamental results in mathematics.

The harmonic mean weights small values more heavily than the arithmetic mean, and weights them more heavily than the geometric mean as well. For a two-value dataset, HM(a, b) = 2ab/(a+b), which is also related to the F1 score (harmonic mean of precision and recall) used in machine learning.

Frequently asked questions

Why is the harmonic mean lower than the arithmetic mean?

The harmonic mean gives more weight to smaller values. When you average rates, slower rates (smaller values) require more time and thus pull the effective average down. Mathematically, the arithmetic mean of reciprocals is larger than the reciprocal of the arithmetic mean (Jensen's inequality for convex functions), so the harmonic mean — being the reciprocal of that arithmetic mean of reciprocals — is always ≤ the arithmetic mean.

When should I use the harmonic mean?

Use the harmonic mean when averaging rates (speed, price-per-unit, efficiency) and the denominator quantity is equal across observations. Common cases: average speed over equal distances, average P/E ratio of an equal-dollar-weighted portfolio, average fuel efficiency (miles per gallon) over equal distances, F1 score in machine learning.

Why can the harmonic mean not include zero or negative values?

A rate of zero (e.g. 0 mph) implies infinite time to cover any distance. The reciprocal 1/0 is undefined, so the harmonic mean cannot be computed. Negative rates (moving backwards) do not fit the physical model the harmonic mean is designed for, and produce mathematically inconsistent results.

What is the F1 score and why does it use the harmonic mean?

In machine learning, the F1 score balances precision (P) and recall (R): F1 = 2PR/(P+R) = HM(P, R). The harmonic mean is used because it is low unless both precision and recall are high — a model with 100% precision and 0% recall should not score well, and the harmonic mean of 1 and 0 is 0, as desired. The arithmetic mean (0.5) would be misleadingly high.

Related

More from nearby categories

These related calculators come from the same leaf category, nearby sibling categories, or the same top-level topic.