Evaluate $\int_0^\infty \frac{(\ln x)^2}{x^2+4} \ dx$ using complex analysis.

Evaluate $\int_0^\infty \frac{(\ln x)^2}{x^2+4} \ dx$. This is the last question in our review for complex analysis. Hints were available upon request, but being the student I am, I waited until the last minute to do this. Can anyone give a detailed answer? It would greatly appreciated. This is part of our residue theorem review, which is how we were taught to evaluate such integrals.


Solution 1:

Consider the contour integral

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

where $C$ is a keyhole contour about the positive real axis, with outer radius $R$ and inner radius $\epsilon$. The contour integral is then equal to

$$\int_{\epsilon}^R dx \frac{\log^3{x}}{x^2+4} +i R \int_0^{2 \pi} d\theta \, e^{i \theta} \frac{\log^3{(R e^{i \theta})}}{R^2 e^{i 2 \theta}+4} \\ + \int_R^{\epsilon} dx \, \frac{(\log{x}+i 2 \pi)^3}{x^2+4} + i \epsilon \int_{2 \pi}^0 d\phi \, e^{i \phi} \frac{\log^3{(\epsilon e^{i \phi})}}{\epsilon^2 e^{i 2 \phi}+4}$$

As $R \to \infty$ the second integral vanishes as $2 \pi R \log^3{R}/(R^2-4)$; as $\epsilon \to 0$, the fourth integral vanishes as $(\pi/2) \epsilon \log^3{\epsilon}$. In this limit, then, the contour integral is

$$-i 6 \pi\int_0^{\infty} dx \frac{\log^2{x}}{x^2+4} + 12 \pi^2 \int_0^{\infty} dx \frac{\log{x}}{x^2+4} + i 8 \pi^3 \int_0^{\infty} \frac{dx}{x^2+4}$$

The third integral is familiar, and is equal to $i 8 \pi^3 (\pi/4) = i 2 \pi^4$. The second integral is evaluated in a similar manner:

$$\begin{align}\int_0^{\infty} dx \frac{\log^2{x}-(\log{x}+i 2 \pi)^2}{x^2+4} &= -i 4 \pi\int_0^{\infty} dx \frac{\log{x}}{x^2+4} + 4 \pi^2 \int_0^{\infty} \frac{dx}{x^2+4} \\ &=-i 4 \pi\int_0^{\infty} dx \frac{\log{x}}{x^2+4} +\pi^3 \\ &= \underbrace{i 2 \pi \frac14 \left ( -i (\log{2}+i \frac{\pi}{2})^2+ i (\log{2}+i \frac{3\pi}{2})^2\right )}_{\text{residue theorem}}\\ &= i \pi (-\pi \log{2} - i \pi^2)\\ &= \pi^3 - i \pi^2 \log{2}\end{align}$$

so that

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

Therefore, by the residue theorem,

$$\begin{align}-i 6 \pi\int_0^{\infty} dx \frac{\log^2{x}}{x^2+4} + 3 \pi^3 \log{2} + i 2 \pi^4 &= i 2 \pi \frac14 \left ( -i (\log{2}+i \frac{\pi}{2})^3+ i (\log{2}+i \frac{3\pi}{2})^3\right ) \\ &= 3 \pi^3 \log{2} + i \left (\frac{13 \pi^4}{8}-\frac{3 \pi^2}{2} \log^2{2} \right ) \end{align} $$

Therefore

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

Solution 2:

I'm going to post a slightly different approach using contour integration.

Consider $ \displaystyle f(z) = \frac{\log^{2}(z)}{z^{2}+4}$ where the branch cut for $\log z$ is placed along the negative imaginary axis.

Now integrate around a contour that consists of the line segment $[-R,R]$ (with a half-circle indentation of radius $r$ around the branch point at the origin) and the upper half of the circle $|z|=R$.

Letting $ r \to 0$ and $R \to \infty$, the integral vanishes along both half-circles.

So we have

$$\int_{0}^{\infty} \frac{\log^{2} (x)}{x^{2}+4} \ dx + \int_{-\infty}^{0} \frac{(\log |x|+ i \pi)^{2}}{x^{2}+4} \ dx = 2 \pi i \ \text{Res}[f(z),2i].$$

And equating the imaginary parts on both sides of the equation,

$$ \begin{align}2 \int_{0}^{\infty} \frac{\log^{2} (x)}{x^{2}+4} \ dx - \pi^{2} \int_{0}^{\infty} \frac{1}{x^{2}+4} \ dx &= \text{Re} \ 2 \pi i \ \text{Res}[f(z),2i] \\ &= 2 \pi \ \text{Re} \ i \lim_{z \to 2i} \frac{\log^{2} (z)}{z+2i} \\ &= 2 \pi \ \text{Re} \ i \frac{(\log 2 + \frac{i \pi}{2})^{2}}{4i} \\ &=\frac{\pi}{2} \log^{2}(2) - \frac{\pi^{3}}{8}. \end{align}$$

But

$$ \int_{0}^{\infty} \frac{1}{x^{2}+4} \ dx = \frac{1}{2} \arctan (\frac{x}{2}) \Big|^{\infty}_{0} = \frac{\pi}{4}.$$

Therefore,

$$ \int_{0}^{\infty} \frac{\log^{2} (x)}{x^{2}+4} \ dx = \frac{\pi}{4} \log^{2}(2) + \frac{\pi^{3}}{16}.$$