<s>[INST] Evaluating $\int_{\theta_0}^{\pi} \frac{d(\cos\theta)}{\sqrt{(\cos\theta_0-\cos\theta)(1+\cos\theta)}}.$ I want to evaluate the following integral ($\theta_0>0$)
\begin{equation*}
    \int_{\theta_0}^{\pi} \sqrt{\frac{1-\cos\theta}{\cos\theta_0-\cos\theta}} d\theta
\end{equation*}
So I thought about $d(\cos\theta)=-\sin\theta d\theta$, then
\begin{equation*}
    \int_{\theta_0}^{\pi} \sqrt{\frac{1-\cos\theta}{\cos\theta_0-\cos\theta}} d\theta = - \int_{\theta_0}^{\pi} \frac{d(\cos\theta)}{\sqrt{(\cos\theta_0-\cos\theta)(1+\cos\theta)}}
\end{equation*}
My question is about that step. Is that legit? I mean, that integral is doubly improper at both limits. How can I ensure that it is integrable?
 [/INST] We first restrict the angle $\theta$ in the range, $0<\theta_0<\theta<\pi, $
then rewrite the integral by double-angle formula
$$1-\cos \theta=2\sin^2 \frac{\theta}{2} \text{ and } 1+\cos \theta=2\cos^2 \frac{\theta}{2} ,$$
\begin{aligned}
& I=\int_{\theta_{0}}^{\pi} \sqrt{\frac{1-\cos \theta}{\cos \theta_{0}-\cos \theta}} d \theta = \int_{\theta_{0}}^{\pi} \frac{\sqrt{2 \sin ^{2} \frac{\theta}{2}}}{\sqrt{\cos \theta_{0}-\cos \theta}} d \theta =\sqrt{2} \int_{\theta_{0}}^{\pi} \frac{\sin \frac{\theta}{2} d \theta}{\sqrt{\cos \theta_{0}-\left(2 \cos^2 \frac{\theta}{2}-1\right)}}
\end{aligned}
Putting $y=\cos \dfrac{\theta}{2}$ yields
\begin{aligned}
I &=-2 \int_{\cos \frac{\theta_{0}}{2}}^{0} \frac{d y}{\sqrt{\cos ^{2} \frac{\theta_{0}}{2}-y^{2}}} \\
&=2\left[\sin ^{-1}\left(\frac{y}{\cos \frac{\theta_{0}}{2}}\right)\right]_{0}^{\cos \frac{\theta_{0}}{2}} \\
&=2 \sin ^{-1}(1) \\
&=\pi,
\end{aligned}
which is surprisingly independent of $\theta_0$.
</s>