# Evaluate: $\int \frac{{\sin(x)}}{{\sin(x) - \cos(x)}}\,dx$

I'm trying to evaluate the following integral:$$\int \frac{{\sin(x)}}{{\sin(x) - \cos(x)}}\,dx$$ Here's my approach so far:
I've multiplied the numerator and denominator by $$-csc^3(x)$$, resulting in $$\int -\frac{{\csc^2(x)}}{{\cot(x)\csc^2(x) - \csc^2(x)}}\,dx$$ Next I substituted $$u = cotx$$, giving me $$\frac{{du}}{{dx}} = -csc^2(x), du = -csc^2(x)dx$$ therefore in $$\int -\frac{{\csc^2(x)}}{{\cot(x)\csc^2(x) - \csc^2(x)}}\,dx$$ by replacing $$cotx$$ with $$u$$, I obtained, $$\int \frac{-1}{{u\left(u^2+1\right) - \left(u^2+1\right)}}\,du$$ $$\int (\frac{1}{{4\left(u+1\right)}} - \frac{1}{{4\left(u-1\right)}} - \frac{1}{{2\left(u-1\right)^2}})\,du$$

I would greatly appreciate any insights or techniques that could help me make progress with this integral. Are there specific strategies or mathematical tools that I should consider? Are there any useful properties or identities related to this type of expression?

Thank you for your attention and assistance.

• Welcome to MSE. Your question is phrased as an isolated problem, without any further information or context. This does not match many users' quality standards, so it may attract downvotes, or be closed. To prevent that, please edit the question. This will help you recognize and resolve the issues. Concretely: please provide context, and include your work and thoughts on the problem. These changes can help in formulating more appropriate answers. Jul 7, 2023 at 7:18
• why is my question still closed? can anyone tell me the reason Jul 7, 2023 at 9:47
• You improved it only 40min ago. You had to wait for 4 votes for its reopening. Done. Jul 7, 2023 at 9:55
• If I can ask a question: you have multiplied by $-\csc^3(x)$, but what's wrong with a simple $\sec(x)$? :-) Jul 7, 2023 at 10:14
• @AnneBauval I thought it wasn't gonna work out in the end and so didn't do the integration. How stupid of me! Jul 8, 2023 at 18:19

Alternatively, you can proceed as follows:

