# Integral $\int_0^\frac{\pi}{2} x^2\sqrt{\tan x}\,\mathrm dx$

Last year I wondered about this integral:$$\int_0^\frac{\pi}{2} x^2\sqrt{\tan x}\,\mathrm dx$$ That is because it looks very similar to this integral and this one. Surprisingly the result is quite nice and an approach can be found here. $$\boxed{\int_0^\frac{\pi}{2} x^2\sqrt{\tan x}\,\mathrm dx=\frac{\sqrt{2}\pi(5\pi^2+12\pi\ln 2 - 12\ln^22)}{96}}$$

Although the approach there is quite skillful, I believed that an elementary approach can be found for this integral.

Here is my idea. First we will consider the following two integrals: $$I=\int_0^\frac{\pi}{2} x^2\sqrt{\tan x}\,\mathrm dx \,;\quad J=\int_0^\frac{\pi}{2} x^2\sqrt{\cot x}\,\mathrm dx$$ $$\Rightarrow I=\frac12 \left((I-J)+(I+J)\right)$$ Thust we need to evaluate the sum and the difference of those two from above.

I also saw from here that the "sister" integral differs only by a minus sign: $$\boxed{\int_0^\frac{\pi}{2} x^2\sqrt{\cot x}\,\mathrm dx=\frac{\sqrt{2}\pi(5\pi^2-12\pi\ln 2 - 12\ln^22)}{96}}$$ Thus using those two boxed answer we expect to find: $$I-J=\frac{\pi^2 \ln 2}{2\sqrt 2};\quad I+J=\frac{5\pi^3}{24\sqrt 2}-\frac{\pi \ln^2 2}{2\sqrt 2}\tag1$$

$$I-J=\int_0^\frac{\pi}{2} x^2\left(\sqrt{\tan x}-\sqrt{\cot x}\right)\,\mathrm dx=\sqrt 2\int_0^\frac{\pi}{2} x^2 \cdot \frac{\sin x-\cos x}{\sqrt{\sin (2x)}}dx$$ $$=-\sqrt 2\int_0^\frac{\pi}{2} x^2 \left(\operatorname{arccosh}(\sin x+\cos x) \right)'dx=2\sqrt 2 \int_0^\frac{\pi}{2} x\operatorname{arccosh} (\sin x+\cos x)dx$$ Let us also denote the last integral with $$I_1$$ and do a $$\frac{\pi}{2}-x=x$$ substitution: $$I_1=\int_0^\frac{\pi}{2} x\operatorname{arccosh} (\sin x+\cos x)dx=\int_0^\frac{\pi}{2} \left(\frac{\pi}{2}-x\right)\operatorname{arccosh} (\sin x+\cos x)dx$$ $$2I_1=\frac{\pi}{2} \int_0^\frac{\pi}{2} \operatorname{arccosh} (\sin x+\cos x)dx\Rightarrow I-J=\frac{\pi}{\sqrt 2}\int_0^\frac{\pi}{2} \operatorname{arccosh} (\sin x+\cos x)dx$$

