# Integral of $\frac{\sin(x)-\cos(x)}{\sqrt{\sin(2x)}}$

I am trying to find the integral of $$\dfrac{\sin(x)-\cos(x)}{\sqrt{\sin(2x)}}$$.

I was trying to use the parametric equations to solve it, but it just turned into a much more complicated problem, moreover, this question seemed very specific and concrete.

Is there any intuition to solve a problem like this?

Hint. Observe that $$(\sin x+\cos x)^2=\sin^2 x+2\sin x\cos x+\cos^2 x=1+\sin(2x),$$ so $$\sin(2x)=(\sin x+\cos x)^2-1.$$ Meanwhile, $$\frac{\mathrm{d}}{\mathrm{d}x}(\sin x+\cos x)=\cos x-\sin x=-(\sin x-\cos x).$$ Try the substitution method with $$u:=\sin x+\cos x$$. For more references, please see this post.
We have that $$I=\int \frac{sin(x)-cos(x)}{\sqrt{sin(2x)}}dx=\int \frac{sin(x)-cos(x)}{\sqrt{2sin(x)cos(x)}}dx=\frac{1}{\sqrt 2}\int(\sqrt{tan(x)}-\frac{1}{\sqrt{tan(x)}})dx,$$ from there make the substitution $$u=\sqrt{tan(x)}$$.
Letting $$\sin x+\cos x=\cosh \theta$$ yields $$I=-\int \frac{\sinh \theta }{\sqrt{\cosh^2 \theta -1}}d\theta=-\theta +C=-\cosh^{-1}(\sin x+\cos x)+C$$