Question:
$$\int_0^{4\pi}\frac{dx}{5+4\cos x} $$
My approach:
First I calculated the antiderivative as follows:
Using: $\cos\theta= \frac{1-\tan^2\frac{\theta}{2}}{1+\tan^2\frac{\theta}{2}}$ we have:
$\int\frac{dx}{5+4\cos x}=\int\frac{dx}{5+4\frac{1-\tan^2\frac{x}{2}}{1+\tan^2\frac{x}{2}}}=\int\frac{1+\tan^2\frac{x}{2}}{5+5\tan^2\frac{x}{2}+4-4\tan^2\frac{x}{2}}dx=\int\frac{\frac{1}{\cos^2 \frac{x}{2}}}{3^2+\tan^2\frac{x}{2}}dx$
Using substitution we have:
$u=\tan\frac{x}{2}$
$du=\frac{1}{2}\frac{1}{\cos^2\frac{x}{2}}dx$
$2\int\frac{\frac{1}{2}\frac{1}{\cos^2 \frac{x}{2}}}{3^2+\tan^2\frac{x}{2}}dx=2\int\frac{du}{3^2+u^2}=\frac{2}{3}\arctan\frac{u}{3}+\mathscr{C}=\frac{2}{3}\arctan\frac{\tan\frac{x}{2}}{3}+ \mathscr{C}$
Now we can calculate the definite integral as follows:
$\int_0^{4\pi}\frac{dx}{5+4\cos x} = \frac{2}{3}\arctan\frac{\tan\frac{x}{2}}{3}\bigl|_0^{4\pi}=\frac{2}{3}(\arctan\frac{\tan\frac{4\pi}{2}}{3}-\arctan\frac{\tan\frac{0}{2}}{3})=0$
The result I get is $0$ but the correct one is $\frac{4\pi}{3}$. Can someone explain me why?
Not an answer to the question but a quick note: we can clean up your computation by working in terms of $u$ rather than in terms of $x$. With the substitution of $u = \tan(x/2)$, we find that $$ du=\frac{1}{2}\sec^2\frac{x}{2}dx = \frac 12 (1 + u^2)\,dx $$ Now, we have $$ \int \frac{1}{5 + 4\cos x}dx = \int \frac{1}{5 + 4\frac{1-u^2}{1+u^2}}dx = \int \frac{(1+u^2)}{5(1+u^2) + 4(1-u^2)}dx = \int \frac{(1+[u(x)]^2)}{3^2 + [u(x)]^2}\,dx. $$ From here, substitution gives us $$ 2\int \frac{1}{3^2 + [u(x)]^2}\cdot\frac{1+[u(x)]^2}{2} dx = 2\int\frac{1}{3^2 + u^2}\,du. $$