<s>[INST] Integrate $I(a) = \int_0^{\pi/2} \frac{dx}{1-a\sin x}$ I have a problem with this integral. It seems that solution has to be simple, but I couldn't find out.
$$I(a) = \int_0^{\pi/2} \frac{dx}{1-a\sin x}$$
I tried using integration by parts and differentiating with regard to a, but neither helped.
 [/INST] Using $u=\sin x$ and $v^2=\frac{1+u}{1-u}$
we have
\begin{eqnarray}
\int_0^{\frac{\pi}{2}}\frac{dx}{1-a\sin x}&=&\int_0^{1}\frac{1}{(1-au)\sqrt{1-u^2}}du\\
&=&\int_0^{1}\frac{1}{(1-au)(1+u)}\sqrt{\frac{1+u}{1-u}}du\\
&=&\int_1^\infty\frac{1}{(1-a\frac{v^2-1}{v^2+1})(1+\frac{v^2-1}{v^2+1})}v\frac{2v}{(1+v^2)^2}dv\\
&=&2\int_1^\infty\frac{1}{(1+a)+(1-a)v^2}dv\\
&=&\frac{2}{1-a}\int_1^\infty\frac{1}{v^2+\frac{1+a}{1-a}}dv\\
&=&\frac{2}{1-a}\sqrt{\frac{1-a}{1+a}}\arctan\left(\sqrt{\frac{1-a}{1+a}}v\right)\bigg|_1^\infty\\
&=&\frac{2}{\sqrt{1-a^2}}\left(\frac{\pi}{2}-\arctan\left(\sqrt{\frac{1-a}{1+a}}\right)\right)
\end{eqnarray}
</s>