Integrating $\int\dfrac{1}{1+\sin x+\cos x}$ I am having a hard time with this integration:
$$\int\frac{1}{1+\sin x+\cos x}$$
I would prefer a hint to solve this.
Also, any other method except the conventional method is also welcome.
 A: The $1+\cos x$ suggests replacing it by $2\cos^2\frac x2$. Knowing that $\sin x=2\sin\frac x2\cos\frac x2$, it becomes
$$\frac12\int\frac{dx}{\cos\frac x2(\sin\frac x2+\cos\frac x2)}.$$
The next thing we could do is partial fraction decomposition, to get rid of the product in the denominator. Writing
$$\frac1{\cos y(\sin y+\cos y)}=\frac{a\sin y +b\cos y}{\sin y+\cos y}+\frac{c\sin y+d\cos y}{\cos y}$$
we find $a=-1$, $b=1$, $c=1$ and $d=0$.
Using this we get
$$\int\frac{\cos\frac x2-\sin\frac x2}{\sin\frac x2+\cos\frac x2}\frac{dx}2-\int\frac{-\sin\frac x2}{\cos\frac x2}\frac{dx}2.$$
Coincidentally, this is precisely
$$\int\frac{d(\sin\frac x2+\cos\frac x2)}{\sin\frac x2+\cos\frac x2}-\int\frac{d(\cos\frac x2)}{\cos\frac x2}$$
wich is
$$\log\left|\sin\frac x2+\cos\frac x2\right|-\log\left|\cos\frac x2\right|=\log\left|1+\tan\frac x2\right|.$$
A: Hint
For problem, of this type, Weierstrass substitution (or tangent half-angle substitution) is extremely useful. Using $t=\tan(x/2)$, you have $$\sin(x)=\frac{2t}{1+t^2}$$  $$\cos(x)=\frac{1-t^2}{1+t^2}$$ $$dx=\frac{2dt}{1+t^2}$$ So, for the integral $$\int\frac{dx}{1+\sin x+\cos x}=\int\frac{dt}{1+t}$$
I am sure that you can take from here.
