Is there another simple way to solve this integral $I=\int\frac{\sin{x}}{\sin{x}+\cos{x}}dx$? The integral I want to find is$$I=\int\frac{\sin{x}}{\sin{x}+\cos{x}}dx$$
The way I learnt is to introduce$$J=\int\frac{\cos{x}}{\sin{x}+\cos{x}}dx$$
Then $J+I=x+C_1$ and $J-I=\ln|\sin{x}+\cos{x}|+C_2$.
Is there some simple way to solve this integral $I$? For example, do not introduce other integrals?
Any hints will be appreciated. Thank you.
 A: $$\int \frac{\sin x}{\sin x +\cos x}\,dx$$
$$=\frac{1}{2}\int \frac{(\sin x+\cos x)-(\cos x-\sin x)}{\sin x+\cos x}\,dx$$
$$=\frac{x}{2}-\frac{1}{2}\ln(\sin x+\cos x)+C$$
A: \begin{align}
\int\frac{\sin{x}}{\sin{x}+\cos{x}}dx&=\int\frac{\sin{x}}{\sqrt 2\sin{(x+\pi/4)}}dx\\
&=\int\frac{\sin{(u-\pi/4)}}{\sqrt 2\sin{(u)}}du\\
&=\frac12\int(1-\cot u)du\\
&=\frac u2-\frac12\log|\sin u|+c\\
&=\frac x2-\frac12\log|\sin x+\cos x|+c'\\
\end{align}
A: The reasoning behind this trick:
(or how to avoid rabbits pulled out of a hat)
$$\frac{\sin(x)}{\sin(x)+\cos(x)}$$
cannot be integrated by inspection, as it is lacking a $-\cos(x)$ term that would enable the use of
$$\frac{-\cos(x)+\sin(x)}{\ \ \ \sin(x)+\cos(x)}=-\frac{(\sin(x)+\cos(x))'}{\sin(x)+\cos(x)}.$$
It is tempting to add and remove this term, giving
$$\frac{-\cos(x)+\sin(x)}{\ \ \ \sin(x)+\cos(x)}+\frac{\cos(x)}{\sin(x)+\cos(x)}.$$
Then it suffices to observe that 
$$\frac{\cos(x)}{\sin(x)+\cos(x)}=1-\frac{\sin(x)}{\sin(x)+\cos(x)},$$
and we are back to where we started from. This is good news as we have established
$$I=-\ln|\sin(x)+\cos(x)|+x-I.$$

For integrals of this type, the so-called Weierstrass substitutions $t=\tan(x/2)$ is a classical one.
Another is based on complex numbers, 
$$\cos(x)=\frac{z+z^{-1}}2,\sin(x)=\frac{z-z^{-1}}{2i},dx=\frac{dz}{iz}.$$
Both will rationalize the integral, i.e. turn it to the ratio of two polynomials, for which a systematic method exists.
You should practice these.
A: hint: $t = \tan\left(\dfrac{x}{2}\right)$
A: As the given
$$I=\int \frac{sinx}{sinx+cosx}dx$$
$$= \int \frac{tanx}{tanx+1}dx$$
Put $ tanx=t \implies sec^2x.dx=dt$
$\implies (1+tan^2x)dx=dt \implies dx=\frac{dt}{1+t^2}$
So we have
$$I=\int\frac{t}{t+1}.\frac{dt}{1+t^2} \to (1)$$
Now by using partial fraction
$$\frac{t}{(1+t)(1+t^2)}=\frac{A}{1+t}+\frac{Bt+C}{1+t^2} \to (2) $$
$$t=A(1+t^2)+(Bt+C)(1+t) \to(3)$$
Put $1+t=0 \implies t=-1$ in above eq
$$-1=A(1+1)+0 \implies A=\frac{-1}{2}$$
Now from eq $(3)$
$$t=A+At^2+Bt+Bt^2+C+Ct$$
Comparing coefficients of $t^2$ and $t$.
Coefficient of $t^2$
$$0=A+B \implies B=-A$$
$$B=\frac{1}{2}$$
Coefficient of $t$
$$1=B+C \implies C=1-B $$
$$C=1-\frac{1}{2} \implies C=\frac{1}{2} $$
Putting these values in eq $(2)$
$$\frac{t}{(1+t)(1+t^2)} = \frac{\frac{-1}{2}}{1+t} + \frac{\frac{1}{2}t+\frac{1}{2}}{1+t^2}$$
Putting this value in eq $(1)$
$$I=\int (\frac{\frac{-1}{2}}{1+t} + \frac{\frac{1}{2}t+\frac{1}{2}}{1+t^2})dt $$
$$I= \frac{1}{2} \int \frac{-1}{1+t}dt + \frac{1}{2} \int \frac{t+1}{t^2+1}dt $$
$$I= - \frac{1}{2} \ln (1+t) + \frac{1}{4}\int \frac{2t}{t^2+1}dt + \frac{1}{2} \int \frac{1}{t^2+1}dt$$
$$I= - \frac{1}{2} \ln (1+t) + \frac{1}{4} \ln (t^2+1) + \frac{1}{2} \arctan(t)+C $$
As $t=tanx$. So we have
$$I= - \frac{1}{2} \ln (1+tanx) + \frac{1}{4} \ln (tan^2x+1) + \frac{1}{2} \arctan(tanx)+C $$
$$I= - \frac{1}{2} \ln (1+tanx) + \frac{1}{4} \ln (tan^2x+1) + \frac{1}{2} x +C$$
$$=-\frac{1}{2}\ln(1+tanx)-\frac{1}{2}\ln(cosx)+\frac{1}{2}x+C$$
$$=\frac{1}{2}x-\frac{1}{2}\ln(sinx+cosx)+C$$
A: HINT:
For $\int\dfrac{a\sin x+b\cos x}{A\sin x+B\cos x}dx$
write $\dfrac{a\sin x+b\cos x}{A\sin x+B\cos x}=C+D\dfrac{\dfrac{d(A\sin x+B\cos x)}{dx}}{A\sin x+B\cos x}$
$\implies a\sin x+b\cos x=C(A\sin x+B\cos x)+D(A\cos x-B\sin x)$
Compare the coefficients of $\sin x,\cos x$ to find $C,D$ in terms of $a,A,b,B$
A: Since
$$
\frac{\sin x}{\sin x+\cos x}=\frac{1}{2}\bigl(1+\tan(x-\pi/4)\bigr),
$$
we get
$$
\int \frac{\sin x}{\sin x+\cos x}\,dx=\frac{1}{2}\bigl(x+\ln|\cos(x-\pi/4)|\bigr)+C.
$$
