terican

Last verified · v1.0

Calculator · math

Harmonic Mean Calculator

Compute the harmonic mean for up to 10 positive values using H = n / Σ(1/xᵢ). Perfect for rates, speeds, and financial ratios.

FreeInstantNo signupOpen source

Inputs

Harmonic Mean

Explain my result

0/3 free

Get a plain-English breakdown of your result with practical next steps.

Harmonic Mean

The formula

How the
result is
computed.

What Is the Harmonic Mean?

The harmonic mean is a type of average specifically designed for datasets that represent rates, ratios, or speeds. Unlike the arithmetic mean, which sums values and divides by their count, the harmonic mean computes the reciprocal of the arithmetic mean of the reciprocals. This property makes it the mathematically correct choice when averaging quantities such as vehicle speed over equal distances, fuel efficiency, price-to-earnings ratios, and flow rates.

The Harmonic Mean Formula

For n positive values x1, x2, ..., xn, the harmonic mean H is defined as:

H = n ÷ (1/x1 + 1/x2 + … + 1/xn)

In compact summation notation: H = n / ∑i=1n (1/xi)

Every value must be strictly positive (greater than zero). A single zero in the dataset makes the denominator undefined, and negative values destroy the reciprocal structure of the formula entirely.

Variables Explained

  • n — The total count of values included in the calculation.
  • xi — Each individual positive data point in the dataset.
  • 1/xi — The reciprocal (multiplicative inverse) of each value.
  • ∑(1/xi) — The sum of all reciprocals, which forms the denominator.

Step-by-Step Calculation Method

  1. Confirm all values are positive. Verify that every data point is greater than zero before proceeding.
  2. Compute each reciprocal. For a value of 4, the reciprocal is 1/4 = 0.25; for a value of 20, it is 1/20 = 0.05.
  3. Sum all reciprocals. Add every reciprocal together to form the denominator.
  4. Divide n by the sum. The resulting quotient is the harmonic mean.

Worked Example: Average Travel Speed

A cyclist rides 90 km at 30 km/h and then another 90 km at 45 km/h. The arithmetic mean of (30 + 45) / 2 = 37.5 km/h is incorrect because equal distances, not equal times, were covered. The harmonic mean gives the true average speed:

H = 2 / (1/30 + 1/45) = 2 / (3/90 + 2/90) = 2 / (5/90) = 2 × 18 = 36 km/h

Verification: 90 km at 30 km/h takes 3 hours; 90 km at 45 km/h takes 2 hours. Total: 180 km in 5 hours = 36 km/h. The harmonic mean matches exactly.

Worked Example: Financial P/E Ratios

An investor allocates equal dollar amounts to three stocks with price-to-earnings ratios of 10, 15, and 30. The correct blended P/E multiple is the harmonic mean:

H = 3 / (1/10 + 1/15 + 1/30) = 3 / (3/30 + 2/30 + 1/30) = 3 / (6/30) = 3 / 0.2 = 15

The arithmetic mean of 18.33 would significantly overstate the blended earnings yield, leading to mispriced portfolio comparisons.

When to Use the Harmonic Mean

  • Speed and travel: Correct average when equal distances are covered at different speeds.
  • Fuel efficiency: Accurate miles-per-gallon average when equal distances are driven on different routes.
  • Financial multiples: Blending P/E, P/B, or P/S ratios for equal-dollar-weight portfolios.
  • Parallel electrical resistors: Computing equivalent resistance in circuit design.
  • Hydrology: The U.S. Geological Survey (2016) applies harmonic mean streamflow in low-flow frequency statistics.

Harmonic Mean vs. Arithmetic Mean vs. Geometric Mean

For any set of unequal positive values, the three classical Pythagorean means obey the strict inequality H ≤ G ≤ A, where H is the harmonic mean, G is the geometric mean, and A is the arithmetic mean. Equality holds only when all values are identical. This fundamental relationship is detailed in the statistical review by Norris et al. (2017, PMC5489931) and the technical exposition by Gavin at Duke University. Selecting the wrong mean for rate data introduces systematic overestimation bias.

Important Limitations

  • Zero or negative values are not permitted; they make the formula mathematically undefined.
  • The harmonic mean is highly sensitive to values near zero, which dominate the sum of reciprocals and pull the result sharply downward.
  • For raw count or quantity data that are not rates, the arithmetic mean remains the appropriate measure of central tendency.

Reference

Frequently asked questions

What is the harmonic mean and when should it be used?
The harmonic mean equals the number of values divided by the sum of their reciprocals. It is the correct average whenever data points represent rates, ratios, or speeds, particularly when equal distances, quantities, or dollar amounts underlie the comparison. Common applications include averaging vehicle speeds over equal distances, blending fuel efficiency figures, computing mean P/E ratios in equal-dollar portfolios, and analyzing flow rates in engineering and hydrology.
How does the harmonic mean differ from the arithmetic mean?
The arithmetic mean sums all values and divides by count, treating each data point with equal additive weight. The harmonic mean works through reciprocals, giving greater influence to smaller values. For the pair 30 and 60, the arithmetic mean is 45 while the harmonic mean is 40. When averaging rates over equal intervals, the arithmetic mean overstates the result, while the harmonic mean produces an unbiased answer that matches total-output-over-total-input.
Can the harmonic mean be calculated if any value is zero or negative?
No. The harmonic mean formula requires all values to be strictly positive. A value of zero makes its reciprocal undefined (division by zero), collapsing the entire denominator. Negative values produce reciprocals that can cancel each other out, generating nonsensical results. This calculator enforces positive inputs for exactly this reason. When a dataset contains zeros or negative numbers, a different statistical measure, such as the median or a trimmed mean, should be considered instead.
How is the harmonic mean used in financial analysis?
In finance, the harmonic mean is the standard method for averaging valuation multiples, such as price-to-earnings (P/E), price-to-book (P/B), and price-to-sales (P/S) ratios, when portfolio positions carry equal dollar weights. For three stocks with P/E ratios of 10, 15, and 30, the arithmetic mean is 18.33 but the harmonic mean is exactly 15. The harmonic mean correctly reflects the aggregate earnings yield per dollar invested, avoiding the upward bias that distorts equal-weighted arithmetic averages.
Why is the harmonic mean the correct average for speeds over equal distances?
When a vehicle covers the same distance at two different speeds, it spends more time traveling at the slower speed. The arithmetic mean of the two speeds ignores this time imbalance and overstates the true average. The harmonic mean corrects for it naturally: taking reciprocals of speeds converts them to time-per-unit-distance, which averages correctly. For speeds of 30 km/h and 60 km/h over equal distances, the harmonic mean is 40 km/h, which matches the exact result of dividing total distance by total time.
What is the relationship between the harmonic mean, geometric mean, and arithmetic mean?
For any set of unequal positive numbers, the three classical Pythagorean means satisfy the inequality H ≤ G ≤ A, where H is the harmonic mean, G is the geometric mean, and A is the arithmetic mean. This ordering always holds strictly for unequal values, with equality only when every value in the dataset is identical. The harmonic mean is always the smallest of the three, making it the most conservative average for rate-based data. This relationship is rigorously documented by Norris et al. (2017) in PMC5489931 and by Gavin at Duke University.