<s>[INST] 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?
 [/INST] 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}$ 
</s>