Evaluating $\int_0^{2\pi}\frac{4 \cdot \cos(x)}{5-4 \cdot \cos(x)}dx=\frac{4}{3}\pi\;$ with residue?

Wolfam Alpha says that $$\int_0^{2\pi}\frac{4 \cdot \cos(x)}{5-4 \cdot \cos(x)}dx=\frac{4}{3}\pi$$

I want to calculate this on my own, but have problems.Would be great, if you could tell me where and what it is.

\begin{align}\int_0^{2\pi}\frac{4 \cdot \cos(x)}{5-4 \cdot \cos(x)}dx & =\operatorname{Re} \Biggr(\int_0^{2\pi}\frac{4e^{ix}}{5-4e^{ix}}dx \Biggl) \\ & = \operatorname{Re} \Biggr(\int_0^{2\pi}\frac{4z}{(5-4z)iz}dz \Biggl)\\ & = \operatorname{Re} \Biggr(-i\int_0^{2\pi}\frac{4}{(5-4z)}dz \Biggl) \\ & = \operatorname{Re} \Biggr(-i\Bigg[\ln(5-4z)\Bigg]_0^{2\pi}\Bigg) \\ & = \operatorname{Re} \Biggr(-i\ln(\frac{5-8\pi}{5})\Bigg)\\ \end{align}

I guess that I can't calculate the integral in this way, right ?

I guess that I can't calculate the integral in this way (4), right ?

• The problem is that, even though $\cos(x) = Re(e^{i x})$, this doesn't mean that $(4\cos(x))/(5-4\cos(x)) = Re(4e^{ix}/(5 - 4e^{ix})$ since in general $Re(a/b) \ne Re(a)/Re(b)$. – Dark Malthorp Jul 17 '18 at 19:55
• @DarkMalthorp: OK, thank you too !! – kratos88 Jul 17 '18 at 19:56

This is not the right way of calculating.$$\int_0^{2\pi}\frac{4 \cdot \cos(x)}{5-4 \cdot \cos(x)}dx=\int_{|z|=1}\frac{2z+2z^{-1}}{5-2z-2z^{-1}}\dfrac{dz}{iz}=\int_{|z|=1}\frac{2z^2+2}{5z-2z^2-2}\dfrac{dz}{iz}$$The singularities are in $2,\dfrac{1}{2},0$ where $$\operatorname{Re}z_0=-1\\\operatorname{Re}z_{\dfrac{1}{2}}=\dfrac{5}{3}$$therefore $$I=\dfrac{1}{i}2\pi i\left(-1+\dfrac{5}{3}\right)=\pi\dfrac{4}{3}$$
Hint: $$\frac{4 \cdot \cos x}{5-4 \cdot \cos x} \neq {\bf Re} \Biggr(\frac{4e^{ix}}{5-4e^{ix}} \Biggl)$$