Use residues to find $\int_0^\pi \frac{d\theta}{5+3\cos\theta}$ I am trying to use residues to find $\int_0^\pi \frac{d\theta}{5+3\cos\theta}$.
My thoughts:
Letting $z=e^{i\theta}$ we get $dz=ie^{i\theta}$.  Then, $\int_0^\pi \frac{d\theta}{5+3\cos\theta}=\frac{1}{5}\int_{|z|=1}\frac{dz}{iz(1+\frac{3}{5}(\frac{z+z^{-1}}{2}))}=-2i\int_{|z|=1}\frac{dz}{3z^2+10z+3}$.
Now, using the quadratic formula, we get that the integral becomes $-2i\int_{|z|=1}\frac{dz}{(z+3)(3z+1)}$.  So, now we will compute the residue at $z=-\frac{1}{3}$ only since $z=3$ is outside of our circle.  The residue is equal to $\frac{3}{8}$, and so the integral is equal to $(2\pi i)(-2i)(\frac{3}{8})=\frac{3\pi}{2}$.  But, this integral, I believe should actually be equal to $\frac{\pi}{4}$ based on Wolfram.
I am wondering if I did something wrong, or (hopefully not) is it just some silly algebra mistake somewhere.  Any thoughts, suggestions, etc. are always appreciated!  Thank you.

$$I = \int_0^\pi \frac{d\theta}{5+3\cos\theta}$$
I want the range to be $0$ to $2\pi$ so I will apply the substitution $\tau = \theta / 2$.
$$I = \int_0^{2 \pi} \frac{d\tau}{10+6\cos\tau}$$
Now I can apply my Residue Theorem lemma (from Freitag):

In our case $$f(z) = \frac{1}{i z}\frac{1}{10 + \tfrac{1}{2}6(z + \frac{1}{z})} = \frac{1}{i}\frac{1}{3z^2 + 10z + 3} = \frac{-i}{(z + 3)(3z + 1)} = \frac{-i}{3 (z + 3)(z + \tfrac{1}{3})}$$
There are two simple poles at $z_1=-3$ and $z_2=-\tfrac{1}{3}$ let's calculate the residues:

*

*$\operatorname{Res}(f;z_1) = \frac{-i}{3 \cdot (z_1 + \tfrac{1}{3})} = i/8$

*$\operatorname{Res}(f;z_2) = \frac{-i}{3 \cdot (z_2 + 3)} = -i/8$
we will only use the $z_2$ residue as $z_1$ lies outside $\mathbb E$.
So $$I = 2 \pi i \cdot - i / 8 = \pi / 4$$
