Understanding the geometric and harmonic mean calculator — concept and principle
The arithmetic mean is not the only way to average. The geometric mean is the right average for growth factors and ratios, the harmonic mean is the right average for rates such as speeds over equal distances, and the quadratic mean (root mean square, RMS) is used for quantities that act through their squares, such as errors and alternating current. This calculator gives all four for a list of positive numbers.
How it is calculated
For n positive values x₁, …, xₙ:
- Geometric mean GM = (x₁ × x₂ × … × xₙ)^(1/n). The calculator computes it as exp(mean of ln xᵢ), which gives the same value without overflowing on long lists.
- Harmonic mean HM = n ÷ (1/x₁ + 1/x₂ + … + 1/xₙ).
- Arithmetic mean AM = (x₁ + … + xₙ) ÷ n.
- Quadratic mean RMS = √((x₁² + … + xₙ²) ÷ n).
All values must be greater than zero.
The principle
Each mean answers "what single value, used n times, gives the same total effect?". If the effect is a sum, the answer is the AM. If it is a product (growth over several periods), the answer is the GM, because GMⁿ equals the product. If it is a sum of reciprocals (time = distance ÷ speed), the answer is the HM. If it is a sum of squares (energy, variance), the answer is the RMS. For positive numbers these satisfy HM ≤ GM ≤ AM ≤ RMS, with equality only when all values are equal; the gaps grow as the values spread out.
Worked example
- Inputs: 2, 8, 32 (n = 3).
- GM: product = 2 × 8 × 32 = 512, and ∛512 = 8.
- HM: 1/2 + 1/8 + 1/32 = 0.65625, so HM = 3 ÷ 0.65625 ≈ 4.571428571.
- AM: (2 + 8 + 32) ÷ 3 = 42 ÷ 3 = 14.
- RMS: (4 + 64 + 1,024) ÷ 3 = 364, and √364 ≈ 19.07878403.
- Check: 4.571 ≤ 8 ≤ 14 ≤ 19.079, as the inequality predicts.
How to read the result
Because 2, 8, 32 grow by a factor of 4 each step, the GM equals the middle term 8, while the AM of 14 is pulled up by 32. A large gap between HM and RMS means the values are widely spread. Choose the mean that matches how the quantities combine.
Common mistakes
- Averaging growth rates arithmetically: +50% then −50% does not break even. The growth factors are 1.5 and 0.5, and their GM is about 0.866.
- Using the AM of speeds for a trip with equal distances; use the HM instead.
- Entering zero or negative values; the GM and HM are not defined for them here.
- Entering percentages instead of factors in a GM (use 1.05, not 5).
Frequently asked questions
What is the average speed if I drive 60 km/h one way and 40 km/h back?
For equal distances it is the harmonic mean: 2 ÷ (1/60 + 1/40) = 48 km/h, not 50.
Why is the geometric mean used for investment returns?
Returns compound by multiplication. The GM of the growth factors, minus 1, is the constant yearly rate that gives the same final amount.
Where is RMS used?
In electrical engineering (the RMS value of an AC voltage), in physics and in statistics, where the RMS of errors measures typical error size.
Sources: G. H. Hardy, J. E. Littlewood and G. Pólya, Inequalities, Cambridge University Press · P. S. Bullen, Handbook of Means and Their Inequalities, Kluwer Academic Publishers