Contraharmonic Mean Calculator

Means

contraharmonic mean of 3 and 75.8000
arithmetic mean5.0000
sum of squares a^2 + b^258
sum a + b10
How this was calculated
  1. The contraharmonic mean is C(a, b) = (a^2 + b^2) / (a + b) - the ratio of the sum of squares to the plain sum.
  2. For a = 3 and b = 7 the sum of squares is 58 and the sum is 10, so C = 5.8000.
  3. It always sits at or above the arithmetic mean (5.0000 here): the identity C = A + (a - b)^2 / (2 (a + b)) shows the gap is exactly the squared-difference term.
  4. The contraharmonic mean appears in statistics as a size-biased average and in signal processing; it is also the Lehmer mean at p = 2, the top of the classical ladder.

The contraharmonic mean is the rebel of the classical family: the only common mean that sits above the arithmetic mean. Where the harmonic mean understates and the geometric mean compromises, the contraharmonic mean overstates - deliberately. It is a size-biased average, the mean you get when bigger values are allowed to speak louder.

Its formula could not be simpler: C(a, b) = (a^2 + b^2) / (a + b), the sum of squares divided by the sum. For 3 and 7: the sum of squares is 58, the sum is 10, and C = 5.8 - against an arithmetic mean of 5.0000.

This contraharmonic mean calculator returns the value with the arithmetic mean and the two sums beside it, so the computation is transparent. It also explains itself: the identity C = A + (a - b)^2 / (2 (a + b)) shows exactly how far above the arithmetic mean the answer must sit, and why.

Worked examples

Contraharmonic mean of 3 and 7

(3 · 7)

contraharmonic mean of 3 and 75.8000
arithmetic mean5.0000
sum of squares a^2 + b^258
sum a + b10

Contraharmonic mean of 2 and 8

(2 · 8)

contraharmonic mean of 2 and 86.8000
arithmetic mean5.0000
sum of squares a^2 + b^268
sum a + b10

Equal inputs 5 and 5

(5 · 5)

contraharmonic mean of 5 and 55.0000
arithmetic mean5.0000
sum of squares a^2 + b^250
sum a + b10

The formula

C(a, b) = (a^2 + b^2) / (a + b). Square each number, add the squares, divide by the plain sum. For 2 and 8: squares 4 and 64 sum to 68, the plain sum is 10, and C = 6.8. For equal inputs the formula collapses: C(5, 5) = (25 + 25) / 10 = 5, the common value - every mean must agree there, and this one does.

An equivalent reading: C is the arithmetic mean weighted by the values themselves, (a x a + b x b) / (a + b). Weighting by size is the whole point, and it is why the contraharmonic mean is also the Lehmer mean at p = 2 - the top of that family's classical ladder.

  • C(a, b) = (a^2 + b^2) / (a + b)
  • C(3, 7) = 58 / 10 = 5.8; C(2, 8) = 68 / 10 = 6.8
  • Also the Lehmer mean at p = 2

Why it exceeds the arithmetic mean

The identity C = A + (a - b)^2 / (2 (a + b)) settles the comparison exactly. The correction term is a square divided by a positive quantity, so it is never negative: the contraharmonic mean is always at least the arithmetic mean, and strictly greater whenever a and b differ. For 3 and 7 the correction is (3 - 7)^2 / (2 x 10) = 16 / 20 = 0.8, and indeed 5.0000 + 0.8 = 5.8.

The correction grows with the spread between the inputs. For 2 and 8 it is (2 - 8)^2 / (2 x 10) = 36 / 20 = 1.8, lifting the arithmetic mean 5.0000 to 6.8. Widely separated inputs are where the contraharmonic mean earns its name - it leans into the larger value hardest exactly when the values disagree most.

  • C = A + (a - b)^2 / (2 (a + b))
  • 3 and 7: correction 0.8, total 5.8
  • 2 and 8: correction 1.8, total 6.8

A size-biased average

In statistics, an average weighted by the size of each observation is called size-biased, and it arises naturally: pick a random person and ask how big their family is, and large families are over-represented in the answers, because they contain more people to ask. The contraharmonic mean is the two-value emblem of that phenomenon - the mean as experienced by the values, not by the slots.

Signal processing uses the same bias on purpose. Contraharmonic filtering of images, with the mean applied over pixel neighbourhoods, suppresses dark impulse noise ('pepper') because bright pixels dominate the local average; reversing the sign convention attacks bright ('salt') noise instead. The bias is a feature, tuned by the application.

  • Size-biased: values weighted by themselves
  • The inspection paradox in miniature
  • Contraharmonic filters suppress impulse noise

Place in the family

The full classical chain for distinct positive numbers reads harmonic < geometric < logarithmic < identric < arithmetic < contraharmonic. The contraharmonic mean is the ceiling of the standard family - the largest mean in everyday use. For 3 and 7 the top of the chain is 5.8 against the arithmetic 5.0000, and even the quadratic (root-mean-square) mean sits below the contraharmonic value.

