Integral $\int_0^{\pi} \frac{\cos(2018x)}{5-4\cos{x}}dx$
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?
Solution 1:
You are correct! This is an elementary approach without complex analysis.
Since $$\cos((n+1)x)+\cos((n-1)x)=2\cos(nx)\cos(x)$$ then for $n\geq 1$, we have the linear recurrence $$\begin{align} I(n-1)+I(n+1)&=\int_{0}^{\pi}\frac{2\cos(nx)\cos(x)}{5-4\cos(x)} dx\\ &= -\frac{1}{2}\int_{0}^{\pi}\frac{\cos(nx)(-5+5-4\cos(x))}{5-4\cos(x)} dx\\ &= \frac{5}{2}I(n)-\frac{1}{2}\int_{0}^{\pi}\cos(nx) dx=\frac{5}{2}I(n). \end{align}$$ Then $$I(n)=A2^n+\frac{B}{2^n}$$ for some constants $A$ and $B$. Since $I(n)$ is bounded it follows that $A=0$ and $$I(n)=\frac{I(0)}{2^n}=\frac{1}{2^n}\int_{0}^{\pi}\frac{dx}{5-4\cos(x)} =\frac{1}{2^n}\left[\frac{2\arctan(3\tan(x/2))}{3}\right]_{0}^{\pi}=\frac{\pi/3}{2^n}.$$ P.S. In order to show that $I(n)$ is not zero for any $n$ it suffices to say that $I(0)>0$ since it is the integral of a positive continuous function.
Solution 2:
$$ \frac{1}{5-4\cos\left(x\right)}=\frac{1}{5-2e^{ix}-2e^{-ix}}=\frac{e^{ix}}{5e^{ix}-2e^{2ix}-2} $$ Let $X=e^{ix}$ then $$ -2X^2+5X-2=-\left(2X-1\right)\left(X-2\right) $$ Now we do a partial decomposition $$-\frac{1}{\left(2X-1\right)\left(X-2\right)}=\frac{2}{3}\frac{1}{2X-1}-\frac{1}{3}\frac{1}{X-2} $$ So far we have $$ \frac{1}{5-4\cos\left(x\right)}=\frac{1}{3}\frac{1}{2e^{ix}-1}-\frac{2}{3}\frac{1}{e^{ix}-2} $$ We'll express this as a series, so we transform it into an adapted form $$ \frac{1}{5-4\cos\left(x\right)}=\frac{1}{3}\left(\frac{1}{2e^{ix}-1}-\frac{2}{e^{ix}-2}\right)=\frac{1}{3}\left(\frac{\frac{1}{2}e^{-ix}}{\displaystyle {1-\frac{1}{2}e^{-ix}}}+\frac{1}{1-\frac{1}{2}e^{ix}}\right)$$
Hence $$ \frac{1}{5-4\cos\left(x\right)}=\frac{1}{3}\left(\sum_{n=1}^{+\infty}\left(\frac{1}{2}\right)^ne^{-inx}+\sum_{n=0}^{+\infty}\left(\frac{1}{2}\right)^ne^{inx}\right) $$ which finally gave us $$ \frac{1}{5-4\cos\left(x\right)}=\frac{1}{3}\left(1+\sum_{n=1}^{+\infty}\left(\frac{1}{2}\right)^{n-1}\cos\left(nx\right)\right)$$ Hence using normal convergence $$ \int_{0}^{\pi}\frac{\cos\left(2018x\right)}{5-4\cos\left(x\right)}\text{d}x=\int_{0}^{\pi}\frac{\cos\left(2018 x\right)}{3}\text{d}x+\sum_{n=1}^{+\infty}\left(\frac{1}{2}\right)^{n-1}\int_{0}^{\pi}\cos\left(nx\right)\cos\left(2018x\right)\text{d}x $$ Using that $$ \int_{0}^{\pi}\cos\left(Kx\right)\text{d}x=0 $$ for all $K \in \mathbb{Z}$, we have
$$ \int_{0}^{\pi}\frac{\cos\left(2018x\right)}{5-4\cos\left(x\right)}\text{d}x=\frac{\pi}{3}\left(\frac{1}{2}\right)^{2018} $$