TITLE: Evaluating $\int_0^{2\pi} \frac {\cos(\theta)}{5-3\cos(\theta)} \, d\theta$ using residue theorem
QUESTION [5 upvotes]: I am to evaluate the following integral using residue theorem:
$$\int_0^{2\pi} \frac {\cos(\theta)}{5-3\cos(\theta)} \, d\theta$$
I know that I need to perform substitution with the following:
$$d\theta = \frac {dz}{iz}$$
$$\cos\theta = \frac 12(z+\frac1z)$$
which yields:
$$\frac 1i=\int_{|z|=1} \frac{z+\frac1z}{-3z^2+10z-3}\, dz$$
Finding the roots for the denominator yields two roots at $1/3$ and $3.$ Only $1/3$ falls within our unit circle so we ignore the root at $3.$
This is where I am a little stuck. I was taught to use the shortcut here to calculate the residue where I would leave the numerator $p(z)$ as is and take the derivative of the denominator $q'(z)$ then plug in the value of the singularity $z=\frac13$ but this approach doesn't give me the correct answer which I know is $\frac\pi6$
Am I making a mistake in setting up the problem? Thanks!

REPLY [6 votes]: Note that we have
$$\begin{align}
\int_0^{2\pi}\frac{\cos(\theta)}{5-3\cos(\theta)}\,d\theta&=\oint_{|z|=1}\frac{\frac12(z+z^{-1})}{5-\frac32(z+z^{-1})}\frac1{iz}\,dz\\\\
&=i\oint_{|z|=1}\frac{z^2+1}{z(3z^2-10z+3)}\,dz\\\\
&=i\oint_{|z|=1}\frac{z^2+1}{z(3z-1)(z-3)}\,dz\\\\
&=-2\pi \text{Res}\left(\frac{z^2+1}{z(3z-1)(z-3)}, z=0,1/3\right)\\\\
&=-2\pi \left(\frac13-\frac5{12}\right)\\\\
&=\frac\pi6
\end{align}$$