Integration of trigonometric function $\int\frac{\sin(2x)}{\sin(x)-\cos(x)}dx$ 
$$\int\frac{\sin(2x)}{\sin(x)-\cos(x)}dx$$

My attempt: Firstly, $\sin(2x)=2\sin(x)\cos(x)$.
After that, eliminate the $\cos(x)$ seen in both the numerator and denominator to get
$$2\int\frac{\sin(x)}{\tan(x)-1}\ dx.$$
From here onwards, should I convert $\sin(x)$, $\tan(x)$ to half-angles and use $\tan(x/2)=t$?
But this would be a time consuming method. Any suggestions?
 A: HINT:
$$\int\frac{\sin(2x)}{\sin(x)-\cos(x)}\space\text{d}x=$$

Use $\sin(2x)=2\sin(x)\cos(x)$:

$$2\int\frac{\sin(x)\cos(x)}{\sin(x)-\cos(x)}\space\text{d}x=$$

Sustitute $u=\tan\left(\frac{x}{2}\right)$ and $\text{d}u=\frac{x\sec^2\left(\frac{x}{2}\right)}{2}\space\text{d}x$:

$$-8\int\frac{u(u^2-1)}{(u^2+1)^2(u^2+2u-1)}\space\text{d}u$$
Now, use partial fractions.
A: Let $u=x-\frac\pi4$, then
$$
\begin{align}
\int\frac{\sin(2x)}{\sin(x)-\cos(x)}\,\mathrm{d}x
&=\int\frac{\sin\left(2u+\frac\pi2\right)}{\sqrt2\sin(u)}\,\mathrm{d}u\\
&=\frac1{\sqrt2}\int\frac{\cos\left(2u\right)}{\sin(u)}\,\mathrm{d}u\\
&=\frac1{\sqrt2}\int\frac{1-2\sin^2(u)}{\sin(u)}\,\mathrm{d}u\\
&=\frac1{\sqrt2}\int\frac{\sin(u)}{1-\cos^2(u)}\,\mathrm{d}u-\sqrt2\int\sin(u)\,\mathrm{d}u\\
&=\sqrt2\cos(u)-\frac1{2\sqrt2}\int\left(\frac1{1-\cos(u)}+\frac1{1+\cos(u)}\right)\,\mathrm{d}\cos(u)\\
&=\sqrt2\cos(u)+\frac1{2\sqrt2}\log\left(\frac{1-\cos(u)}{1+\cos(u)}\right)+C\\
&=\sqrt2\cos(u)+\frac1{\sqrt2}\log(\tan(u/2))+C
\end{align}
$$
A: Let $$I = \int\frac{\sin 2x}{\sin x-\cos x}dx = \frac{1}{\sqrt{2}}\int\frac{\sin 2x}{\sin \left(x-\frac{\pi}{4}\right)}dx$$
Now Put $\displaystyle x- \frac{\pi}{4} = t\;,$ Then $dx = dt$
So $$I = \frac{1}{\sqrt{2}}\int\frac{\cos 2t}{\sin t}dt = \frac{1}{\sqrt{2}}\int \frac{1-2\sin^2 t}{\sin t}dt$$
So $$I = \frac{1}{\sqrt{2}}\int \csc t dt-\sqrt{2}\int \sin t dt$$
So $$I = \frac{1}{\sqrt{2}}\ln \left|\tan \frac{t}{2}\right|+\sqrt{2}\cos t+\mathcal{C}$$
So $$I = \frac{1}{\sqrt{2}}\ln \left|\tan \left(\frac{x-\frac{\pi}{4}}{2}\right)\right|+\sqrt{2}\cos \left(x-\frac{\pi}{4}\right)+\mathcal{C}$$
A: I like trigonometric substitutions so I will try to implement that !
Use $\sin(x)-\cos(x)=z$.Find numerator in terms of $z^2$.
Then $(\cos(x)+\sin(x))dx=dz$
$\sin(x)-\cos(x)=z$
so,$z^2=1-\sin(2x)$
Also $(\sin(x)+\cos(x))^2+ (\sin(x)-\cos(x))^2=2$
So the integral boils down to 
$$\frac{1-z^2}{z(\sqrt{2-z^2})}dz$$
Substitute $z=\sqrt{2}\sin(y)$
The integral becomes $$\int \frac{\cos(2y)}{\sqrt{2}\sin(y)}dy$$
$$\int \frac{\csc(y)-2\sin(y)}{\sqrt{2}}dy$$
which equals $$\frac{1}{\sqrt{2}}\ln|\tan(y/2)|+\sqrt{2}\cos(y)+C$$
On resubstituting original variables we get $$\frac{1}{\sqrt{2}}\ln \left|\tan \left(\frac{x-\frac{\pi}{4}}{2}\right)\right|+\sqrt{2}\cos \left(x-\frac{\pi}{4}\right)+\mathcal{C}$$
Hurray ! :-)
A: Assuming $$u=x-\frac\pi4$$
$$
\begin{align}
\int\frac{\sin(2x)}{\sin(x)-\cos(x)}\,\mathrm{d}x
&=\int\frac{\sin\left(2u+\frac\pi2\right)}{\sqrt2\sin(u)}\,\mathrm{d}u\\
&=\frac1{\sqrt2}\int\frac{\cos\left(2u\right)}{\sin(u)}\,\mathrm{d}u\\
&=\frac1{\sqrt2}\int\frac{1-2\sin^2(u)}{\sin(u)}\,\mathrm{d}u\\
&=\frac1{\sqrt2}\int\left(\csc u -2\sin u\right)\,\mathrm{d}u\\
&=\frac1{\sqrt2}\int \csc u \text{du} -2\sin u \text{du} \\
&=\frac1{\sqrt2}\left(\log \left|\tan \frac{u}{2}\right|  +2\cos u\right) \\
\end{align}
$$
A: Hint:
$$\int\frac{\sin(2x)}{\sin(x)-\cos(x)}dx = \int\frac{2\sin(x)\cos(x) }{\sin(x)-\cos(x)}dx =  \int\frac{\sin(x)\cos(x)+\cos(x)\sin(x) }{\sin(x)-\cos(x)}dx\\
=\int\frac{\sin(x)\cos(x)-\sin^2(x)+\cos(x)\sin(x)-\cos^2(x)+1 }{\sin(x)-\cos(x)}dx \\=\int -\sin(x)dx+\int \cos(x)dx + \int \frac{1}{\sin(x) -\cos(x)}dx \\= \cos(x) + \sin(x) +\int \frac{1}{\sin(x) -\cos(x)}dx $$
For $\int \frac{1}{\sin(x) -\cos(x)}dx$:
Notice that $$\int \frac{1}{\sin(x) -\cos(x)}dx = \int \frac{1}{\sqrt{2} \sin(x-\frac{1}{4} \pi ) }dx$$
Let $u = x-\frac{1}{4} \pi$,
$$ \int \frac{1}{\sqrt{2} \sin\left(x-\frac{1}{4} \pi \right) }dx = \int \frac{1}{\sqrt{2} } \csc(u)du $$
