Evaluation of $\int\frac{\sqrt{\cos 2x}}{\sin x}\,dx$ 
Compute the indefinite integral
  $$
\int\frac{\sqrt{\cos 2x}}{\sin x}\,dx
$$

My Attempt:
$$
\begin{align}
\int\frac{\sqrt{\cos 2x}}{\sin x}\,dx &= \int\frac{\cos 2x}{\sin^2 x\sqrt{\cos 2x}}\sin xdx\\
&= \int\frac{2\cos^2 x-1}{(1-\cos^2 x)\sqrt{2\cos^2 x-1} }\sin x \,dx
\end{align}
$$
Let $\cos x = t$, so that $\sin x\,dx = -dt$. This changes the integral to
$$
\begin{align}
\int\frac{(2t^2-1)}{(t^2-1)\sqrt{2t^2-1}}\,dt &= \int\frac{(2t^2-2)+1}{(t^2-1)\sqrt{2t^2-1}}\,dt\\
&= 2\int\frac{dt}{\sqrt{2t^2-1}}+\int \frac{dt}{(t^2-1)\sqrt{2t^2-1}}
\end{align}
$$
How can I solve the integral from here?
 A: If in the last integral you substitute $t=\frac{1}{\sqrt{2}}\cosh z$, you end with:
$$ I = \frac{1}{\sqrt{2}}\int\frac{1}{\frac{\cosh^2 z}{2}-1}dz=-\operatorname{arctanh}(\sqrt{2}\tanh z)=-\operatorname{arctanh}\left(\sqrt{2-\frac{1}{t^2}}\right).$$
A: $\displaystyle I=\int\frac{\sqrt{2t^2-1}}{t^2-1}dt$, so $\displaystyle t=\frac{1}{\sqrt{2}}\sec\theta, dt=\frac{1}{\sqrt{2}}\sec\theta\tan\theta d\theta$ gives
$\displaystyle I=\frac{1}{\sqrt{2}}\int\frac{\sec\theta\tan^2\theta}{\frac{1}{2}\sec^2\theta-1}d\theta=\sqrt{2}\int\frac{\sec\theta\tan^2\theta}{\sec^2\theta-2}d\theta=\sqrt{2}\int\frac{\sin^2\theta\cos\theta}{\cos^2\theta(1-2\cos^2\theta)}d\theta$.
Next letting $u=\sin\theta, du=\cos\theta d\theta$ gives
$\displaystyle I=\sqrt{2}\int\frac{u^2}{(1-u^2)(2u^2-1)}du=\sqrt{2}\cdot\frac{1}{2}\int\left(\frac{1}{1-u}+\frac{1}{1+u}-\frac{1}{\sqrt{2}u+1}+\frac{1}{\sqrt{2}u-1}\right)du$
$\displaystyle=\frac{1}{\sqrt{2}}\left[\ln\left(\frac{1+u}{1-u}\right)+\frac{1}{\sqrt{2}}\ln\left(\frac{\sqrt{2}u-1}{\sqrt{2}u+1}\right)\right]+C$
$\displaystyle=\frac{1}{\sqrt{2}}\left[\ln\left(\frac{1+\sin\theta}{1-\sin\theta}\right)+\frac{1}{\sqrt{2}}\ln\left(\frac{\sqrt{2}\sin\theta-1}{\sqrt{2}\sin\theta+1}\right)\right]+C=\frac{1}{\sqrt{2}}\left[2\ln\lvert\sec\theta+\tan\theta\rvert+\frac{1}{\sqrt{2}}\ln\left(\frac{\sqrt{2}\sin\theta-1}{\sqrt{2}\sin\theta+1}\right)\right]+C$
$\displaystyle=\sqrt{2}\ln\big|\sqrt{2}t+\sqrt{2t^2-1}\big|+\frac{1}{2}\ln\bigg|\frac{\sqrt{2t^2-1}-t}{\sqrt{2t^2-1}+t}\bigg|+C$
$=\displaystyle\sqrt{2}\ln\bigg|\sqrt{2}\cos x+\sqrt{\cos 2x}\bigg|+\ln\bigg|\frac{\cos x-\sqrt{\cos 2x}}{\sin x}\bigg|+C$
A: Put $$\cos 2x =\frac{1 -\tan^2x}{1+\tan^2x}$$
$$\int\frac{\sqrt{1-\tan^2 x}}{\tan x}$$
$$1-\tan^2 x =t^2$$
$$\implies -2\tan x \sec^2 x dx=2tdt$$
$$\int\frac{t}{\tan x}.\frac{-tdt}{\tan x\sec^2 x}=-\int\frac{t^2}{(1-t^2)(2-t^2)}$$
$$=-\int\left[\frac{1}{(1-t^2)} -\frac{2}{(2-t^2)}\right]dt$$
$$=-\frac{1}{2}\log\left|{\frac{1+t}{1-t}}\right| +\frac{1}{\sqrt2}\log\left|{\frac{\sqrt2+t}{\sqrt2-t}}\right|$$
A: \begin{align}
\int\frac{\sqrt{\cos 2x}}{\sin x}\ dx&=\int\frac{\sqrt{\cos^2x-\sin^2x}}{\sin x}\ dx\\
&\stackrel{\color{red}{[1]}}=\int\frac{\sqrt{t^4-6t^2+1}}{t^3+t}\ dt\\
&\stackrel{\color{red}{[2]}}=\frac12\int\frac{\sqrt{u^2-6u+1}}{u^2+u}\ du\\
&\stackrel{\color{red}{[3]}}=\int\frac{(y^2-6y+1)^2}{(y-1)(y-3)(y+1)(y^2+2t-7)}\ dy\\
&\stackrel{\color{red}{[4]}}=\int\left[\frac1{y-1}+\frac1{y-3}-\frac1{y+1}-\frac{16}{y^2+2y-7}\right]\ dt\\
&=\int\left[\frac1{y-1}+\frac1{y-3}-\frac1{y+1}-\frac{16}{(y+1)^2-8}\right]\ dt
\end{align}
The rest is yours.

Notes :
$\color{red}{[1]}\;\;\;$Use Weierstrass substitution, $\tan\left(\dfrac{x}{2}\right)=t$.
$\color{red}{[2]}\;\;\;$Use substitution $u=t^2$.
$\color{red}{[3]}\;\;\;$Use Euler substitution, $y-u=\sqrt{u^2-6u+1}\;\color{blue}{\Rightarrow}\;y=\dfrac{u^2-1}{2u-6}$.
$\color{red}{[4]}\;\;\;$Use partial fractions decomposition.
A: The magic appears when performing the change $u=\dfrac{\cos(x)}{\sqrt{\cos(2x)}}$ due to the fact that there is $\sin(x)$ on denominator.
The integral is changed to $I=\displaystyle\int\dfrac {\mathop{du}}{(u^2-1)(2u^2-1)}\quad$ with not square root anymore.
Now it is just $\dfrac 1{u^2-1}-\dfrac{2}{2u^2-1}$ 
And $$I=\sqrt{2}\operatorname{argth}(\sqrt{2}\,u)-\operatorname{argth}(u)$$
Note: $\operatorname{argth}=\tanh^{-1}$
