Prove that, $\int_{0}^{2\pi}\frac{\cos x+2}{5+4\cos x} dx=\pi$

I have tried to solve this which goes as follows-
\begin{align*} \int\frac{\cos x+2}{5+4\cos x} dx &=\int\frac{(1/4)(5+4\cos x)+(3/4)}{5+4\cos x} dx\\ &={1\over4}\int dx+{3\over4}\int\frac{dx}{9\cos^2 {x\over 2}+\sin^2{x\over2}}\\ &=({x\over4}+C)+{3\over4}\int\frac{\sec^2{x\over2}}{9+\tan^2{x\over2}}dx\\ &=({x\over4}+C)+{3\over2}\int\frac{dy}{9+y^2}\qquad \text{substituting \tan {x\over2}=y}\\ &={x\over4}+{1\over2}\arctan({y\over3})+C'={x\over4}+{1\over2}\arctan({\tan{x\over2}\over3})+C' \end{align*} So, $$\int_{0}^{2\pi}\frac{\cos x+2}{5+4\cos x} dx=\left[{x\over4}\right]_{0}^{2\pi}+{1\over2}\left[\arctan({\tan{x\over2}\over3})\right]_{0}^{2\pi} \\={\pi\over2}+{1\over2}\left[\arctan({\tan\pi\over3})-0\right]={\pi\over2}+{1\over2}\left[0-0\right]={\pi\over2}$$ So, I can't get $$\pi$$!! Can anybody find out where is my fault? Thanks for assistance in advance.

Note that $$\int\frac{\cos x+2}{5+4\cos x} dx=F(x):={x\over4}+{1\over2}\arctan\left({\tan{x\over2}\over3}\right)+c$$ but the function $$F$$ is not continuous on the interval of integration $$[0,2\pi]$$ (on the other hand a primitive of a continuous function should be continuous by the Fundamental Theorem of Calculus).

Since $$F$$ has a "jump" at $$x=\pi$$ we may split the interval and therefore we obtain $$\int_0^{2\pi}\frac{\cos x+2}{5+4\cos x} dx =\int_0^{\pi} +\int_{\pi}^{2\pi} =[F(x)]_{0^+}^{\pi^-}+[F(x)]_{\pi^+}^{2\pi^-}=\frac{\pi}{2}+\frac{\pi}{2}=\pi.$$

• @BiswarupSaha See my edit! Is it clear now? – Robert Z Feb 12 '19 at 15:11
• But $\left[\arctan({\tan{x\over2}\over3})\right]_{0}^{\pi}={\pi\over2}$ and $\left[\arctan({\tan{x\over2}\over3})\right]_{\pi}^{2\pi}=-{\pi\over2}$? – MathBS Feb 12 '19 at 15:13
• @BiswarupSaha You shoul take right limit at $\pi$ and left limit at $2\pi$!! – Robert Z Feb 12 '19 at 15:17
• @greedoid $\frac{\cos x+2}{5+4\cos x}$ does exist and it is continuous on $[0,2\pi]$ – Robert Z Feb 12 '19 at 15:18
• Ah, yes, I don't know why I saw -4/5 instead of -5/4 – Aqua Feb 12 '19 at 15:20


Hint: Substitute $$\cos(x)=\frac{1-t^2}{1+t^2}$$ and $$dx=\frac{2}{1+t^2}dt$$

• I think the OP is asking specifically where he's made a mistake as opposed to how to integrate the function. – Clayton Feb 12 '19 at 15:00
• “Can anybody find out where is my fault?” – once more I wonder if you read all of the question ... – Martin R Feb 12 '19 at 16:06