Integral of $ \mathrm{d}z/(a+\sin^2{z}) $ I am trying to compute $$\int_0^{\pi/2} \frac{\mathrm{d}z}{a+\sin^2{z}},\,a>0 $$
for a physics problem. I've managed to expand the integrand to $$\frac{1}{a} - \frac{z^2}{a^2}+\frac{(3+a)z^4}{3a^3} + O(z^6)$$
but there are no terms of order $z^{-1}$ and so I don't see how to apply Cauchy's remainder theorem. Any help would be appreciated; the expected result is 
$$\frac{\pi\sqrt{1+1/a}}{2(1+a)}$$
obtained via Mathematica.
 A: I assume $a>0$. We have $$I=\int_{0}^{\pi/2}\frac{dz}{a+\sin^{2}\left(z\right)}=\int_{0}^{\pi/2}\frac{\sec^{2}\left(z\right)}{a\sec^{2}\left(z\right)+\tan^{2}\left(z\right)}dz=\int_{0}^{\pi/2}\frac{\sec^{2}\left(z\right)}{\left(a+1\right)\tan^{2}\left(z\right)+a}dz
 $$ now put $\tan\left(z\right)=u
 .$ We have $$I=\int_{0}^{\infty}\frac{1}{\left(a+1\right)u^{2}+a}du=\frac{1}{a}\int_{0}^{\infty}\frac{1}{\frac{\left(a+1\right)u^{2}}{a}+1}du
 $$ now if put $\sqrt{\frac{a+1}{a}}u=v
 $ we get $$I=\frac{1}{\sqrt{a\left(a+1\right)}}\int_{0}^{\infty}\frac{1}{v^{2}+1}du=\color{red}{\frac{\pi}{2\sqrt{a\left(a+1\right)}}}.$$ 
A: Call the answer $J$.  By symmetry, 
$$ J = \dfrac{1}{4} \int_0^{2\pi} \dfrac{dt}{a + \sin^2(t)} $$ 
Now express this as a contour integral around the unit circle $\Gamma$:
$z = e^{it}$, $dz = i e^{it}\; dt$, $\sin(t) = (z - 1/z)/(2i)$:
$$ J = \dfrac{1}{4} \oint_\Gamma \dfrac{dz}{i z (a + ((z-1/z)/(2i))^2)} =-i \oint_\Gamma \dfrac{z\; dz}{4a z^2 - (z^2-1)^2} $$
This can be done using residues.
The integrand has poles at $\pm \sqrt{2a+1 \pm 2\sqrt{a^2+a}}$.  The question is whether these are inside or outside the unit circle.
Note that $4 a w - (w-1)^2 = -w^2 + (4a+2) w - 1$.  Its two roots have product $1$, so either both are on the unit circle or one is inside and the other outside.  They are both on the unit circle when $-1 \le a \le 0$ (in which case the integral doesn't exist).  For $a > 0$ the roots inside the unit circle are $\pm \sqrt{2a+1 - 2 \sqrt{a^2+a}}$.  
A: Note that the integral of interest diverges for $-1<a<0$.  We assume tacitly, therefore, that $a>0$.  Then, we can write
$$\begin{align}
a+\sin^2(z)&=(1+a)-\cos^2(z)\\\\
&=(1+a)-\left(\frac12+\frac12\cos(2z)\right)\\\\
&=\frac12\left((1+2a)-\cos(2z)\right)
\end{align}$$
Then, we have
$$\begin{align}
\int_0^{\pi/2} \frac{1}{a+\sin^2(z)}\,dz&=\frac12\int_{-\pi/2}^{\pi/2}\frac{1}{a+\sin^2(z)}\,dz\\\\
&=\int_{-\pi/2}^{\pi/2}\frac{1}{(1+2a)-\cos(2z)}\,dz\\\\
&=\frac12 \int_{-\pi}^\pi \frac{1}{(1+2a)-\cos(z)}\\\\
&=\frac12 \oint_{|z|=1}\frac{1}{iz\left((1+2a)-\frac12(z+z^{-1})\right)}\,dz\\\\
&=i\oint_{|z|=1}\frac{1}{z^2-2(1+2a)z+1}\,dz\\\\
&=(2\pi i) (i) \text{Res}\left(\frac{1}{z^2-2(1+2a)z+1}, z=(1+2a)+2\sqrt{a(a+1)}\right)\\\\
&=\bbox[5px,border:2px solid #C0A000]{\frac{\pi}{2\sqrt{a(a+1)}}}
\end{align}$$
