**GFUN AND THE AGM**

*Bruno Salvy*

January 1998

Let
and
be two positive real numbers, with
. The
*arithmetic-geometric*
mean of
and
is classically defined as the common limit of the sequences
and
defined by

, with
and
.

That the sequences converge to the same limit can be inferred from

.

This common limit is known by Maple as
__GaussAGM__
. It was discovered by Gauss that the arithmetic-geometric mean is related to hypergeometric functions by

`> `
**GaussAGM(a,b)=a/hypergeom([1/2, 1/2],[1],1-b^2/a^2);**

`> `
**eval(subs(a=3.,b=2.,"));**

This worksheet, largely inspired by [1], shows how
__gfun__
can be used to guess and then prove this result, as well as a generalization of it due to J. M. Borwein and P. B. Borwein.

**The functional equation**

Following [1], we start by introducing a generalization of the arithmetic-geometric mean obtained by considering the following iteration where is an integer:

.

where the second equality is motivated by

from which follows that both sequences converge to a common limit, which is denoted by . The arithmetic-geometric mean corresponds to the case .

The function is easily seen to be homogeneous: , for . Together with the obvious property that , this implies that for in ,

.

Defining the function by

the equation above translates into the following
*functional equation*
for
:

`> `

which plays a central rôle in this worksheet. It is not too difficult to show that is analytic in the neighborhood of the origin and that the functional equation above has a unique analytic solution in this neighborhood.

**The quadratic case**

This is the case and Gauss's theorem is equivalent to stating that

.

We now use
__gfun__
to first guess and then prove this result. The first step is to use the functional equation to compute a series expansion of
, then we use this series to guess a possible closed form which turns out to be analytic, then we show that this analytic function does satisfy the functional equation.

**Series expansion**

Starting from the functional equation,

`> `
**funeq2:=subs(N=2,A[2]=A,op(1,funeq)-op(2,funeq));**

a series solution is easily obtained by a method of undeterminate coefficients:

`> `
**sol:=1:**

`> `
**for i to 12 do
sol:=sol+x^i*solve(op(1,series(eval(
subs(A=unapply(sol+a*x^i,x),funeq2)),x,i+2)),a) od:sol;**

**Guessing the solution**

From this series,
__gfun__
guesses a differential equation which could be satisfied by
:

`> `
**deq:=op(1,gfun[seriestodiffeq](series(sol,x,13),y(x),[ogf]));**

It turns out that Maple's dsolve function is unable to solve this differential equation:

`> `
**dsolve(deq,y(x));**

We then use
__gfun[diffeqtorec]__
which deduces from this differential equation the recurrence satisfied by the Taylor coefficients of its solutions:

`> `
**gfun[diffeqtorec](deq,y(x),u(n));**

From this first order linear recurrence, a solution is easily found:

`> `
**rsolve(",u(n));**

hence the sum:

`> `
**y(x)=sum("*x^n,n=0..infinity);**

**Proving the result of the guess**

The proof consists in showing that the function , which is obviously analytic, satisfies the functional equation

`> `
**subs(A=y,funeq2)=0;**

Our approach consists in using closure properties of solutions of linear differential equations that are implemented in
__gfun__
to compute a linear differential equation satisfied by the left-hand side of this equation. The proof then reduces to showing that 0 is the only solution of this differential equation that is compatible with the initial conditions, which are 0 up to a large order by construction of
.

It turns out that this proof can be performed directly from the differential equation, and would apply even if no closed-form had been found.

Given a linear differential equation satisfied by a series
, the function
__gfun[algebraicsubs]__
computes a linear differential equation satisfied by
for any algebraic function, given by a polynomial
such that
. Thus a differential equation satisfied by
is easily computed from that satisfied by
:

`> `
**deq:=op(select(has,deq,x)):**

`> `
**deq1:=gfun[algebraicsubs](deq,numer(y-(1-(1-x)^2/(1+x)^2)),y(x));**

Similarly, satisfies

`> `
**gfun[algebraicsubs](deq,y-x^2,y(x));**

and its product by satisfies

`> `
**deq2:=gfun[`diffeq*diffeq`](",y(x)+1+x,y(x));**

From there, we deduce a differential equation satisfied by the left-hand side of the functional equation when applied to the hypergeometric function we have guessed:

`> `
**gfun[`diffeq+diffeq`](deq1,deq2,y(x));**

Analytic solutions of this equation have a coefficient sequence which satisfies

`> `
**gfun[diffeqtorec](",y(x),u(n));**

and thus the first three zeroes of the Taylor expansion of the left-hand side of the functional equation conclude the proof.

**The cubic case**

It has been discovered by J. M. Borwein and P. B. Borwein that a hypergeometric expression also exists when
. Again, the same steps as above lead to guessing and then proving the following result by
__gfun__
.

**Theorem**
. [Borwein & Borwein 90]
*The function *
* corresponding to the AGM iteration of order 3 has the following closed form:*

.

**Series expansion**

We start from the functional equation

`> `
**funeq3:=subs(N=3,A[3]=A,op(1,funeq)-op(2,funeq));**

and compute the first terms of the series expansion of the solution:

`> `
**sol:=1:**

`> `
**for i to 12 do
sol:=sol+x^i*solve(op(1,series(eval(
subs(A=unapply(sol+a*x^i,x),funeq3)),x,i+2)),a) od:sol;**

**Guessing the solution**

Again, this is a lucky situation where a differential equation can be guessed:

`> `
**deq:=op(1,gfun[seriestodiffeq](series(sol,x,13),y(x),[ogf]));**

From there, we find a closed-form as before

`> `
**gfun[diffeqtorec](deq,y(x),u(n));**

`> `
**rsolve(",u(n));**

`> `
**y(x)=sum("*x^n,n=0..infinity);**

**Proving the result of the guess**

The same routine applies:

`> `
**subs(A=y,funeq3)=0;**

`> `
**deq:=op(select(has,deq,x)):**

`> `
**deq1:=gfun[algebraicsubs](deq,numer(y-(1-(1-x)^3/(1+2*x)^3)),y(x));**

`> `
**gfun[algebraicsubs](deq,y-x^3,y(x));**

`> `
**deq2:=gfun[`diffeq*diffeq`](",y(x)+1+2*x,y(x));**

`> `
**gfun[`diffeq+diffeq`](deq1,deq2,y(x));**

`> `
**gfun[diffeqtorec](",y(x),u(n));**

and thus the first five zeroes of the Taylor expansion of the left-hand side of the functional equation conclude the proof.

**Conclusion**

These results are very good examples of the use of
__gfun__
: experiments first lead to conjecture a general form for the solution to a problem and then a completely different process leads to a proof. However, the apparent ease with which the problems treated here are solved using gfun hides the preliminary work which led to the form under which this approach could work. For example this approach does not seem to work for higher values of
, where similar results might exist.

**Bibliography**

[1] Arithmetic-Goemetric Means Revisited. Jonathan M. Borwein, Petr Lisonek and John A. Macdonald.
*MapleTech*
,
**4-1**
, pp. 20-27 (1997).