I wish to evaluate $$I(2018)=\int\_{0}^{\pi}\frac{\cos(2018x)}{5-4\cos x} dx$$ Considering $$X=I(k)+iJ(k)=\int\_{-\pi}^{\pi}\frac{\cos{kx}}{5-4\cos x} dx +i\int\_{-\pi}^{\pi}\frac{\sin{kx}}{5-4\cos x} dx=\int\_{-\pi}^{\pi}\frac{e^{ikx}}{5-4\cos x} dx$$ let us substitute $$e^{ix}=z\rightarrow dx=\frac{dz}{iz} \, ,|z|=1$$ Due to Euler's formula we can rewrite $$\cos x=\frac{z^2+1}{2z}$$ $$X=\oint\_{|z|=1} \frac{z^k}{5-4\frac{z^2+1}{2z}}\frac{dz}{iz}=\frac{1}{i}\oint\_{|z|=1} \frac{z^k}{-2z^2+5z-2}dz$$ $$-2z^2+5z-2=-\frac{1}{2}((2z)^2-5(2z)+4)=-\frac{1}{2}(2z-4)(2z-1)=-2(z-2)(z-\frac{1}{2})$$ Now let us notice that in our contour $|z|=1\,$ only the pole $z\_2=\frac{1}{2}$ is found. Thus the integral we seek to evaluate is $$\frac{1}{i} \cdot 2\pi i \, \text{Res} (f(z),z\_2)$$ where $f(z)=\frac{z^k}{-2(z-2)(z-\frac{1}{2})}$ $$X=2\pi \lim\_{z\to z\_2} (z-z\_2)\frac{z^k}{-2(z-2)(z-z\_2)}=\frac{2}{3}\pi \frac{1}{2^k}$$ therefore $$I(k)=\Re (X) =\frac{2\pi}{3}\frac{1}{2^k}$$ And $$\int\_{0}^{\pi}\frac{\cos(2018 x)}{5-4\cos x} dx=\frac{\pi}{3}\cdot\frac{1}{2^{2018}}.$$ Now someone told me that the answer is $0$ and I am wrong (also wolfram gives $0$ as an answer). Could you please clarify? Or maybe give another solution to this integral if it's $0$ or another answer?