Definite integral of $1/(5+4\cos x)$ over $2$ periods 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?  
Here it shows that the correct answer is $\frac{4\pi}{3}$.
 A: Use $$\int_{0}^{2a} f(x) dx=2 \int_{0}^{a} f(x) dx,~ if~ f(2a-x)=f(x)$$ to get
$$I=\int_{0}^{4\pi} \frac{dx}{5+4\cos x}=4\int_{0}^{\pi} \frac{dx}{5+4 \cos x}~~~~(1)$$
Next use $$\int_{0}^{a} f(x) dx= \int_{0}^{a} f(a-x) dx$$ to get
$$I=4\int_{0}^{\pi} \frac{dx}{5-4 \cos x}~~~~(2)$$
Adding (1) and (2) we get
$$2I=40\int_{0}^{\pi} \frac{dx}{25-16 \cos^2 x} =40 \int_{0}^{\pi}\frac{\sec^2x dx}{25sec^2 x-16}=$$
$$40 \int_{0}^{\pi}\frac{\sec^2x dx}{25\tan^2 x-16}=\frac{8}{5} \int_{0}^{\infty}\frac{du}{9/25+u^2}=\left.\frac{8}{3} \tan^{-1}\frac{5u}{3}\right|_{0}^{\infty}=\frac{4 \pi}{3}.$$
A: Just observe that $I=\int\limits_0^{4\pi}\frac{dx}{5+4\cos x} = 4\int\limits_0^{\pi}\frac{dx}{5+4\cos x} $.
Then you can use tangent half-angle substitution to get 
$I=\frac{8}{3}\int_\limits0^{\infty}\frac{(1/3)dx}{1+{(u/3)}^2}=\frac{8}{3}\cdot\tan^{-1}(u/3)|_0^\infty =\frac{4\pi}{3}$
A: You have everything right up to the limit taking,
$$I=\int_0^{4\pi}\frac{dx}{5+4\cos x} = \frac{2}{3}\arctan\frac{\tan\frac{x}{2}}{3}\bigl|_0^{4\pi}$$
Note that the anti derivative function on the RHS is discontinuous at $\pi$ and $3\pi$. So, the limits have to be broken into  three intervals,
$$\bigl|_0^{4\pi} =  \bigl|_0^{\pi}+\bigl|_\pi^{3\pi} +\bigl|_{3\pi}^{4\pi} $$
which leads to the result 
$$I = \frac23 (\frac\pi2+\pi+\frac\pi2)=\frac43\pi$$
as expected.
A: 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.
$$
A: In real life the indefinite integral is usually given via Kepler's angle:
$$\sin\psi=\frac{\sqrt{1-e^2}\sin x}{1+e\cos x}$$
For $0<e<1$. So
$$\cos^2\psi=\frac{1+2e\cos x+e^2\cos^2-\sin^2 x+e^2\sin^2x}{\left(1+e\cos x\right)^2}=\frac{\left(\cos x+e\right)^2}{\left(1+e\cos x\right)^2}$$
Since we want a small positive $x$ to correspond to a small positive $\psi$,
$$\cos\psi=\frac{\cos x+e}{1+e\cos x}$$
We can take differentials of the definition to get
$$\cos\psi\,d\psi=\sqrt{1-e^2}\frac{\cos x\left(1+e\cos x\right)-\sin x\left(-e\sin x\right)}{\left(1+e\cos x\right)^2}dx=\frac{\sqrt{1-e^2}\left(\cos x+e\right)}{\left(1+e\cos x\right)^2}dx=\frac{\sqrt{1-e^2}\cos\psi}{1+e\cos x}dx$$
So that
$$\frac{dx}{1+e\cos x}=\frac{d\psi}{\sqrt{1-e^2}}$$
Applying this substitution to the instant case,
$$\int\frac{dx}{5+4\cos 5}=\frac15\int\frac{dx}{1+\frac45\cos x}=\frac15\int\frac{d\psi}{\sqrt{1-16/25}}=\frac13\psi+C$$
Now, when $x=2\pi n$, $\sin\psi=0$ and $\cos\psi=1$ so $\psi=2\pi n$ , that is, $\psi$ makes $1$ complete cycle for every cycle of $x$; it just advances at different rates in between multiples of $\pi$. Thus
$$\int_0^{4\pi}\frac{dx}{5+4\cos x}=\left.\frac13\psi\right|_0^{4\pi}=\frac134\pi$$