Within the Lehmer family the contraharmonic mean is the p = 2 stop, and within the broader theory of means it is the standard counterexample to any claim that 'a mean' must lie below the arithmetic mean. It lies between the inputs - 5.8 is between 3 and 7 - but it hugs the top of the interval.

  • Ceiling of the classical chain
  • Always between the inputs, hugging the larger
  • Lehmer p = 2

Worked examples

Three computations anchor the page. C(3, 7) = 5.8: squares sum 58, sum 10. C(2, 8) = 6.8: squares sum 68, sum 10 - the same denominator, a larger numerator, because the spread is wider. C(5, 5) = 5: squares sum 50, sum 10, and the correction term vanishes because a - b = 0.

The trio is a complete diagnostic kit. If a contraharmonic computation gives less than the arithmetic mean, it is wrong. If it gives the arithmetic mean for distinct inputs, it is wrong. If it gives anything outside the input interval, it is wrong. The correct answers pass all three tests trivially.

  • C(3, 7) = 5.8; C(2, 8) = 6.8; C(5, 5) = 5
  • Never below the arithmetic mean
  • Never outside the input interval

When to use it (and when not to)

Use the contraharmonic mean when the quantity being averaged is genuinely experienced in proportion to size: total cost per unit where large units dominate expenditure, average load where large loads dominate wear, or any 'average per participant' where participants cluster in large groups. In those settings the arithmetic mean answers a question nobody asked, and the contraharmonic mean answers the real one.

Avoid it for rates over fixed bases (that is harmonic territory), for growth factors (geometric), and whenever each observation should count once regardless of size (arithmetic). Choosing a mean is choosing a weighting; the contraharmonic choice is 'weight by size', and it should be made on purpose.

  • Use: size-experienced averages
  • Avoid: fixed-base rates, growth factors, equal-weight data
  • A mean is a weighting decision

The inspection paradox in miniature

Stand at a bus stop served by two routes: one bus carries 3 passengers, another carries 7. The arithmetic mean load is 5.0000 passengers per bus. But ask the passengers how crowded their bus was: the 3 on the small bus say 3, the 7 on the large bus say 7, and the average answer is (3 x 3 + 7 x 7) / (3 + 7) = 58 / 10 = 5.8 - the contraharmonic mean. More people experience the larger group precisely because it is larger. This is the inspection paradox, and the contraharmonic mean is its two-value arithmetic.

The same arithmetic governs average class size as experienced by students (larger than the average over classes), average family size as reported by children, and average delay as experienced by passengers. Whenever a report says 'the average X experienced by a participant', a size-biased mean - contraharmonic in the two-value case - is usually the honest statistic, and the gap above the arithmetic mean, (a - b)^2 / (2 (a + b)), measures how misleading the naive average is. For 2 and 8 the gap is 1.8 on a base of 5.0000: the experienced average is 6.8, more than a third higher.

  • Experienced averages are size-biased
  • Bus loads: 5.0000 per bus, 5.8 per passenger
  • The gap formula prices the naive average's error

Using the calculator

Enter two positive numbers. The output is the contraharmonic mean to four decimals, the arithmetic mean for comparison, and the sum of squares and plain sum that produced the result - the entire computation, auditable at a glance. Equal inputs return the common value.

Cross-check with the Lehmer calculator: its p = 2 stop for the same inputs must match this page exactly - for 4 and 9, both give 7.4615.

  • Output includes both sums for audit
  • Arithmetic mean shown alongside
  • Matches the Lehmer page at p = 2

FAQs

What is the contraharmonic mean of 3 and 7?

5.8 - the sum of squares (58) divided by the sum (10). The arithmetic mean is 5.0000, and the contraharmonic mean sits 0.8 above it.

What is the contraharmonic mean formula?

C(a, b) = (a^2 + b^2) / (a + b) - the sum of squares over the sum, equivalently a size-weighted arithmetic mean.

Is the contraharmonic mean larger than the arithmetic mean?

Always at least as large: C = A + (a - b)^2 / (2 (a + b)), and the correction term is never negative. For 2 and 8 the correction is 1.8, giving 6.8 against 5.0000.

What is the contraharmonic mean of 2 and 8?

6.8 - squares sum to 68, the plain sum is 10.

How does the contraharmonic mean relate to the Lehmer mean?

It is the Lehmer mean at p = 2, the top of the classical ladder. Both pages give 7.4615 for 4 and 9.

What is the contraharmonic mean of equal numbers?

The number itself: C(5, 5) = 5, because the correction term (a - b)^2 vanishes.

Sources

Related calculators

Lehmer Mean Calculator
Compute the Lehmer mean (a^p + b^p) / (a^(p-1) + b^(p-1)) for any power p - the family that slides from harmonic (p = 0) through geometric and arithmetic to contraharmonic (p = 2).
Quadratic Mean (RMS) Calculator
The root mean square of up to eight values — the mean that squares first, used for AC voltages, errors and signal levels.
Arithmetic-Geometric Mean Calculator
Gauss's arithmetic-geometric mean of two numbers, iterated to convergence — plus the complete elliptic integral K(k) it unlocks.