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.


\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}

  • $\begingroup$ A good and simple solution. Just a little question: is it compound angle formula from the second line to the third? thank you $\endgroup$ – Brian Cheung Jul 16 '15 at 9:15
  • 1
    $\begingroup$ From the 2nd to 3rd (and 4th to 5th), I used $\sin(a+b)=\sin(a)\cos(b)+\sin(b)\cos(a)$. You are welcome! $\endgroup$ – Math-fun Jul 16 '15 at 10:13

$$\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$$

  • 5
    $\begingroup$ Well then it is actually the same as my solution $\endgroup$ – Brian Cheung Jul 16 '15 at 7:13
  • $\begingroup$ I think it is the simplest way...... $\endgroup$ – Empty Jul 16 '15 at 7:16
  • $\begingroup$ It is a simple way but I think it is hard to think of for beginners like me...... $\endgroup$ – Brian Cheung Jul 16 '15 at 7:19
  • 1
    $\begingroup$ If it is hard to think to you then I think putting $t=\tan(x/2)$ is too much hard to think.. $\endgroup$ – Empty Jul 16 '15 at 7:21

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


and we are back to where we started from. This is good news as we have established


For integrals of this type, the so-called Weierstrass substitutions $t=\tan(x/2)$ is a classical one.

Another is based on complex numbers,


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.

  • $\begingroup$ (+1) very nice answer. i like how you explain the logic behind this trick! Deserves many more upvotes! $\endgroup$ – tired Jul 16 '15 at 10:47

hint: $t = \tan\left(\dfrac{x}{2}\right)$

  • $\begingroup$ So should I use t-substitution then trigonometric substitution again to duel with the denominator? $\endgroup$ – Brian Cheung Jul 16 '15 at 7:21
  • $\begingroup$ Yes you should. $\endgroup$ – DeepSea Jul 16 '15 at 7:45

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$$



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$


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. $$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.