How to calculate the harmonic mean
Calculate the harmonic mean H = n/Σ(1/xᵢ): average speeds, P/E ratios, parallel resistances, F1-score. Comparison with arithmetic and geometric mean with verified examples.
Report a calculation error
Help us improve. Describe what is wrong with the calculation.
Result
| Voce | Valore |
|---|
Show full details
Share result
Disclaimer: this calculation is for informational purposes only. For important decisions, consult a qualified professional.
How to calculate the harmonic mean lets you find the appropriate average when data represent rates, speeds, frequencies, or ratios. The formula is H = n / Σ(1/xᵢ): the number of elements divided by the sum of reciprocals. The harmonic mean is always ≤ the geometric mean, which is ≤ the arithmetic mean (HM-GM-AM inequality, Cauchy 1821). It is used for speeds with equal distances, aggregated P/E ratios, parallel resistances, F1-scores in machine learning, and averaging growth rates, per NIST Engineering Statistics Handbook standards.
Formula and definition
Given n positive observations x₁, x₂, ..., xₙ, the harmonic mean is: H = n / (1/x₁ + 1/x₂ + ... + 1/xₙ). For two values it simplifies to H = 2x₁x₂ / (x₁ + x₂). For the weighted version: H = Σwᵢ / Σ(wᵢ/xᵢ), where wᵢ are weights, used by US Census Bureau and Federal Reserve.
The HM ≤ GM ≤ AM inequality always holds, with equality only if all values are identical. For two values 40 and 60: H = 48, G = √(40·60) = 48.99, A = 50. The HM-AM gap grows with value dispersion; for identical data (50, 50) all means coincide. Derivation follows from Hardy-Littlewood-Pólya generalized means theory (1934), foundational in NIST mathematical statistics.
History and mathematical context
The harmonic mean was studied by the Pythagoreans (6th century BCE) in musical proportion contexts: the 1:1/2:1/3 ratio corresponds to consonant interval frequencies. Archytas of Tarentum (430-360 BCE) defined it as the "third mean" after arithmetic and geometric. The term "harmonia" derives from musical chord harmony. Cauchy (Cours d'Analyse, 1821) and Schwarz rigorously proved the HM ≤ GM ≤ AM inequality.
In modern applications, NIST uses harmonic mean in measurement statistics. NHS uses it for healthcare cost aggregation. The F1-score in machine learning is a harmonic mean of precision and recall (lowering one automatically lowers F1). The CDC applies it for outbreak rate aggregation, FDA for drug efficacy ratios, and the SEC for portfolio P/E aggregation. NASA also uses it for averaging satellite velocity components.
Comparison table arithmetic/geometric/harmonic means
| Values | Arithmetic | Geometric | Harmonic | AM-HM gap |
|---|---|---|---|---|
| 10, 10 | 10.00 | 10.00 | 10.00 | 0% |
| 40, 60 | 50.00 | 48.99 | 48.00 | 4% |
| 1, 100 | 50.50 | 10.00 | 1.98 | 96% |
| 2, 4, 8 | 4.67 | 4.00 | 3.43 | 27% |
| 5, 10, 15, 20 | 12.50 | 10.61 | 9.07 | 27% |
| 30, 50, 70, 90 | 60.00 | 56.12 | 52.03 | 13% |
| 0.1, 0.5, 1, 5 | 1.65 | 0.71 | 0.30 | 82% |
Means converge for similar values and diverge significantly for dispersed values. The harmonic mean is particularly sensitive to small values, hence its use when small values dominate (parallel resistors, long times).
5 verified numerical examples
- Average speed at equal distance: outbound 60 mph and return 100 mph on same route. Average speed = H(60, 100) = 2·60·100/(60+100) = 75 mph, NOT 80 (common AM error).
- Parallel resistors: three resistors 10Ω, 20Ω, 30Ω. R_eq = 1/(1/10 + 1/20 + 1/30) = 5.455Ω. Standard IEEE 1241-2010.
- Aggregated portfolio P/E: 3 stocks with P/E 15, 25, 50. Harmonic mean = 3/(1/15 + 1/25 + 1/50) = 22.06; arithmetic = 30.00. The harmonic better reflects aggregate earnings yield (total EPS/Price).
- F1-score machine learning: precision 0.80 and recall 0.60. F1 = 2·0.80·0.60/(0.80+0.60) = 0.686. Penalizes the low recall value more than AM (0.70). Standard scikit-learn library.
- Average task completion time: 4 machines complete in 3, 4, 5, 6 hours. Harmonic average time = 4/(1/3+1/4+1/5+1/6) = 4.11 hours. Reflects the effective "average" machine considering completion rates (1/time).
Model limitations
Three main limits to harmonic mean usage:
- Doesn't work with zero or negative values: division 1/0 is undefined; negative values give paradoxical results. For mixed positive/negative data use arithmetic mean or transform data (e.g., absolute values), per NIST Statistical Engineering Handbook.
- Small outlier sensitivity: a value near zero dominates the mean, similar to a short-circuit. Example: H(1, 100, 100) = 2.97 vs A = 67. A single small value drastically reduces harmonic mean.
- Contextual interpretation: use HM only when data are rates or ratios with a constant physical denominator. For additive quantities (weights, monetary amounts, counts) arithmetic mean is correct.
Common errors
- Using AM for speeds: at equal distances but different times, average speed is harmonic, not arithmetic. Common in physics homework.
- F1-score with AM: F1 must be harmonic to penalize unbalanced classifiers; AM would show false optimism.
- Index P/E mean: indices (S&P 500, FTSE 100) use aggregate P/E (sum earnings / sum prices), a weighted harmonic mean.
- Network speed calculation: bandwidth in series is harmonic; parallel is sum. Common error in enterprise network sizing per Cisco design guides.
- Average density: for mixtures at equal volume use AM; equal mass use HM. Frequent error in chemistry and ASTM E12 density standards.
- Productivity indices: average time per unit is harmonic if units are equal (e.g., machines), arithmetic if different (e.g., labor-hours).
Numbered practical applications
- Round-trip average speed: 100 mi at 80 mph and 100 mi at 50 mph. H = 2·80·50/(80+50) = 61.5 mph.
- Parallel resistors electronics: voltage divider design with 100Ω, 220Ω, 470Ω: R_eq = 56.5Ω. Standard IEEE/IEC 60063.
- F1-score ML models: classifier evaluation with precision 0.75 and recall 0.90: F1 = 0.818. Standard scikit-learn and TensorFlow.
- P/E ratio index funds: ETF with stocks at P/E 12, 18, 25, 40: aggregate harmonic P/E = 19.1 (vs arithmetic 23.75). Reflects index earnings yield.
- Composite alloy density: alloys at equal mass, average density = HM of individual ρ. Stainless steel AISI 304 ρ = 8.0 g/cm³, ASTM A240.
- Series capacitors: 3 capacitors 10μF, 22μF, 47μF in series: C_eq = 1/(1/10+1/22+1/47) = 5.82μF. IEC 60384 standard.
- Composite thermal conductivity: layered wall perpendicular to flow → HM. ISO 6946 thermal insulation standard for buildings.
For technical support: info@calcoi.com.
Updated July 2026
Comments (0)
Login to leave a comment.
No comments yet. Be the first!