# A definite integral with trigonometric functions: $\int_{0}^{\pi/2} x^{2} \sqrt{\tan x} \sin(2x) \, \mathrm{d}x$

How could we get a closed form for the following integral:

$$\int_{0}^{\frac{\pi }{2}}{{{x}^{2}}\sqrt{\tan x}\sin \left( 2x \right) \, \mathrm{d}x} \tag{1}$$

While the antiderivative of $\sqrt{\tan x} \sin(2x)$ can be expressed in terms of elementary functions according to Wolfram Alpha, the antiderivative of $x^{2} \sqrt{\tan x} \sin(2x)$ seeminly cannot be expressed in closed form.

To evaluate $(1)$, would introducing a parameter and differentating under the integral sign be helpful?

• Why do you expect there to be one? A quick numeric computation and a look at the inverse symbolic calculator gives no match for the number (1.1057733282580962321535756282112900456642421892605) – mrf Jan 23 '13 at 10:38
• @mrf the answer is in terms of pai and logs. I dont know what substitution or other methods are involved. – Ryan Jan 23 '13 at 10:47
• Using @rlgordonma's method, the final result can be written in terms of elementary functions and is given by $\frac{\pi \left(5 \pi ^2-6 \pi (\log (4)-2)-3 (8+(\log (4)-4) \log (4))\right)}{96 \sqrt{2}}$. – Fabian Jan 23 '13 at 11:21
• @Fabian: I get precisely what you get. I take it we have Mathematica in common? And I can simplify what I have presented and present the actual result if it is wanted. – Ron Gordon Jan 23 '13 at 11:52
• @rigordonma I am really interested how to get these value :) – Ryan Jan 23 '13 at 13:20

The general method of attack on an integral like this is to recognize that the $x^2$ could be ignored for the time being upon expressing the integral in terms of a suitable parameter which may then be twice differentiated. To wit, after a little manipulatin, I find:

$$\displaystyle \int_{0}^{\frac{\pi}{2}} dx \: {x}^2 \sqrt{\tan x} \sin \left( 2x \right) = 2 \Im{ \int_{0}^{\frac{\pi}{2}} dx \: x^2 e^{i x} \sqrt{\sin{x} \cos{x}}}$$

So consider the following integral:

$$J(\alpha) = \int_{0}^{\frac{\pi}{2}} dx \: e^{i \alpha x} \sqrt{\sin{x} \cos{x}}$$

Note that the integral we seek is

$$\displaystyle \int_{0}^{\frac{\pi}{2}} dx \: {x}^2 \sqrt{\tan x} \sin \left( 2x \right) = -2 \Im{\left [ \frac{\partial^2}{\partial \alpha^2} J(\alpha) \right ]_{\alpha = 1}}$$

It turns out that there is, in fact, a closed for for $J(\alpha)$:

$$J(\alpha) = -\frac{\left(\frac{1}{16}+\frac{i}{16}\right) \sqrt{\frac{\pi }{2}} \left ( e^{\frac{i \pi a}{2}}-i\right) \Gamma \left(\frac{a-1}{4}\right)}{\Gamma \left ( \frac{a+5}{4} \right )}$$

Plugging this into the above expression, you will find terms including polylogs and harmonic numbers, which I will spare you unless explicitly asked for. But this is how you would get a closed-form expression for your integral.

EDIT

The integral is even nicer when we consider

$$J(\alpha) = \int_{0}^{\frac{\pi}{2}} dx \: \sin{\alpha x} \sqrt{\sin{x} \cos{x}}$$

Then

$$J(\alpha) = \frac{\pi ^{3/2} \sin \left(\frac{\pi a}{4}\right)}{8 \Gamma \left(\frac{5-a}{4}\right) \Gamma \left(\frac{5+a}{4}\right)}$$

and

$$\left [ \frac{\partial^2}{\partial \alpha^2} J(\alpha) \right ]_{\alpha = 1} = \frac{\pi \left(-5 \pi ^2+6 \pi (\log (4)-2)+3 (8+(\log (4)-4) \log (4))\right)}{192 \sqrt{2}}$$

The integral we seek is then

$$\int_0^{\frac{\pi}{2}} dx \: x^2 \sqrt{\tan{x}} \sin{(2 x)} = -2 \left [ \frac{\partial^2}{\partial \alpha^2} J(\alpha) \right ]_{\alpha = 1} = \frac{\pi \left(-24+12 \pi +5 \pi ^2-3 \log ^2(4)+12 \log (4)-6 \pi \log (4)\right)}{96 \sqrt{2}}$$

