TITLE: Compute $\int \frac{\sin(x)}{\sin(x)+\cos(x)}\mathrm dx$
QUESTION [87 upvotes]: 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.

REPLY [2 votes]: So we have the integral
$$\int \frac{\sin(x)}{\sin(x)+\cos(x)}\mathrm dx.$$
A little bit more general solution would be to substitute $\sin(x) + \cos(x) = k\cos(\phi+x)$:
$$\int \frac{1}{k}\frac{\sin(x)}{\cos(\phi+x)}\mathrm dx.$$
We know this is true from elementary trigonometry. Now if we know the logarithmic derivative : $$\frac{\partial \ln(g(x))} {\partial x} = \frac{g'(x)}{g(x)}$$ we are almost done immediately without even needing to do any substitution, however of course we need to determine $\phi$ and add a constant of integration, but that is a rather easy exercise.