<s>[INST] Evaluating $\int {\sin \theta + \cos \theta \over \sqrt{\sin 2\theta} }d\theta$ 
$$\int {\sin \theta + \cos \theta \over \sqrt{\sin 2\theta} }d\theta$$


After simplifying I get, 
$${1\over \sqrt{2}}\int {\tan \theta + 1 \over \sqrt{\tan \theta}} d\theta$$
Substituting $u = \tan \theta$
$${1\over \sqrt{2}}\int {u + 1\over \sqrt{u}(1 + u^2)} du$$
Substituting $t^2 = u$
$${\sqrt{2}}\int {t^2 + 1\over (1 + t^4)} dt = \sqrt{2} \int {1 + 1/t^2 \over(t - 1/t)^2 + 2 }dt$$
Substituting $z = t - 1/t$
$$\sqrt{2} \int {1\over z^2 + 2 }dz =  \arctan\left(\tan \theta - 1\over \sqrt{2\tan \theta} \right) + C = {\arcsin(2\sqrt{\sin2\theta} (\sin\theta - \cos \theta))\over 2} + C$$
Which is far from the right answer of $\arcsin(\sin \theta - \cos \theta) + C$.
Where did I go wrong ?
Edit :
I would like to know where I am wrong rather than knowing how to solve the problem. 
 [/INST] Hint -
Put $\sin\theta - \cos \theta = t$
$(\cos \theta + \sin \theta)\text{d}\theta = \text{d}t$
Also on squaring above equation,
$\sin^2\theta + \cos^2 \theta - 2 \sin \theta \cos \theta = t^2$
$1 - \sin2\theta = t^2$
$\sin2\theta = 1 - t^2$
Then given integral becomes,
$\int \frac{1}{\sqrt {1-t^2}} \text{d}t$
Hope now its easy to solve.
</s>