It turns out that the numerical value of the latter value is about $1.10577$, which agrees with the numerical approximation of the integral mentioned by @mrf and verified in Mathematica.

• Very nice! That was surprising, at least to me. – mrf Jan 23 '13 at 13:03
• @mrf: Thanks. That means a lot given what I've seen you do here. – Ron Gordon Jan 23 '13 at 20:18
• $+1$. You’re always surprising us. Great. – Felix Marin Oct 9 '20 at 14:05

This integral appears as an exercise on page 857 of the textbook Classical Complex Analysis: A Geometric Approach, Volume 1 by I-Hsiung Lin.

You're told to integrate the function $$f(z) = \log^{2}(z) \Big( \frac{1-z}{1+z} \Big)^{1/2}$$ around an closed indented contour that runs just above the real axis from $z=-1$ to $z=1$ and then along the upper half of the unit circle.

Since the contributions from the indentations around the branch points at $z=0, z=1$, and $z=-1$ can be shown to be vanishing small, we get (using the principal branch of the logarithm throughout),

$$\int_{-1}^{0} \left(\log|x| + i \pi\right)^{2}\left( \frac{1-x}{1+x} \right)^{1/2} \, dx + \int_{0}^{1} \log^{2}(x) \left(\frac{1-x}{1+x} \right)^{1/2} \, dx$$

$$\ + i \int_{0}^{\pi} \log^{2}(e^{it}) \left(\frac{1-e^{i t}}{1+e^{i t}} \right)^{1/2} e^{it} \, dt = 0$$

Looking at each piece separately,

\begin{align} \int_{-1}^{0} \left(\log|x| + i \pi \right)^{2} \left( \frac{1-x}{1+x} \right)^{\frac{1}{2}} \, dx &= \int_{0}^{1} \left(\log x + i \pi \right)^{2} \left(\frac{1+x}{1-x} \right)^{1/2} \, dx \\ &= \int_{0}^{1}\left(\log^{2} (x) + 2 \pi i \log x - \pi^{2} \right) \frac{1+x}{\sqrt{1-x^{2}}} \, dx, \end{align}

$$\int_{0}^{1} \log^{2}(x) \left(\frac{1-x}{1+x} \right)^{1/2} \ dx = \int_{0}^{1} \log^{2}(x) \frac{1-x}{\sqrt{1-x^{2}}} \, dx,$$

and

\begin{align} i \int_{0}^{\pi} \log^{2}(e^{it}) \Big(\frac{1-e^{i t}}{1+e^{i t}} \Big)^{1/2} e^{it} \ dt &= -i \int_{0}^{\pi} t^{2} \sqrt{-i \tan t/2} \ e^{it} \ dt \\ &= - i e^{-i \pi/4} \int_{0}^{\pi} t^{2} \sqrt{\tan t/2} \ e^{it} \ dt \end{align}

So we have

$$e^{-i \pi /4} \int_{0}^{\pi} t^{2} \sqrt{\tan t/2} \, e^{it} \, dt = -2i \int_{0}^{1} \frac{\log^{2}(x)}{\sqrt{1-x^{2}}} \, dx + 2 \pi \int_{0}^{1} \frac{\log x}{\sqrt{1-x^{2}}} \, dx$$

$$+ 2 \pi \int_{0}^{1} \frac{x \log x}{\sqrt{1-x^{2}}} \, dx +i \pi^{2} \int_{0}^{1} \frac{1}{\sqrt{1-x^{2}}} \, dx +i \pi^{2} \int_{0}^{1} \frac{x}{\sqrt{1-x^{2}}} \, dx$$

We can use the fact that

$$\int_{0}^{1} \frac{x^{a}}{\sqrt{1-x^{2}}} \ dx = \frac{1}{2} \int_{0}^{1} u^{a/2+1/2-1} (1-u)^{1/2-1} \ du = \frac{1}{2} B \left( \frac{1}{2}, \frac{a}{2}+ \frac{1}{2} \right)$$

along with properties of the beta function (entries 23-26) to evaluate the first three integrals on the right side of the equation.

