How to evaluate $\int_{0}^{2\pi}\frac{1}{1+\sin^{2}(\theta)}d\theta$ I'm pretty sure the idea is to interpret this integral as a contour integral over a closed path in the complex plane.
$$I = \int_{0}^{2\pi}\frac{1}{1+\sin^{2}(\theta)}d\theta$$
We take $C = \{z \in \mathbb{C} : |z| = 1\}$, which is positively oriented.
$$z = e^{i\theta}$$
$$\frac{dz}{d\theta} = ie^{i\theta} = iz \rightarrow d\theta = \frac{dz}{iz} $$
$$\sin(\theta) = \frac{e^{i\theta}-e^{-i\theta}}{2i} = \frac{z-z^{-1}}{2i} $$
$$\sin^2(\theta) = \frac{z^2 - 2zz^{-1} + z^{-2}}{(2i)^2} = \frac{z^2 - 2 + z^{-2}}{-4} $$
After some manipulation:
$$I = \frac{4}{i}\oint_{C}\frac{z}{-z^4+6z^2-1}dz$$
After that one should obtain the roots of the polynomial in the denominator and solve the integral either by residues or using Cauchy's formula. However, I'm not sure how to find the roots. This was in the context of an exam, so I assume something must be wrong if the roots are too difficult to find, or if they are not "nice" numbers.
Is there a more clever way of going about this? I tried calculating the residue at infinity, but $\frac{1}{z^{2}}f(\frac{1}{z})$ yields the exact same function and it doesn't get any easier.
Thanks.
 A: Contour integration is a chance, but not the only one. For instance, symmetry gives
$$ \int_{0}^{2\pi}\frac{d\theta}{1+\sin^2\theta}=4\int_{0}^{\pi/2}\frac{d\theta}{1+\sin^2\theta}=4\int_{0}^{\pi/2}\frac{d\theta}{1+\cos^2\theta}\stackrel{\theta\mapsto\arctan u}{=}4\int_{0}^{+\infty}\frac{du}{2+u^2} $$
and the last integral clearly equals $\color{red}{\pi\sqrt{2}}$.
A: $$I=\int\frac{\mathrm{d}x}{1+\sin^2x}$$
Recall that $\sin x=\frac{\tan x}{\sec x}$: 
$$I=\int\frac{\mathrm{d}x}{1+\frac{\tan^2x}{\sec^2x}}$$
$$I=\int\frac{\sec^2x\ \mathrm{d}x}{\sec^2x+\tan^2x}$$
$$I=\int\frac{\sec^2x\ \mathrm{d}x}{1+2\tan^2x}$$
$u=\tan x$:
$$I=\int\frac{\mathrm{d}u}{1+2u^2}$$
$u=\frac1{\sqrt{2}}\tan w$:
$$I=\frac1{\sqrt{2}}\int\frac{\sec^2w\mathrm{d}w}{1+\tan^2w}$$
$$I=\frac1{\sqrt{2}}w$$
$$I=\frac1{\sqrt{2}}\arctan\sqrt{2}\tan x$$
$$I\bigg|_0^{2\pi}=\pi\sqrt2$$
A: How about using Weierstrauss substitution.
$$I=\int_0^{2\pi}\frac{1}{1+\sin^2(x)}dx$$
$t=\tan\frac{x}{2}$ so it becomes:
$$I=4\int_0^\infty\frac{1}{1+\left(\frac{2t}{1+t^2}\right)^2}\frac{dt}{1+t^2}=4\int_0^\infty\frac{1+t^2}{(1+t^2)^2+(2t)^2}dt$$
$$=4\int_0^\infty\frac{t^2+1}{t^4+6t^2+1}dt=4\int_0^\infty\frac{t^2+1}{(t^2+3-2\sqrt{2})(t^2+3+2\sqrt{2})}dt$$
now using partial fractions:
$$\frac{t^2+1}{(t^2+3-2\sqrt{2})(t^2+3+2\sqrt{2})}=\frac{At+B}{t^2+3-2\sqrt{2}}+\frac{Ct+D}{t^2+3+2\sqrt{2}}$$
giving us the simultaneous equations:
$$A+C=0$$$$B+D=1$$$$(3+2\sqrt{2})A+(3-2\sqrt{2})C=0$$$$(3+2\sqrt{2})B+(3-2\sqrt{2})D=1$$
Both $A$ and $C$ come out as $0$ so some form of $\tan$ substitution can be used to solve the two integrals that are formed.
