# Evaluate the integral $\int_0^\infty \frac{x (\ln(x))^2}{x^4 + x^2 + 1}\text{ d}x$

What is the value of $$\displaystyle\int_0^\infty \frac{x (\ln(x))^2}{x^4 + x^2 + 1}\text{ d}x$$?

### This is a question I came up with myself. It is not homework.

I constructed this example to make the following technique work:

Integrate $$\frac{z (\log(z))^3}{z^4 + z^2 + 1}$$ along a "key-hole" contour. The argument can be made rigorous by splitting the contour into two parts, and using two different branch cuts for each part. Warning: This method is time-consuming and not for the faint-hearted

• To the down-voter: It's a valid question, and I've certainly tried it myself! Please read the tooltip first before clicking: "This question does not show any research effort; it is unclear or not useful". Commented Jan 10, 2015 at 3:56
• Which part of the calculation you got stuck at? Commented Jan 10, 2015 at 3:57
• What's your question then? Please be explicit. Commented Jan 10, 2015 at 3:59
• Ok I see. I thought you need help with computing the integral. Commented Jan 10, 2015 at 4:01
• @Bombyxmori: The point is, it's not a duplicate. Either you don't understand the art, or you don't understand what a duplicate is. Either way, not a duplicate. End of story. Commented Jan 10, 2015 at 19:05

## 4 Answers

\begin{align} \int^\infty_0\frac{x\ln^2{x}}{x^4+x^2+1}dx &=\frac{1}{8}\int^\infty_0\frac{\ln^2{x}}{x^2+x+1}dx\\ &=\frac{1}{4}\int^1_0\frac{(1-x)\ln^2{x}}{1-x^3}dx\\ &=\frac{1}{4}\sum^\infty_{n=0}\int^1_0\left(x^{3n}-x^{3n+1}\right)\ln^2{x}dx\\ &=\frac{1}{2}\sum^\infty_{n=0}\left(\frac{1}{(3n+1)^3}-\frac{1}{(3n+2)^3}\right)\\ &=-\frac{1}{2}\operatorname*{Res}_{z=-1/3}\frac{\pi\cot(\pi z)}{(3z+1)^3}\\ &=-\frac{1}{108}\left(2\pi^3\cot(\pi z)\csc^2(\pi z)\right)\Bigg{|}_{z=-1/3}\\ &=\frac{2\pi^3}{81\sqrt{3}} \end{align}

• This is a truly tour-de-fource! Commented Jan 10, 2015 at 4:51

Let's actually do the integral using the keyhole contour. It may be time-consuming but it is not as bad as it looks.

We can begin by simplifying the integral using the substitution $u=x^2$:

$$I = \frac18 \int_0^{\infty} du \frac{\log^2{u}}{u^2+u+1}$$

Consider

$$\oint_C dz \frac{\log^3{z}}{z^2+z+1}$$

where $C$ is the keyhole contour, as pictured below.

The integral over the circular arcs vanish, and the contour integral is equal to

$$i \left ( -6 \pi \int_0^{\infty} dx \frac{\log^2{x}}{x^2+x+1} + 8 \pi^3 \int_0^{\infty} dx \frac{1}{x^2+x+1}\right ) + 12 \pi^2 \int_0^{\infty} dx \frac{\log{x}}{x^2+x+1}$$

We can easily show that

$$\int_0^{\infty} dx \frac{\log{x}}{x^2+x+1} = 0$$

by splitting up the integration interval into $[0,1]$ and $[1,\infty)$ and subbing $x=1/u$ in the latter subinterval.

Now, we can evaluate the other integral any way we want, but let's stay consistent within our chosen methodology, and evaluate the integral using the residue theorem, all the same. Let the poles of the denominator be $z_{\pm}$; here

$$z_+ = e^{i 2 \pi/3} \quad z_-=e^{i 4 \pi/3}$$

Then

$$\int_0^{\infty} dx \frac{1}{x^2+x+1} = - \left (\frac{\log{z_+}}{2 z_++1} +\frac{\log{z_-}}{2 z_-+1}\right ) = -\frac{i 2 \pi/3}{i \sqrt{3}} + \frac{i 4 \pi/3}{i \sqrt{3}} = \frac{2 \pi}{3 \sqrt{3}}$$

The contour integral is of course equal to $i 2 \pi$ times the sum of the residues at $z=z_{\pm}$. Thus we have

$$-3 \int_0^{\infty} dx \frac{\log^2{x}}{x^2+x+1} + 4 \pi^2 \frac{2 \pi}{3 \sqrt{3}} = \left (\frac{\log^3{z_+}}{2 z_++1} +\frac{\log^3{z_-}}{2 z_-+1}\right ) = \frac{56 \pi^3}{27 \sqrt{3}}$$

Thus, from above, we have

$$\int_0^{\infty} dx \frac{x \log^2{x}}{x^4+x^2+1} = \frac{2 \pi^3}{81 \sqrt{3}}$$

