Is there a technique for solving the integral of the square root of a constant minus the square of the cosecant? I have to solve this integral:
$$
\frac{1}{\pi}\int_{\theta_1}^{\theta_2}\sqrt{\Gamma^2 - \frac{J^2}{\sin^2(\theta)}}\text{d}\theta,
$$
where $\theta_1$ and $\theta_2$ are the endpoints of one of the intervals where the integrand function is defined, so - for example - $\theta_1 = \arcsin(J/\Gamma)$ and $\theta_2 = \arcsin(-J/\Gamma)+\pi$, if $J > 0$.
$\Gamma$ and $J$ are real values chosen such that the previous expressions are well defined.
The solution should be $\Gamma-|J|$. Is there any change of variable or technique useful in solving it?
 A: Denote $a=(J/\Gamma)^2$, substitute $t=\sin^2\theta$ and use the symmetry w.r.t. $\theta\mapsto\pi-\theta$: $$I=\frac\Gamma\pi\int_a^1\sqrt{\frac{t-a}{1-t}}\frac{dt}{t}.$$
Now try $(t-a)/(1-t)=z$, i.e. $t=(a+z)/(1+z)$. You get $$I=\frac\Gamma\pi\int_0^\infty\frac{(1-a)\sqrt{z}\,dz}{(a+z)(1+z)}=\frac\Gamma\pi\int_0^\infty\left(\frac1{1+z}-\frac{a}{a+z}\right)\frac{dz}{\sqrt{z}}.$$
And now the (elementary) integration is easy: $$I=\frac{2\Gamma}\pi\left(\arctan\sqrt{z}-\sqrt{a}\arctan\sqrt{z/a}\right)_{z=0}^{z=\infty}=(1-\sqrt{a})\Gamma.$$
Which matches your expected result.
A: For $J \in [0,\Gamma]$ and $k \in \mathbb{Z}$, we will prove that
$$\frac{1}{\pi}\int_{\arcsin\left(\frac{J}{Γ}\right)+k\pi}^{\arcsin\left(-\frac{J}{Γ}\right)+\left(k+1\right)\pi}\sqrt{Γ^{2}-\frac{J^{2}}{\sin^{2}\theta}}d\theta=Γ-J.$$
Proof. We can rewrite the integral as
$$\frac{2}{\pi}\int_{\arcsin\left(\frac{J}{Γ}\right)+k\pi}^{\frac{\pi k}{2}+\frac{\pi\left(k+1\right)}{2}}\frac{\sqrt{\left(Γ^{2}-J^{2}\right)\sec^{2}\theta-Γ^{2}}}{\sec\left(\theta\right)\left(\sec^{2}\theta-1\right)}\sec\left(\theta\right)\tan\left(\theta\right)d\theta$$
since both $\displaystyle \sqrt{Γ^{2}-\frac{J^{2}}{\sin^{2}\theta}}$ and $\frac{\sqrt{\left(Γ^{2}-J^{2}\right)\sec^{2}\theta-Γ^{2}}}{\sec\left(\theta\right)\left(\sec^{2}\theta-1\right)}\sec\left(\theta\right)\tan\left(\theta\right)$ are equal when $\theta \in \left[\arcsin\left(\frac{J}{g}\right)+k\pi, \frac{\pi k}{2}+\frac{\pi\left(k+1\right)}{2}\right)$, where that upper bound is the halfway point of the original interval. To avoid ugly lower and upper bounds, we can calculate the indefinite integral instead:
$$
\begin{align}
\int\frac{\sqrt{\left(Γ^{2}-J^{2}\right)\sec^{2}\theta-Γ^{2}}}{\sec\theta\left(\sec^{2}\theta-1\right)}\sec\theta\tan\theta d\theta &= \int_{ }^{ }\frac{\sqrt{\left(Γ^{2}-J^{2}\right)u^{2}-Γ^{2}}}{u\left(u^{2}-1\right)}du \tag{1} \\
&= \left(Γ^{2}-J^{2}\right)\int_{ }^{ }\frac{v^{2}}{\left(v^{2}+Γ^{2}\right)\left(v^{2}+J^{2}\right)}dv \tag{2} \\
&= \int_{ }^{ }\left(\frac{Γ^{2}}{v^{2}+Γ^{2}}-\frac{J^{2}}{v^{2}+J^{2}}\right)dv \tag{3} \\
&= Γ\arctan\left(\frac{v}{Γ}\right)-J\arctan\left(\frac{v}{J}\right)+C \\
\end{align}
$$
where in: $(1)$ we used $u=\sec\theta$; $(2)$ we used $v=\sqrt{\left(Γ^{2}-J^{2}\right)u^{2}-Γ^{2}}$; $(3)$ we used partial fractions. Recalling that $v=\sqrt{\left(Γ^{2}-J^{2}\right)\sec^{2}\theta-Γ^{2}}$, we can use FTC as follows:
$$\frac{2}{\pi}\lim_{t \to \frac{\pi k}{2}+\frac{\pi\left(k+1\right)}{2}}\left[Γ\arctan\left(\frac{\sqrt{\left(Γ^{2}-J^{2}\right)\sec^{2}\theta-Γ^{2}}}{Γ}\right)-J\arctan\left(\frac{\sqrt{\left(Γ^{2}-J^{2}\right)\sec^{2}\theta-Γ^{2}}}{J}\right)\right]_{\arcsin\left(\frac{J}{Γ}\right)+k\pi}^{\Large t}.$$
Doing some calculations results in $\Gamma-J$, as desired. Q.E.D.
(A similar proof could be letting $J \in [\Gamma,0]$ and $k\in\mathbb{Z}$ and proving the integral in question equals $J-\Gamma$.)
