Evaluation of $\int_0^{\pi/4} \sqrt{\tan x} \sqrt{1-\tan x}\,\,dx$

How to evaluate the following integral $$\int_0^{\pi/4} \sqrt{\tan x} \sqrt{1-\tan x}\,\,dx$$ It looks like beta function but Wolfram Alpha cannot evaluate it. So, I computed the numerical value of integral above to 70 digits using Wolfram Alpha and I used the result to find its closed-form. The possible candidate closed-form from Wolfram Alpha is $$\pi\sqrt{\frac{1+\sqrt{2}}{2}}-\pi$$ Is this true? If so, how to prove it?


Solution 1:

\begin{align} \int_0^{\Large\frac{\pi}{4}} \sqrt{\tan x} \sqrt{1-\tan x}\,\,dx&=\int_0^1\frac{\sqrt{y(1-y)}}{1+y^2}\,dy\quad\Rightarrow\quad y=\tan x\\ &=\int_0^\infty\frac{\sqrt{t}}{(1+t)(1+2t+2t^2)}\,dt\quad\Rightarrow\quad t=\frac{y}{1-y}\\ &=\int_0^\infty\frac{2z^2}{(1+z^2)(1+2z^2+2z^4)}\,dz\quad\Rightarrow\quad z^2=t\\ &=2\int_0^\infty\left[\frac{2z^2}{1+2z^2+2z^4}+\frac{1}{1+2z^2+2z^4}-\frac{1}{1+z^2}\right]\,dz\\ &=\int_{-\infty}^\infty\left[\frac{2z^2}{1+2z^2+2z^4}+\frac{1}{1+2z^2+2z^4}-\frac{1}{1+z^2}\right]\,dz\\ &=I_1+I_2-\pi \end{align}


\begin{align} I_1 &=\int_{-\infty}^\infty\frac{2z^2}{1+2z^2+2z^4}\,dz\\ &=\int_{-\infty}^\infty\frac{1}{z^2+\frac{1}{2z^2}+1}\,dz\\ &=\int_{-\infty}^\infty\frac{1}{\left(z-\frac{1}{\sqrt{2}z}\right)^2+1+\sqrt{2}}\,dz\\ &=\int_{-\infty}^\infty\frac{1}{z^2+1+\sqrt{2}}\,dz\\ &=\frac{\pi}{\sqrt{1+\sqrt{2}}} \end{align} where the 4th line we use identity

\begin{align} \int_{-\infty}^\infty f\left(x\right)\,dx=\int_{-\infty}^\infty f\left(x-\frac{a}{x}\right)\,dx\qquad,\qquad\text{for }\, a>0. \end{align}

