Integral of trig fraction using substitution? I'm chewing on an integral problem and don't have a clue where to begin.  If someone could assist by suggesting a good starting point, I'd really appreciate it!  Not asking for anyone to solve the integral, just looking for a hint or two:
$$\int{\frac{1}{1+\sin{x}+\cos{x}}\,\,dx}$$
I'm completely stuck - tried substituting for $\tan^2{x}=\sec^2{x}-1$ and so forth, but haven't found it to be terribly useful yet.  Maybe I'm missing something.  I also suspect this is a prime candidate for u- or t-substitution.
Thanks!
 A: We take $u=\tan\left(\frac{x}{2}\right)
 $, $du=\frac{1}{2}\sec^{2}\left(\frac{x}{2}\right)dx
 $, then we use the substitutions $\sin\left(x\right)=\frac{2u}{u^{2}+1}
 $, $\cos\left(x\right)=\frac{1-u^{2}}{u^{2}+1}
 $ and $dx=\frac{2du}{u^{2}+1}
 $. So we have $$\int\frac{1}{1+\sin\left(x\right)+\cos\left(x\right)}dx=\int\frac{2}{\left(u^{2}+1\right)\left(1+\frac{2u}{u^{2}+1}+\frac{1-u^{2}}{u^{2}+1}\right)}du=\int\frac{1}{u+1}du
 .$$ I think you can take it now.
A: This might help. I will put some more steps in a bit.
\begin{align}
& \frac{1}{1+(\sin(x)+\cos(x))} \cdot \frac{1-(\sin(x)+\cos(x))}{1-(\sin(x)+\cos(x))} = \frac{1-(\sin(x)+\cos(x)}{1-(\sin(x)+\cos(x))^2} \\[8pt]
= {} &\frac{1-\sin(x)-\cos(x)}{1-(\sin^2(x)+2\sin(x)\cos(x)+\cos^2(x)}=\frac{1-\sin(x)-\cos(x)}{1-(1+2 \sin(x) \cos(x))} \\[8pt]
= {} &\frac{1-\sin(x)-\cos(x)}{-2 \sin(x) \cos(x)}
\end{align}
\begin{align}
& \int \frac{1}{-2 \sin(x) \cos(x) } \, dx-\int \frac{\sin(x)}{-2 \sin(x) \cos(x)} \, dx-\int \frac{\cos(x)}{-2 \sin(x) \cos(x)} \, dx \\[8pt]
= {} & \int - \csc(2x) \, dx+\int \frac{1}{2} \sec(x)dx+\int \frac{1}{2} \csc(x) \, dx
\end{align}
Think you can finish it from here.
A: $$\int \frac{1}{1+\cos x+\sin x}dx=\int \frac{1}{\frac{2}{2}(1+cos x)+2\cos(x/2)\sin(x/2)}dx$$
$$=\int \frac{1}{2\cos^2(x/2)+2\cos(x/2)\sin(x/2)}dx$$
$$=\int \frac{1}{2\cos^2(x/2)(1+\tan(x/2))}dx$$
$$=\int \frac{.5\sec^2(x/2)}{1+\tan(x/2)}dx=\log(1+\tan(x/2))+C$$
A: Since
$\sin x + \cos x
=\sqrt{2}\sin(x+\pi/2)
$,
$I
=\int \frac{dx}{1+\sin x+\cos x}
=\int \frac{dx}{1+\sqrt{2}\sin (x+\pi/2)}
=\int \frac{dy}{1+\sqrt{2}\sin (y)}
$,
where
$y = x+\pi/2$.
Setting
$u = \tan(y/2)$,
so
$\sin y = 2u/(u^2+1)$
and
$dy
=2du/(u^2+1)
$,
$\begin{array}\\
I
&=\int \frac{2du/(u^2+1)}{1+\sqrt{2}2u/(u^2+1)}\\
&=\int \frac{2du}{u^2+1+2\sqrt{2}u}\\
&=\int \frac{2du}{(u+\sqrt{2})^2-1}\\
&=2\int \frac{dv}{v^2-1}
\qquad (v = u+\sqrt{2})\\
&=\int dv\left(\frac{1}{v-1}-\frac{1}{v+1}\right)\\
&=\ln|v-1|-\ln|v+1|+c\\
&=\ln\big|\frac{v-1}{v+1}\big|+c\\
&=\ln\big|\frac{u+\sqrt{2}-1}{u+\sqrt{2}+1}\big|+c\\
\end{array}
$
Continuing,
replace $u$
by $\tan((x+\pi/2)/2)$
to get the integral
as a function of $x$.
