TITLE: Which is the easiest way to evaluate $\int \limits_{0}^{\pi/2} (\sqrt{\tan x} +\sqrt{\cot x})$?
QUESTION [33 upvotes]: Which is the easiest way to evaluate $\int \limits_{0}^{\pi/2} (\sqrt{\tan x} +\sqrt{\cot x})$?

I have reduced this problem to $$   2\int_0^{\pi/2} \sqrt{\tan x} \ dx$$
but now, evaluating this integral is giving me some problems, simply substituting $u=\tan(x)$
and then $\mathrm{d}u=\sec^2(x)\mathrm{d}x \Rightarrow \frac{\mathrm{d}u}{1+u^2}=\mathrm{d}x$ and which in turn gives something a bit ugly, I was wondering which is the most elegant way to evaluate this?

REPLY [2 votes]: Using the fact that $\cot(x)=\tan\left(\frac\pi2-x\right)$, we get
$$
\begin{align}
\int_0^{\pi/2}\left(\sqrt{\tan(x)}+\sqrt{\cot(x)}\right)\mathrm{d}x
&=2\int_0^{\pi/2}\sqrt{\tan(x)}\,\mathrm{d}x\tag{1}\\
&=2\int_0^{\pi/2}\frac{\sqrt{\tan(x)}}{1+\tan^2(x)}\,\mathrm{d}\tan(x)\tag{2}\\
&=2\int_0^\infty\frac{u^{1/2}}{1+u^2}\,\mathrm{d}u\tag{3}\\
&=\int_0^\infty\frac{t^{-1/4}}{1+t}\,\mathrm{d}t\tag{4}\\[3pt]
&=\mathrm{B}\left(\frac34,\frac14\right)\tag{5}\\
&=\frac{\Gamma\left(\frac34\right)\Gamma\left(\frac14\right)}{\Gamma(1)}\tag{6}\\[3pt]
&=\pi\csc\left(\frac\pi4\right)\tag{7}\\[9pt]
&=\pi\sqrt2\tag{8}
\end{align}
$$
Explanation:
$(1)$: use $\cot(x)=\tan\left(\frac\pi2-x\right)$
$(2)$: $\mathrm{d}\tan(x)=\left(1+\tan^2(x)\right)\mathrm{d}x$
$(3)$: substitute $u=\tan(x)$
$(4)$: substitute $t=u^2$
$(5)$: apply the Beta Function
$(6)$: write the Beta function in terms of the Gamma function
$(7)$: apply Euler's Reflection Formula
$(8)$: evaluate $(7)$