\begin{align} \int_{0}^{1} \frac{\log^{2}(x)}{\sqrt{1-x^{2}}} \, dx &= \frac{d^{2}}{da^{2}} \frac{1}{2} B \left( \frac{1}{2}, \frac{a}{2}+ \frac{1}{2} \right) \Bigg|_{a=0} \\ &= \frac{1}{8} B \left( \frac{1}{2}, \frac{1}{2} \right) \left[ \left( \psi \left(\frac{1}{2} \right) - \psi(1) \right)^{2} + \psi_{1}\left(\frac{1}{2}\right) - \psi_{1}(1) \right] \\ &= \frac{\pi^{3}}{24} + \frac{\pi \log^{2} 4}{8} \end{align}

\begin{align} \int_{0}^{1} \frac{\log x}{\sqrt{1-x^{2}}} \, dx &= \frac{d}{da} \frac{1}{2} B \left( \frac{1}{2}, \frac{a}{2}+ \frac{1}{2} \right) \Bigg|_{a=0} \\ &= \frac{1}{4} B \left( \frac{1}{2}, \frac{1}{2} \right) \left( \psi\left(\frac{1}{2}\right) - \psi(1) \right) \\ &= - \frac{\pi \log 2}{2} \end{align}

\begin{align} \int_{0}^{1} \frac{x \log x}{\sqrt{1-x^{2}}} \, dx &= \frac{d}{da} \frac{1}{2} B \left( \frac{1}{2}, \frac{a}{2}+ \frac{1}{2} \right) \Bigg|_{a=1} \\ &= \frac{1}{4} B \left( \frac{1}{2}, 1 \right) \left( \psi(1) - \psi\left(\frac{3}{2}\right) \right) \\ &= \log 2 -1 \end{align}

Therefore,

$$\int_{0}^{\pi} t^{2} \sqrt{\tan t/2} \ e^{it} \ dt = e^{i \pi /4} \left( -\frac{i \pi^{3}}{12} - \frac{i\pi \log^{2} 4}{4} - \pi^{2} \log 2 + 2 \pi \log 2 - 2 \pi + \frac{i\pi^{3}}{2} +i \pi^{2} \right)$$

Now just make the substitution $u = \frac{t}{2}$, and then equate the imaginary parts on both sides of the equation.


