Harmonic Mean Calculator

Calculate the harmonic mean of a set of numbers and compare with arithmetic and geometric means.

Enter Your Values

Enter positive numbers separated by commas. All values must be greater than zero.

Result

Harmonic Mean
0
H = n / Σ(1/xi)
Arithmetic Mean
Geometric Mean
Harmonic Mean
Count (n)
Sum of Reciprocals
Relationship

Step-by-Step Solution

H = n / (1/x1 + 1/x2 + ... + 1/xn)

Understanding the Harmonic Mean

The harmonic mean is one of the three Pythagorean means, alongside the arithmetic mean and the geometric mean. It is defined as the reciprocal of the arithmetic mean of the reciprocals of a set of positive numbers. The harmonic mean always produces a value that is less than or equal to the geometric mean, which itself is less than or equal to the arithmetic mean.

The Three Pythagorean Means

Arithmetic Mean (AM)

The most common average. Sum of values divided by count.

AM = (x1 + x2 + ... + xn) / n

Geometric Mean (GM)

The nth root of the product of n values.

GM = (x1 * x2 * ... * xn)^(1/n)

Harmonic Mean (HM)

The reciprocal of the average of reciprocals.

HM = n / (1/x1 + 1/x2 + ... + 1/xn)

AM-GM-HM Inequality

For any set of positive numbers, the means always satisfy this ordering.

AM ≥ GM ≥ HM

When to Use the Harmonic Mean

The harmonic mean is particularly useful when dealing with rates, ratios, and averages of rates. It gives the correct average when the quantities being averaged are defined in relation to a common quantity.

Practical Applications

  • Average Speed: If you travel equal distances at different speeds, the harmonic mean gives the correct average speed. For example, driving 60 km at 30 km/h and 60 km at 60 km/h gives an average speed of HM(30, 60) = 40 km/h.
  • Finance (P/E Ratios): The harmonic mean is used to average price-to-earnings ratios in index calculations because it appropriately weights the underlying earnings.
  • F1-Score: In machine learning, the F1-score is the harmonic mean of precision and recall, giving a balanced measure of a classifier's performance.
  • Parallel Resistors: The combined resistance of parallel resistors is related to the harmonic mean of individual resistances.
  • Population Genetics: The effective population size over generations is computed using the harmonic mean of per-generation sizes.

Properties of the Harmonic Mean

  • Only defined for positive numbers (all values must be greater than zero).
  • Sensitive to small values: one very small value can significantly lower the harmonic mean.
  • For equal values, AM = GM = HM.
  • The harmonic mean of two numbers a and b can also be written as 2ab/(a+b).