Compute an integral with residue theorem Using residue theorem, compute the following integral:
$$
\int_{0}^{2\pi}\frac{\left(  1+2\cos t\right)  ^{n}\cos\left(  nt\right)
}{5+4\cos t}\operatorname*{dt}.
$$
Or a source with a solution.
 A: \begin{align} \int_{0}^{2 \pi} \frac{(1+2 \cos t)^{n} \cos (nt)}{5 + 4 \cos t} \ dt &= \text{Re} \int_{0}^{2 \pi} \frac{(1+2 \cos t)^{n} e^{int}}{5 + 4 \cos x} \ dt \\ &= \text{Re} \int_{0}^{2 \pi}\frac{(1+ e^{it} + e^{-it})^{n}e^{int}}{5 + 2(e^{it} + e^{-it})} \ dt \\ &= \text{Re} \int_{|z|=1} \frac{(1+z+z^{-1})^{n}z^{n}}{5+2z+2z^{-1}} \frac{dz}{iz} \\ &= \text{Re} \frac{1}{i} \int_{|z|=1} \frac{(z^{2}+z+1)^{n}}{2z^{2}+5z+2} \ dz \\ &= \text{Re} \frac{1}{i} \int_{|z|=1} \frac{(z^{2}+z+1)^{n}}{(2z+1)(z+2)} \ dz\end{align}
Only the pole at $z=- \frac{1}{2}$ is inside of the unit circle.
Therefore,
\begin{align} \int_{0}^{2 \pi} \frac{(1+2 \cos t)^{n} \cos (nt)}{3 + 2 \cos t} \ dt &= \text{Re} \frac{1}{i} 2 \pi i \ \text{Res} \Big[\frac{(z^{2}+z+1)^{n}}{(2z+1)(z+2)}, - \frac{1}{2}\Big] \\ &= 2 \pi \ \text{Re} \lim_{z \to - \frac{1}{2}} \frac{1}{2} \frac{(z^{2}+z+1)^{n}}{z+2} \\ &= \pi \ \text{Re} \frac{(\frac{1}{4} - \frac{1}{2}+1)^{n}}{\frac{3}{2}} \\ &= \frac{2 \pi}{3} \left(\frac{3}{4} \right)^{n} \end{align}
