# Arithmetic-harmonic mean

I’ve written several times about the arithmetic-geometric mean and variations. Take the arithmetic and geometric mean of two positive numbers a and b. Then take the arithmetic and geometric of the means from the previous step. Repeat ad infinitum and the result converges to a limit. This limit is called the arthmetic-geometric mean or AGM.

What if instead of repeatedly taking the arithmetic and geometric means, we repeatedly take the arithmetic and harmonic means? That is, first define

and for integer n > 0 define

and take the limit. We could call this the arithmetic-harmonic mean by analogy with the arithmetic-geometric mean. But it already has another name: the geometric mean! The iteration defined above converges to the geometric mean √(ab). Not only that, it converges quickly.

We can illustrate this with a little Python code.

    a, b = 4, 9

for _ in range(5):
a, b = (a + b)/2, 2*a*b/(a + b)
print(a, b)


This prints the following.

    6.5 5.538461538461538
6.019230769230769 5.980830670926518
6.000030720078644 5.999969280078643
6.000000000078643 5.999999999921357
6.0 6.0


## One thought on “Arithmetic-harmonic mean”

1. If you set b_n=2/a_n, you get the familiar iteration for calculating the square root of 2: the first formula becomes a_n+1 = 1/2 (a_n + 2/a_n), and the second simplifies to b_n+1 = 4/(a_n + 2/(a_n)) = 2/(a_n+1) by the first equation.

Indeed for any x, setting b_n = x/a_n gives the square root of x.