95

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.

ಠ_ಠ
  • 11,310
Michael Li
  • 2,251
  • 2
    I removed the display from your title. It's better to keep titles simple so that the main page does not break too much. – Mariano Suárez-Álvarez Aug 09 '12 at 17:01
  • 1
    http://www.wolframalpha.com/input/?i=int+%7B+sin+x+%2F%7Bcosx+%2B+sinx%7D. wolframaplha.com it is a helpful site for computations – clark Aug 09 '12 at 17:06

8 Answers8

249

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.

Davide Giraudo
  • 181,608
  • 12
    You can make this even simpler by just writing the $\sin x$ in the numerator as ${1 \over 2}(\sin x + \cos x) - {1 \over 2}(\cos x - \sin x)$. – Zarrax Aug 09 '12 at 17:12
  • 8
    @Zarrax, that magical step only helps in hiding what is going on :-) – Mariano Suárez-Álvarez Aug 09 '12 at 18:09
  • 23
    In this math education article the author describes giving the same problem to a young Terence Tao, aged 8; he gave essentially the same beautiful solution. – Erick Wong Aug 09 '12 at 18:29
  • 4
    $$\frac{\cos x - \sin x}{\cos x + \sin x} = \frac{1 - \tan x}{1+\tan x} = \frac{\tan\frac\pi4 - \tan x}{1 + \tan\frac\pi4\tan x} = \tan\left( \frac \pi4 - x \right),\quad\text{etc.}$$ – Michael Hardy Dec 01 '15 at 18:54
  • 5
    This was essentially the important thing to notice for A putnam question asking to evaluate $$\int_{0}^{\pi/2} \frac{1}{1+\tan^{\sqrt{2}}(x)}dx$$ in which case $I=J$ – Andres Mejia Aug 30 '16 at 06:10
  • 1
    @Erick Wong, can you please check the link if still working! Every story about Tao is sort of legendary. – MathArt May 02 '24 at 11:57
  • @MathArt Thanks for mentioning this. I used Internet Archive to find the link redirection to https://link.springer.com/article/10.1007/BF00312075. For posterity, here is the citation: Clements, MA (Ken). Terence Tao. Educ Stud Math 15, 213–238 (1984). – Erick Wong May 03 '24 at 22:07
45

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

Myshkin
  • 36,898
  • 28
  • 168
  • 346
  • 5
    Thanks. This is a new formula for me. The pity is a number of constants appears meanwhile. – Michael Li Aug 09 '12 at 17:30
  • 4
    Very nice, at least if we can regard $\int \csc t ,dt$ as a "book" integral. – André Nicolas Aug 09 '12 at 18:57
  • 27
    @Michael This formula generalizes to $$A\cos x+B\sin x=\sqrt{A^{2}+B^{2}}\sin \left( x+\arctan \frac{A}{B}\right) ,$$

    which is very useful in (electrical) engineering.

    – Américo Tavares Aug 09 '12 at 20:05
  • 1
    @AméricoTavares Why this is so important in EE I thought this is pretty basic formula. –  Apr 23 '17 at 15:19
  • @A---B Yes, it's pretty basic, but it allows us to use the complex plane to represent currents, voltages and impedances of a.c. circuits operating in a single frequence. V = Z I, where V is a voltage drop across the impedance Z and I is the current through it. – Américo Tavares Apr 23 '17 at 16:37
  • @MichaelLi It is just a special case of the formula to expand $\sin(\alpha+\beta)$. – Federico Poloni Apr 19 '19 at 09:12
36

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

27

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

14

Write the numerator (here $\sin x$) as a linear combination of the denominator and the derivative of the denominator: $$A(\sin x+ \cos x) + B( \cos x- \sin x) = \sin x$$ Solve for $A$ and $B$ and split the fraction accordingly. Integrating give a linear term and an $\ln$ This method generally works for $\frac{A\sin x+B\cos x}{C\sin x+D\cos x}$ where $A$ and $B$ couldn't be zero at the same time (one of them can be zero as in this post), and $C$ and $D$ certainly not both zero at the same time.

Kamal Saleh
  • 6,973
imranfat
  • 10,212
12

$$= \frac{1}{2} \cdot \int \frac{\sin(x) + \sin(x)}{\sin(x) + \cos(x)} dx = \frac{1}{2} \int \frac{\sin(x) + \cos(x) + \sin(x) - \cos(x) }{\sin(x) + \cos(x)} dx $$ $$= \frac{x}{2} - \frac{1}{2} \int \frac{\cos(x) - \sin(x)}{\sin(x) + \cos(x)} dx$$ Let $u = \sin(x) + \cos(x)$ $$ \implies \frac{x}{2} - \frac{1}{2} \cdot \log \left| \sin(x) + \cos(x) \right| + C$$

Amad27
  • 11,551
3

Just for some new ideas! I would reccomend a completely different method. This method uses the Gudermannian $\text{gd}$ function. So you would substitute $x=\text{gd}(a);\text{d}x=\text{sech}\space a\text{d}a$ That transforms the integral into:

$$\int \frac{\tanh a}{\tanh a+\text{sech}\space a}(\text{sech}\space a)\mathrm da$$

Through some hyperbolic trig properties, we get (correct me if I'm wrong)

$$\int {\frac{1}{\cosh a+\coth a}}\text{d}a$$

You could probably take it from here

  • 1
    There are plenty of awesome answers out here, just wanted to offer a new way –  Nov 29 '15 at 22:13
  • 1
    I am giving you a bounty because the idea is really impressive:i.e. new –  Dec 01 '15 at 18:33
3

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.

mathreadler
  • 26,534