Evaluate using Residues $\int_0^{2\pi}\frac{d\theta}{1+a\sin\theta}$ I need to evaluate the following using residues: $\int_0^{2\pi}\frac{d\theta}{1+a\sin\theta}$ where $-1<\theta<1$.
I suppose the $a$ in front of $\sin\theta$ is throwing me off.  I was thinking I could let $z=e^{i\theta}$ and so $\sin\theta=\frac{z-z^{-1}}{2i}$ and $dz=izd\theta$.  So, the integral becomes: $\int_{|z|=1}\frac{dz}{iz(1+a(\frac{z-z^{-1}}{2i}))}$.  After some, hopefully mistake-free, algebra, we'd get:
$2\int_{|z|=1}\frac{dz}{az^2+2iz-a}$.  Now, we can use the quadratic formula (again, hopefully mistake-free) to get $z=\frac{-i\pm\sqrt{-1-a^2}}{a}$.
From here, I'm not really sure where to go.  Do I just plug and chug and find residues using these two poles, or is there something sneaky going on?  Or, did I make a mistake somewhere earlier?
Any help is appreciated :)  Thank you.
 A: I guess nothing prevents you from exploiting some symmetry before switching to the computation of residues.
$$\int_{0}^{2\pi}\frac{d\theta}{1+a\sin\theta}=\int_{0}^{\pi}\frac{d\theta}{1+a\sin\theta}+\int_{0}^{\pi}\frac{d\theta}{1-a\sin\theta}=\int_{0}^{\pi}\frac{2\,d\theta}{1-a^2\sin^2\theta}$$
equals
$$ 4\int_{0}^{\pi/2}\frac{d\theta}{1-a^2\sin^2\theta}=4\int_{0}^{\pi/2}\frac{d\theta}{1-a^2\cos^2\theta} $$
or, by letting $\theta=\arctan u$,
$$ 4\int_{0}^{+\infty}\frac{du}{(1+u^2)-a^2}=2\int_{-\infty}^{+\infty}\frac{du}{(1-a^2)+u^2} $$
which equals
$$ 4\pi i\operatorname*{Res}_{u=i\sqrt{1-a^2}}\frac{1}{(1-a^2)+u^2}=\frac{2\pi}{\sqrt{1-a^2}}. $$
A: Use $$\int_{0}^{a} f(x) dx=\int_{0}^{a} f(a-x) dx$$
So $$I=\int_{0}^{2\pi} \frac{dx}{1+a\sin x}~~~~(1)$$
$$\implies I=\int_{0}^{2\pi} \frac{dx}{1-a\sin x}~~~~(2)$$
Adding (12) and (2), nxt using  $\int_{0}^{2a} f(x) dx= 2 \int_{0}^{a} f(x) dx$ if $f(2a-x)=f(x)$
$$I=\int_{0}^{2\pi} \frac{~dx}{1-a^2 \sin^2 x}=4\int_{0}^{\pi/2} \frac{dx}{(1-a^2)\sin^2 x+\cos^2 x}=4\int_{0}^{\pi/2} \frac{\sec^2 x dx}{1+(1-a^2)\tan^2x}$$
$$\implies I=\frac{4}{b^2}\int_{0}^{\infty} \frac{dt}{1/b^2+t^2}=\frac{4}{b} \tan^{-1} bt|_{0}^{\infty}=\frac{2\pi}{ b}=\frac{2 \pi}{\sqrt{1-a^2}}, ~if~ a^2<1.$$