The proof can be seen in my answer here. $I_2$ can be proved in similar manner (see user111187's answer). \begin{equation} I_2=\frac{1}{2}\int_{-\infty}^\infty\frac{1}{z^4+z^2+\frac{1}{2}}\,dz=\pi\sqrt{\frac{\sqrt{2}-1}{2}} \end{equation}


Combine all the results together, we finally get

\begin{equation} \int_0^{\Large\frac{\pi}{4}} \sqrt{\tan x} \sqrt{1-\tan x}\,\,dx=\frac{\pi}{\sqrt[4]{2}}\sqrt{\frac{2+\sqrt{2}}{2}}-\pi \end{equation}

Solution 2:

Here is a complex analysis approach. Integrate $$f(z)=\frac{\sqrt{z}\sqrt{z-1}}{z^2+1}=\frac{|z|^\frac{1}{2}|z-1|^\frac{1}{2}e^{i\varphi}}{z^2+1}$$ where $\varphi=\dfrac{1}{2}\left(\arg{z}+\arg(z-1)\right)$, $0\le \arg{z}, \arg(z-1)\le 2\pi$, along a dumbbell contour. Just above $[0,1]$, $\varphi=\dfrac{\pi}{2}$, and just below $[0,1]$, $\varphi=\dfrac{3\pi}{2}$. So the contour integral is \begin{align} 2i\int^1_0\frac{\sqrt{x}\sqrt{1-x}}{1+x^2}{\rm d}x =&2\pi i\left[\operatorname*{Res}_{z=i}f(z)+\operatorname*{Res}_{z=-i}f(z)-\operatorname*{Res}_{z=0}\frac{f(z^{-1})}{z^2}\right]\\ =&2\pi i\left[\frac{\sqrt[4]{2}}{2i}e^{i5\pi/8}-\frac{\sqrt[4]{2}}{2i}e^{i11\pi/8}-1\right]\\ =&2\pi i\left[\frac{\sqrt[4]{2}}{2i}\left(e^{i3\pi/8}-e^{-i3\pi/8}\right)-1\right]\\ =&2\pi i\left[\sqrt[4]{2}\sin\left(\frac{3\pi}{8}\right)-1\right] \end{align} Therefore $$\int^\frac{\pi}{4}_0\sqrt{\tan{x}-\tan^2{x}}\ {\rm d}x=\int^1_0\frac{\sqrt{x}\sqrt{1-x}}{1+x^2}{\rm d}x=\pi\left[\sqrt[4]{2}\sin\left(\frac{3\pi}{8}\right)-1\right]$$

Solution 3:

To continue the work of Anastasiya-Romanova but not using complex analysis

For $I_1$:

Notice: $p(z)=1+2z^2+2z^4=2\Big(z^2+az+b\Big)\Big(z^2-az+b\Big)$

where $a=\sqrt{\sqrt{2}-1}$ and $b=\dfrac{\sqrt{2}}{2}$

Therefore:

$f(z)=\displaystyle \dfrac{2z^2}{1+2z^2+2z^4}=\dfrac{z}{2a\Big(z^2-az+b\Big)}-\dfrac{z}{2a\Big(z^2+az+b\Big)}$ $f(z)=\dfrac{2z-a}{4a\Big(z^2-az+b\Big)}-\dfrac{2z+a}{4a\Big(z^2+az+b\Big)}+\dfrac{1}{4\Big(z^2-az+b\Big)}+\dfrac{1}{4\Big(z^2+az+b\Big)}$

Let $c=b-\dfrac{a^2}{4}$, $c>0$

Therefore:

$f(z)=\dfrac{2z-a}{4a\Big(z^2-az+b\Big)}-\dfrac{2z+a}{4a\Big(z^2+az+b\Big)}+\dfrac{1}{4\Big(\big(z-\tfrac{a}{2}\big)^2+c\Big)}+\dfrac{1}{4\Big(\big(z+\tfrac{a}{2}\big)^2+c\Big)}$

So a primitive of $\displaystyle \dfrac{2z}{1+2z^2+2z^4}$ is:

$\dfrac{1}{4a}\log\Big(\dfrac{z^2-az+b}{z^2+az+b}\Big)+\dfrac{1}{4\sqrt{c}}\arctan\Big(\dfrac{z-\tfrac{a}{2}}{\sqrt{c}}\Big)+\dfrac{1}{4\sqrt{c}}\arctan\Big(\dfrac{z+\tfrac{a}{2}}{\sqrt{c}}\Big)$

(think about derivative of $\log(u(x))$ )

Therefore:

$\displaystyle \int_{-\infty}^{+\infty}\dfrac{2x^2dx}{1+2x^2+2x^4}=\dfrac{\pi}{2\sqrt{c}}=\pi\sqrt{\sqrt{2}-1}$

To compute $I_2$ start performing change of variable $u=\dfrac{1}{x}$ , the function to integrate becomes $\dfrac{x^2}{x^4p\Big(\dfrac{1}{x}\Big)}$

$q(x)=x^4p\Big(\dfrac{1}{x}\Big)$

$q(x)=2x^4\Big(\dfrac{1}{x^2}+\dfrac{a}{x}+b\Big)\Big(\dfrac{1}{x^2}-\dfrac{a}{x}+b\Big)$

$q(x)=2(1+ax+bx^2)(1-ax+bx^2)$

$q(x)=2b^2\Big(x^2+\dfrac{a}{b}x+\dfrac{1}{b}\Big)\Big(x^2-\dfrac{a}{b}x+\dfrac{1}{b}\Big)$

The new $a,b$ are respectively $\dfrac{a}{b},\dfrac{1}{b}$ and there is a new $c$.

Therefore:

$\displaystyle \int_{-\infty}^{+\infty}\dfrac{dx}{1+2x^2+2x^4}=\dfrac{2}{b^2}\times \dfrac{\pi}{2\sqrt{c}}=\dfrac{\pi}{b^2\sqrt{c}}=\pi\dfrac{\sqrt{2}}{2}\sqrt{\sqrt{2}-1}$

Solution 4:

That's just a start, but using the change of variable:

$$ u = \sqrt{\tan(x)}\quad\Rightarrow\quad\mathrm du = \frac{1+u^4}{2u}\mathrm dx, $$ you get:

$$ I= 2\int_0^1 \frac{u^2\sqrt{1-u^2}}{1+u^4}\mathrm du $$

Now, let: $u= \sin(t)\Rightarrow\mathrm du = \cos(t)\mathrm dt$

$$ I= 2\int_0^{\frac{\pi}{2}} \frac{\sin^2(t)\cos^2(t)}{1+\sin^4(t)}\mathrm dt $$

Now replacing the $\cos$ will give you:

$$ I = 2\Bigl(\int_0^{\frac{\pi}{2}} {\frac{1+\sin^2(t)}{1+\sin^4(t)}\mathrm dt}\Bigr) -\pi $$

So here is the $-\pi$ :), now you can work on the other integral that might be easier to deal with. let's call it $I_1$.

Edit :

Now use : $v = \tan(t)$ -> $dv = \frac{1}{\cos^2(t)}dt$

$$ I_1 = \int_0^{+\infty} \frac{cos^2(t)*(1+sin^2(t)}{1+sin^4(t)} du = \int_0^{+\infty} \frac{cos^4(t)*(1+2*u^2)}{1+sin^4(t)} du $$

Hence : $$ I_1 = \int_0^{+\infty} \frac{1+2*u^2}{u^4+(1+u^2)^2} du $$

Now : $u^4 + (1+u^2)^2 = 2*u^4 +2*u^2 + 1 = \frac{1}{2}*(4*u^4+4*u^2 +2) = \frac{1}{2}*(1+ (2*u^2+1)^2) $

Thus giving : $$ I_1 = \int_0^{+\infty} \frac{1+2u^2}{1+(1+2u^2)^2} du$$

Now this one is easier to treat I think.

Solution 5:

The result happens to coincide with the conjectured form: $$\mathcal I=\left(\sqrt[4]{2}\,\cos\frac{\pi}{8}-1\right)\pi.$$


Derivation: make the change of variables $t=\tan x$. This transforms the integral into $$\mathcal I=\int_0^1\frac{\sqrt{t(1-t)}}{1+t^2}dt$$ Now since we have a mix of rational function with only square roots of a quadratic polynomial, the antiderivative can be found in elementary functions using a suitable rational change of variables, e.g. $2t-1=\frac{\lambda-\lambda^{-1}}{2i}$.