# $\int \frac{dx}{\sin x-\cos x}$

Evaluate $$\int \frac{dx}{\sin{x}-\cos{x}}$$

I know it can be done by Weierstrass substitution. But I am looking for new/simple approach. For example I tried:

$$\int \frac{1}{\sin{x}-\cos{x}} \cdot \frac{\sin{x}+\cos{x}}{\sin{x}+\cos{x}}dx=\int \frac{\sin{x}+\cos{x}}{-\cos{2x}}dx ,$$ but I can't continue from here.

Write $$\sin{x}-\cos{x}=\sqrt2\left(\frac1{\sqrt2}\sin{x}-\frac1{\sqrt2}\cos{x}\right)=\sqrt2\sin\left(x-\frac{\pi}4\right).$$

Hint Using an angle sum formula gives $$\sin x - \cos x = \sqrt{2} \sin \left(x - \frac{\pi}{4}\right) .$$

Multiply and divide the denominator by $$\frac{\sqrt{2}}{2}$$ which is equal to $$\sin(\frac{\pi}{4})=\cos(\frac{\pi}{4})$$

Now use the fact that $$\sin(u-v)=\sin(u)\cos(v)-\cos(u)\sin(v)$$.

• Down voters, kindly explain why? – Hussain-Alqatari Oct 24 '19 at 15:55
• There were already effectively two copies of this exact answer before yours. Why feel the need to add another? – Peter Foreman Oct 24 '19 at 16:33
• It looks like they were all done at the same time. I see nothing wrong with independent answers. – marty cohen Oct 24 '19 at 19:06
• @martycohen Exactly. We did it simultaneously. Dear users/readers, vote (Down) for wrong answers. But for right answers, if you will not vote (Up) then just do not vote. Down votes may confuse the questioner or other users. Not only for this question, but for all. Kindly think about voting. Thanks! – Hussain-Alqatari Oct 25 '19 at 11:50

$$\frac1{\sin x-\cos x}=\frac{\sin x+\cos x}{\sin^2x-\cos^2x}=\frac{\sin x}{1-2\cos^2x}+\frac{\cos x}{2\sin^2-1}$$
$$I=-\frac1{\sqrt{2}}\tanh^{-1}(\sqrt{2}\cos x)-\frac1{\sqrt{2}}\tanh^{-1}(\sqrt{2}\sin x)+C$$