Harmonic mean

From Wikipedia, the free encyclopedia
  (Redirected from Weighted harmonic mean)
Jump to: navigation, search

In mathematics, the harmonic mean (sometimes called the subcontrary mean) is one of several kinds of average, and in particular one of the Pythagorean means. Typically, it is appropriate for situations when the average of rates is desired.

The harmonic mean can be expressed as the reciprocal of the arithmetic mean of the reciprocals. As a simple example, the harmonic mean of 1, 2, and 4 is \frac{3}{\frac{1}{1}+\frac{1}{2}+\frac{1}{4}} = \frac{1}{\frac{1}{3}(\frac{1}{1}+\frac{1}{2}+\frac{1}{4})} = \frac{12}{7}\,.

The harmonic mean H of the positive real numbers x_1, x_2, ..., x_n is defined to be

H = \frac{n}{\frac{1}{x_1} + \frac{1}{x_2} + \cdots + \frac{1}{x_n}} = \frac{n}{\sum_{i=1}^n \frac{1}{x_i}} = \frac{n \cdot \prod_{j=1}^n x_j }{ \sum_{i=1}^n \frac{\prod_{j=1}^n x_j}{x_i}}.

From the third formula in the above equation, it is more apparent that the harmonic mean is related to the arithmetic and geometric means. It is the reciprocal dual of the arithmetic mean for positive inputs:

 1/H(1/x_1 \ldots 1/x_n) = A(x_1 \ldots x_n)

The harmonic mean is a Schur-concave function, and dominated by the minimum of its arguments, in the sense that for any positive set of arguments,  \min(x_1 \ldots x_n) \leq H(x_1 \ldots x_n) \leq n \min(x_1 \ldots x_n) . Thus, the harmonic mean can not be made arbitrarily large by changing some values to a bigger one (while having at least one value unchanged).

Relationship with other means[edit]

A geometric construction of the three Pythagorean means of two numbers, a and b. The harmonic mean is denoted by H in purple color. The Q denotes a fourth mean, the quadratic mean.

The harmonic mean is one of the three Pythagorean means. For all positive data sets containing at least one pair of nonequal values, the harmonic mean is always the least of the three means, while the arithmetic mean is always the greatest of the three and the geometric mean is always in between. (If all values in a nonempty dataset are equal, the three means are always equal to one another; e.g. the harmonic, geometric, and arithmetic means of {2, 2, 2} are all 2.)

It is the special case M−1 of the power mean:

H(x_1, x_2, ..., x_n) = M_{-1}(x_1, x_2, ..., x_n) = \frac{n}{x_1^{-1} + x_2^{-1} + ... + x_n^{-1}}

Since the harmonic mean of a list of numbers tends strongly toward the least elements of the list, it tends (compared to the arithmetic mean) to mitigate the impact of large outliers and aggravate the impact of small ones.

The arithmetic mean is often mistakenly used in places calling for the harmonic mean.[1] In the speed example below for instance, the arithmetic mean of 50 is incorrect, and too big.

The harmonic mean is related to the other Pythagorean means, as seen in the third formula in the above equation. This is noticed if we interpret the denominator to be the arithmetic mean of the product of numbers n times but each time we omit the jth term. That is, for the first term, we multiply all n numbers except the first; for the second, we multiply all n numbers except the second; and so on. The numerator, excluding the n, which goes with the arithmetic mean, is the geometric mean to the power n. Thus the nth harmonic mean is related to the nth geometric and arithmetic means.

Three positive numbers H, G, and A are respectively the harmonic, geometric, and arithmetic means of three positive numbers if and only if[2]:p.74,#1834

\frac{A^3}{G^3}+\frac{G^3}{H^3}+1 \leq \frac{3}{4} \left(1+\frac{A}{H} \right)^2.

If a set of non-identical numbers is subjected to a mean-preserving spread — that is, two or more elements of the set are "spread apart" from each other while leaving the arithmetic mean unchanged — then the harmonic mean always decreases.[3]

Weighted harmonic mean[edit]

If a set of weights w_1, ..., w_n is associated to the dataset x_1, ..., x_n, the weighted harmonic mean is defined by

\frac{\sum_{i=1}^n w_i }{ \sum_{i=1}^n \frac{w_i}{x_i}}.

The unweighted harmonic mean can be regarded as the special case where all of the weights are equal to 1, or, equivalently, where all weights are equal.


