# Arithmetic–geometric mean

Short description: Mathematical function of two real arguments
Plot of the arithmetic–geometric mean $\displaystyle{ \operatorname{agm}(1,x) }$ (in dark blue)

In mathematics, the arithmetic–geometric mean of two positive real numbers x and y is defined as follows:

Call x and y a0 and g0: \displaystyle{ \begin{align} a_0 &= x,\\ g_0 &= y. \end{align} }

Then define the two interdependent sequences (an) and (gn) as

\displaystyle{ \begin{align} a_{n+1} &= \tfrac12(a_n + g_n),\\ g_{n+1} &= \sqrt{a_n g_n}\, . \end{align} }

These two sequences converge to the same number, the arithmetic–geometric mean of x and y; it is denoted by M(x, y), or sometimes by agm(x, y) or AGM(x, y).

The arithmetic–geometric mean is used in fast algorithms for exponential and trigonometric functions, as well as some mathematical constants, in particular, computing π.

The arithmetic–geometric mean can be extended to complex numbers and when the branches of the square root are allowed to be taken inconsistently, it is, in general, a multivalued function.[1]

## Example

To find the arithmetic–geometric mean of a0 = 24 and g0 = 6, iterate as follows:

$\displaystyle{ \begin{array}{rcccl} a_1 & = & \tfrac12(24 + 6) & = & 15\\ g_1 & = & \sqrt{24 \cdot 6} & = & 12\\ a_2 & = & \tfrac12(15 + 12) & = & 13.5\\ g_2 & = & \sqrt{15 \cdot 12} & = & 13.416\ 407\ 8649\dots\\ & & \vdots & & \end{array} }$

The first five iterations give the following values:

n an gn
0 24 6
1 15 12
2 13.5 13.416 407 864 998 738 178 455 042...
3 13.458 203 932 499 369 089 227 521... 13.458 139 030 990 984 877 207 090...
4 13.458 171 481 745 176 983 217 305... 13.458 171 481 706 053 858 316 334...
5 13.458 171 481 725 615 420 766 820... 13.458 171 481 725 615 420 766 806...

The number of digits in which an and gn agree (underlined) approximately doubles with each iteration. The arithmetic–geometric mean of 24 and 6 is the common limit of these two sequences, which is approximately 13.4581714817256154207668131569743992430538388544.[2]

## History

The first algorithm based on this sequence pair appeared in the works of Lagrange. Its properties were further analyzed by Gauss.[1]

## Properties

The geometric mean of two positive numbers is never bigger than the arithmetic mean (see inequality of arithmetic and geometric means). As a consequence, for n > 0, (gn) is an increasing sequence, (an) is a decreasing sequence, and gnM(xy) ≤ an. These are strict inequalities if xy.

M(x, y) is thus a number between the geometric and arithmetic mean of x and y; it is also between x and y.

If r ≥ 0, then M(rx,ry) = r M(x,y).

There is an integral-form expression for M(x,y):[3]

\displaystyle{ \begin{align} M(x,y) &= \frac{\pi}{2} \left( \int_0^\frac{\pi}{2}\frac{d\theta}{\sqrt{x^2\cos^2\theta+y^2\sin^2\theta}} \right)^{-1}\\ &=\pi\left(\int_0^\infty \frac{dt}{\sqrt{t(t+x^2)(t+y^2)}}\right)^{-1}\\ &= \frac{\pi}{4} \cdot \frac{x + y}{K\left( \frac{x - y}{x + y} \right)} \end{align} }

where K(k) is the complete elliptic integral of the first kind:

$\displaystyle{ K(k) = \int_0^\frac{\pi}{2}\frac{d\theta}{\sqrt{1 - k^2\sin^2(\theta)}} }$

Indeed, since the arithmetic–geometric process converges so quickly, it provides an efficient way to compute elliptic integrals via this formula. In engineering, it is used for instance in elliptic filter design.[4]

The arithmetic–geometric mean is connected to the Jacobi theta function $\displaystyle{ \theta_3 }$ by[5]

$\displaystyle{ M(1,x)=\theta_3^{-2}\left(\exp \left(-\pi \frac{M(1,x)}{M\left(1,\sqrt{1-x^2}\right)}\right)\right)=\left(\sum_{n\in\mathbb{Z}}\exp \left(-n^2 \pi \frac{M(1,x)}{M\left(1,\sqrt{1-x^2}\right)}\right)\right)^{-2}, }$

which upon setting $\displaystyle{ x=1/\sqrt{2} }$ gives

$\displaystyle{ M(1,1/\sqrt{2})=\left(\sum_{n\in\mathbb{Z}}e^{-n^2\pi}\right)^{-2}. }$

## Related concepts

