How the three means are calculated
These are the classical "Pythagorean means" — three ways to average two positive numbers, each built for a different kind of quantity.
- a, b — the two positive numbers
- AM — arithmetic mean — simple average
- GM — geometric mean — square root of the product
- HM — harmonic mean — reciprocal of the average of reciprocals
More detail
AM ≥ GM ≥ HM, always
For any two positive numbers, the arithmetic mean is never smaller than the geometric mean, which is never smaller than the harmonic mean. This is the AM-GM-HM inequality, a standard result in mathematics. The three values only meet — all equal — when a = b.
When to use which mean
Arithmetic mean fits everyday averaging (test scores, prices). Geometric mean fits growth rates and ratios (e.g. averaging annual returns). Harmonic mean fits rates over a fixed quantity, like averaging speeds over the same distance — a trip at 30 km/h and 60 km/h over equal distances averages to 40 km/h, not 45.
Quick check. Set a = b to any everyday value — all three means collapse to that same number, which is a fast way to sanity-check the calculator. Above roughly 9.5e153 the harmonic mean overflows double precision — its numerator is 2ab — and above 1.35e154 the product ab itself overflows, so the geometric mean follows.
Frequently asked questions
What's the difference between arithmetic and geometric mean?
Arithmetic mean is (a+b)/2, the familiar average. Geometric mean is √(ab), the square root of the product — it's more appropriate for values that multiply together, like growth rates or ratios, since it doesn't overweight large outliers the way a plain average can.
When should I use the harmonic mean instead?
Harmonic mean (2ab/(a+b)) is the right average for rates measured over a fixed base, like speed over the same distance. For example, driving equal distances at 30 km/h and 60 km/h averages to 40 km/h — the harmonic mean — not the arithmetic mean of 45.
Is AM always greater than or equal to GM and HM?
Yes — the AM-GM-HM inequality guarantees AM ≥ GM ≥ HM for any two positive numbers, with equality only when a = b. Try a = 4, b = 16 above: AM = 10, GM = 8, HM = 6.4, matching the inequality.
Why does the calculator show "—" for some inputs?
All three means require both numbers to be strictly positive (a > 0, b > 0) — geometric and harmonic mean aren't defined for zero or negative inputs in this standard form, so the calculator shows "—" instead of a misleading number.
Why are all three means equal when a = b?
When a = b, (a+b)/2 = a, √(a·a) = a, and 2a²/(2a) = a — every formula reduces to the same value. This is also the equality case of the AM-GM-HM inequality: the means only coincide when there's no spread between the two numbers.