How to resolve this integral $J = \int{\frac{2-\sin{x}}{2+\cos{x}}}dx$? $$J = \int{\frac{2-\sin{x}}{2+\cos{x}}}dx$$
I'm already try to do this step in below:
$$\overset{split}{=} \int{\frac{2}{2+\cos{x}}dx}+\int{\frac{d(\cos{x}+2)}{2+\cos{x}}} = \int{\frac{2}{1+2\cos^2{\frac{x}{2}}}dx} + \ln({2+\cos{x}})$$
 A: Note
$$\int{\frac{2}{1+2\cos^2{\frac{x}{2}}}dx}=\int{\frac{2\sec^2\frac x2}{\sec^2\frac x2+2}dx} 
 =4\int{\frac{d(\tan\frac x2)}{\tan^2\frac x2+3}dx} 
= \frac4{\sqrt3}\tan^{-1}\frac{\tan\frac x2}{\sqrt3}
$$
A: This is a classical example where the parametric formulas help
$$dx=\frac{2}{1+t^2}dt$$
$$\sin x=\frac{2t}{1+t^2}$$
$$\cos x=\frac{1-t^2}{1+t^2}$$
A: We need to find $$J:=\int \frac{2-\sin(x)}{2+\cos(x)}\operatorname{dx}.$$
The answer is $$\boxed{J=\frac{4}{\sqrt{3}}\arctan\left(\frac{\tan(x/2)}{\sqrt{3}} \right)+\ln(\cos(x)+2)+C}$$
For solve $J$, we can use the substitution recommended by @Prime Mover.
Let, $\color{blue}{u=\tan(x/2)}$ so we have that $$\operatorname{du}=\frac{1}{2}\sec^{2}(x/2)\operatorname{dx}.$$
Then transform the integrand using the substitution recommended by @tommik, $$\sin(x)=\frac{2u}{u^{2}+1},$$ we can find that $$\cos(x)=\frac{1-u^{2}}{u^{2}+1},$$ and $$\operatorname{dx}=\frac{2}{u^{2}+1}\operatorname{du}.$$
Then, \begin{eqnarray}
J&=&\int \frac{2\left(2-\frac{2u}{u^{2}+1}\right)}{(u^{2}+1)\left(\frac{1-u^{2}}{u^{2}+1}+2 \right)}\operatorname{du}\\
&=&4\int \frac{u^{2}-u+1}{u^{4}+4u^{2}+3}\operatorname{du}\\
&=&2\int \frac{u+2}{u^{2}+3}\operatorname{du}-2\int \frac{u}{u^{2}+1}\operatorname{du}.
\end{eqnarray}
In the last part I used partial fractions, I'll let you fill in those details.
Since that, $$\frac{u+2}{u^{2}+3}=\frac{u}{u^{2}+3}+\frac{2}{u^{2}+3},$$so we have that $$J=2\int \frac{u}{u^{2}+3}\operatorname{du}+4\int \frac{1}{u^{2}+3}\operatorname{du}-2\int \frac{u}{u^{2}+1}\operatorname{du}.$$
The first integral is solved for change of variable $t_{1}:=u^{2}+3$, the second integral for change of variable $t_{2}:=\frac{u}{\sqrt{3}}$ and the third integral for change of variable $t_{3}:=u^{2}+1$.
Finally, return the variable changes and you will get $$J=\frac{4}{\sqrt{3}}\arctan\left(\frac{\tan(x/2)}{\sqrt{3}} \right)+\ln(\cos(x)+2)+C.$$
A: To solve the $\displaystyle \int \dfrac 2 {2 + \cos x} \mathrm d x$, you may want to try the Weierstrass substitution $u = \tan \dfrac x 2$.
This will then yield a polynomial which simplifies significantly.
