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?
 A: $\int_0^{\frac{\pi}{2}} \frac{{\rm d}\alpha}{1+\cos\alpha\cos\beta}$ =  $\int_0^{\frac{\pi}{2}} \frac{{\rm d}\alpha}{1+k\cos\alpha}$
then use $cos\alpha$ = ($cos$ ^2)$\alpha/2$ - $(sin$^2)$\alpha/2$.
divide numerator and denom by ($cos$ ^2)$\alpha/2$
then take tan$\alpha/2$ = t
then u can get a quadratic in denominator which can be factorized, get two fraction.
A: 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}
$$
A: For any $\beta \textrm{ is not a multiple of }\pi$, we multiply both the numerator and denominator by $1-\cos \alpha \cos \beta.$
$$
\begin{aligned}
\int_0^{\frac{\pi}{2}} \frac{d \alpha}{1+\cos \alpha \cos \beta} 
=& \int_0^{\frac{\pi}{2}} \frac{1-\cos \alpha \cos \beta}{1-\cos ^2 \alpha \cos ^2 \beta} d \alpha \\
=& \int_0^{\frac{\pi}{2}} \frac{\sec ^2 \alpha}{\sec ^2 \alpha-\cos ^2 \beta} d \alpha-\cos \beta \int_0^{\frac{\pi}{2}} \frac{\cos \alpha}{1-\cos ^2 \alpha \cos ^2 \beta}d\alpha \\
=& \int_0^{\frac{\pi}{2}} \frac{d(\tan \alpha)}{\tan ^2 \alpha+\sin ^2 \beta}-\int_0^{\frac{\pi}{2}} \frac{d\left(\sin \alpha \cos  \beta\right)}{\sin ^2 \alpha \cos ^2 \beta+\sin ^2 \beta} \\
=& \frac{1}{\sin \beta}\left[\tan ^{-1}\left(\frac{\tan \alpha}{\sin \beta}\right)\right]_0^{\frac{\pi}{2}}-\frac{1}{\sin \beta}\left[\tan ^{-1}\left(\frac{\sin \alpha \cos \beta}{\sin \beta}\right)\right]_0^{\frac{\pi}{2}} \\
=&\frac{\pi}{2 \sin \beta}-\frac{1}{\sin \beta}\left(\frac{\pi}{2}-\beta\right) \\
=& \frac{\pi}{\sin \beta}
\end{aligned}
$$
