Show that the two elliptic integrals are equal Prove or disprove: for any $0<a<1$
$$ \int _{-a}^a \frac{du}{\sqrt{(u^2-a^2)(a^2u^2-1)}}=\int_0^\pi \frac{d\theta}{|e^{2i\theta}-a^2|} \tag{1}\label{eq1}$$

Where did I come across these beasts?

We know the Schwarz–Christoffel mapping maps the upper half plane biholomorphically to a rectangle via the map $z\mapsto \int_0^z \frac{du}{\sqrt{(u^2-a^2)(a^2u^2-1)}}$. I was trying to understand the image of the hemisphere $\{z\in \mathbb H: |z|<1\}$ under this map. After experimenting, I believe the hemisphere also gets mapped to a rectangle. In particular, I believe, the top arc of the hemisphere gets mapped to one of the sides of the rectangle. But a rectangle has opposite sides equal from which I conclude equation (\ref{eq1}).

The RHS of (\ref{eq1}) can be re-written as  $$\int_0^\pi \frac{d\theta}{\sqrt{(a^2-\cos(2\theta)-\sin(2\theta))(a^2-\cos(2\theta)+\sin(2\theta))}}$$
after expanding $e^{i\theta}$ in sin and cos. But I don't see any $u$-substitution that takes this to the other one because in LHS the integrand blows up near the boundary points but the integrand of RHS is bounded.

Some values:

Experimentation using numerical calculators gives more evidence that they are equal.
\begin{array}{|c|c|c|c|}
\hline
a& \text{numerical value of LHS}& \text{numerical value of RHS} \\ \hline
 0.3& 3.141671197826467& 3.141671197824304\\ \hline
0.4 &  3.161993625960735 & 3.161993625959924\\ \hline
0.7 &  3.360852415660911 &3.360852415664235\\ \hline
 0.9& 4.030573051205955& 4.030573051201128\\ \hline
\end{array}

My real motivation to study all this is to understand the modulus of the annulus which forms a branched cover over the disc $\mathbb D$ over two points $\pm a$. This is just the restriction of the branched cover of the elliptic curve $\{(z,w):w^2=(z^2-a^2)(a^2z^2-1)\}$ over the Riemann sphere by projection down to $z$ variable.
 A: We have
\begin{align}
\int \limits_0^\pi \frac{\mathrm{d}\phi}{\lvert \mathrm{e}^{2 \mathrm{i} \phi} - a^2 \rvert} &= \int \limits_0^\pi \frac{\mathrm{d}\phi}{\sqrt{1 + a^4 - 2 a^2 \cos(2 \phi)}} = \int \limits_0^\pi \frac{\mathrm{d}\phi}{\sqrt{(1 + a^2)^2 - 4 a^2 \cos^2(\phi)}} \\
&= 2 \int \limits_0^{\pi/2} \frac{\mathrm{d}\phi}{\sqrt{(1 + a^2)^2 - 4 a^2 \cos^2(\phi)}} \overset{\psi = \frac{\pi}{2} - \phi}{=} 2 \int \limits_0^{\pi/2} \frac{\mathrm{d}\psi}{\sqrt{(1 + a^2)^2 - 4 a^2 \sin^2(\psi)}} \\
&= \frac{2}{1+a^2} \operatorname{K} \left(\frac{2a}{1+a^2}\right) = 2 \operatorname{K}(a^2) = 2 \int \limits_0^{\pi/2} \frac{\mathrm{d} t}{\sqrt{1 - a^4 \sin^2(t)}} \\
&= \int \limits_{-\pi/2}^{\pi/2} \frac{\mathrm{d} t}{\sqrt{1 - a^4 \sin^2(t)}} \overset{u = a \sin(t)}{=} \int \limits_{-a}^a \frac{\mathrm{d} u}{\sqrt{(a^2 - u^2)(1 - a^2 u^2)}} \, .
\end{align}
Of course, the identity of the elliptic integrals is central to this calculation. A proof, based on the substitution
$$
\tan(t) = \frac{\sin(2\psi)}{a^2 + \cos(2\psi)} \, ,
$$
is given here.
