Solve the following integration $$\int \sqrt{cot\theta} d\theta$$
I tried to set $t=\sqrt{cot\theta},t^2=cot\theta$ and substitute into the original integration and get$$-\int\frac{2t^2}{1+t^4}dt$$, but then what can I do?
 A: Consider that $$t^4+1 = (t^4+2t^2+1)-2t^2 = (t^2+1)^2-(\sqrt{2}\,t)^2 = (t^2+\sqrt{2}\,t+1)(t^2-\sqrt{2}\, t+1)$$
hence:
$$\frac{2t^2}{t^4+1}=\frac{t}{\sqrt{2}\, t^2 -2t+\sqrt{2}}-\frac{t}{\sqrt{2}\, t^2 +2t+\sqrt{2}}\tag{1}$$
and the integral of both terms in the RHS is given by:
$$\frac{1}{2\sqrt{2}}\left(\log(\sqrt{2}\, t^2 \pm 2t+\sqrt{2})-2\arctan(1\pm\sqrt{2}\,t)\right).\tag{2}$$
A: Consider the integral
\begin{align}
I = \int \sqrt{\cot(\theta)} \, d\theta.
\end{align}
Make the substitution $t = \sqrt{\cot(\theta)}$ to obtain the integral
\begin{align}
I = -2 \int \frac{t^{2} \, dt}{1+t^{4}}.
\end{align}
Now it can be seen that
\begin{align}
\frac{t^{2}}{1+t^{4}} &= \frac{t^{2}}{(1+i t^{2})(1- i t^{2})}  \\
&= \frac{1}{2i} \left( \frac{1}{1-i t^{2}} - \frac{1}{1+ i t^{2}} \right)
\end{align}
which leads to
\begin{align}
I = i \int \left( \frac{1}{1-i t^{2}} - \frac{1}{1+ i t^{2}} \right) \, dt.
\end{align}
Since 
\begin{align}
\int \frac{dt}{1+a t^{2}} = \frac{1}{\sqrt{a}} \, \tan^{-1}(\sqrt{a} t)
\end{align}
then the integral $I$ becomes
\begin{align}
I = i \left[ e^{\pi i/4} \tan^{-1}(e^{\pi i/4} t) - e^{- \pi i/4} \tan^{-1}(e^{- \pi i/4} t) \right].
\end{align}
By the $\tan^{-1}(x)$ addition and eliminating the complex components the result becomes
\begin{align}
I = \frac{1}{\sqrt{2}} \left[ \tan^{-1}\left( \frac{\sqrt{2} \, t}{1- t^{2}} \right) - \tanh^{-1}\left( \frac{\sqrt{2} \, t}{1+ t^{2}} \right) \right].
\end{align}
This leads to the result
\begin{align}
\int \sqrt{\cot(\theta)} \, d\theta = \frac{1}{\sqrt{2}} \left[ \tan^{-1}\left( \frac{\sqrt{2 \cot(\theta)}}{1-\cot(\theta)} \right) - \tanh^{-1}\left( \frac{\sqrt{2 \cot(\theta)}}{1+\cot(\theta)} \right) \right].
\end{align}
