The harmonic mean is a measure of central tendency defined, for positive numbers, as the reciprocal of the arithmetic mean of their reciprocals. In statistics and applied mathematics, it is particularly useful for combining rates when the quantities in the numerators of those rates are equal, or when appropriate numerator-based weights are available. Compared with the arithmetic mean, it gives greater influence to small values. Together with the arithmetic and geometric mean, it forms the three classical Pythagorean means, studied in ancient Greece.
Definition
For positive real numbers , the harmonic mean is
For two positive numbers and , this becomes
For example, the harmonic mean of and is
whereas their geometric mean is and their arithmetic mean is .
The standard definition assumes strictly positive inputs. This restriction ensures that the denominator is positive and that the result lies between the smallest and largest inputs. Although the same algebraic expression can sometimes be evaluated for nonzero negative or mixed-sign values, it need not then behave as a mean.
Weighted harmonic mean
Given nonnegative weights , not all zero, the weighted harmonic mean is
If the weights are normalized so that , the formula simplifies to
Equal weights give the ordinary harmonic mean. Multiplying every weight by the same positive constant leaves the result unchanged. An input with zero weight has no effect and may be omitted.
The interpretation of the weights is crucial. For a rate expressed as “quantity per unit resource,” harmonic weights ordinarily represent amounts of the numerator quantity. Arithmetic weights instead represent amounts of the denominator resource.
Mathematical properties
Bounds and inequalities
For positive inputs,
Let and denote the geometric and arithmetic means of the same numbers. Then
with equality throughout if and only if all inputs are equal.
The inequality follows directly from the Cauchy–Schwarz inequality:
Weighted versions of these inequalities hold when all three means use the same normalized nonnegative weights.
For two inputs there is also the identity
Scaling, monotonicity, and sensitivity
The harmonic mean is symmetric in its inputs and homogeneous of degree one:
Thus, changing measurement units changes the mean by the same scale factor.
Increasing any input while keeping the others fixed increases the harmonic mean. Its partial derivative is
Within a given collection of values, a smaller input therefore has a larger local effect than a larger one. In particular, if one input approaches zero while the others remain fixed and positive, the harmonic mean approaches zero.
Unlike the arithmetic mean, the harmonic mean is not translation-equivariant: adding a constant to every input does not generally add that same constant to the mean. Its interpretation consequently depends on meaningful ratios and a meaningful zero, as with speeds, durations, and many physical rates.
Relation to other families of means
The harmonic mean is the power mean of order . The power mean of order is
so that .
A sequence is called a harmonic progression when its reciprocals form an arithmetic progression. For two positive numbers and , inserting their harmonic mean between them makes
an arithmetic progression.
Averaging rates and ratios
The main practical question is not simply whether the observations are rates, but which underlying quantities are being combined.
Suppose
The aggregate rate is
Since ,
which is the weighted harmonic mean of the individual rates, with weights . Equivalently,
which is their weighted arithmetic mean, with weights .
Thus, the harmonic and arithmetic formulations describe the same aggregate ratio using different weights. Neither is universally the correct way to average rates without information about the underlying totals.
Average speed
A vehicle travels two equal distances, one at and the other at . Its average speed is
The slower leg takes more time, so the arithmetic mean is not the average speed over the complete journey.
For unequal distances , the average speed is the distance-weighted harmonic mean:
By contrast, when speeds are maintained for equal durations, their arithmetic mean gives the average speed.
Prices and unit costs
If equal amounts of money are spent on a commodity at positive unit prices , the overall price paid per unit is the harmonic mean of those prices. At a low price, the same expenditure buys more units, giving that price more influence on the aggregate unit cost.
For unequal expenditures , the aggregate unit price is
If equal quantities rather than equal expenditures are purchased, the appropriate average price is instead arithmetic.
Other applications
Classification metrics
In machine learning and information retrieval, the F1 score is the harmonic mean of precision and recall:
This construction makes the score sensitive to a low value of either component. A high value of one cannot fully compensate for a very low value of the other.
The more general score
is a weighted harmonic mean. In reciprocal form,
Zero-valued and undefined precision or recall require conventions beyond the strictly positive definition.
Electrical resistance and layered media
For positive resistances connected in parallel, their equivalent resistance satisfies
Consequently,
The equivalent resistance is therefore not itself the harmonic mean: it is the harmonic mean divided by the number of branches.
A weighted harmonic mean also describes effective conductivity across ideal layers arranged in series with the direction of steady flow. If layer has thickness and conductivity , with equal cross-sectional area and no additional interface resistance, then
Population harmonic mean
For a positive random variable , the population harmonic mean can be defined as
provided , where denotes expected value.
When is also finite, Jensen’s inequality gives
If , a generalized harmonic mean is sometimes assigned the value zero. This can occur even when is strictly positive, because sufficiently much probability near zero makes its reciprocal have infinite expectation.
Under independent, identically distributed sampling with finite reciprocal expectation, the sample harmonic mean converges to by the law of large numbers. It is not generally an unbiased estimator of that population quantity.
Limitations and computation
A zero input makes the reciprocal formula undefined. On the nonnegative domain, a continuous extension assigns the harmonic mean the value zero whenever at least one input is zero. Whether that convention is meaningful depends on the application.
Negative values create more serious difficulties. Reciprocals of opposite signs can cancel, making the expression undefined or placing its value outside the range of the inputs.
The harmonic mean is not a general-purpose substitute for other measures of central tendency. Its strong sensitivity to small observations is useful for some aggregation problems but can make it highly sensitive to near-zero measurement errors.
Direct computation can also encounter problems in floating-point arithmetic if reciprocals overflow. One scaled formula for positive inputs uses :
Here every ratio lies in , avoiding explicit reciprocals of very small inputs. Summation error and extreme input ranges may still require attention to numerical stability.