Compute $\int \frac{\sin(x)}{\sin(x)+\cos(x)}\mathrm dx$

I'm having trouble computing the integral: $$\int \frac{\sin(x)}{\sin(x)+\cos(x)}\mathrm dx.$$ I hope that it can be expressed in terms of elementary functions. I've tried simple substitutions such as $u=\sin(x)$ and $u=\cos(x)$, but it was not very effective.

Any suggestions are welcome. Thanks.


Solution 1:

Let $I:=\int\frac{\cos x}{\cos x+\sin x}dx$ and $J:=\int\frac{\sin x}{\cos x+\sin x}dx$. Then $I+J=x + C$, and $$I-J=\int\frac{\cos x-\sin x}{\cos x+\sin x}dx=\int\frac{u'(x)}{u(x)}dx,$$ where $u(x)=\cos x+\sin x$. Now we can conclude.

Solution 2:

Hint: $\sqrt{2}\sin(x+\pi/4)=\sin x +\cos x$, then substitute $x+\pi/4=z$

Solution 3:

You can do this without thinking: use the Weierstrass substitution to reduce the integral to a rational function, and integrate that as usual.

Solution 4:

We can write the integrand as $$\begin{equation*} \frac{1}{1+\cot x} \end{equation*}$$ and use the substitution $u=\cot x$. Since $du=-\left( 1+u^{2}\right) dx$ we reduce it to a rational function

$$\begin{equation*} I:=\int \frac{\sin x}{\sin x+\cos x}dx=-\int \frac{1}{\left( 1+u\right) \left( u^{2}+1\right) }\,du. \end{equation*}$$

By expanding into partial fractions and using the identities

$$\begin{eqnarray*} \cot ^{2}x+1 &=&\csc ^{2}x \\ \arctan \left( \cot x\right) &=&\frac{\pi }{2}-x \\ \frac{\csc x}{1+\cot x} &=&\frac{1}{\sin x+\cos x} \end{eqnarray*}$$

we get

$$\begin{eqnarray*} I &=&-\frac{1}{2}\int \frac{1}{1+u}-\frac{u-1}{u^{2}+1}\,du \\ &=&-\frac{1}{2}\ln \left\vert 1+u\right\vert +\frac{1}{4}\ln \left( u^{2}+1\right) -\frac{1}{2}\arctan u +C\\ &=&-\frac{1}{2}\ln \left\vert 1+\cot x\right\vert +\frac{1}{4}\ln \left( \cot ^{2}x+1\right) -\frac{1}{2}\arctan \left( \cot x\right) +C \\ &=&-\frac{1}{2}\ln \left\vert 1+\cot x\right\vert +\frac{1}{4}\ln \left( \csc ^{2}x\right) +\frac{1}{2}x+\text{ Constant} \\ &=&\frac{1}{2}x-\frac{1}{2}\ln \left\vert \sin x+\cos x\right\vert +\text{ Constant.} \end{eqnarray*}$$