Integrate $\int \frac{1}{1+ \tan x}dx$ Does this integral have a closed form?
$$\int \frac{1}{1+ \tan x}\,dx$$
My attempt:
$$\int \frac{1}{1+ \tan x}\,dx=\ln (\sin x + \cos x) +\int \frac{\tan x}{1+ \tan x}\,dx$$
What is next?
 A: $$
I=\int  \frac 1 {1+\tan  x} \, dx=\int \frac {\cos x}{\cos x +\sin x} \, dx\\
J=\int \frac {\sin x}{\cos x +\sin x} \, dx\\
I+J=\int \frac {\cos x+\sin x}{\cos x +\sin x} \, dx = x+C_1\\ \\
I-J=\int \frac {\cos x-\sin x}{\cos x +\sin x} \,dx=\int \frac { d\left( \sin x +\cos x\right)  }{ \cos x +\sin x} =\ln \left| \sin x +\cos x \right| + C_2 \\
2I = x+\ln \left| \sin x +\cos x\right| + C_3 \\
I=\frac 1 2 \left[ x+\ln \left| \sin x +\cos x \right| + C_3 \right]
$$
A: Notice that $$\int \frac{\tan{x}}{1+\tan{x}}= \int 1-\frac{1}{1+\tan{x}}$$
A: Continuation from the Work in the Question
$$
\begin{align}
\int\frac1{1+\tan(x)}\,\mathrm{d}x
&=\log(\sin(x)+\cos(x))+\int\frac{\tan(x)}{1+\tan(x)}\,\mathrm{d}x\tag1\\
&=\frac12\log(\sin(x)+\cos(x))+\frac12\int\frac{1+\tan(x)}{1+\tan(x)}\,\mathrm{d}x\tag2\\
&=\frac12(x+\log(\sin(x)+\cos(x)))+C\tag3
\end{align}
$$
Explanation:
$(1)$: copied from the question
$(2)$: average the left and right sides of $(1)$
$(3)$: $\int1\,\mathrm{d}x=x+C$

Another Approach
One can also try $u=\tan(x)$ and partial fractions:
$$
\begin{align}
\int\frac{\mathrm{d}x}{1+\tan(x)}
&=\int\frac{\mathrm{d}\tan(x)}{(1+\tan(x))\left(1+\tan^2(x)\right)}\tag4\\
&=\int\frac12\left(\frac1{1+u}+\frac{1-u}{1+u^2}\right)\mathrm{d}u\tag5\\
&=\frac12\left(\log(1+u)+\tan^{-1}(u)-\frac12\log\left(1+u^2\right)\right)+C\tag6\\
&=\frac12(x+\log(\sin(x)+\cos(x)))+C\tag7
\end{align}
$$
Explanation:
$(4)$: $\mathrm{d}\tan(x)=\left(1+\tan^2(x)\right)\,\mathrm{d}x$
$(5)$: $u=\tan(x)$ and partial fractions
$(6)$: integrate
$(7)$: backsubstitute
A: $$ \tan x=\frac {2\tan x/2}{1+\tan^2 x/2}$$
Solves your integral with $$u=\tan x/2$$
A: Notice that
$$(\log(\sin x\pm\cos x))'=\frac{\cos x\mp\sin x}{\sin x+\cos x}$$
Then
$$(\log(\sin x+\cos x)+\log(\sin x-\cos x))'=(\log(\sin^2x-\cos^2x))'=\frac{2\cos x}{\sin x+\cos x}.$$
A: How about:
$$\int\frac{1}{1+\tan(x)}dx= \ln(\sin(x)+\cos(x)) +\int\frac{\tan(x)}{1+tan(x)}dx= \ln(\sin(x)+\cos(x)) +\int\left(1-\frac{1}{1+\tan(x)}\right)dx$$
$$\therefore I= \ln(\sin(x)+\cos(x))+x-I$$
$$\therefore I=\frac{\ln(\sin(x)+\cos(x))+x}{2}+C $$
A: If the numerator and denominator are both polynomials of trigonometric functions, then the substitution $y= \tan(x/2)$ should always work. It is not necessarily the shortest solution, but it works. 
