# Landen's transformation

Landen's transformation is a mapping of the parameters of an elliptic integral, useful for the efficient numerical evaluation of elliptic functions. It was originally due to John Landen and independently rediscovered by Carl Friedrich Gauss.

## Statement

The incomplete elliptic integral of the first kind F is
    $F(\varphi \setminus \alpha )=F(\varphi ,\sin \alpha )=\int _{0}^{\varphi }{\frac {d\theta }{\sqrt {1-(\sin \theta \sin \alpha )^{2}}}},$
where $\alpha$ is the modular angle. Landen's transformation states that if $\alpha _{0}$, $\alpha _{1}$, $\varphi _{0}$, $\varphi _{1}$ are such that $(1+\sin \alpha _{1})(1+\cos \alpha _{0})=2$ and $\tan(\varphi _{1}-\varphi _{0})=\cos \alpha _{0}\tan \varphi _{0}$, then
    ${\begin{aligned}F(\varphi _{0}\setminus \alpha _{0})&=(1+\cos \alpha _{0})^{-1}F(\varphi _{1}\setminus \alpha _{1})\\&={\tfrac {1}{2}}(1+\sin \alpha _{1})F(\varphi _{1}\setminus \alpha _{1}).\end{aligned}}$
Landen's transformation can similarly be expressed in terms of the elliptic modulus $k=\sin \alpha$ and its complement $k'=\cos \alpha$.

## Complete elliptic integral

In Gauss's formulation, the value of the integral
    $I=\int _{0}^{\frac {\pi }{2}}{\frac {1}{\sqrt {a^{2}\cos ^{2}(\theta )+b^{2}\sin ^{2}(\theta )}}}\,d\theta$
is unchanged if $a$ and $b$ are replaced by their arithmetic and geometric means respectively, that is
    $a_{1}={\frac {a+b}{2}},\qquad b_{1}={\sqrt {ab}},$
    $I_{1}=\int _{0}^{\frac {\pi }{2}}{\frac {1}{\sqrt {a_{1}^{2}\cos ^{2}(\theta )+b_{1}^{2}\sin ^{2}(\theta )}}}\,d\theta .$
Therefore,
    $I={\frac {1}{a}}K\left({\frac {\sqrt {a^{2}-b^{2}}}{a}}\right),$
    $I_{1}={\frac {2}{a+b}}K\left({\frac {a-b}{a+b}}\right).$
From Landen's transformation we conclude
    $K\left({\frac {\sqrt {a^{2}-b^{2}}}{a}}\right)={\frac {2a}{a+b}}K\left({\frac {a-b}{a+b}}\right)$
and $I_{1}=I$.

### Proof

The transformation may be effected by integration by substitution. It is convenient to first cast the integral in an algebraic form by a substitution of $\theta =\arctan(x/b)$, $d\theta =(\cos ^{2}(\theta )/b)dx$ giving
    $I=\int _{0}^{\frac {\pi }{2}}{\frac {1}{\sqrt {a^{2}\cos ^{2}(\theta )+b^{2}\sin ^{2}(\theta )}}}\,d\theta =\int _{0}^{\infty }{\frac {1}{\sqrt {(x^{2}+a^{2})(x^{2}+b^{2})}}}\,dx$
A further substitution of $x=t+{\sqrt {t^{2}+ab}}$ gives the desired result
    ${\begin{aligned}I&=\int _{0}^{\infty }{\frac {1}{\sqrt {(x^{2}+a^{2})(x^{2}+b^{2})}}}\,dx\\&=\int _{-\infty }^{\infty }{\frac {1}{2{\sqrt {\left(t^{2}+\left({\frac {a+b}{2}}\right)^{2}\right)(t^{2}+ab)}}}}\,dt\\&=\int _{0}^{\infty }{\frac {1}{\sqrt {\left(t^{2}+\left({\frac {a+b}{2}}\right)^{2}\right)\left(t^{2}+\left({\sqrt {ab}}\right)^{2}\right)}}}\,dt\end{aligned}}$
This latter step is facilitated by writing the radical as
    ${\sqrt {(x^{2}+a^{2})(x^{2}+b^{2})}}=2x{\sqrt {t^{2}+\left({\frac {a+b}{2}}\right)^{2}}}$
and the infinitesimal as
    $dx={\frac {x}{\sqrt {t^{2}+ab}}}\,dt$
so that the factor of $x$ is recognized and cancelled between the two factors.

### Arithmetic-geometric mean and Legendre's first integral

If the transformation is iterated a number of times, then the parameters $a$ and $b$ converge very rapidly to a common value, even if they are initially of different orders of magnitude. The limiting value is called the arithmetic-geometric mean of $a$ and $b$, $\operatorname {AGM} (a,b)$. In the limit, the integrand becomes a constant, so that integration is trivial
    $I=\int _{0}^{\frac {\pi }{2}}{\frac {1}{\sqrt {a^{2}\cos ^{2}(\theta )+b^{2}\sin ^{2}(\theta )}}}\,d\theta =\int _{0}^{\frac {\pi }{2}}{\frac {1}{\operatorname {AGM} (a,b)}}\,d\theta ={\frac {\pi }{2\operatorname {AGM} (a,b)}}$
The integral may also be recognized as a multiple of Legendre's complete elliptic integral of the first kind. Putting $b^{2}=a^{2}(1-k^{2})$
    $I={\frac {1}{a}}\int _{0}^{\frac {\pi }{2}}{\frac {1}{\sqrt {1-k^{2}\sin ^{2}(\theta )}}}\,d\theta ={\frac {1}{a}}F\left({\frac {\pi }{2}},k\right)={\frac {1}{a}}K(k)$
Hence, for any $a$, the arithmetic-geometric mean and the complete elliptic integral of the first kind are related by
    $K(k)={\frac {\pi }{2\operatorname {AGM} (1,{\sqrt {1-k^{2}}})}}$
By performing an inverse transformation (reverse arithmetic-geometric mean iteration), that is
    $a_{-1}=a+{\sqrt {a^{2}-b^{2}}}\,$
    $b_{-1}=a-{\sqrt {a^{2}-b^{2}}}\,$
    $\operatorname {AGM} (a,b)=\operatorname {AGM} \left(a+{\sqrt {a^{2}-b^{2}}},a-{\sqrt {a^{2}-b^{2}}}\right)\,$
the relationship may be written as
    $K(k)={\frac {\pi }{2\operatorname {AGM} (1+k,1-k)}}\,$
which may be solved for the AGM of a pair of arbitrary arguments;
    $\operatorname {AGM} (u,v)={\frac {\pi (u+v)}{4K\left({\frac {u-v}{v+u}}\right)}}.$