<s>[INST] Evaluate $\int \frac{dx}{1+\sin x+\cos x}$ Evaluate $$\int \frac{1}{1+\sin x+\cos x}\:dx$$
I tried several ways but all of them didn't work
I tried to use Integration-By-Parts method but it's going to give me a more complicated integral
I also tried u-substitution but all of my choices of u didn't work
Any suggestions?
 [/INST] $$
\begin{aligned}
\int \frac{d x}{1+\sin x+\cos x} 
= & \int \frac{d x}{2 \cos ^2 \frac{x}{2}+2 \sin \frac{x}{2} \cos \frac{x}{2}}\\ &=\frac{1}{2} \int \frac{\sec ^2 \frac{x}{2}}{1+\tan \frac{x}{2}} d x\\&=\int \frac{d\left(\tan \frac{x}{2}\right)}{1+\tan \frac{x}{2}}
\\&=\ln \left|1+\tan \frac{x}{2}\right|+C
\end{aligned}
$$
</s>