# Which is the easiest way to evaluate $\int \limits_{0}^{\pi/2} (\sqrt{\tan x} +\sqrt{\cot x})$?

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?

-

$${\int_0^{\frac{\pi}{2}} \sqrt{\tan x}dx + \sqrt{\cot x}dx}$$ $$={\int_0^{\frac{\pi}{2}}\frac{\sin x + \cos x}{\sqrt{\sin x \cos x}}dx = \int_0^{\frac{\pi}{2}} \frac{\sin x + \cos x}{\frac{\sqrt{2\sin{x}\cos{x}}}{\sqrt{2}}}dx = \sqrt{2}\int_0^{\frac{\pi}{2}} \frac{ \sin{x} + \cos{x}}{\sqrt{1 - (1 - 2 \sin{x} \cos{x})}}dx}$$ $${=\sqrt{2}\int_0^{\frac{\pi}{2}} \frac{ \sin{x} + \cos{x}}{\sqrt{1 - (\sin{x} - \cos{x})^2}}dx}$$

Let ${t = \sin{x} - \cos{x}}$, $\Large {{\small{dx}} = \frac{dt}{\sin{x} + \cos{x}}}$ $${x \to \frac{\pi}{2} \implies t = (\sin{x} - \cos{x}) \to 1}$$ $${x \to 0 \implies t = (\sin{x} - \cos{x}) \to -1}$$

$$\sqrt{2}\int_{-1}^{1} \frac{1}{\sqrt{1 - t^2}}dt = \sqrt{2}\left[\sin^{-1}{t}\right]_{-1}^{1} = \sqrt{2}\left[\frac{\pi}{2} - \left(- \frac{\pi}{2} \right) \right] = \sqrt{2} \pi$$

I think this might be the simplest approach.

-
Brilliant substitution. Clever Manipulation of the integral! +1 –  user21436 Jan 22 '12 at 14:08

We will employing the substitution $u=\sqrt{\tan x}$: $$u'= \frac{1+\tan^2 x}{2 \sqrt{\tan x}}$$ and $$2\int_0^{\pi/2} \sqrt{\tan x}\,dx = 4 \int_0^\infty \frac{u^2}{1+u^4} du= 2 \int_{-\infty}^\infty \frac{u^2}{1+u^4} du.$$ The last integral has two poles ($u_1 = e^{i\pi/4}$, $u_2=e^{i3\pi/4}$) in the upper complex half-plane. The corresponding residue are $$\text{Res}_{u=u_1} \frac{u^2}{1+u^4} = -\frac{u_2}{4} \qquad\qquad \text{Res}_{u=u_1} \frac{u^2}{1+u^4} = -\frac{u_1}{4}.$$

Thus the value of the integral is $$2\int_0^{\pi/2} \sqrt{\tan x}\,dx =- \pi i (u_1+u_2)=\sqrt{2}\pi$$

-
This is high-school level problem, so hopefully that's not the suitable way to do it. –  Quixotic Jan 18 '12 at 21:20
@MaxX With substitution $u = \sqrt{\tan(x)}$ you get $\int_0^{\pi/2} \sqrt{\tan(x)} \mathrm{d} x = \int_0^\infty \frac{2u^2}{1+u^4} \mathrm{d} u$. The integrand has an elementary anti-derivative, so one can apply the fundamental theorem of calculus. –  Sasha Jan 18 '12 at 21:24
@MarxX: of course one can also solve it using some arctan and logs. However, you were asking for the easiest solution and there is nothing easier then residue theorem :-) –  Fabian Jan 18 '12 at 21:31
@Fabian assuming you know Residue theorem.... –  Pureferret Jan 19 '12 at 0:56
In the sense that the question involves "the most elegant" way, I do not understand the downvote –  Fabian Jan 19 '12 at 7:27

Hint: subtituting $u=\sin^2 x$ you will get the beta function, you will also need some basic properties of beta and gamma functions

-
+1, I see you beat me too it. –  Eric Naslund Jan 18 '12 at 21:52

Let $u=\sqrt{\tan(x)}$. Then $u^2 = \tan(x)$ and $2 u \mathrm{d} u = (1+ \tan^2(x)) \mathrm{d} x$. Thus $$\int_0^{\frac{\pi}{2}} \sqrt{\tan(x)} \mathrm{d} x = \int_0^\infty \frac{2u^2}{1+u^4} \mathrm{d} u$$ Since $1+u^4 = (1 + \sqrt{2} u + u^2)( 1- \sqrt{2} u + u^2)$, partial fraction decomposition applies: $$\frac{2u^2}{1+u^4} = \frac{1}{\sqrt{2}} \left( \frac{u}{u^2-\sqrt{2} u+1}-\frac{u}{u^2+\sqrt{2} u+1} \right)$$ Hence $$\begin{eqnarray} \int \frac{2u^2}{1+u^4} \mathrm{d} u &=& \frac{1}{2 \sqrt{2}} \log \left(\frac{u^2-\sqrt{2} u+1}{u^2+\sqrt{2} u+1}\right) + \\ &\phantom{=}& \frac{\tan ^{-1}\left(\sqrt{2} u+1\right) -\tan ^{-1}\left(1-\sqrt{2} u\right) }{\sqrt{2}} \end{eqnarray}$$ Applying the fundamental theorem of calculus: $$\int_0^{\pi/2} \sqrt{\tan(x)} \mathrm{d} x = \frac{\pi}{\sqrt{2}}$$

-

I would argue the easiest way is to use the Gamma function. Notice that by making the change $x=\sin^2(u)$ we get that $$\int_0^1 x^{-\frac{1}{4}}(1-x)^{-\frac{3}{4}}dx=\int_0^{\pi/2}\sqrt{\tan(x)}dx$$ Then this is $$B\left(\frac{1}{4},\frac{3}{4}\right)=\Gamma\left(\frac{1}{4}\right)\Gamma\left(\frac{3}{4}\right)=\frac{\pi}{\sin\left(\frac{\pi}{4}\right)}=\frac{\pi}{\sqrt{2}}.$$

-

$$\int_0^{\frac{\pi}{2}} \sqrt{\tan(x)} \mathrm{d} x = \int_0^\infty \frac{2u^2}{1+u^4} \mathrm{d} u$$

$$= \int^{\infty}_0 \frac{u^2+1}{1+u^4} + \frac{u^2-1}{1+u^4} \mathrm{d} u$$

$$= \int^{\infty}_0 \frac{\mathrm{d} (u-1/u)}{ (u-1/u)^2 +2 } + \int^{\infty}_0 \frac{\mathrm{d} (u+1/u)}{ (u+1/u)^2 -2 }$$

and these have simple primitives in terms of arctan and logs. I like the Beta function approach or residues better, but this is something a high schooler can do.

-