<s>[INST] How to evaluate $\int_0^{\frac{\pi}{2}} \frac{{\rm d}\alpha}{1+\cos\alpha\cos\beta}$ without using antiderivative? Someone gives a solution here:
\begin{align*} \int_0^{\frac{\pi}{2}} \frac{{\rm d}\alpha}{1+\cos\alpha\cos\beta}&=\int_0^{\frac{\pi}{2}} \sum_{n=0}^{\infty} (-\cos\alpha\cos\beta)^n{\rm d}\alpha\\ &=\sum_{n=0}^{\infty}(-\cos\beta)^n\int_0^{\frac{\pi}{2}} \cos^n\alpha{\rm d}\alpha\\ &=\sum_{n=0}^{\infty}(-\cos \beta) ^n\frac{\sqrt{\pi}\Gamma\left(\frac{n}{2}+\frac{1}{2}\right)}{2\Gamma\left(\frac{n}{2}+1\right)}\\  &=\frac{\pi-2\arcsin\cos \beta}{2\sqrt{1-\cos^2\beta}}\\ &=\frac{\beta}{\sin \beta}.   \end{align*}
Is it correct? How to obtain the fourth equlity?
 [/INST] Using tangent half-angle substitution $t=\tan \frac{x}{2} $, we transform the integral into
$$
I=2 \int_0^1 \frac{d t}{(1-\cos \beta) t^2+1 +\cos \beta},\quad \textrm{ where }\beta \textrm{ is not a multiple of }\pi.
$$
By the half-angle formula of sine and cosine, we have
$$
\begin{aligned}
I&=\int_0^1 \frac{d t}{t^2 \sin ^2 \frac{\beta}{2}+\cos ^2 \frac{\beta}{2}} \\
&=\frac{1}{\sin \frac{\beta}{2} \cos \frac{\beta}{2}}\left[\tan ^{-1}\left(\frac{t \sin \frac{\beta}{2}}{\cos \frac{\beta}{2}}\right)\right]_0^1 \\
&=\frac{2}{\sin \beta} \cdot \tan ^{-1}\left(\tan \frac{\beta}{2}\right) \\
&=\frac{\beta}{\sin \beta}
\end{aligned}
$$
</s>