• @Bombyxmori: By using the $\log^3{z}$ over the keyhole contour, we are able to recover the integral over $\log^2{x}$ because, about the branch point, the contour integral is equal to $$\int_0^{\infty} dx \frac{\log^3{x}-(\log{x}+i 2 \pi)^3}{x^2+x+1}$$ and the $\log^3{x}$ terms cancel. This is true for general powers of log. Commented Jan 10, 2015 at 19:35
• I see. This is obviously the crucial step I was missing. Now the set up is clear to me. Commented Jan 10, 2015 at 19:41

$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\dsc}[1]{\displaystyle{\color{red}{#1}}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\Li}[1]{\,{\rm Li}_{#1}} \newcommand{\norm}[1]{\left\vert\left\vert\, #1\,\right\vert\right\vert} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$ $\ds{\int_{0}^{\infty}{x\ln^{2}\pars{x} \over x^4 + x^2 + 1}\,\dd x:\ {\large ?}}$.

\begin{align}&\color{#66f}{\large% \int_{0}^{\infty}{x\ln^{2}\pars{x} \over x^4 + x^2 + 1}\,\dd x} =\int_{0}^{1}{x\ln^{2}\pars{x} \over x^4 + x^2 + 1}\,\dd x\ +\ \overbrace{\int_{1}^{\infty}{x\ln^{2}\pars{x} \over x^4 + x^2 + 1}\,\dd x} ^{\ds{\dsc{x}\ \mapsto\ \dsc{1 \over x}}} \\[5mm]&=2\ \overbrace{\int_{0}^{1}{x\ln^{2}\pars{x} \over x^4 + x^2 + 1}\,\dd x} ^{\ds{\dsc{x}\ \mapsto\ \dsc{x^{1/2}}}}\ =\ ={1 \over 4}\int_{0}^{1}{\ln^{2}\pars{x} \over x^2 + x + 1}\,\dd x =\ \overbrace{{1 \over 4}\int_{0}^{1}{\pars{1 - x}\ln^{2}\pars{x} \over 1 - x^{3}}\,\dd x} ^{\ds{\dsc{x}\ \mapsto\ \dsc{x^{1/3}}}} \\[5mm]&={1 \over 4}\int_{0}^{1}{\pars{1 - x^{1/3}}\ln^{2}\pars{x^{1/3}} \over 1 - x}\, {1 \over 3}\,x^{-2/3}\,\dd x ={1 \over 108}\int_{0}^{1}{\pars{x^{-2/3} - x^{-1/3}}\ln^{2}\pars{x} \over 1 - x}\, \,\dd x \\[5mm]&={1 \over 108}\lim_{\mu\ \to\ 0}\ \partiald[2]{}{\mu} \int_{0}^{1}{x^{\mu - 2/3} - x^{\mu - 1/3} \over 1 - x}\,\,\dd x \\[5mm]&={1 \over 108}\lim_{\mu\ \to\ 0}\ \partiald[2]{}{\mu}\pars{% \int_{0}^{1}{1 - x^{\mu - 1/3} \over 1 - x}\,\,\dd x -\int_{0}^{1}{1 - x^{\mu - 2/3} \over 1 - x}\,\,\dd x} \\[5mm]&={1 \over 108}\lim_{\mu\ \to\ 0}\ \partiald[2]{}{\mu}\bracks{% \Psi\pars{\mu + {2 \over 3}} - \Psi\pars{\mu + {1 \over 3}}} \end{align} where $\ds{\Psi}$ is the Digamma Function.
Then, \begin{align}&\color{#66f}{\large% \int_{0}^{\infty}{x\ln^{2}\pars{x} \over x^4 + x^2 + 1}\,\dd x} ={1 \over 108}\bracks{\Psi''\pars{2 \over 3} - \Psi''\pars{1 \over 3}} \end{align} With Euler Reflection Formula $\ds{\Psi''\pars{1 - z} =\Psi''\pars{z} + 2\pi^{3}\cot\pars{\pi z}\csc^{2}\pars{\pi z}}$: \begin{align}&\color{#66f}{\large% \int_{0}^{\infty}{x\ln^{2}\pars{x} \over x^4 + x^2 + 1}\,\dd x} ={1 \over 54}\,\pi^{3}\ \overbrace{\cot\pars{\pi \over 3}}^{\dsc{1 \over \root{3}}} \ \overbrace{\csc^{2}\pars{\pi \over 3}}^{\dsc{4 \over 3}} \ = \color{#66f}{\large{2\root{3} \over 243}\,\pi^{3}} \end{align}

May be, this will be totally off-topic; if this is the case, please, forgive me.

What I found interesting is that $$I=\int \frac{x \big(\ln(x)\big)^2}{x^4 + x^2 + 1}\text{ d}x$$ has (found by a CAS) a closed form mainly in terms of polylogarithms.

The next point is that, using the so-found antiderivative, $$\int_0^\infty \frac{x \big(\ln(x)\big)^2}{x^4 + x^2 + 1}\text{ d}x=\frac{2 \pi ^3}{81 \sqrt{3}}$$