Harmonic Mean Calculator
Harmonic Mean Calculator
What Is a Harmonic Mean Calculator?
A harmonic mean calculator computes HM = n / Σ(1/xᵢ) and compares it against the geometric mean (GM) and arithmetic mean (AM). Pre-filled with the geometric sequence {1, 2, 4, 8, 16}: HM ≈ 2.581, GM = 4.0, AM = 6.2 — demonstrating the AM≥GM≥HM inequality. The reciprocals table shows exactly how each value contributes to the calculation.
The Harmonic Mean Formula
HM = n / (1/x₁ + 1/x₂ + ... + 1/xₙ). Equivalently: HM = n / Σ(1/xᵢ). For two values a and b: HM = 2ab/(a+b). The harmonic mean is the reciprocal of the arithmetic mean of the reciprocals. This gives smaller values more weight — essential when averaging rates where the denominator matters.
The AM-GM-HM Inequality
For any set of positive numbers: Arithmetic Mean ≥ Geometric Mean ≥ Harmonic Mean. Equality holds only when all values are equal. This inequality has deep mathematical significance — it appears in optimization, information theory, and geometry. The geometric mean sits exactly between AM and HM on a multiplicative scale.
Speed Averaging: The Classic Example
You drive 100 km at 60 km/h and return 100 km at 100 km/h. Average speed = HM(60, 100) = 2×60×100/(60+100) = 75 km/h. Verify: time out = 100/60 = 1.667h, time back = 100/100 = 1h, total 200 km in 2.667h = 75 km/h ✓. Always use harmonic mean for equal-distance averaging. Use arithmetic mean for equal-time averaging.
The F₁ Score in Machine Learning
F₁ = 2 × (Precision × Recall) / (Precision + Recall) = harmonic mean of precision and recall. Using the harmonic mean instead of arithmetic mean ensures that a high F₁ score requires both precision AND recall to be high. A model with precision=1.0 and recall=0.01 would get AM=0.505 (misleadingly high) but F₁=0.0198 (correctly low). This makes F₁ the standard binary classification metric.
P/E Ratio Aggregation
For an equal-dollar-weighted portfolio, the correct aggregate P/E is the harmonic mean: HM P/E = n / Σ(1/P/Eᵢ). If you invest $10,000 each in 3 stocks with P/E of 10, 20, 30: each dollar buys different amounts of earnings. HM P/E = 3/(0.1+0.05+0.033) = 3/0.183 = 16.4, not the arithmetic mean of 20. Many financial databases incorrectly report arithmetic P/E averages, understating value.
Frequently Asked Questions
Related Calculators
Home Loan Calculator
Calculate home loan EMI, total interest, and amortization schedule.
Auto Loan Calculator
Detailed auto loan with trade-in, taxes, fees, and amortization.
Bike Loan Calculator
Calculate bike loan EMI, total cost, and repayment breakdown.
Boat Loan Calculator
Estimate boat financing payments, interest, and amortization.
Student Loan Calculator
Calculate student loan payments with income-driven repayment plans.
Gold Loan Calculator
Calculate gold loan amount based on gold weight, purity, and LTV ratio.
USDA Loan Calculator
Calculate USDA loan payments with guarantee fee and income eligibility.
Loan Against Property Calculator
Calculate LAP EMI based on property value and loan-to-value ratio.