In physics[edit]

In certain situations, especially many situations involving rates and ratios, the harmonic mean provides the truest average. For instance, if a vehicle travels a certain distance at a speed x (e.g. 60 kilometres per hour) and then the same distance again at a speed v (e.g. 40 kilometres per hour), then its average speed is the harmonic mean of x and y (48 kilometres per hour), and its total travel time is the same as if it had traveled the whole distance at that average speed. However, if the vehicle travels for a certain amount of time at a speed x and then the same amount of time at a speed y, then its average speed is the arithmetic mean of x and y, which in the above example is 50 kilometres per hour. The same principle applies to more than two segments: given a series of sub-trips at different speeds, if each sub-trip covers the same distance, then the average speed is the harmonic mean of all the sub-trip speeds; and if each sub-trip takes the same amount of time, then the average speed is the arithmetic mean of all the sub-trip speeds. (If neither is the case, then a weighted harmonic mean or weighted arithmetic mean is needed. For the arithmetic mean, the speed of each portion of the trip is weighted by the duration of that portion, while for the harmonic mean, the corresponding weight is the distance. In both cases, the resulting formula reduces to dividing the total distance by the total time.)

However one may avoid use of the harmonic mean for the case of "weighting by distance". Pose the problem as finding "slowness" of the trip where "slowness" (in hours per kilometre) is the inverse of speed. When trip slowness is found, invert it so as to find the "true" average trip speed. For each trip segment i, the slowness si=1/speedi. Then take the weighted arithmetic mean of the si's weighted by their respective distances (optionally with the weights normalized so they sum to 1 by dividing them by trip length). This gives the true average slowness (in time per kilometre). It turns out that this procedure, which can be done with no knowledge of the harmonic mean, amounts to the same mathematical operations as one would use in solving this problem by using the harmonic mean. Thus it illustrates why the harmonic mean works in this case.

Similarly, if one wishes to estimate the density of an alloy given the densities of its constituent elements and their mass fractions (or, equivalently, percentages by mass), then the predicted density of the alloy (exclusive of typically minor volume changes due to atom packing effects) is the weighted harmonic mean of the individual densities, weighted by mass, rather than the weighted arithmetic mean as one might at first expect. To use the weighted arithmetic mean, the densities would have to be weighted by volume. Applying dimensional analysis to the problem, while labeling the mass units by element and making sure that only like element-masses cancel, makes this clear.

If one connects two electrical resistors in parallel, one having resistance x (e.g. 60 Ω) and one having resistance y (e.g. 40 Ω), then the effect is the same as if one had used two resistors with the same resistance, both equal to the harmonic mean of x and y (48 Ω): the equivalent resistance in either case is 24 Ω (one-half of the harmonic mean). However, if one connects the resistors in series, then the average resistance is the arithmetic mean of x and y (with total resistance equal to the sum of x and y). And, as with previous example, the same principle applies when more than two resistors are connected, provided that all are in parallel or all are in series.

The same principle applies to capacitors in series.

The conductivity effective mass of a semiconductor is also defined as the harmonic mean of the effective masses along the three crystallographic directions.[4]

In other sciences[edit]

In computer science, specifically information retrieval and machine learning, the harmonic mean of the precision (true positives per predicted positive) and the recall (true positives per real positive) is often used as an aggregated performance score for the evaluation of algorithms and systems: the F-score (or F-measure). This is used in information retrieval because only the positive class is of relevance and number of negatives is not in general known. It is thus a trade-off as to whether the correct positive predictions should be measured in relation to the number of predicted positives or the number of real positives, so it is measured versus a putative number of positives that is an arithmetic mean of the two possible denominators.

An interesting consequence arises from basic algebra in problems where people or systems work together. As an example, if a gas-powered pump can drain a pool in 4 hours and a battery-powered pump can drain the same pool in 6 hours, then it will take both pumps (6 · 4)/(6 + 4), which is equal to 2.4 hours, to drain the pool together. Interestingly, this is one-half of the harmonic mean of 6 and 4: (2*6*4)/(6+4) = 4.8. That is the appropriate average for the two types of pump is the harmonic mean, and with one pair of pumps (two pumps) it takes half this harmonic mean time, while with two pairs of pumps (four pumps) it would take a quarter of this harmonic mean time.

