TITLE: Find $\int_0^{2\pi}\frac1{5-4\cos x}\ dx$
QUESTION [5 upvotes]: $$\int_0^{2\pi}\frac1{5-4\cos x}\ dx$$
How do I compute this integral? An online integral calculator gives an antiderivative as
$$\frac{2\arctan(3\tan\frac x2)}3$$
but then gives the definite integral as $\frac{2\pi}3$. Obviously this doesn't make sense as the antiderivative vanishes at $x=0$ and $x=2\pi$.

REPLY [7 votes]: A simple way:
$$ I=\int_{0}^{2\pi}\frac{dx}{5-4\cos x}=\int_{0}^{\pi}\left(\frac{1}{5-4\cos x}+\frac{1}{5+4\cos x}\right)\,dx\tag{1}$$
$$ I = 10\int_{0}^{\pi}\frac{dx}{25-16\cos^2 x}=20\int_{0}^{\pi/2}\frac{dx}{25-16\cos^2 x} \tag{2}$$
and now, by setting $x=\arctan t$,
$$ I = 20 \int_{0}^{+\infty}\frac{dt}{25(1+t^2)-16} = 20 \int_{0}^{+\infty}\frac{dt}{9+25 t^2}\tag{3}$$
so by setting $t=\frac{3}{5}u$,
$$ I = 20\cdot\frac{3}{5}\cdot\frac{1}{9}\int_{0}^{+\infty}\frac{du}{1+u^2}=\frac{4}{3}\cdot\frac{\pi}{2}=\color{red}{\frac{2\pi}{3}}.\tag{4}$$