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?

Spectree’s step is correct and can be carried on as follows:
$$\begin{aligned}\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)}}\\ &\stackrel{y=\cos \theta}{=} -\int_{a}^{-1} \frac{d y}{\sqrt{a-(1-a) y-y^{2}}}, \text{ where }a=\cos \theta_{0}.
\\&=\int_{-1}^{a} \frac{d y}{\sqrt{\left(\frac{1+a}{2}\right)^{2}-\left(y+\frac{1-a}{2}\right)^{2}}}
\\&=\left[\sin ^{-1}\left(\frac{y+\frac{1-a}{2}}{\frac{1+a}{2}}\right)\right]_{-1}^{a}\\&=\pi,
\end{aligned}$$
which is certainly independent of $\theta_{0}.$
$$\text{********}\tag*{} $$
Alternate method:
$$
\begin{aligned}
I &=-\int_{a}^{-1} \frac{d y}{\sqrt{a-y} \sqrt{1+y}} \\
&=-2 \int_{a}^{-1} \frac{1}{\sqrt{a-y}} d(\sqrt{1+y}) \\
&=-2 \int_{a}^{-1} \frac{1}{\sqrt{a+1-(\sqrt{1+y})^{2}}} d(\sqrt{1+y}) \\
&=2\left[\sin ^{-1}\left(\frac{\sqrt{1+y}}{\sqrt{a+1}}\right)\right]_{-1}^{a}\\ &=\pi
\end{aligned}
$$
