Integration of fractional trigonometric functions How can we integrate the function $\displaystyle f(x)= \int \frac {dx}{1+\sin(x)+\cos(x)}$ ? Is there any general solution for such a functions?
 A: Use the substitution $\text{u}=1+\tan\frac{x}{2}$ and $\text{d}\text{u}=\frac{\sec^2\frac{x}{2}}{2}\space\text{d}x$:
$$\int\frac{1}{1+\cos x+\sin x}\space\text{d}x=\int\frac{1}{\text{u}}\space\text{d}\text{u}=\ln\left|\text{u}\right|+\text{C}=\ln\left|1+\tan\frac{x}{2}\right|+\text{C}$$
Because, we can write:
$$\frac{1}{1+\cos x+\sin x}=\frac{1}{2}\cdot\frac{\sec^2\frac{x}{2}}{1+\tan\frac{x}{2}}$$
A: $$ \int \frac 1 {1+(\sin x+\cos x)}\,dx = \int\frac{1-(\sin x+\cos x)}{1-(\sin x+\cos x)^2} \, dx = \int\frac{(\sin x+\cos x)-1}{2\sin x\cos x} \, dx$$
So $$ \frac 1 2 \int \sec x \, dx+\frac 1 2 \int \csc xdx-\int \csc 2x \, dx$$
Now use Identity
$$\bullet \; \int \sec x\,dx = \ln|\sec x+\tan x|+C = \ln \bigg|\tan \left(\frac \pi 4 +\frac x 2 \right)\bigg|+\mathcal{C}$$
$$\bullet \; \int \csc x \, dx = \ln|\csc x-\cot x|+C = \ln \left|\sin \frac x 2 \right|+C$$
A: We can also use the t-substitution where $t=\tan\frac{x}2$ which gives
$\cos x=\frac{1-t^2}{1+t^2}$ and $\sin x =\frac{2t}{1+t^2}$.
Also $dx=\frac{2}{1+t^2}dt$. Hence
$$\displaystyle\int\frac{1}{1+\cos x+\sin x}dx=\int\frac{1}{{1+\frac{1-t^2}{1+t^2}}+\frac{2t}{1+t^2}} \frac{2}{1+t^2}dt=\int\frac{1}{1+t}dt=\ln|1+t|+C$$
