You're reading: Irregulars

Taming the AGM

This post is in response to Peter’s post introducing the Approximate Geometric Mean.

The approximate geometric mean (AGM) is a nice approximation of the geometric mean (GM), but it has some quirks as we will see. After a discussion at the MathsJam gathering, I was intrigued to find out how good an approximation it is.

To get a better understanding, we first have to look again at its definition. For A=a10x and B=b10y, we set

AGM(A,B):=AM(a,b)10AM(x,y)

where AM stands for the arithmetic mean. This makes also sense when a and b are not just integers between 1 and 10, but any real numbers. Note that we won’t consider negative A and B (i.e. negative a and b), as the geometric mean runs into issues if we do so. The values of x and y may be negative, though. The AGM looks like a mix between the AM and the GM, so what can possibly go wrong?

Same mean, different numbers

In contrast to the AM and the GM, the AGM depends on the number base (10 in this case) and the presentation of A and B.

If we write A=(10a)10(x1), we get a different value for AGM(A,B). This looks rather unfortunate, but it will turn out to be helpful. To ease notation we will assume in the following that ab unless otherwise stated. This can be done without loss of generality as AGM(A,B)=AGM(B,A).

Peter Rowlett proved in his post that GMAGM. The question is, how far can the AGM exceed the GM? In other words, what’s the supremum of the ratio R=AGM/GM?

Using the notation of A and B as above we get
R=AGM(A,B)GM(A,B)=AM(a,b)GM(a,b)=12(a/b+b/a).

So, the ratio R doesn’t depend on x and y but only on a and b. That’s convenient. Taking a and b in the interval [1,10), as is usual, we can look at the plot of R(a,b).3D plot of the function

As long as we are in the blue part of the graph, AGM looks to be a sensible approximation of the GM. So let’s look at the bad combinations of a and b.

The worst case happens when a and b are maximally far apart: The supremum of R(a,b) is its limit for a10 and b=1. So in general, 1R<5.5/101.74.

This supremum doesn’t look too bad at first, but unfortunately, the result can be unusable in extreme cases. For example, if a=999=9.99102 and b=1000=1103, we have GM(A,B)AM(A,B)=999.5 and AGM(A,B)1738 – not only is the AM a better approximation of the GM than the AGM in this instance, the AGM is bigger than both the numbers A and B of which it is supposed to give some kind of mean!

Let’s analyse this a bit deeper. The ratio R only depends on the ratio r=a/b. In closed form we can write R(r)=1/2(r+r1) and we are left to study this function in the range [1,10]. Its maximum is R(10), but smaller r give better results. And we will see, that we don’t have to put up with r=10.

Here, the flexibility of the definition of the AGM comes into play. Due to the choice of a suitable presentation of the numbers we can guarantee that r isn’t too big. If we have r10 which is equivalent to 10bab we calculate AGM(A,B) as above. If a>10b, we change the presentation of the number:

B=b10y=(10b)10y1=:b10y1
and continue from there.

So, let’s redefine the AGM for 10>ab1 like this:

AGM(A,B)={AM(a,b)10AM(x,y),10ba,AM(10b,a)10AM(x,y1),otherwise.

Note, that in the second case we have 10a>10b>a, so that the roles of the pair (a,b) are taken over by the pair (10b,a). Setting r=10b/a in the second case, we have in both cases 1r10, so we only have to study R(r) in the interval [1,10], which will turn out to be rather benign.

Note also, that this new AGM can still be calculated without a calculator when using the approximation 103, as Colin Beveridge suggested in Peter’s post.

In the example above with A=999 and B=1000 we write B=10102 and find with this new definition of the AGM:

AGM(999;1000)=AM(9.99;10)10AM(2;2)=999.5,

This coincides with the arithmetic mean of the two numbers and is really close to the geometric mean. This is looking promising.

If we define the AGM of two numbers A and B in the way explained above, we get the following two inequalities:

(I)GM(A,B)AGM(A,B)GM(A,B)1.2(II)GM(A,B)AGM(A,B)AM(A,B)Both inequalities together mean that not a lot can go wrong when using the AGM with the appropriate presentation of the numbers: The AGM is bigger than the GM, but exceeds it by maximally 20%, and it is always smaller than the AM.

As a consequence, the AGM will always be between A and B. So it is indeed a “mean” of some kind.

A proof of these two inequalities

(I) We only have to find the maximum of R=AGM/GM. Due to the discussion above we can assume that 10bab, but a can now be bigger than 10. The latter is not a problem though.

The maximum of R=AGM(A,B)/GM(A,B)=AM(a,b)/GM(a,b) is attained when a and b are maximally apart, i.e. r=10, so
max(AGM(A,B)GM(A,B))=12(101/4+101/4)1.2.

(II) We will show that AGM(A,B)/AM(A,B)1. Let’s drop the assumption that ab. Instead we assume, again without loss of generality, that xy, so that we can set z=:xy0. For the ratio r=a/b we have 10r1/10. If r fell outside this interval, we would have had to change the presentation of one of the numbers before calculating the AGM. Dividing the numerator and denominator in the above inequality by B we get:
AGM(A,B)AM(A,B)=(1+r)10z/21+r10z.

So we look for an upper bound of the function fz(r):=(1+r)10z/21+r10z when varying z and r and want to show that this upper bound is smaller or equal to 1. Note, that we only have to check for integer z0 (The result is actually false if we allow any real z).

For z=0, we have f0(r)=1 for any r and hence AGM=AM. For a fixed z1 we can derive the function fz(r) with respect to r and find that the slope is always negative. Hence for a fixed z, the function fz(r) attains a maximum when r is smallest, i.e. r=1/10, so we are left to show that

fz(1/10)=(1+101/2)10z/21+10z1/21.

For z=1 we have equality again and AGM=AM. For z2 we can write z=2+z with z being an integer 0. We get the following chain of inequalities

fz(110)=(1+101/2)10(2+z)/21+103/2+z<2101+z/2103/2+z210<1.

This proves the second inequality. ☐

In summary, modifying the definition of the AGM to assure that the ratio of the “leading characters” is as close to 1 as possible, makes sure that the AGM works well, even in the bad cases.

One Response to “Taming the AGM”

(will not be published)

LATEX: You can use LaTeX in your comments. e.g. $ e^{\pi i} $ for inline maths; \[ e^{\pi i} \] for display-mode (on its own line) maths.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>