In electronics the harmonic mean in the same way gives the average contribution per component for parallel resistance, parallel inductance, serial conductance and serial capacitance.

In hydrology, the harmonic mean is similarly used to average hydraulic conductivity values for flow that is perpendicular to layers (e.g. geologic or soil) - flow parallel to layers uses the arithmetic mean. This apparent difference in averaging is explained by the fact that hydrology uses conductivity, which is the inverse of resistivity.

In sabermetrics, a player's Power-speed number is the harmonic mean of their home run and stolen base totals.

In population genetics, the harmonic mean is used when calculating the effects of fluctuations in generation size on the effective breeding population. This is to take into account the fact that a very small generation is effectively like a bottleneck and means that a very small number of individuals are contributing disproportionately to the gene pool, which can result in higher levels of inbreeding.

In transportation, to find the average speed of a trip over a route divided into constant speed segments (of distance) one must use the weighted harmonic mean (weighted by the distance of each segment). For example, if one travels half-way to a destination at 20 mi/hr, and then goes 60 mi/hr for the second half of the distance, the average speed is only 30 mi/hr (harmonic mean) and not the 40 mi/hr (arithmetic mean). This is because it took 3 times as long (in time) to go the first half of the trip distance as it did to go the second half and true average speed is a simple Weighted arithmetic mean with the weights being time. Thus 20 mi/hr gets 3 times more weight than 60 mi/hr:( 3/4 x 20 ) + ( 1/4 x 60 ) = 30 mi/hr

When considering fuel economy in automobiles two measures are commonly used – miles per gallon (mpg), and litres per 100 km. As the dimensions of these quantities are the inverse of each other (one is distance per volume, the other volume per distance) when taking the mean value of the fuel-economy of a range of cars one measure will produce the harmonic mean of the other – i.e. converting the mean value of fuel economy expressed in litres per 100 km to miles per gallon will produce the harmonic mean of the fuel economy expressed in miles-per-gallon.

In chemistry and nuclear physics the average mass per particle of a mixture consisting of different species (e.g. molecules or isotopes) is given by the harmonic mean of the individual species' masses weighted by their respective mass fraction.

In finance[edit]

The harmonic mean is the preferable method for averaging multiples, such as the price/earnings ratio, in which price is in the numerator. If these ratios are averaged using an arithmetic mean (a common error), high data points are given greater weights than low data points. The harmonic mean, on the other hand, gives equal weight to each data point.[5]The simple arithmetic mean when applied to non-price normalized ratios such as the P/E is biased upwards and cannot be numerically justified, since it is based on equalized earnings; just as vehicles speeds cannot be averaged for a roundtrip journey.[6]

In geometry[edit]

In any triangle, the radius of the incircle is one-third of the harmonic mean of the altitudes.

For any point P on the minor arc BC of the circumcircle of an equilateral triangle ABC, with distances q and t from B and C respectively, and with the intersection of PA and BC being at a distance y from point P, we have that y is half the harmonic mean of q and t.[7]

In a right triangle with legs a and b and altitude h from the hypotenuse to the right angle, h2 is half the harmonic mean of a2 and b2.[8][9]

Let t and s (t > s) be the sides of the two inscribed squares in a right triangle with hypotenuse c. Then s2 equals half the harmonic mean of c2 and t2.

Let a trapezoid have vertices A, B, C, and D in sequence and have parallel sides AB and CD. Let E be the intersection of the diagonals, and let F be on side DA and G be on side BC such that FEG is parallel to AB and CD. Then FG is the harmonic mean of AB and DC. (This is provable using similar triangles.)

Crossed ladders. h is half the harmonic mean of A and B

In the crossed ladders problem, two ladders lie oppositely across an alley, each with feet at the base of one sidewall, with one leaning against a wall at height A and the other leaning against the opposite wall at height B, as shown. The ladders cross at a height of h above the alley floor. Then h is half the harmonic mean of A and B. This result still holds if the walls are slanted but still parallel and the "heights" A, B, and h are measured as distances from the floor along lines parallel to the walls.

In an ellipse, the semi-latus rectum (the distance from a focus to the ellipse along a line parallel to the minor axis) is the harmonic mean of the maximum and minimum distances of the ellipse from a focus.

In trigonometry[edit]

