I want to solve the following integral:
$$\int \frac{dx}{\sqrt{1-\sin(2x)}}$$
My attempt: $$\int \frac{dx}{\sqrt{1-\sin(2x)}}$$ $$=\int \frac{dx}{\sqrt{(\sin x- \cos x)^2}}\tag{1}$$ $$=\int \frac{dx}{\sin x- \cos x} \qquad \tag{2}$$
After this, I used this method and got the final answer as, $$\displaystyle \dfrac1{\sqrt{2}} \ln \left|\csc\left(x - \dfrac\pi4\right) - \cot\left(x - \dfrac\pi4\right)\right|+ C$$
But, the problem is that WolframAlpha returns answer as an imaginary solution. I want to know how can we approach this complex solution.
Also I'm not sure if moving from $(1)$ to $(2)$ is even valid; as I'm ignoring the negative version.