\begin{align} &\bbox[5px,#ffd]{\int_{0}^{\pi/2}x^{2} \root{\tan\pars{x}}\sin\pars{2x}\,\dd x} \\[5mm] = &\ \root{2}\int_{0}^{\pi/2}x^{2} \sin^{1/2}\pars{2x}\sin\pars{x}\,\dd x \\[5mm] = &\ \left. -\root{2}\,\partiald[2]{\mathcal{I}\pars{\alpha}}{\alpha}\,\right\vert_{\ \alpha\ =\ 1^{\color{red}{\large +}}} \end{align} where \begin{align} \mathcal{I}\pars{\alpha} & \equiv \int_{0}^{\pi/2} \sin^{1/2}\pars{2x} \sin\pars{\alpha x}\,\dd x \\[5mm] & = \Im\int_{0}^{\pi/2} \sin^{1/2}\pars{2x}\expo{\ic\alpha x}\,\dd x \\[5mm] & = \left.\Im\int_{x\ =\ 0}^{x\ =\ \pi/2} \pars{z^{2} - 1/z^{2} \over 2\ic}^{1/2} z^{\alpha}\,\,{\dd z \over \ic z} \,\right\vert_{\ z\ =\ \exp\pars{\ic x}} \\[5mm] & = -\,{\root{2} \over 2}\ \times \\[2mm] & \Re\bracks{\expo{\ic\pi/4}\int_{x\ =\ 0}^{x\ =\ \pi/2} \pars{1 - z^{4}}^{1/2}\, z^{\alpha - 2}\,\,\dd z} _{\ z\ =\ \exp\pars{\ic x}} \label{1}\tag{1} \end{align} At this point, I'll "close" the above integration around a quarter circle in the first quadrant: Namely, $$\ds{\pars{~\vphantom{\Large A} \pars{\epsilon,1}\cup \expo{\ic\pars{0,\pi/2}}\cup\pars{\ic,\epsilon\ic}\cup\epsilon\expo{\ic\pars{\pi/2,0}}~}}$$ which doesn't contain any pole.
Then \begin{align} \mathcal{I}\pars{\alpha} & \stackrel{\mrm{as}\ \epsilon\ \to\ 0^{+}}{\sim} \\[5mm] & {\root{2} \over 2} \Re\bracks{\expo{\ic\pi/4}\int_{1}^{\epsilon} \pars{1 - y^{4}}^{1/2}\, y^{a - 2}\, \expo{\ic\pars{a - 2}\pi/2}\,\,\ic\,\dd y} \\[2mm] & + {\root{2} \over 2} \Re\braces{\expo{\ic\pi/4}\int_{\pi/2}^{0} \bracks{\epsilon^{a - 2} \expo{\ic\pars{a - 2}\theta}}\bracks{\epsilon \expo{\ic\theta}\ic}\dd\theta} \\[2mm] & + {\root{2} \over 2} \Re\bracks{\expo{\ic\pi/4}\int_{\epsilon}^{1} \pars{1 - x^{4}}^{1/2}\,x^{a - 2}\,\dd x} \\[5mm] & = -\,{\root{2} \over 2} \sin\pars{{\pi \over 4} + {\pi a \over 2}} \int_{\epsilon}^{1} \pars{1 - y^{4}}^{1/2}\, y^{a - 2}\,\,\dd y \\[2mm] &\ + {\root{2} \over 2}\,\epsilon^{a - 1}\, \int_{0}^{\pi/2} \sin\pars{{\pi \over 4} + \bracks{a - 1}\theta} \dd\theta \\[2mm] &\ + {1 \over 2}\int_{\epsilon}^{1} \pars{1 - x^{4}}^{1/2}\, x^{a - 2}\,\,\dd x \\[5mm] & = {1 - \root{2}\sin\pars{\pi/4 + \pi a/2} \over 2} \int_{\epsilon}^{1} \pars{1 - x^{4}}^{1/2}\, x^{a - 2}\,\,\dd x \\[2mm] &\ + {\root{2} \over 2}\,\epsilon^{a - 1}\, \underbrace{\int_{0}^{\pi/2} \sin\pars{{\pi \over 4} + \bracks{a - 1}\theta} \dd\theta} _{\ds{-\,{-1 + \root{2}\sin\pars{\pi/4 + a/2} \over \root{2}\pars{a - 1}}}} \end{align} The integral over $$\ds{x}$$ is integrated by parts: \begin{align} &\int_{\epsilon}^{1} \pars{1 - x^{4}}^{1/2}\, x^{a - 2}\,\,\dd x \stackrel{\mrm{as}\ \epsilon\ \to\ 0^{+}}{\sim} \\[2mm] & -\,{\epsilon^{a - 1} \over a - 1} + {2 \over a - 1}\int_{\epsilon}^{1} x^{a + 2}\pars{1 - x^{4}}^{-1/2}\dd x \end{align} such thtat $$\ds{\mathcal{I}\pars{\alpha}}$$ becomes, in the limit $$\ds{\epsilon \to 0^{+}}$$, \begin{align} \mathcal{I}\pars{\alpha} & = {1 - \root{2}\sin\pars{\pi/4 + \pi a/2} \over a - 1} \int_{0}^{1} \pars{1 - x^{4}}^{-1/2}\, x^{a + 2}\,\,\dd x \\[5mm] & \stackrel{x^{4}\ \mapsto\ x}{=}\,\,\, {1 - \root{2}\sin\pars{\pi/4 + \pi a/2} \over 4\pars{a - 1}} \int_{0}^{1} x^{a/4 - 1/4}\,\,\pars{1 - x}^{-1/2}\,\,\dd x \\[5mm] & = {1 - \root{2}\sin\pars{\pi/4 + \pi a/2} \over 4\pars{a - 1}}\, {\Gamma\pars{a/4 + 3/4}\Gamma\pars{1/2} \over \Gamma\pars{a/4 + 5/4}} \end{align}
Finally, \begin{align} &\bbox[5px,#ffd]{\int_{0}^{\pi/2}x^{2} \root{\tan\pars{x}}\sin\pars{2x}\,\dd x} \\[5mm] = & -\,{\root{2} \over 4} \partiald[2]{}{\alpha}\bracks{% {1 - \root{2}\sin\pars{\pi/4 + \pi a/2} \over a - 1}\, {\Gamma\pars{a/4 + 3/4}\Gamma\pars{1/2} \over \Gamma\pars{a/4 + 5/4}}}_{\ \alpha\ =\ 1} \\[5mm] & = \bbx{{5\pi^{2} + 12\pi - 24 + 24\ln\pars{2} - 12\pi\ln\pars{2} - 12\ln^{2}\pars{2} \over 192}\,\root{2}\pi} \\[5mm] & \approx 1.10577332825810 \end{align}