The reciprocal of the arithmetic–geometric mean of 1 and the square root of 2 is called Gauss's constant, after Carl Friedrich Gauss.

$\displaystyle{ \frac{1}{M(1, \sqrt{2})} = G = 0.8346268\dots }$

In 1799, Gauss proved[note 1] that

$\displaystyle{ M(1,\sqrt{2})=\frac{\pi}{\varpi} }$

where $\displaystyle{ \varpi }$ is the lemniscate constant.

In 1941, $\displaystyle{ M(1,\sqrt{2}) }$ (and hence $\displaystyle{ G }$) was proven transcendental by Theodor Schneider.[note 2][6][7] The set $\displaystyle{ \{\pi,M(1,1/\sqrt{2})\} }$ is algebraically independent over $\displaystyle{ \mathbb{Q} }$,[8][9] but the set $\displaystyle{ \{\pi,M(1,1/\sqrt{2}),M'(1,1/\sqrt{2})\} }$ (where the prime denotes the derivative with respect to the second variable) is not algebraically independent over $\displaystyle{ \mathbb{Q} }$. In fact,[10]

$\displaystyle{ \pi=2\sqrt{2}\frac{M^3(1,1/\sqrt{2})}{M'(1,1/\sqrt{2})}. }$

The geometric–harmonic mean can be calculated by an analogous method, using sequences of geometric and harmonic means. One finds that GH(x,y) = 1/M(1/x, 1/y) = xy/M(x,y).[11] The arithmetic–harmonic mean can be similarly defined, but takes the same value as the geometric mean (see section "Calculation" there).

The arithmetic–geometric mean can be used to compute – among others – logarithms, complete and incomplete elliptic integrals of the first and second kind,[12] and Jacobi elliptic functions.[13]

## Proof of existence

From the inequality of arithmetic and geometric means we can conclude that:

$\displaystyle{ g_n \leq a_n }$

and thus

$\displaystyle{ g_{n + 1} = \sqrt{g_n \cdot a_n} \geq \sqrt{g_n \cdot g_n} = g_n }$

that is, the sequence gn is nondecreasing.

Furthermore, it is easy to see that it is also bounded above by the larger of x and y (which follows from the fact that both the arithmetic and geometric means of two numbers lie between them). Thus, by the monotone convergence theorem, the sequence is convergent, so there exists a g such that:

$\displaystyle{ \lim_{n\to \infty}g_n = g }$

However, we can also see that:

$\displaystyle{ a_n = \frac{g_{n + 1}^2}{g_n} }$

and so:

$\displaystyle{ \lim_{n\to \infty}a_n = \lim_{n\to \infty}\frac{g_{n + 1}^2}{g_{n}} = \frac{g^2}{g} = g }$

## Proof of the integral-form expression

This proof is given by Gauss.[1] Let

$\displaystyle{ I(x,y) = \int_0^{\pi/2}\frac{d\theta}{\sqrt{x^2\cos^2\theta+y^2\sin^2\theta}} , }$

Changing the variable of integration to $\displaystyle{ \theta' }$, where

$\displaystyle{ \sin\theta = \frac{2x\sin\theta'}{(x+y)+(x-y)\sin^2\theta'} , }$

gives

\displaystyle{ \begin{align} I(x,y) &= \int_0^{\pi/2}\frac{d\theta'}{\sqrt{\bigl(\frac12(x+y)\bigr)^2\cos^2\theta'+\bigl(\sqrt{xy}\bigr)^2\sin^2\theta'}}\\ &= I\bigl(\tfrac12(x+y),\sqrt{xy}\bigr) . \end{align} }

Thus, we have

\displaystyle{ \begin{align} I(x,y) &= I(a_1, g_1) = I(a_2, g_2) = \cdots\\ &= I\bigl(M(x,y),M(x,y)\bigr) = \pi/\bigr(2M(x,y)\bigl) . \end{align} } The last equality comes from observing that $\displaystyle{ I(z,z) = \pi/(2z) }$.

Finally, we obtain the desired result

$\displaystyle{ M(x,y) = \pi/\bigl(2 I(x,y) \bigr) . }$

## Applications

### The number π

For example, according to the Gauss–Legendre algorithm:[14]

$\displaystyle{ \pi = \frac{4\,M(1,1/\sqrt{2})^2} {1 - \displaystyle\sum_{j=1}^\infty 2^{j+1} c_j^2} , }$

where

$\displaystyle{ c_j = \frac{1}{2}\left(a_{j-1}-g_{j-1}\right) , }$

with $\displaystyle{ a_0=1 }$ and $\displaystyle{ g_0=1/\sqrt{2} }$, which can be computed without loss of precision using

$\displaystyle{ c_j = \frac{c_{j-1}^2}{4a_j} . }$

### Complete elliptic integral K(sinα)

Taking $\displaystyle{ a_0 = 1 }$ and $\displaystyle{ g_0 = \cos\alpha }$ yields the AGM

$\displaystyle{ M(1,\cos\alpha) = \frac{\pi}{2K(\sin \alpha)} , }$

where K(k) is a complete elliptic integral of the first kind:

$\displaystyle{ K(k) = \int_0^{\pi/2}(1 - k^2 \sin^2\theta)^{-1/2} \, d\theta. }$

That is to say that this quarter period may be efficiently computed through the AGM, $\displaystyle{ K(k) = \frac{\pi}{2M(1,\sqrt{1-k^2})} . }$

### Other applications

Using this property of the AGM along with the ascending transformations of John Landen,[15] Richard P. Brent[16] suggested the first AGM algorithms for the fast evaluation of elementary transcendental functions (ex, cos x, sin x). Subsequently, many authors went on to study the use of the AGM algorithms.[17]

## References

### Notes

1. By 1799, Gauss had two proofs of the theorem, but neither of them was rigorous from the modern point of view.
2. In particular, he proved that the beta function $\displaystyle{ \Beta (a,b) }$ is transcendental for all $\displaystyle{ a,b\in\mathbb{Q}\setminus\mathbb{Z} }$ such that $\displaystyle{ a+b\notin \mathbb{Z}_0^- }$. The fact that $\displaystyle{ M(1,\sqrt{2}) }$ is transcendental follows from $\displaystyle{ M(1,\sqrt{2})=\tfrac{1}{2}\Beta \left(\tfrac{1}{2},\tfrac{3}{4}\right). }$

### Citations

1. Cox, David (January 1984). "The Arithmetic-Geometric Mean of Gauss". L'Enseignement Mathématique 30 (2): 275–330.
2. Carson, B. C. (2010), "Elliptic Integrals", in Olver, Frank W. J.; Lozier, Daniel M.; Boisvert, Ronald F. et al., NIST Handbook of Mathematical Functions, Cambridge University Press, ISBN 978-0-521-19225-5
3. Analog Electronic Filters: Theory, Design and Synthesis. Springer. 2011. pp. 147–155. ISBN 978-94-007-2189-0.
4. Borwein, Jonathan M.; Borwein, Peter B. (1987). Pi and the AGM: A Study in Analytic Number Theory and Computational Complexity (First ed.). Wiley-Interscience. ISBN 0-471-83138-7.  pages 35, 40
5. Schneider, Theodor (1941). "Zur Theorie der Abelschen Funktionen und Integrale". Journal für die reine und angewandte Mathematik 183 (19): 110–128. doi:10.1515/crll.1941.183.110.
6. Todd, John (1975). "The Lemniscate Constants". Communications of the ACM 18 (1): 14–19. doi:10.1145/360569.360580.
7. G. V. Choodnovsky: Algebraic independence of constants connected with the functions of analysis, Notices of the AMS 22, 1975, p. A-486
8. G. V. Chudnovsky: Contributions to The Theory of Transcendental Numbers, American Mathematical Society, 1984, p. 6
9. Borwein, Jonathan M.; Borwein, Peter B. (1987). Pi and the AGM: A Study in Analytic Number Theory and Computational Complexity (First ed.). Wiley-Interscience. ISBN 0-471-83138-7.  p. 45
10. R [pseudonym], Martin, Geometric-Harmonic Mean (Answer), StackExchange, retrieved September 19, 2020
11. Abramowitz, Milton; Stegun, Irene Ann, eds (1983). "Chapter 17". Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. Applied Mathematics Series. 55 (Ninth reprint with additional corrections of tenth original printing with corrections (December 1972); first ed.). Washington D.C.; New York: United States Department of Commerce, National Bureau of Standards; Dover Publications. pp. 598–599. LCCN 65-12253. ISBN 978-0-486-61272-0.
12. King, Louis V. (1924). On the Direct Numerical Calculation of Elliptic Functions and Integrals. Cambridge University Press.
13. Salamin, Eugene (1976). "Computation of π using arithmetic–geometric mean". Mathematics of Computation 30 (135): 565–570. doi:10.2307/2005327.
14. Landen, John (1775). "An investigation of a general theorem for finding the length of any arc of any conic hyperbola, by means of two elliptic arcs, with some other new and useful theorems deduced therefrom". Philosophical Transactions of the Royal Society 65: 283–289. doi:10.1098/rstl.1775.0028.
15. Brent, Richard P. (1976). "Fast Multiple-Precision Evaluation of Elementary Functions". Journal of the ACM 23 (2): 242–251. doi:10.1145/321941.321944.
16. Borwein, Jonathan M.; Borwein, Peter B. (1987). Pi and the AGM. New York: Wiley. ISBN 0-471-83138-7.