In the case of the double-angle tangent identity, if the tangent of an angle A is given as a/b, then the tangent of 2A is the product of (1) the harmonic mean of the numerator and denominator of tan A and (2) the reciprocal of (the denominator minus the numerator of tan A).

In general, the double-angle formula can be written as

\tan 2A = \frac{2 a b}{a + b} * \frac{1}{b - a}

if \tan A = \frac{a}{b} and a and b are real numbers.

For example, if

\tan A = \frac{3}{7},

then the most familiar form of the double-angle formula is

\tan 2A = \frac{2 * \frac{3}{7}}{1 - (\frac{3}{7})^2}= \frac{21}{20};

but this can also be written as

\frac{2 * 3 * 7}{3 + 7} * \frac{1}{7 - 3} = \frac{21}{20}.

Harmonic mean of two numbers[edit]

For the special case of just two numbers, x_1 and x_2, the harmonic mean can be written

H = \frac{2 x_1 x_2}{x_1 + x_2}.

In this special case, the harmonic mean is related to the arithmetic mean A = \frac{x_1 + x_2}{2} and the geometric mean G = \sqrt{x_1 x_2}, by

H = \frac {G^2} {A}.

So G = \sqrt{A H}, meaning the two numbers' geometric mean equals the geometric mean of their arithmetic and harmonic means.

As noted above, this relationship between the three Pythagorean means is not limited to n equals 1 or 2; there is a relationship for all n. However, it should be noted that for n equals 1 all means are equal and for n equals 2 we have the above relationship between the means. For arbitrary n ≥ 2 we may generalize this formula, as noted above, by interpreting the third equation for the harmonic mean differently. The generalized relationship was already explained above. If one carefully observes the third equation, one will notice it also works for n = 1. That is, it predicts the equivalence between the harmonic and geometric means but it falls short by not predicting the equivalence between the harmonic and arithmetic means.

The general formula, which can be derived from the third formula for the harmonic mean by the reinterpretation as explained in relationship with other means, is

 H(x_1, \ldots , x_n)= \frac{(G(x_1, \ldots , x_n))^n}{A(x_2x_3 \cdots x_n, x_1x_3 \cdots x_n, \ldots , x_1x_2 \cdots x_{n-1})} = \frac{(G(x_1, \ldots , x_n))^n}{A\left( \frac{\prod_{i=1}^n x_i}{x_1}, \frac{\prod_{i=1}^n x_i}{x_2}, \ldots , \frac{\prod_{i=1}^n x_i}{x_n} \right)} .

Notice that for n=2 we have

H(x_1, x_2)= \frac{(G(x_1, x_2))^2}{A(x_2, x_1)}=\frac{(G(x_2, x_1))^2}{A(x_1, x_2)}

where we used the fact that the arithmetic mean evaluates to the same number independent of the order of the terms. This equation can be reduced to the original equation if we reinterpret this result in terms of the operators themselves. If we do this, we get the symbolic equation

H = \frac {G^2} {A}

because each function was evaluated at

 (x_1, x_2).

See also[edit]


  1. ^ *Statistical Analysis, Ya-lun Chou, Holt International, 1969, ISBN 0030730953
  2. ^ Inequalities proposed in “Crux Mathematicorum”, [1].
  3. ^ Mitchell, Douglas W., "More on spreads and non-arithmetic means," The Mathematical Gazette 88, March 2004, 142-144.
  4. ^ http://ecee.colorado.edu/~bart/book/effmass.htm
  5. ^ "Fairness Opinions: Common Errors and Omissions", The Handbook of Business Valuation and Intellectual Property Analysis, McGraw Hill, 2004. ISBN 0071429670
  6. ^ "Using the Price-to-Earnings Harmonic Mean to Improve Firm Valuation Estimates", Pankaj Agrrawal, Richard Borgman, John M. Clark and Robert Strong, Journal of Financial Education, Vol 36, 2010, http://ssrn.com/abstract=2621087
  7. ^ Posamentier, Alfred S., and Salkind, Charles T., Challenging Problems in Geometry, second edition, Dover Publ. Co., 1996, p 172.
  8. ^ Voles, Roger, "Integer solutions of a^{-2}+b^{-2}=d^{-2}," Mathematical Gazette 83, July 1999, 269–271.
  9. ^ Richinick, Jennifer, "The upside-down Pythagorean Theorem," Mathematical Gazette 92, July 2008, 313–;317.

External links[edit]