By using $$(1)$$ we can easily deduce that: $$\bbox[10pt,#000, border:2px solid green ]{\color{orange}{\int_0^\frac{\pi}{2} \operatorname{arccosh} (\sin x+\cos x)dx=\frac{\pi}{2}\ln 2}}$$

Doing something similar for $$I+J$$ we get: $$I+J=\int_0^\frac{\pi}{2} x^2\left(\sqrt{\tan x}+\sqrt{\cot x}\right)\,\mathrm dx=\sqrt 2\int_0^\frac{\pi}{2} x^2 \cdot \frac{\sin x+\cos x}{\sqrt{\sin (2x)}}dx$$ $$=\sqrt 2 \int_0^\frac{\pi}{2} x^2 \left( \arcsin \left(\sin x-\cos x\right)\right)'dx=\frac{\pi^3 \sqrt 2}{8}-2\sqrt 2 \int_0^\frac{\pi}{2} x \arcsin \left(\sin x-\cos x\right)dx$$

Unfortunately, we're not lucky this time and the substitution used for $$I-J$$ doesn't help in this case. Of course using $$(1)$$ we can again deduce that: $$\bbox[10pt,#000, border:2px solid green ]{\color{red}{\int_0^\frac{\pi}{2} x \arcsin \left(\sin x-\cos x\right)dx=\frac{\pi^3}{96}+\frac{\pi}{8}\ln^2 2}}$$

In the meantime I found a way for the first one, mainly using: $$\frac{\arctan x}{x}=\int_0^1 \frac{dy}{1+x^2y^2}$$ Let us denote: $$I_1=\int_0^\frac{\pi}{2} \operatorname{arccosh} (\sin x+\cos x)dx\overset{IBP}= \int_0^\frac{\pi}{2} x \cdot \frac{\sin x-\cos x}{\sqrt{\sin(2x)}}dx$$ $$\overset{\tan x\rightarrow x}=\frac{1}{\sqrt 2}\int_0^\infty \frac{\arctan x}{1+x^2}\frac{x-1}{\sqrt x}dx=\frac1{\sqrt 2}\int_0^\infty \int_0^1 \frac{dy}{1+x^2y^2} \frac{\sqrt x(x-1)}{1+x^2}dx$$ $$=\frac1{\sqrt 2}\int_0^1 \int_0^\infty \frac{1}{1+y^2x^2} \frac{\sqrt x(x-1)}{1+x^2} dxdy$$ $$=\frac{1}{\sqrt 2}\int_0^1 \frac{{\pi}}{\sqrt 2}\left(\frac{2}{y^2-1}-\frac{1}{\sqrt y (y^2-1)}-\frac{\sqrt y}{y^2-1}\right)dy=\frac{\pi}{2}\ln 2$$

Although the integral in the third row looks quite unpleasant, it can be done quite elementary.

Sadly a similar approach for the second one is madness, because we would have: $$I_2=\int_0^1 \int_0^1 \int_0^\infty \frac{\sqrt x (x+1)}{1+x^2}\frac{1}{1+y^2x^2}\frac{1}{1+z^2x^2} dxdydz$$

But atleast it gives hope that an elementary approach exists.

For this question I would like to see an elementary approach (without relying on special functions) for the second integral (red one).

If possible please avoid contour integration, although this might be included in elementary.

• I look forward to being about to integrate as you do. Very nice work here. – user150203 Jan 13 at 6:42

On the path of Zacky, the missing part...

Let,

\begin{align}I&=\int_0^{\frac{\pi}{2}}x^2\sqrt{\tan x}\,dx\\ J&=\int_0^{\frac{\pi}{2}}\frac{x^2}{\sqrt{\tan x}}\,dx\\ \end{align}

Perform the change of variable $$y=\sqrt{\tan x}$$,

\begin{align}I&=\int_0^{\infty}\frac{2x^2\arctan^2\left(x^2\right)}{1+x^4}\,dx\\\\ J&=\int_0^{\infty}\frac{2x^2\arctan^2\left(\frac{1}{x^2}\right)}{1+x^4}\,dx\\ \end{align}

\begin{align} \text{I+J}&=\int_0^{\infty}\frac{2x^2\left(\arctan\left(x^2\right)+\arctan\left(\frac{1}{x^2}\right)\right)^2}{1+x^4}\,dx-4\int_0^{\infty}\frac{x^2\arctan\left(x^2\right)\arctan\left(\frac{1}{x^2}\right)}{1+x^4}\,dx\\ &=\frac{\pi^2}{4}\int_0^{\infty}\frac{2x^2}{1+x^4}\,dx-4\int_0^{\infty}\frac{x^2\arctan\left(x^2\right)\arctan\left(\frac{1}{x^2}\right)}{1+x^4}\,dx\\ \end{align}

Perform the change of variable $$y=\dfrac{1}{x}$$,

\begin{align} \text{K}&=\int_0^{\infty}\frac{2x^2}{1+x^4}\,dx\\ &=\int_0^{\infty}\frac{2}{1+x^4}\,dx\\ \end{align}

Therefore,

\begin{align} \text{2K}=\int_0^{\infty}\frac{2\left(1+\frac{1}{x^2}\right)}{\left(x-\frac{1}{x}\right)^2+2}\,dx \end{align}

Perform the change of variable $$y=x-\dfrac{1}{x}$$,

\begin{align}\text{2K}&=2\int_{-\infty}^{+\infty}\frac{1}{2+x^2}\,dx\\ &=2\left[\frac{1}{\sqrt{2}}\arctan\left(\frac{x}{\sqrt{2}}\right)\right]_{-\infty}^{+\infty}\\ &=2\times \frac{\pi}{\sqrt{2}} \end{align}

therefore,

\begin{align} \text{I+J}&=\frac{\pi^3}{4\sqrt{2}}-4\int_0^{\infty}\frac{x^2\arctan\left(x^2\right)\arctan\left(\frac{1}{x^2}\right)}{1+x^4}\,dx\\ \end{align}

Let $$a>0$$,

\begin{align} \text{K}_1(a)&=\int_0^{\infty}\frac{x^2}{a+x^4}\,dx\\ &=\frac{1}{a}\int_0^{\infty}\frac{x^2}{1+\left(a^{-\frac{1}{4}}x\right)^4}\,dx\\ \end{align}

Perform the change of variable $$y=a^{-\frac{1}{4}}x$$,

\begin{align} \text{K}_1(a)&=a^{-\frac{1}{4}}\int_0^{\infty}\frac{x^2}{1+x^4}\,dx\\ &=\frac{a^{-\frac{1}{4}}\pi}{2\sqrt{2}} \end{align}

In the same manner,

\begin{align} \text{K}_2(a)&=\int_0^{\infty}\frac{x^2}{1+ax^4}\,dx\\ &=\frac{a^{-\frac{3}{4}}\pi}{2\sqrt{2}} \end{align}

Since, for $$a$$ real,

\begin{align}\arctan a=\int_0^1 \frac{a}{1+a^2t^2}\,dt\end{align}

then,

\begin{align}\text{L}&=\int_0^{\infty}\frac{x^2\arctan\left(x^2\right)\arctan\left(\frac{1}{x^2}\right)}{1+x^4}\,dx\\ &=\int_0^{\infty}\left(\int_0^1 \int_0^1 \frac{x^2}{(1+u^2x^4)\left(1+\frac{v^2}{x^4}\right)(1+x^4)}\,du\,dv\right)\,dx\\ &=\\ &\int_0^{\infty}\left(\int_0^1\int_0^1 \left(\frac{x^2}{(1-u^2)(1-v^2)(1+x^4)}-\frac{x^2}{1-u^2v^2}\left(\frac{u^2}{(1-u^2)(1+u^2x^4)}+\frac{v^2}{(1-v^2)(v^2+x^4)}\right) \right)dudv\right)dx\\ &=\int_0^1\int_0^1 \left(\frac{\pi}{2\sqrt{2}(1-u^2)(1-v^2)}-\frac{1}{1-u^2v^2}\left(\frac{u^2\text{K}_2(u^2)}{1-u^2}+\frac{v^2\text{K}_1(v^2)}{1-v^2}\right)\right)dudv\\ &=\frac{\pi}{2\sqrt{2}}\int_0^1\int_0^1 \left(\frac{1}{(1-u^2)(1-v^2)}-\frac{1}{(1-u^2v^2)}\left(\frac{u^{\frac{1}{2}}}{1-u^2}+\frac{v^{\frac{3}{2}}}{1-v^2}\right)\right)dudv\\ &=\pi\int_0^1\left[\frac{\sqrt{v}\left(\text{ arctanh}\left(\sqrt{uv}\right)-\text{ arctan}\left(\sqrt{uv}\right)-\text{ arctanh}\left(uv\right)\right)+\arctan\left(\sqrt{u}\right)+\ln\left(\frac{\sqrt{1+u}}{1+\sqrt{u}}\right)}{2\sqrt{2}(1-v^2)}\right]_{u=0}^{u=1}\,dv\\ &=\frac{\pi}{2\sqrt{2}}\int_0^1\frac{\sqrt{v}\big(\text{ arctanh}\left(\sqrt{v}\right)-\text{ arctan}\left(\sqrt{v}\right)-\text{ arctanh}\left(v\right)\big)+\frac{\pi}{4}-\frac{1}{2}\ln 2}{1-v^2}\,dv\\ &=\frac{\pi}{2\sqrt{2}}\int_0^1\frac{\sqrt{v}\arctan\left(\frac{1-\sqrt{v}}{1+\sqrt{v}}\right)}{1-v^2}\,dv+\frac{\pi}{2\sqrt{2}}\left(\frac{\pi}{4}-\frac{1}{2}\ln 2\right)\int_0^1 \frac{1-\sqrt{v}}{1-v^2}\,dv+\\ &\frac{\pi}{2\sqrt{2}}\int_0^1\frac{\sqrt{v}\ln\left(\frac{1+\sqrt{v}}{2}\right)}{1-v^2}\,dv-\frac{\pi}{4\sqrt{2}}\int_0^1\frac{\sqrt{v}\ln\left(\frac{1+v}{2}\right)}{1-v^2}\,dv \end{align}

Perform the change of variable $$y=\dfrac{1-\sqrt{v}}{1+\sqrt{v}}$$,

\begin{align}\text{R}_1&=\int_0^1\frac{\sqrt{v}\arctan\left(\frac{1-\sqrt{v}}{1+\sqrt{v}}\right)}{1-v^2}\,dv\\ &=\frac{1}{2}\int_0^1 \frac{(1-v)^2\arctan v}{v(1+v^2)}\,dv\\ &=\frac{1}{2}\int_0^1 \frac{\arctan v}{v}\,dv-\int_0^1 \frac{\arctan v}{1+v^2}\,dv\\ &=\frac{1}{2}\text{G}-\frac{1}{2}\Big[\arctan^2 v\Big]_0^1\\ &=\frac{1}{2}\text{G}-\frac{\pi^2}{32}\\ \text{R}_2&=\int_0^1 \frac{1-\sqrt{v}}{1-v^2}\,dv\\ &=\left[\ln\left(\frac{\sqrt{1+v}}{1+\sqrt{v}}\right)+\arctan\left(\sqrt{v}\right)\right]_0^1\\ &=\frac{\pi}{4}-\frac{1}{2}\ln 2\\ \end{align}

Perform the change of variable $$y=\dfrac{1-\sqrt{v}}{1+\sqrt{v}}$$,

\begin{align}\text{R}_3&=\int_0^1\frac{\sqrt{v}\ln\left(\frac{1+\sqrt{v}}{2}\right)}{1-v^2}\,dv\\ &=-\frac{1}{2}\int_0^1\frac{(1-v)^2\ln(1+v)}{v(1+v^2)}\,dv\\ &=\int_0^1\frac{\ln(1+v)}{1+v^2}\,dv-\frac{1}{2}\int_0^1 \frac{\ln(1+v )}{v}\,dv\\ &=\int_0^1\frac{\ln(1+v)}{1+v^2}\,dv-\frac{1}{4}\int_0^1 \frac{2v\ln(1-v^2)}{v^2}\,dv+\frac{1}{2}\int_0^1 \frac{\ln(1-v)}{v}\,dv\\ \end{align}

In the second integral perform the change of variable $$y=v^2$$,

\begin{align}\text{R}_3&=\int_0^1\frac{\ln(1+v)}{1+v^2}\,dv+\frac{1}{4}\int_0^1 \frac{\ln(1-v)}{v}\,dv\\ \end{align}

In the second integral perform the change of variable $$y=1-v$$,

\begin{align}\text{R}_3&=\int_0^1\frac{\ln(1+v)}{1+v^2}\,dv+\frac{1}{4}\int_0^1 \frac{\ln v}{1-v}\,dv\\ &=\int_0^1\frac{\ln(1+v)}{1+v^2}\,dv+\frac{1}{4}\times -\zeta(2)\\ &=\int_0^1\frac{\ln(1+v)}{1+v^2}\,dv-\frac{\pi^2}{24}\\ \end{align}

Perform the change of variable $$y=\dfrac{1-v}{1+v}$$,

\begin{align} \text{S}_1&=\int_0^1\frac{\ln(1+v)}{1+v^2}\,dv\\ &=\int_0^1\frac{\ln(\frac{2}{1+v})}{1+v^2}\,dv\\ &=\ln 2\int_0^1 \frac{1}{1+v^2}\,dv-\text{S}_1\\ &=\frac{\pi}{4}\ln 2-\text{S}_1 \end{align}

Therefore,

\begin{align} \text{S}_1&=\frac{\pi}{8}\ln 2\\ \text{R}_3&=\frac{\pi}{8}\ln 2-\frac{\pi^2}{24}\\ \end{align}

Perform the change of variable $$y=\dfrac{1-\sqrt{v}}{1+\sqrt{v}}$$,

\begin{align} \text{R}_4&=\int_0^1\frac{\sqrt{v}\ln\left(\frac{1+v}{2}\right)}{1-v^2}\,dv\\ &=\frac{1}{2}\int_0^1 \frac{(1-v)^2\ln\left(\frac{1+v^2}{(1+v)^2}\right)}{v(1+v^2)}\,dv\\ &=\frac{1}{2}\int_0^1 \frac{(1-v)^2\ln\left(1+v^2\right)}{v(1+v^2)}\,dv+2\text{R}_3\\ &=\frac{1}{2}\int_0^1\frac{\ln(1+v^2)}{v}\,dv-\int_0^1\frac{\ln(1+v^2)}{1+v^2}\,dv+\frac{\pi}{4}\ln 2-\frac{\pi^2}{12}\\ &=\frac{1}{2}\times \frac{1}{4}\zeta(2)-\int_0^1\frac{\ln(1+v^2)}{1+v^2}\,dv+\frac{\pi}{4}\ln 2-\frac{\pi^2}{12}\\ &=\frac{\pi}{4}\ln 2-\frac{\pi^2}{16}-\int_0^1\frac{\ln(1+v^2)}{1+v^2}\,dv\\ &=\frac{\pi}{4}\ln 2-\frac{\pi^2}{16}-\int_0^1\int_0^1\frac{v^2}{(1+v^2)(1+v^2t)}\,dt\,dv\\ &=\frac{\pi}{4}\ln 2-\frac{\pi^2}{16}-\int_0^1 \left[\frac{\arctan\left(v\right)\sqrt{t}-\arctan\left(v\sqrt{t}\right)}{(t-1)\sqrt{t}}\right]_{v=0}^{v=1}\,dt\\ &=\frac{\pi}{4}\ln 2-\frac{\pi^2}{16}-\int_0^1 \frac{\frac{\pi\sqrt{t}}{4}-\arctan\left(\sqrt{t}\right)}{(t-1)\sqrt{t}}\,dt\\ &=\frac{\pi}{4}\ln 2-\frac{\pi^2}{16}+\int_0^1 \frac{\arctan\left(\frac{1-\sqrt{t}}{1+\sqrt{t}}\right)}{(1-t)\sqrt{t}}\,dt-\frac{\pi}{4}\int_0^1 \frac{\sqrt{t}-1}{(t-1)\sqrt{t}}\,dt\\ &=\frac{\pi}{4}\ln 2-\frac{\pi^2}{16}+\int_0^1 \frac{\arctan\left(\frac{1-\sqrt{t}}{1+\sqrt{t}}\right)}{(1-t)\sqrt{t}}\,dt-\frac{\pi}{4}\Big[2\ln\left(1+\sqrt{t}\right)\Big]_0^1\\ &=\int_0^1 \frac{\arctan\left(\frac{1-\sqrt{t}}{1+\sqrt{t}}\right)}{(1-t)\sqrt{t}}\,dt-\frac{\pi}{4}\ln 2-\frac{\pi^2}{16}\\ \end{align}

Perform the change of variable $$y=\dfrac{1-\sqrt{t}}{1+\sqrt{t}}$$,

\begin{align} \text{R}_4&=\int_0^1 \frac{\arctan t}{t}\,dt-\frac{\pi}{4}\ln 2-\frac{\pi^2}{16}\\ &=\text{G}-\frac{\pi}{4}\ln 2-\frac{\pi^2}{16}\\ \end{align}

Therefore,

\begin{align}L&=\frac{\pi}{2\sqrt{2}}\text{R}_1+\frac{\pi}{2\sqrt{2}}\left(\frac{\pi}{4}-\frac{1}{2}\ln 2\right) \text{R}_2+\frac{\pi}{2\sqrt{2}}\text{R}_3-\frac{\pi}{4\sqrt{2}}\text{R}_4\\ &=\frac{\pi}{2\sqrt{2}}\left(\frac{\text{G}}{2}-\frac{\pi^2}{32}\right)+\frac{\pi}{2\sqrt{2}}\left(\frac{\pi}{4}-\frac{1}{2}\ln 2\right)^2+\frac{\pi}{2\sqrt{2}}\left(\frac{\pi}{8}\ln 2-\frac{\pi^2}{24}\right)-\\ &\frac{\pi}{4\sqrt{2}}\left(\text{G}-\frac{\pi}{4}\ln 2-\frac{\pi^2}{16}\right)\\ &=\frac{\pi^3}{96\sqrt{2}}+\frac{\pi\ln^2 2}{8\sqrt{2}} \end{align}

Thus, \begin{align}\text{I+J}&=\frac{\pi^3}{4\sqrt{2}}-4\text{L}\\ &=\frac{\pi^3}{4\sqrt{2}}-4\left(\frac{\pi^3}{96\sqrt{2}}+\frac{\pi\ln^2 2}{8\sqrt{2}}\right)\\ &=\boxed{\frac{5\pi^3}{24\sqrt{2}}-\frac{\pi\ln^2 2}{2\sqrt{2}}} \end{align}

Both integrals depend on $$\int_{0}^{\pi} x^2 \frac{\sqrt{1+\cos x}\pm \sqrt{1-\cos x}}{\sqrt{\sin x}}\,dx=\\\int_{0}^{\pi/2}\frac{dx}{\sqrt{\sin x}}\left[(x^2\pm(\pi-x)^2)\sqrt{1+\cos x}+(\pm x^2+(\pi-x)^2)\sqrt{1-\cos x}\right]\,dx$$ and they can be tackled through the Fourier series of a periodic version of $$x^2\pm(\pi-x)^2$$. For instance

$$x^2+(\pi-x)^2 = \frac{2\pi^2}{3}+2\sum_{n\geq 1}\frac{\cos(2nx)}{n^2}\qquad \forall x\in[0,\pi]$$ (yes, I am exploiting Bernoulli polynomials) and for any $$n\in\mathbb{N}^+$$ $$\int_{0}^{\pi/2}\frac{\sqrt{1+\cos x}+\sqrt{1-\cos x}}{\sqrt{\sin x}}\cos(2nx)\,dx=\frac{\pi}{4^n\sqrt{2}}\binom{2n}{n}$$ so the whole question boils down to computing $$\sum_{n\geq 1}\frac{1}{n^2 4^n}\binom{2n}{n} = \frac{1}{2}\,\phantom{}_4 F_3\left(1,1,1,\tfrac{3}{2};2,2,2;1\right)=\zeta(2)-2\log^2(2).$$ The last equality follows by recalling $$\frac{1}{4^n}\binom{2n}{n}=\frac{2}{\pi}\int_{0}^{\pi/2}(\sin t)^{2n}\,dt$$ and by tackling $$\int_{0}^{1}\frac{\text{Li}_2(z)}{\sqrt{z(1-z)}}\,dz$$ through Fourier-Legendre series or the reflection formula for $$\text{Li}_2$$.
The remaining part is just related to the well-known $$\int_{0}^{1}\frac{\log x}{\sqrt{x(1-x)}}\,dx = 4\int_{0}^{\pi/2}\log\sin\theta\,d\theta = -2\pi\log 2.$$ Summarizing, all the involved integrals just depend on $$\left.\frac{d^\nu}{da^\nu}B\left(a,\tfrac{1}{2}\right)\right|_{a=1/2}$$ for $$\nu\in\{1,2\}$$.

• I don't know if this fits the requirements for 'elementary', but nice job anyway – clathratus Jan 12 at 20:55
• Could you give me a tip on proving $$\sum_{n\geq1}\frac1{4^n n^2}{2n\choose n}=\zeta(2)-2\log^22$$? – clathratus Jan 18 at 4:01
• The value of this series is (integrate first using variable t) \begin{align}\sum_{n\geq 1}^\infty \frac{1}{4^n n^2}\binom{2n}{n}&=\frac{2}{\pi}\int_{x=0}^1\int_{t=0}^{\frac{\pi}{2}}\frac{\ln x\sin^2 t }{x\sin^2 t-1}\,dt\,dx\end{align} – FDP Jan 18 at 21:40