<s>[INST] Find $\int_0^{2\pi}\frac1{5-4\cos x}\ dx$ $$\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$.
 [/INST] By Weierstrass Substitution:
By symmetry, we can half the integration interval as
$$
\int_0^{2 \pi} \frac{1}{5-4 \cos x} d x=2 \int_0^\pi \frac{1}{5-4 \cos x} d x
$$
Putting $t=\tan \frac{x}{2}$ transforms the integral into
$$
\begin{aligned}
I & =2 \int_0^\pi \frac{1}{5-\frac{4\left(1-t^2\right)}{1+t^2}} \cdot \frac{2 d t}{1+t^2} \\
& =4 \int_0^{ \infty} \frac{d t}{9 t^2+1} \\
& =\frac{4}{3}\left[\tan ^{-1}(3 t)\right]_0^{\infty} \\
& =\frac{2 \pi}{3} 
\end{aligned}
$$
</s>