I came across the following integral:
Calculate $\int_0^\pi\frac{dx}{2+\sin^2x}$.
I know that you probably can solve it using residue theorem, but since we haven't proved it yet, I tried another approach: I know that $\sin x=\frac{e^{ix}-e^{-ix}}{2i}$ and therefore $\sin^2x=\frac{e^{2ix}-2+e^{-2ix}}{-4}$. So the integral becomes: $$\int_0^\pi\frac{dx}{2+\frac{e^{2ix}-2+e^{-2ix}}{-4}}=-4\int_0^\pi \frac{dx}{e^{2ix}+e^{-2ix}-10}$$ Denoting by $\gamma:[0,\pi]\to\mathbb{C}$ the path $\gamma(x)=e^{2ix}$ and using change of variables $z=\gamma(x)$, we have: $$-4\int_0^\pi \frac{dx}{e^{2ix}+e^{-2ix}-10}=-4\int_\gamma\frac{1}{z+\frac{1}{z}-10}\frac{dz}{2iz}=\frac{-2}{i}\int_\gamma\frac{1}{z^2-10z+1}dz$$ But I couldn't solve the last one (I figured that I must find the zeroes of the function in the denominator and then use Cauchy's integral formula somehow).
Any help would be appreciated.
$$ z^2 - 10z +1 = (z-z_1)(z-z_2) $$ has one zero $z_1 = 5-2\sqrt 6$ inside the unit disk, and the other zero $z_2 = 5 + 2\sqrt 6$ outside of the unit disk. So $$ f(z) = \frac{1}{z-z_2} $$ is holomorphic in a neighborhood of the unit disk and $$ \int_\gamma \frac{1}{z^2-10z+1} \, dz = \int_\gamma \frac{f(z)}{z-z_1} \, dz = 2 \pi i f(z_1) = \frac{2 \pi i}{z_1 - z_2} $$ using Cauchy's integral formula. This gives $$ \int_0^\pi\frac{dx}{2+\sin^2x} = -\frac 2i \frac{2 \pi i}{(-4 \sqrt 6)} = \frac{\pi}{\sqrt 6} \, . $$