Calculate the integral value using residues Hello I'm trying to solve this integral : $\\$
$$\int_{0}^{2\pi} \frac {\cos^2(x)}{4+3\cos(x)} dx.$$
I want to solve this integral using the theorem: 
$$\int_{0}^{2\pi} R\bigl(\cos(\alpha),\sin(\alpha)\bigr) d\alpha =2\pi i \sum_{|z_{k}|<1} \operatorname*{Res}_{z=z_k}f(z)$$
where $\displaystyle\;f(z)=\frac {1}{iz}R\biggl(\frac{1}{2}\Bigl(z+\frac {1}{z}\Bigr),\frac {1}{2i}\Bigl(z-\frac {1}{z}\Bigr)\biggr).$
Let $R(x,y)=\frac {x^2}{4+3x}$, then i used the theorem to find $f(z)$.
So $f(z)=\frac{1}{i} \frac {(z+\frac {1}{z})^2}{16z+6z^{2}+6}$ then i find the zeros of ${16z+6z^{2}+6}$ which is $z_{1}=\frac{-8+\sqrt{28}}{6}$ and $z_{2}=\frac{-8-\sqrt{28}}{6}$.
Then i don't know but i should use only $z_{1}$ to answer the question?
$$I=\int_{0}^{2\pi} \frac {\cos^2(x)}{4+3\cos(x)} dx=2\pi i {Res}_{z=z_1}f(z)$$
I found ${Res}_{z=z_1}f(z)=\frac{64-8\sqrt{28}}{i(-8\sqrt{28}+28)}$
Using the theorem I mentioned, I found the singular points ($z_1=0$ essential point, $z_2=\frac{−8+sqrt(28)}{6}$ and $z_3=\frac{−8-sqrt(28)}{6}$ such as simple poles). But $z_3$ isn't in the disk $D(0,1)$. So the integral $=2\pi i(Res_{z=z1}f(z)+Res_{z=z2}f(z))$. I found the $Res_{z=z2} f(z)$ but i can't find $Res_{z=z1}f(z)$.
Can someone help me with that?
Thank you :)
 A: $$I=\int_{0}^{2\pi}\frac{\cos^2(x)}{4+3\cos x}\,dx = \int_{0}^{2\pi}\frac{\left(\frac{e^{ix}+e^{-ix}}{2}\right)^2}{4+3\left(\frac{e^{ix}+e^{-ix}}{2}\right)}\,dx=\int_{0}^{2\pi}\frac{e^{2ix}+e^{-2ix}+2}{16+6e^{ix}+6e^{-ix}}\,dx $$
equals, via $e^{ix}\to z$,
$$ -i\oint_{|z|=1}\frac{(z^2+1)^2}{z^2(6z^2+16z+6)}\,dz. $$
The only root of $6z^2+16z+6$ lying inside $|z|<1$ is at $\frac{\sqrt{7}-4}{3}$, so
$$ I = 2\pi\operatorname*{Res}_{z=0}\frac{(z^2+1)^2}{z^2(6z^2+16z+6)}+2\pi\operatorname*{Res}_{z=\frac{\sqrt{7}-4}{3}}\frac{(z^2+1)^2}{z^2(6z^2+16z+6)}$$
and this leads to
$$ I = 2\pi\left[-\frac{4}{9}+\frac{16}{9\sqrt{7}}\right]=\frac{2\pi}{9}\left(\frac{16}{\sqrt{7}}-4\right). $$
A real-analytic way deserves to be outlined, too. By symmetry
$$ I = \int_{-\pi}^{\pi}\frac{\cos^2(x)}{4-3\cos x}\,dx = \int_{0}^{\pi}\frac{1+\cos(2x)}{4-3\cos x}\,dx = 16\int_{0}^{\pi/2}\frac{\cos^2(x)}{16-9\cos^2(x)}\,dx$$
and the substitution $x=\arctan t$ turns the last integral into an elementary one (by partial fraction decomposition):
$$ I=16\int_{0}^{+\infty}\frac{dt}{(t^2+1)(16t^2+7)}.$$