\begin{align*} \int\frac{\sin(x)}{\sin(x) - \cos(x)}\mathrm{d}x & = \frac{1}{2}\int\frac{2\sin(x)}{\sin(x) - \cos(x)}\mathrm{d}x\\\\ & = \frac{1}{2}\int\frac{(\sin(x) - \cos(x)) + (\sin(x) + \cos(x))}{\sin(x) - \cos(x)}\mathrm{d}x\\\\ & = \frac{x}{2} + \frac{1}{2}\int\frac{(\sin(x) - \cos(x))'}{\sin(x) - \cos(x)}\mathrm{d}x\\\\ & = \frac{x}{2} + \frac{1}{2}\ln\left(\sin(x) - \cos(x)\right) + C \end{align*}

• thank you very much your process was so much simpler Jul 7, 2023 at 16:20
• that should be sin(x) + cos(x) instead of (sin(x)−cos(x)), anyway thanks again. Jul 7, 2023 at 16:42
• @JayadrataBanerjee you are welcome ! I am glad to help. Jul 7, 2023 at 18:15
• quite beautiful! Jul 7, 2023 at 19:27

It is not clear what you are asking for (see comments) but if it is a verification of your solution, here is one. You did very well with your substitution choice, and were quite near to the solution. I only have three remarks.

1. You did a small sign mistake when you "obtained, $$\int \frac{\color{red}-1}{{u\left(u^2+1\right) - \left(u^2+1\right)}}\,du$$": it should be $$\int \frac{\color{green}+1}{{u\left(u^2+1\right) - \left(u^2+1\right)}}\,du.$$
2. Next, your partial fraction decomposition was wrong. The correct one is: $$\frac1{\left(u-1\right)\left(u^2+1\right)}=\frac12\left(\frac1{u-1}-\frac{u+1}{u^2+1}\right).$$
3. Incomprehensibly, you did not dare integrating it. \begin{align}\frac12\int\left(\frac1{u-1}-\frac{u+1}{u^2+1}\right)du&=\frac12\left(\ln|u-1|-\frac12\ln\left(u^2+1\right)- \arctan u+C\right)\\&=\frac12\left(\ln\frac{|u-1|}{\sqrt{u^2+1}}+ \operatorname{arccot}u+D\right)\qquad(D=C-\frac\pi2)\\&=\frac12\Big(\ln|\cos x-\sin x|+x+D\Big).\end{align}
• thank you very much for pointing out my errors and the solution Jul 7, 2023 at 16:21

Let $$A=\int \frac{{\sin(x)}}{{\sin(x) - \cos(x)}}\,dx, B=\int \frac{{\cos(x)}}{{\sin(x) - \cos(x)}}\,dx.$$ Clearly $$A-B=\int \;dx=x+C_1. \tag1$$ Note $$A=-\int \frac{1}{{\sin(x) - \cos(x)}}\,d\cos(x), B=\int \frac{1}{{\sin(x) - \cos(x)}}\,d\sin(x)$$ and hence $$B+A=\int \frac{1}{{\sin(x) - \cos(x)}}\,d(\sin(x)-\cos(x))=\ln|\sin(x)-\cos(x)|+C_2. \tag2$$ From (1) and (2), it is easy to obtain $$A$$. In fact, $$A=\frac12 x+\frac12\ln|\sin(x)-\cos(x)|+C.$$

Use the substitution $$x=\frac{\pi}{4}+v \Rightarrow dx=dv$$

Now use the following facts: \begin{aligned} &\sin\left(x+\frac{\pi}{4}\right)=\frac{\sin x+\cos x}{\sqrt{2}} \\ & \cos \left(x+\frac{\pi}{4}\right)=\frac{\cos x-\sin x}{\sqrt{2}} \end{aligned}

So we get \begin{aligned} I= & \int \frac{\sin x d x}{\sin x-\cos x}=\int \frac{\left(\frac{\sin v+\cos v}{\sqrt{2}}\right) d v}{\left(\frac{2 \sin v}{\sqrt{2}}\right)} \\ & \Rightarrow I=\frac{1}{2} \int \frac{\sin v}{\sin v} d v+\frac{1}{2} \int \cot v d v \\ & \Rightarrow I=\frac{v}{2}+\frac{1}{2} \ln |\sin v|+C \end{aligned} Where $$v=x-\frac{\pi}{4}$$.

Method $$2:$$

Use the identities \begin{aligned} \cos ^2 x-\sin ^2 x & =\cos 2 x=1-2 \sin ^2 x \\ \sin 2 x & =2 \sin x \cos x \end{aligned}

\begin{aligned} f(x) & =\frac{\sin x}{\sin x-\cos x}=\frac{-\sin x(\cos x+\sin x)}{\cos ^2 x-\sin ^2 x} \\ & \Rightarrow f(x)=\frac{-1}{2}\left(\frac{2 \sin x \cos x+2 \sin ^2 x}{\cos 2x}\right) \\ & \Rightarrow f(x)=\frac{-1}{2}\left(\frac{\sin 2x+1-\cos 2 x}{\cos 2 x}\right) \\ & \Rightarrow f(x)=\frac{-1}{2}(\tan (2 x)+\sec (2 x)-1) \end{aligned}

Hope you can proceed from here.

• You gave two methods. Damn! Jul 9, 2023 at 16:36

Multiplying the numerator and the denominator of the integrand by $$\sin x+\cos x$$ we get the integral of $$\frac12-\frac12\sec2x-\frac12\tan2x$$ which is $$\frac x2-\frac14\ln|\sec2x+\tan2x|-\frac14\ln|\cos2x|+c$$ and $$\frac x2-\frac14\ln|1+\sin2x|+c.$$

$$1/2(\ln |\sin(x)-\cos(x)|)+x/2+c$$

$$\sin(x)$$ can be written as $$1/2(2\sin(x))$$ and then $$2\sin(x)$$ should be written as $$\sin(x)+\cos(x)+\sin(x)-\cos(x)$$. Then integrating we get the above result.

• How does your solution differ from Atia Correia? Jul 7, 2023 at 14:35