It's well known that if we set $a_0=x \geq 0, \ g_0=y \geq 0$, and $$a_{n+1}=\dfrac{1}{2}(a_n+g_n), \ g_{n+1}=\sqrt{a_n g_n} ,$$ then both $\{a_n\}$ and $\{g_n\}$ will converge to $AGM(x,y)$. Further more, we have $$AGM(x,y)=\dfrac{\pi}{2}\big( \int_0^{\pi/2} \dfrac{\mathbf{d}\theta}{\sqrt{x^2 \cos^2 \theta + y^2 \sin^2 \theta}} \big)^{-1}.$$ Which was proved by Gauss firstly, by noting that $$I(a,b) = \int_0^{\pi/2} \dfrac{\mathbf{d}\theta}{\sqrt{a^2 \cos^2 \theta + b^2 \sin^2 \theta}} = \int_0^{\pi/2} \dfrac{\mathbf{d}\theta}{\sqrt{(\sqrt{ab})^2 \cos^2 \theta + {(\frac{a+b}{2})}^2 \sin^2 \theta}} = I(\sqrt{ab}, \dfrac{a+b}{2}).$$ In other words, $I$ is an invariant for $(a_n,g_n)$.
My question is, could someone give a heuristic reason to deduce invariant $I$?
• More natural and more close to the hystorical developement is that starting from the elliptic integral $I$ (an object of great interest, of course), which is of elementary computation for $x=y$, and having proved the change of variable that you wrote, one is lead to study the iteration $(a_n,g_n)$. Since it converges to a point of the diagonal $(z,z)$ this allow to compute $I(x,y)=I(z,z)$. – Pietro Majer Oct 30 '13 at 20:13