I''m stuck in a exercise in complex analysis concerning integration of rational trigonometric functions. I have the solution but I don't understand a specific part. Here it goes:
We want to find $\int_{0}^{2\pi}\frac{\sin^2\theta}{5+3\cos\theta}\,d\theta$.
Let $z=e^{i\theta}$ so that $d\theta=dz/iz$, $\cos \theta = \frac12 (z+z^{-1})$ and $\sin \theta = \frac {1}{2i}(z-z^{-1})$. We have
$$\begin{align} I&=\int_0^{2\pi} \frac{\sin^2\theta}{5+3\cos \theta}d\theta\\\\ &=\oint_C \frac{-\frac14(z-z^{-1})^2}{5+3\frac12 (z+z^{-1})}\frac{dz}{iz}\\\\ &=\oint_C \frac{\frac i4 (z^2-2+z^{-2})}{5z+ \frac32 z^2 + \frac32}dz\\\\ &=\oint_C \frac{\frac i2 (z^2-2+z^{-2})}{3z^2 + 10z + 3}dz\\\\ &=\frac i2 \oint_C \frac{z^4-2z^2+1}{z^2(3z^2 + 10z + 3)}dz \quad (1) \end{align}$$
where $C$ is the unit circle in the complex $z$-plane.
If I understand the last step correctly we multipliy numerator/denominator by $z^2$ in order to get rid of the negative power of $z$.
Now for the part that I don't understand in the solution. It is said that
$$(1) = \frac i2 \oint_C \frac{z^4-2z^2+1}{z^23(z+3)(z+\frac13)}dz = \frac i6 \oint_C \frac{z^4-2z^2+1}{z^2(z+3)(z+\frac13)}dz$$
Where does this $3$ come from in the denominator? If I factor out $3z^2 + 10z + 3$ I simply get $(z+3)(z+\frac13)$.
What is even stranger to me is that, after the computation of residues, the author is getting the correct solution of $\frac{2\pi}{9}$ (I verified with Wolfram) while I'm getting $\frac{2\pi}{3}$ so I'm missing a factor of $\frac13$ (i.e. I'm missing that $3$ in the denominator).
Can someone help me with this?
I think your error comes from the wrong use of the quadratic formula for factoring a second order polynomial. Factoring a polynomial and using the quadratic formula are two different things. Recall that for a quadratic polynomial
$$\color{blue}{ax^2+bx+c = a(x-x_1)(x-x_2)}$$
where you are missing the coefficient $a=3$. The quadratic formula will only give you the solutions of the quadratic equation.