# Complex analysis integral (maybe using residue theory?)

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:

$$I = \pi\sqrt{2}.$$

-

You can solve the integral also without the help of complex analysis. For instance

\begin{align*} \int\dfrac{1}{1+\sin^2(x)}\, dx &= \int\dfrac{1}{1+\sin^2(x)}\dfrac{\frac{1}{\sin^2(x)}}{\frac{1}{\sin^2(x)}} \ dx \\ &=\int\dfrac{\frac{1}{\sin^2(x)}}{\frac{1}{\sin^2(x)}+1}\, dx \\ &=\int\dfrac{\frac{1}{\sin^2(x)}}{2+\cot^2(x)}\, dx,\qquad \text{since }\dfrac{1}{\sin^2(x)}=1+\dfrac{\cos^2(x)}{\sin^2(x)} \\ &=\int\dfrac{\frac{1}{\sin^2(x)}}{2+u^2}\cdot \left(-\sin^2(x)\right)\, du,\qquad u=\cot(u), du = -\dfrac{1}{\sin^2(x)}dx\\ &=-\int\dfrac{1}{2+u^2}\, du \\ &=-\frac12\int\dfrac{1}{(\frac{u^2}{2}+1)}\, du \\ &=-\frac{1}{\sqrt{2}}\int\dfrac{1}{s^2+1}\,ds, \qquad s=\frac{u}{\sqrt{2}},ds = \frac{du}{\sqrt{2}}\\ &=-\frac{1}{\sqrt{2}}\arctan\left(\dfrac{\cot(x)}{\sqrt{2}}\right)=:f(x) \end{align*}

And evaluating $f(x)$ from $-\pi$ to $\pi$ gives you $\sqrt{2}\pi$.

-