Integral $\int\!\sqrt{\cot x}\,dx $ Find the integral
$$\int\!\sqrt{\cot x}\,dx $$
How can one solve this using substitution?
Can this be solved by complex methods?
 A: Consider $I_1=\int (\sqrt{\tan x}+\sqrt{\cot x})dx$
Put $ x=\arctan t^2\implies dx= \frac{2t}{1+t^4}dt$
Then, $I_1=2\int \frac{t(t+\frac{1}{t})}{1+t^4}dt=2\int \frac{1+\frac{1}{t^2}}{(t-\frac{1}{t})^2+2}dt$
Put $t-\frac{1}{t}=z\implies (1+\frac{1}{t^2})dt=dz$
Then $I_1=2\int \frac{1}{z^2+2}dz =\sqrt{2}\tan^{-1}\left(\frac{z}{\sqrt{2}}\right)+c=\sqrt{2}\tan^{-1}\left(\frac{\sqrt{\tan x}-\sqrt{\cot x}}{\sqrt{2}}\right)+c$
Similarly, $I_2=\int (\sqrt{\tan x}-\sqrt{\cot x})dx$
First substitute is same, then, in denominator make term $(t+1/t)^2-1$ and substitute $t+1/t=z$ which gives $I_2$
Then $I_3=\int \sqrt{\cot x}dx=\frac{I_1-I_2}{2}$ 
A: $$\cot x =t^2$$
$$dx=\frac{-2t}{1+t^4}{dt}$$
$$-\int\frac{2t^2}{1+t^4}{dt}$$
$$-\left[\int \frac{1+\frac{1}{t^2}}{\left(t-\frac{1}{t}\right)^2 +2}dt +\int \frac{1-\frac{1}{t^2}}{\left(t + \frac{1}{t}\right)^2 - 2}dt\right]$$
$$-\left(\frac{1}{\sqrt2}\tan^{-1}\left[\frac{\cot x -1}{\sqrt{2\cot x}}\right] +\frac{1}{2\sqrt2}\log\left|\frac{\cot x +1-\sqrt{2\cot x}}{\cot x +1+\sqrt{2\cot x}}\right|\right)$$
A: Off of WolframAlpha, but it should be enough to answer your question.

A: $\displaystyle \int \sqrt{\cot{x}}dx$
$\displaystyle \cot{x}=z^{2}\Rightarrow 2zdz=-(1+\cot^{2}{x})dx$
$\displaystyle \int \sqrt{\cot{x}}dx=-\int\frac{2z^{2}dz}{1+z^{4}}=-\int\frac{2dz}{z^{2}+\frac{1}{z^{2}}
}$
$\displaystyle\frac{1}{z^{2}+\frac{1}{z^{2}}}=\frac{1}{(z+\frac{1}{z})^{2}-2}=\frac{1}{(z-\frac{1}{z})^{2}+2}$
$\displaystyle u=z+\frac{1}{z},v=z-\frac{1}{z}$
$\displaystyle d(u+v)=2dz=du+dv$
$\displaystyle\frac{2dz}{z^{2}+\frac{1}{z^{2}}}=\frac{du}{u^{2}-2}+\frac{dv}{v^{2}+2}$
$=\displaystyle\frac{1}{2\sqrt{2}}(\frac{du}{u-\sqrt{2}}-\frac{du}{u+\sqrt{2}})+\frac{1}{\sqrt{2}}(\frac{d(\frac{v}{\sqrt{2}})}{(\frac{1}{\sqrt{2}}v)^{2}+1})$
$\displaystyle \int \sqrt{\cot{x}}dx=\frac{1}{2\sqrt{2}}ln\left| \frac{u+\sqrt{2}}{u-\sqrt{2}} \right|-\frac{1}{2}  \arctan{\frac{1}{\sqrt{2}}v}+c$
$=\displaystyle \frac{1}{2\sqrt{2}}ln\left| \frac{z+\frac{1}{z}+\sqrt{2}}{z+\frac{1}{z}-\sqrt{2}} \right|-\frac{1}{2}  \arctan{\frac{1}{\sqrt{2}}(z-\frac{1}{z})}+c$
$=\displaystyle \frac{1}{2\sqrt{2}}ln\left| \frac{\sqrt{\cot{x}}+\frac{1}{\sqrt{\cot{x}}}+\sqrt{2}}{\sqrt{\cot{x}}+\frac{1}{\sqrt{\cot{x}}}-\sqrt{2}} \right|-\frac{1}{2}  \arctan{\frac{1}{\sqrt{2}}(\sqrt{\cot{x}}-\frac{1}{\sqrt{\cot{x}}})}+c\\$
