Harmonic Mean Calculator Formula

Understand the math behind the harmonic mean calculator. Each variable explained with a worked example.

Formulas Used

Harmonic Mean

harm_mean = 2 / (1/a + 1/b)

Arithmetic Mean (for comparison)

arith_mean = (a + b) / 2

Variables

VariableDescriptionDefault
aValue 140
bValue 260
recip_sumDerived value= 1/a + 1/bcalculated

How It Works

How to Compute the Harmonic Mean

Formula (for two values)

Harmonic Mean = 2 / (1/a + 1/b)

More generally for n values: HM = n / (1/v1 + 1/v2 + ... + 1/vn)

The harmonic mean gives more weight to smaller values. It is the correct average to use when the quantities are defined in relation to a common unit, such as speed over the same distance at different rates.

Worked Example

A car travels 100 km at 40 km/h and returns at 60 km/h. What is the average speed?

a = 40b = 60
  1. 01Reciprocal sum = 1/40 + 1/60 = 0.025 + 0.01667 = 0.04167
  2. 02Harmonic Mean = 2 / 0.04167 = 48
  3. 03The average speed is 48 km/h (not 50 as the arithmetic mean would suggest)

Ready to run the numbers?

Open Harmonic Mean Calculator