Trying to compute the following integral:
$$ \int_{-\pi}^{\pi} \frac{d\theta}{1+\sin^2(\theta)}. $$
This is for a complex analysis course, so I'm trying to find a way to use residue theory of something of that nature to solve the problem. I can't think of a substitution that will easily allow me to use residue theory.
Since $\sin\theta = \frac{e^{i\theta}-e^{-i\theta}}{2i}$, your integral equals: $$I=-i\oint_\gamma\frac{1/z}{1-\left(\frac{z-1/z}{2}\right)^2}dz =i\oint_\gamma\frac{4z\,dz}{(z^2-2z-1)(z^2+2z-1)},$$ where $\gamma$ is the boundary of the unit ball centered in zero, counter-clockwise oriented.
The residue theorem now gives that the value of the integral depends on the residues of $\frac{4z\,dz}{(z^2-2z-1)(z^2+2z-1)}$ in the singularities belonging to $B(0,1)$, namely $\pm(\sqrt{2}-1)$. Evaluating the residues hence gives: