Just need to be sure on this : $\displaystyle \int \frac{dx}{2+\sin x +\cos x}$, making the substitution $\displaystyle x=2 \arctan (t)$ I reached that the integral is worth $\displaystyle \frac{2 \tan \left( \frac{x}{2}\right) }{5}+C$.
Just need to be sure on this : $\displaystyle \int \frac{dx}{2+\sin x +\cos x}$, making the substitution $\displaystyle x=2 \arctan (t)$ I reached that the integral is worth $\displaystyle \frac{2 \tan \left( \frac{x}{2}\right) }{5}+C$.
You're right. I think I know where is my error... Hmm no...
Let me show you what I did : Let $\displaystyle x=2\arctan (t)$, $\displaystyle dx=\frac{2}{1+t^2}$.
So the integral becomes $\displaystyle \int \frac{\frac{2}{1+t^2}}{2+\sin(2\arctan(t))+\cos(2\ arctan(t))}dt$.
Now let $\displaystyle \theta = \arctan(t)$.
We know that $\displaystyle \sin(2\theta)=2\cos(\theta)\sin(\theta)$ and that $\displaystyle \cos(2\theta)=2\cos ^2(\theta)-1$. Furthermore, $\displaystyle \cos(\arctan(t))=\frac{1}{\sqrt{1+t^2}}$ and $\displaystyle \sin(\arctan(t))=\frac{t}{\sqrt{1+t^2}}$.
Therefore we can rewrite the integral as $\displaystyle \int \frac{\frac{2}{1+t^2}}{2+2\left(\frac{1}{\sqrt{1+t ^2}} \right) \left( \frac{t}{\sqrt{1+t^2}} \right) +\frac{2}{1+t^2}-1}dt$, and from it I reached the result I gave in my first post. I thought I might have made an error for $\displaystyle \sin(\arctan(t))$, but I don't think so. Can you help me finding where is my error?
Before I read I tried by integration by parts and then by substitution but didn't reach anything. Now following your trick, I got that the final result is...................................... $\displaystyle \frac{\tan \left(\frac{x}{2} \right)}{\frac{\tan\left(\frac{x}{2} \right)+1}{\sqrt{2}}}+C$ or $\displaystyle \frac{\sqrt{2}\tan\left(\frac{x}{2} \right)}{\tan\left(\frac{x}{2} \right)+1}+C$. But you know what? I've a strong feeling I made at least an error in all that.
I am going to do the integral for you, so that you can check it when you get stuck ok?
$\displaystyle 2\int\frac{dt}{(t+1)^2+2}$
Let $\displaystyle t+1=\sqrt{2}\tan(\theta)$
$\displaystyle \Rightarrow{dt=\sqrt{2}\sec^2(\theta)}$
$\displaystyle \therefore\quad2\int\frac{dt}{(t+1)^2+2}\underbrac e{\Rightarrow}_{t+1=\sqrt{2}\tan(\theta)}2\int\fra c{\sqrt{2}\sec^2(\theta)}{2\tan^2(\theta)+2}~d\the ta$
$\displaystyle =\sqrt{2}\int\frac{\sec^2(\theta)}{\sec^2(\theta)~ }d\theta$
$\displaystyle =\sqrt{2}\int~d\theta$
$\displaystyle =\sqrt{2}\theta$
$\displaystyle \underbrace{\Rightarrow}_{\text{backsub}}2\int\fra c{dt}{(t+1)^2+2}=\sqrt{2}\arctan\left(\frac{t+1}{\ sqrt{2}}\right)$
$\displaystyle \underbrace{\Rightarrow}_{\text{backsub again}}\int\frac{dx}{2+\sin(x)+\cos(x)}=\sqrt{2}\a rctan\left(\frac{\tan\left(\frac{x}{2}\right)+1}{\ sqrt{2}}\right)+C$