$\int \frac{\sin x-\cos x}{\sqrt{\sin 2 x}} d x$
$\int \frac{\sin x-\cos x}{\sqrt{\sin 2 x}} d x$
We can write above integral as
$=\int \frac{\sin x-\cos x}{\sqrt{1+\sin 2 x-1}} d x$ [Adding and subtracting 1 in denominator]
$=\int \frac{\sin x-\cos x}{\sqrt{(1+\sin 2 x)-1}} d x$
$=\int \frac{\sin x-\cos x}{\sqrt{\left(\sin ^{2} x+\cos ^{2} x+2 \sin x \cos x\right)-1}} d x \because \sin ^{2} x+\cos ^{2} x=1$ and
$\sin 2 x=2 \sin x \cos x$
$=\int \frac{(\sin x-\cos x)}{\sqrt{(\sin x+\cos x)^{2}-1}} d x \because \sin ^{2} x+\cos ^{2} x+2 \sin x \cos x=(\sin x+\cos x)^{2}$
Taking minus (-) common from numerator we get,
$=-\int \frac{(-\sin x+\cos x)}{\sqrt{(\sin x+\cos x)^{2}-1}} d x$
Put $\sin x+\cos x=t$
Differentiating w.r.t $x$ we get,
$(\cos x-\sin x) d x=d t$
Putting values we get,
$=-\int \frac{(\cos x-\sin x)}{\sqrt{(\sin x+\cos x)^{2}-1}} d x=-\int \frac{d t}{\sqrt{t^{2}-1}}$
We know that,
$\int \frac{d x}{\sqrt{x^{2}-a^{2}}}=\log \left|x+\sqrt{x^{2}-a^{2}}\right|+C$
Here $x=t$ and $a=1$
$\therefore-\int \frac{d t}{\sqrt{t^{2}-1}}=-\log \left|t+\sqrt{t^{2}-1}\right|+C$
Putting value of $t$ we get,
$\int \frac{\sin x-\cos x}{\sqrt{\sin 2 x}} d x=-\log \left|\sin x+\cos x+\sqrt{(\sin x+\cos x)^{2}-1}\right|+C$
$\therefore$ from (1) we get,
$\therefore \int \frac{\sin x-\cos x}{\sqrt{\sin 2 x}} d x=-\log |\sin x+\cos x+\sqrt{\sin 2 x}|+C$