How to use the harmonic mean calculator
- Choose Equal weights for a plain harmonic mean, or Weighted if some values should count more, such as speeds that cover different distances.
- Enter the numbers separated by commas, spaces or new lines. Every number must be above 0.
- For the weighted version, enter one weight for each number, in the same order. A weight can be a distance, a quantity or a count.
- Read the harmonic mean, with the arithmetic and geometric means beside it for comparison.
Formula
Harmonic mean = n / (1/x1 + 1/x2 + ... + 1/xn)
Weighted harmonic mean = (w1 + ... + wn) / (w1/x1 + ... + wn/xn)
It is the reciprocal of the average of the reciprocals. With equal weights the weighted formula reduces to the plain one.
Average speed over a round trip
You drive to a town at 40 mph and come back at 60 mph over the same road. The average speed is not 50. The harmonic mean is 2 / (1/40 + 1/60) = 2 / 0.041667 = 48 mph, because you spend more time at the slower speed.
If instead you drive 30 miles at 40 mph and 90 miles at 60 mph, the distances are the weights. The weighted harmonic mean is 120 / (30/40 + 90/60) = 120 / 2.25 = 53.33 mph. That equals total distance divided by total time: 120 miles in 0.75 + 1.5 = 2.25 hours.
When to use the harmonic mean
Use it to average rates when each rate covers the same amount of the thing in the denominator. Speeds over equal distances, prices per unit when you spend the same amount on each, and ratios such as price to earnings across equal dollar holdings are typical cases.
If instead you drive for equal times at each speed, the ordinary average is the right one. The deciding question is what is held equal: equal distance means harmonic, equal time means arithmetic.
How it compares with the other means
For positive numbers that are not all equal, the harmonic mean is the smallest of the three common averages. For two numbers a and b, the geometric mean squared equals the arithmetic mean times the harmonic mean, which for 2 and 8 gives 4 x 4 = 5 x 3.2.
See the geometric mean calculator for averaging growth, the average calculator for the usual mean, median and mode, and the ratio calculator for working with ratios directly.
Assumptions and limits
- Every value and every weight is above zero.
- For the weighted version, each weight describes the amount of the denominator quantity attached to that value, such as the distance for a speed.
- The numbers are rates or ratios of the same kind and in the same unit.
- Results are shown to 8 significant digits.
Frequently asked questions
What is the harmonic mean used for?
It averages rates such as speed, price per unit or work per hour when each rate applies to the same amount of the underlying quantity. A round trip at two speeds is the classic case.
How do you calculate the harmonic mean of 40 and 60?
Divide the count of numbers by the sum of their reciprocals: 2 divided by (1/40 + 1/60), which is 48. That is the average speed over equal distances.
What is a weighted harmonic mean?
It is the harmonic mean where each value counts in proportion to a weight, such as the miles driven at each speed. The result equals the total weight divided by the total of weight over value.
Why can't the harmonic mean include zero?
Because it divides by each value. A zero would mean dividing by zero, which has no meaning here, so the tool requires values above zero.