Harmonic Mean Calculator — Step-by-Step Solutions
The Harmonic Mean Calculator computes the reciprocal-based average, which is especially useful for averaging rates, speeds, and ratios. It gives less weight to large outliers compared to the arithmetic mean.
Enter a dataset to calculate the harmonic mean, provide value-weight pairs for a weighted harmonic mean, or compare all three Pythagorean means (arithmetic, geometric, harmonic) to see the AM-GM-HM inequality in action.
Your calculations will appear here
How to Use the Harmonic Mean
- Harmonic Mean: enter non-zero numbers separated by commas. The result shows the harmonic mean, the sum of reciprocals and the count.
- Weighted HM: enter one pair per line, as value, weight (for example 40, 2). Use it when the values apply to different amounts, such as speeds over different distances.
- Compare All Means: enter positive numbers to see the arithmetic, geometric and harmonic means side by side and check that HM <= GM <= AM.
- The harmonic mean is not defined when any value is zero, and the comparison mode needs all values above zero.
Formula and Theory
The harmonic mean is the reciprocal of the average of the reciprocals: HM = n / (1/x1 + 1/x2 + ... + 1/xn). It is the correct average for rates when the same amount of the underlying quantity is covered at each rate, for instance average speed over equal distances, or price-earnings ratios across equal investments.
The reason is that rates are quantities divided by something. If you drive 60 km at 40 km/h and 60 km at 60 km/h, the times are different, so the arithmetic mean of 40 and 60 overstates the true average speed. The harmonic mean gives the total distance divided by the total time.
For unequal amounts, weight each rate by the amount it applies to: WHM = (sum of weights) / (sum of weight / value). With weights as distances, this gives the true overall average speed.
For positive numbers HM <= GM <= AM, with equality only when all values are equal. The harmonic mean is pulled towards the smallest values, which makes it the most conservative of the three.
Worked Examples
Example 1: Average speed over equal distances
Problem: You drive to a town at 40 km/h and return at 60 km/h over the same road. What is your average speed for the round trip?
Solution: Equal distances means a harmonic mean. HM = 2 / (1/40 + 1/60) = 2 / 0.041667 = 48. Check with distance: for a 120 km one-way trip, the times are 3 hours and 2 hours, so 240 km in 5 hours = 48 km/h.
Answer: 48 km/h (not 50)
Example 2: Equal distances at 30 and 60
Problem: Find the harmonic mean of 30 and 60.
Solution: HM = 2 / (1/30 + 1/60) = 2 / (2/60 + 1/60) = 2 / (3/60) = 2 x 20 = 40.
Answer: 40
Example 3: Weighted harmonic mean
Problem: You cover 2 units of distance at 40, 3 units at 60 and 5 units at 80. What is the overall average speed?
Solution: Total weight = 2 + 3 + 5 = 10. Weighted reciprocal sum = 2/40 + 3/60 + 5/80 = 0.05 + 0.05 + 0.0625 = 0.1625. WHM = 10 / 0.1625 = 61.538.
Answer: 61.54
Example 4: Comparing the three means
Problem: Compare the means of 1, 4, 4.
Solution: AM = 9 / 3 = 3. GM = (1 x 4 x 4)^(1/3) = 16^(1/3) = 2.5198. HM = 3 / (1 + 0.25 + 0.25) = 3 / 1.5 = 2.
Answer: AM 3, GM 2.5198, HM 2
Frequently Asked Questions
When do I use the harmonic mean?
Why is the average speed not just the average of the two speeds?
Why can the harmonic mean not include zero?
What is the relationship between AM, GM and HM?
What do the weights mean in the weighted version?
Does it work with negative values?
Related Statistics Calculators
Probability Calculator
Calculate probability of events, complements, unions, and intersections. Free online probability calculator for statistics.
Standard Deviation Calculator
Calculate standard deviation, variance, mean, and more for any dataset. Supports population and sample statistics. Free online tool.
Z-Score Calculator
Calculate z-scores, find values from z-scores, and determine probabilities. Free online z-score calculator with bell curve visualisation.
Binomial Calculator
Calculate binomial probabilities, cumulative distributions, and expected values. Free online binomial distribution calculator with bar chart.
Normal Distribution Calculator
Calculate probabilities for normal distributions. Find areas under the bell curve, percentiles, and inverse values. Free online tool.
Correlation Calculator
Calculate Pearson correlation coefficient, R-squared, and regression line. Free online correlation calculator with scatter plot.