Evaluation of $\int \sqrt{1+\cot x}dx$? 
What is $$\int \sqrt{1+\cot x}dx$$  

My friends and I tried using all possible trigonometric formula. We couldn't find a way to solve it 
Please help me solve it.
 A: $u = 1+\cot x \implies du = -\dfrac{1}{\sin^2 x}dx = -\left(1+(u-1)^2\right)dx$ 
then we have
$$
-\int \dfrac{\sqrt{u}}{1+(u-1)^2}du 
$$
if we set $u = v^2\implies  du = 2vdv$ we find 
$$
-2\int \dfrac{v^2}{\left(v^2-1\right)^2+1}dv = 
-2\int \dfrac{v^2}{\left(\left(v^2-1\right)+i\right)\left(\left(v^2-1\right)-i\right)}dv
$$
Can you continue from here?
$$
\dfrac{v^2}{\left(v^2+\alpha\right)\left(v^2+\beta\right)} = \frac{1}{\alpha-\beta}\left[\frac{\alpha}{v^2+\alpha}-\frac{\beta}{v^2+\beta}\right]
$$
so your integral becomes
$$
-\frac{2}{2i}\int \frac{(i-1)}{v^2+(i-1)}-\frac{2}{2i}\int \frac{(i+1)}{v^2+(i+1)}dv
$$
or
$$
-(i+1)\int \frac{1}{v^2+(i-1)}dv +(i-1)\int \frac{1}{v^2+(i+1)}dv
$$
which as pointed out in the other answer is standard.
A: Put $(1+cotx)=t^2$ in the given integral and then do the reqd. Substitutions to get :
$$\int  -\frac {2x^2dx}{x^4-2x^2+2}$$
I think we can avoid complex numbers.
Write it as:
$$\int -2(\frac {(x^2+ \sqrt2+x^2-\sqrt2)dx}{x^4-2x^2+2})$$
Split it into two integrals,
$$\int\frac {(x^2+\sqrt2)dx}{x^4-2x^2+2}$$
And
$$\int \frac {(x^2-\sqrt2)dx}{x^4-2x^2+2}$$
Simply divide by $x^2$ in both the integrals to get,
$$\int \frac {(1+\frac {\sqrt2}{x^2})dx}{x^2+2/x^2-2}$$
Now complete the square in the denominator as $(x-\sqrt2/x)^2 + 2(\sqrt2-1)$ .    (for first integral)
Then substitute $x-\sqrt(2)/x = v$.
To get the integrals as
$$\int \frac{dv}{(v^2+ 2(\sqrt(2)-1))}$$
And $$\int \frac{dv}{(v^2-2(\sqrt(2)+1))}$$
Which are standard integrals.
