Evaluate$\int \sqrt{\tan x}dx$ 

My instructor told us that the integral of square root of tangent can be evaluated. How can one really do it? 

Answer

Let $$A=\int\sqrt{\tan x}\,\mathrm dx$$ $$B=\int\sqrt{\cot x}\,\mathrm dx$$
Then 
\[A+B=\int\left(\sqrt{\tan x}+\sqrt{\cot x}\right) dx=\sqrt{2} \int\frac{\sin x+\cos x}{\sqrt{\sin2x}}\mathrm dx\]
\[ =\sqrt2\int\frac{(\sin x-\cos x)'}{\sqrt{1-(\sin x-\cos x)^2}}\,\mathrm dx =\sqrt2\int\frac{1}{\sqrt{1-u^2}}\,\mathrm du\]
\[ =\sqrt2\sin^{-1}u  =\sqrt2\sin^{-1}(\sin x-\cos x).\]
Also
\[A-B=\int\left(\sqrt{\tan x}-\sqrt{\cot x}\right)\,\mathrm dx =\sqrt2\int\frac{\sin x-\cos x}{\sqrt{\sin2x}} \,\mathrm dx\]
\[ =-\sqrt2\int\frac{(\sin x+\cos x)'}{\sqrt{(\sin x+\cos x)^2-1}}\,\mathrm dx  =-\sqrt2\int\frac{\mathrm du}{\sqrt{u^2-1}}\]
\[=-\sqrt2\cosh^{-1}(\sin x+\cos x) \]
Thus we get
\[A=\int\sqrt{\tan x} dx=\frac{(A-B)+(A+B)}2\]
\[= \frac{\sqrt2}2(\sin^{-1}(\sin x-\cos x)-\cosh^{-1}(\sin x+\cos x)) + C.\]
Note than you also get 
\[B=\int\sqrt{\cot x} dx=-\frac{(A-B)-(A+B)}2\]
\[=- \frac{\sqrt2}2(\sin^{-1}(\sin x-\cos x)-\cosh^{-1}(\sin x+\cos x)) + C.\]

The answer is accepted.