Harmonic Mean Calculator
Calculate the harmonic mean of a set of numbers.
Enter strictly positive numbers. Zeros and negatives are filtered out. For speeds, enter values in consistent units (km/h, mph, etc.).
About
The harmonic mean of n positive numbers is the reciprocal of the arithmetic mean of their reciprocals: HM = n / Σ(1/xᵢ). Equivalently, HM = n / (1/x₁ + 1/x₂ + … + 1/xₙ). It weights small values more heavily than the arithmetic mean — for {1, 2, 4}: AM = 2.333, GM = 2, HM = 1.714. The harmonic mean is the right average when the data represents rates measured over a fixed denominator: speed over a fixed distance, throughput over a fixed batch, resistance in a parallel circuit.
The classic example is round-trip speed. If you drive 100 km at 50 km/h, then return at 100 km/h, the average speed is the harmonic mean 2 / (1/50 + 1/100) = 66.67 km/h, not the arithmetic mean of 75 km/h. The arithmetic mean is wrong because you spend twice as long at the slower speed, and the harmonic mean correctly weights by time. The same logic applies to electrical resistors in parallel: 1/R_total = Σ 1/Rᵢ, so R_total = n × HM(Rᵢ) / n = HM(Rᵢ) / n.
The AM–GM–HM inequality is a foundational result: AM ≥ GM ≥ HM, with equality only when all values are equal. The gap between the three means measures how unequal the data is — large gaps indicate skewed distributions where the arithmetic mean overstates the typical value, the harmonic mean understates it, and the geometric mean sits in the middle. For nearly-equal data, all three converge.
In finance, the harmonic mean is used to average price-to-earnings (P/E) ratios when the portfolio is equally weighted in cash (rather than equally weighted in shares). If you invest equal dollar amounts in stocks with P/E ratios 10, 15, and 20, the average P/E you actually pay is HM(10, 15, 20) = 3 / (1/10 + 1/15 + 1/20) = 13.85, not the arithmetic 15. The harmonic mean correctly captures that more shares are bought at cheaper prices.
The harmonic mean requires strictly positive values. A zero makes 1/x undefined (division by zero); a negative breaks the reciprocal structure. For data with zeros or negatives, use the arithmetic mean or transform the data to be strictly positive first. This calculator filters out zeros and negatives automatically — if no valid values remain, it reports an error.
How to Use
- 1Enter positive data valuesType strictly positive numbers separated by commas or spaces (e.g., 30, 60, 90 for speeds in km/h). The harmonic mean requires non-zero positive values — zeros and negatives are filtered out.
- 2Read the harmonic meanThe hero shows HM = n / Σ(1/x) computed directly. Below: the arithmetic and geometric means for comparison, the count, and the sum of reciprocals.
- 3Compare AM, GM, HMThe breakdown lists all three Pythagorean means. Verify AM ≥ GM ≥ HM with equality only when all values are equal. The gap between them measures inequality in the data.
- 4Use the comparison tableThe table shows common datasets with all three means side by side, so you can see how each reacts to outliers, skew, and equal values.
- 5Apply to your use caseUse HM for rates over a fixed denominator (speed over fixed distance, throughput, resistance in parallel). For multiplicative growth use GM; for additive quantities use AM.
Formula
Harmonic mean (direct form):
HM = n / Σ_i=1..n (1 / xᵢ) = n / (1/x₁ + 1/x₂ + … + 1/xₙ)
Reciprocal form:
1 / HM = (1/n) × Σ (1 / xᵢ) (arithmetic mean of reciprocals)
Pythagorean means inequality:
AM ≥ GM ≥ HM with equality iff x₁ = x₂ = … = xₙ
For two values: (a + b) / 2 ≥ √(ab) ≥ 2 / (1/a + 1/b) = 2ab / (a + b)
Average speed over fixed distance D:
Given speeds v₁, v₂ over equal distance D:
avg speed = 2D / (D/v₁ + D/v₂) = 2 / (1/v₁ + 1/v₂) = HM(v₁, v₂)
Worked Example
Example 1 — Round-trip speed:
- Drive 100 km at 50 km/h, return at 100 km/h.
- AM = (50 + 100) / 2 = 75 km/h (wrong!)
- HM = 2 / (1/50 + 1/100) = 2 / 0.03 = 66.67 km/h (correct).
- Why: total time = 2 + 1 = 3 hours for 200 km → 66.67 km/h.
Example 2 — Three numbers {1, 2, 4}:
- AM = (1 + 2 + 4) / 3 = 2.333.
- GM = (1 × 2 × 4)^(1/3) = 8^(1/3) = 2.
- HM = 3 / (1 + 0.5 + 0.25) = 3 / 1.75 = 1.714.
- Note AM (2.333) ≥ GM (2) ≥ HM (1.714) ✓.
Example 3 — Parallel resistors (3Ω and 6Ω):
- 1/R_total = 1/3 + 1/6 = 1/2.
- R_total = 2Ω. HM(3, 6) = 2 / (1/3 + 1/6) = 4Ω.
- R_total = HM(R₁, R₂) / n = 4 / 2 = 2Ω ✓.
Tips
- Use the harmonic mean for rates over a fixed denominator (speed over fixed distance, throughput, parallel resistance). For rates over a fixed numerator (distance over fixed time), use the arithmetic mean.
- The harmonic mean is undefined for zero (division by zero) and meaningless for negatives. Filter such values out before computing — for data with zeros or negatives, the arithmetic mean is the only valid choice.
- The Pythagorean means are ordered: AM ≥ GM ≥ HM with equality only when all values are equal. The gap between the three measures inequality in the data.
- The harmonic mean weights small values more heavily — for {1, 2, 4}: AM = 2.333, GM = 2, HM = 1.714. This is why HM is the right choice when small rates dominate the average.
- For parallel resistors R₁, R₂, …, Rₙ, the equivalent resistance is 1 / Σ(1/Rᵢ) = HM(Rᵢ) / n — the harmonic mean divided by n. The same formula applies to spring constants and other parallel reciprocal systems.
Common Mistakes
The most common mistake is using the arithmetic mean for average speed over a fixed distance — the answer is wrong because you spend more time at the slower speed. Always use the harmonic mean when averaging rates over a common denominator. A second error is including zero or negative values, which break the reciprocal structure — the HM is defined only for strictly positive numbers. A third is forgetting the HM weights small values more heavily; for{1, 100, 100}, HM = 2.94, much closer to 1 than the arithmetic 67. Finally, do not confuse the harmonic mean with the arithmetic mean of reciprocals — the latter is 1/HM, not HM itself.
Frequently Asked Questions
- What is the harmonic mean?
- The harmonic mean of n positive numbers is the reciprocal of the arithmetic mean of their reciprocals: HM = n / Σ(1/xᵢ). Equivalently, HM = n / (1/x₁ + 1/x₂ + … + 1/xₙ). It is the right average when the data represents rates or speeds measured over a fixed unit — like kilometers per hour over a fixed distance, or jobs per hour.
- When should I use the harmonic mean?
- Use the harmonic mean when averaging rates that share a common denominator — for example, average speed over a fixed distance (60 km at 30 km/h, then 60 km at 60 km/h). The arithmetic mean gives 45 km/h, but the true average speed is HM = 2 / (1/30 + 1/60) = 40 km/h. Use AM for distances over fixed time; HM for times over fixed distance.
- Why is AM ≥ GM ≥ HM always true?
- By the AM–GM–HM inequality, the arithmetic mean is always ≥ geometric mean, which is always ≥ harmonic mean, with equality only when all values are identical. The gap between the three means measures how unequal the data is — large gaps indicate skewed distributions where the AM overstates the typical value.
- Can the harmonic mean handle zero or negative values?
- No — the harmonic mean is defined only for strictly positive numbers. A zero makes 1/x undefined (division by zero); a negative breaks the reciprocal structure. For data with zeros or negatives, use the arithmetic mean or transform the data to be strictly positive first.
- How is the harmonic mean related to electrical resistors and speeds?
- For electrical resistors or conductances in parallel, the total is the harmonic mean (resistance) or arithmetic mean (conductance) — the parallel formula 1/R = 1/R₁ + 1/R₂ gives the harmonic mean. For round-trip speeds over the same distance, the average speed is the harmonic mean of the two one-way speeds, never the arithmetic mean.
- How does the harmonic mean differ from the arithmetic and geometric means?
- The harmonic mean emphasizes the smallest values; the arithmetic mean emphasizes the largest. For {1, 2, 4}, AM = 2.333, GM = 2, HM = 1.714 — HM is closest to the smallest value. This is why HM is the right choice when small rates dominate the average, like slow steps in a multi-step process.
Harmonic mean
The harmonic mean of n positive numbers is the reciprocal of the arithmetic mean of their reciprocals: HM = n / Σ(1/xᵢ). Equivalently, HM = n / (1/x₁ + 1/x₂ + … + 1/xₙ). It weights small values more heavily than the arithmetic mean, making it the right choice when averaging rates that share a common denominator — like speeds over a fixed distance.
When to use (rates, speeds)
Use HM when averaging rates over a fixed denominator. If you drive 60 km at 30 km/h then 60 km at 60 km/h, the average speed is HM = 2 / (1/30 + 1/60) = 40 km/h, not the arithmetic 45 km/h — you spend twice as long at the slower speed. The same applies to throughput, batch processing, and electrical resistors in parallel.
AM ≥ GM ≥ HM
The Pythagorean means are ordered: arithmetic ≥ geometric ≥ harmonic, with equality only when all values are equal. For{1, 2, 4}: AM = 2.333, GM = 2, HM = 1.714. The gap between the three measures how unequal the data is — large gaps indicate skewed distributions where AM overstates the typical value and HM understates it.
Real-world examples (avg speed)
Round-trip speed: drive 100 km at 50 km/h, return at 100 km/h. Average speed = HM = 2 / (1/50 + 1/100) = 66.67 km/h, not AM = 75 km/h. Parallel resistors: two resistors of 6Ω and 3Ω in parallel give 1/R = 1/6 + 1/3 = 1/2, so R = 2Ω = HM(3, 6) / 2. For n resistors, R_parallel = 1 / Σ(1/Rᵢ) = HM / n.
| Dataset | Arithmetic mean | Geometric mean | Harmonic mean | Notes |
|---|---|---|---|---|
| 2, 8 | 5 | 4 | 3.2 | AM > GM > HM |
| 1, 2, 4 | 2.3333 | 2.0000 | 1.7143 | Powers of 2 |
| 30, 60 | 45 | 42.4264 | 40.0000 | Round-trip speeds |
| 50, 100 | 75 | 70.7107 | 66.6667 | Round trip → HM = 66.67 |
| 100, 100, 100 | 100 | 100 | 100 | All equal → AM = GM = HM |
| 3, 6 | 4.5 | 4.2426 | 4 | Parallel resistors |
The three Pythagorean means — arithmetic, geometric, and harmonic — are unified by the AM–GM–HM inequality: AM ≥ GM ≥ HM, with equality only when all values are equal. The arithmetic mean is the right choice for additive quantities (heights, weights, counts), the geometric mean for multiplicative growth (returns, rates), and the harmonic mean for rates over a fixed denominator (speeds, throughput). Each is the "correct" average for a different class of problem.
The harmonic mean has a beautiful physical interpretation: it is the equivalent resistance of n equal resistors in parallel, multiplied by n. For two resistors of 3Ω and 6Ω in parallel, the equivalent is 1 / (1/3 + 1/6) = 2Ω. The harmonic mean of 3 and 6 is 4Ω, so the parallel combination is 4 / 2 = 2Ω — exactly the formula. The same structure applies to springs in parallel, conductances in series, and any reciprocal-linear system.
Authoritative References
- Wikipedia — Harmonic mean— wikipedia.orgComprehensive treatment of the harmonic mean, including the AM–GM–HM inequality, applications to speeds and resistors, and weighted harmonic means in finance (P/E ratios).
- Khan Academy — Mean, median, mode— khanacademy.orgKhan Academy unit on summarizing quantitative data, including the arithmetic, geometric, and harmonic means and when to use each.
- Wolfram MathWorld — Harmonic Mean— wolfram.comEric Weisstein's reference on the harmonic mean with formal properties, the AM–GM–HM inequality, and applications to electrical networks.
Try our other free calculators
CalcGenius has 1,200+ free, ad-free, browser-based calculators for finance, health, math, science, and everyday life. No sign-up required.