Proving that $ \int_{0}^{\pi/2} \frac{\mathrm{d}{x}}{\sqrt{a^{2} {\cos^{2}}(x) + b^{2} {\sin^{2}}(x)}} = \frac{\pi}{2 \cdot \text{AGM}(a,b)} $. I know Neumann’s solution of this famous definite integral that is totally based on substitution, but is there any solution using complex analysis? Assuming that $ a > b $, show that
$$
  \int_{0}^{\pi/2} \frac{\mathrm{d}{x}}{\sqrt{a^{2} {\cos^{2}}(x) + b^{2} {\sin^{2}}(x)}}
= \frac{\pi}{2 \cdot \text{AGM}(a,b)},
$$
where $ \text{AGM}(a,b) $ is the arithmetic-geometric mean of $ a $ and $ b $, which satisfies the following functional equation:
$$
\text{AGM}(a,b) = \text{AGM} \! \left( \frac{a + b}{2},\sqrt{a b} \right).
$$
 A: Let
$$I(a,b)=\int_{0}^{\pi/2}\frac{dx}{\sqrt{a^2\sin^2 x+b^2\cos^2 x}}=\int_{0}^{1}\frac{dt}{\sqrt{(1-t^2)(a^2 t^2 + b^2(1-t^2))}}.\tag{1}$$
Obviously $I(a,a)=\frac{\pi}{2a}$, hence in order to prove our identity we just need to prove that:
$$ I(a,b)=I\left(\sqrt{ab},\frac{a+b}{2}\right).\tag{2}$$
By replacing $b\tan x$ with $z$, we have:
$$ I(a,b) = \int_{0}^{\infty}\frac{dz}{\sqrt{(z^2+a^2)(z^2+b^2)}}.\tag{3}$$
By Lagrange's identity for multiplying the sums of two squares,
$$ (z^2+a^2)(z^2+b^2) = (z^2-ab)^2+(a+b)^2 z^2, \tag{4} $$
hence, with the substitution $z=\frac{1}{2}\left(u-\frac{ab}{u}\right)$, $(3)$ turns into
$$ \int_{0}^{\infty}\frac{du}{\sqrt{\left(u^2+\frac{1}{4}(a+b)^2\right)(u^2+ab)}}=I\left(\sqrt{ab},\frac{a+b}{2}\right),$$
so we're done, since $I(a,b)$ is a continuous function with respect to its parameters and the iterates of the map $\varphi:(a,b)\to\left(\sqrt{ab},\frac{a+b}{2}\right)$ converge towards $\left(\text{AGM}(a,b),\text{AGM}(a,b)\right)$ giving:
$$ I(a,b)=\frac{\pi}{2\cdot\text{AGM}(a,b)} $$ 
as wanted.
A: This is not an answer to the question but it is too long for a comment.
As far as I can remember, it starts with $$I=\int\frac{dx}{\sqrt{(a^2\cos^2x+b^2\sin^2x)}}=\sqrt{2}\int\frac{dx}{\sqrt{\left(a^2-b^2\right) \cos (2 x)+(a^2+b^2)}}$$ and the integration leads to an elliptic integral given by $$I=\frac 1a F\left(x\left|1-\frac{b^2}{a^2}\right.\right)=\frac 1b F\left(x\left|1-\frac{a^2}{b^2}\right.\right)$$ Using the bounds, the definite integral is then $$J=\int^{\pi/2}_{0}\frac{dx}{\sqrt{(a^2\cos^2x+b^2\sin^2x)}}=\frac 1a {K\left(1-\frac{b^2}{a^2}\right)}=\frac 1b {K\left(1-\frac{a^2}{b^2}\right)}$$ and I suppose that Legendre functional relation is then used to get the result.
I am sorry for not being of more help.
