Every so often there comes an integral that I see as a major teaching opportunity in complex integration applications. This integral represents one such opportunity.

Problem: Evaluate the definite integral

$$\int_0^{\infty} dx \, \frac{\log^2{x} \, \log{(1+x)}}{1+x^2} $$

This integral may be evaluated using the residue theorem. The analysis involves two branch points with respective branch cuts that must be treated separately. Further, as well will see, the log-squared term in the integral will produce several levels of recursion. I will demonstrate the evaluation of all steps so that it is clear how to treat the several nuances in this approach. While not the most quick-and-dirty approach, this approach demonstrates several techniques used for evaluating real integrals using complex integration techniques.

We begin by evaluating the contour integral

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

where $C$ is the following contour:

The radius of the outer arcs in the contour $C$ is $R$, which will increase without bound. Note that the integral about the outer arcs vanishes as $\log^4{R}/R$ as $R \to \infty$, so we may ignore the integrals over those arcs.

The radius of the small arcs about the branch points in the contour $C$ is $\epsilon$. The integrals about those small arcs also vanish as $\epsilon^2 \log^3{\epsilon}$ or $\epsilon \log{\epsilon}$ as $\epsilon \to 0$.

Note a first branch cut, corresponding to the branch point at the origin, is along the real axis, while a second branch cut, corresponding to the branch point $z=-1$, is along the line $(-\infty,-1]$. In the vicinity of the first branch cut, $\arg{z} \in [0,2 \pi]$ and in the vicinity of the second branch cut, $\arg{z} \in [-\pi,\pi]$.

Keeping all of the above in mind, we may write out the contour integral in terms of real integrals as follows:

$$\int_0^{\infty} dx \, \frac{\log^3{x} \log{(1+x)}}{1+x^2} + \int_{\infty}^0 dx \, \frac{(\log{x}+i 2 \pi)^3 \log{(1+x)}}{1+x^2} \\ + e^{i \pi} \int_{\infty}^1 dx \, \frac{(\log{x}+i \pi)^3 [\log{(x-1)}+i \pi]}{1+x^2} + e^{-i \pi} \int_1^{\infty} dx \, \frac{(\log{x}+i \pi)^3 [\log{(x-1)}-i \pi]}{1+x^2} $$

It should be noted that, around the first branch cut, $\arg{z}=0$ above and $\arg{z} = 2 \pi$ below, so that $\log{z}=\log{x}$ above and $\log{z}=\log{x}+i 2 \pi$ below. Around the second branch cut, $\arg{z}=\pi$ above and $\arg{z}=-\pi$ below, so that $\log{(1+z)}=\log{(x-1)}+i \pi$ above and $\log{(1+z)}=\log{(x-1)}-i \pi$ below.

Further, and the importance of this fact needs to be stressed, because $\log{z}$ is governed by the first branch cut, $\arg{z} = \pi$ for $\log{z}$ in the vicinity of the negative real axis, so that $\log{z}=\log{x}+i \pi$ both above and below the second branch cut. This is one crucial detail that needs pointing out in the face of the two separate branch points in this integral.

The above expressions may be expanded and combined to reveal several real integrals, so that the contour integral is equal to the following:

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

By the residue theorem, the contour integral is also equal to $i 2 \pi$ times the sum of the residues at the poles $\pm i$. Again, we have to be very careful about what we mean by $\pm i$. For example, $\log{i} = i \pi/2$ and $\log{(-i)}= i 3 \pi/2$. On the other hand, $\log{(1+i)} = \log{\left ( \sqrt{2} e^{i \pi/4} \right )}$ and $\log{(1-i)} = \log{\left ( \sqrt{2} e^{-i \pi/4} \right )}$. This is a result of the separate branch cuts with separate ranges of $\arg{z}$.

Thus, the contour integral is also equal to

$$i 2 \pi \left [\frac{\left (i \frac{\pi}{2} \right )^3 \left (\frac12 \log{2} + i \frac{\pi}{4} \right )}{i 2} + \frac{\left (i \frac{3 \pi}{2} \right )^3 \left (\frac12 \log{2} – i \frac{\pi}{4} \right )}{-i 2} \right ] = \frac{7 \pi^5}{8} + i \frac{13 \pi^4}{8} \log{2}$$

Going back to the four integrals above, the first integral is the one we seek, we will return to the second and third integrals, while the fourth integral may be split up into four integrals that are readily computed. Along these lines, define

$$J_k = \int_1^{\infty} dx \, \frac{\log^k{x}}{1+x^2} $$

Then

$$J_0 = \frac{\pi}{4}$$

$$J_1 = G_2$$

$$J_2 = \frac{\pi^3}{16}$$

$$J_3 = 6 G_4$$

where

$$G_m = \sum_{\ell=0}^{\infty} \frac{(-1)^{\ell}}{(2 \ell+1)^m} $$

so that $G_2$ is Catalan’s constant ($\approx 0.915$), and $G_4$ is, well, some other constant ($\approx 0.988$). Both of these may be expressed in terms of polygamma functions, but there really is no simpler expression for these. We will take $G_2$ and $G_4$ as given constants in terms of which the final answer will be expressed.

(Note that the derivation of the expressions for $J_0$, $J_1$, and $J_3$ are straightforward. The derivation of $J_2$ may be found here.)

Thus, we have

$$-i 6 \pi \int_0^{\infty} dx \, \frac{\log^2{x} \log{(1+x)}}{1+x^2} + 12 \pi^2 \int_0^{\infty} dx \, \frac{\log{x} \log{(1+x)}}{1+x^2} \\ +i 8 \pi^3 \int_0^{\infty} dx \, \frac{\log{(1+x)}}{1+x^2} = \frac{3 \pi^5}{4} + i \frac{13 \pi^4}{8} \log{2} + i 6 \pi^3 G_2 – i 12 \pi G_4 $$

Again, the first integral is the one we seek. We are now tasked with evaluating the second and third integrals. And this is where the concept of recursion comes into play, because we may attack these integrals exactly as we attacked the original one. If we begin with the third integral, then using the exact contour integration process above, we will get an integral we may evaluate on its own.

So let’s begin evaluating the third integral. Following the example above, we evaluate

$$\oint_C dz \, \frac{\log{z} \, \log{(1+z)}}{1+z^2} $$

Using the exact same reasoning outlined above, we find that the integral is equal to

$$-i 2 \pi \int_0^{\infty} dx \, \frac{\log{(1+x)}}{1+x^2} + i 2 \pi \int_1^{\infty} dx \frac{\log{x}+i \pi}{1+x^2} $$

which is equal to

$$-i 2 \pi \int_0^{\infty} dx \, \frac{\log{(1+x)}}{1+x^2} + i 2 \pi G_2 – \frac{\pi^3}{2}$$

and, by the residue theorem, is also equal to

$$i 2 \pi \left [\frac{\left (i \frac{\pi}{2} \right ) \left (\frac12 \log{2} + i \frac{\pi}{4} \right )}{i 2} + \frac{\left (i \frac{3 \pi}{2} \right ) \left (\frac12 \log{2} – i \frac{\pi}{4} \right )}{-i 2} \right ] = – \frac{\pi^3}{2} – i \frac{\pi^2}{2} \log{2}$$

Therefore

$$\int_0^{\infty} dx \, \frac{\log{(1+x)}}{1+x^2} = \frac{\pi}{4} \log{2} + G_2 $$

Now for the second integral – almost exactly as we did the third. Consider

$$\oint_C dz \, \frac{\log^2{z} \, \log{(1+z)}}{1+z^2} $$

Using the exact same reasoning outlined above, we find that the integral is equal to

$$-i 4 \pi \int_0^{\infty} dx \, \frac{\log{x} \, \log{(1+x)}}{1+x^2} + 4 \pi^2 \int_0^{\infty} dx \, \frac{\log{(1+x)}}{1+x^2} + i 2 \pi \int_1^{\infty} dx \, \frac{(\log{x}+i \pi)^2}{1+x^2} $$

Note that we may now use the above result to simplify this expression to

$$-i 4 \pi \int_0^{\infty} dx \, \frac{\log{x} \, \log{(1+x)}}{1+x^2} + \pi^3 \log{2} – i \frac{3 \pi^4}{8} $$

which, by the residue theorem, is equal to

$$i 2 \pi \left [\frac{\left (i \frac{\pi}{2} \right )^2 \left (\frac12 \log{2} + i \frac{\pi}{4} \right )}{i 2} + \frac{\left (i \frac{3 \pi}{2} \right )^2 \left (\frac12 \log{2} – i \frac{\pi}{4} \right )}{-i 2} \right ] =\pi^3 \log{2} – i \frac{5 \pi^4}{8} $$

Therefore

$$ \int_0^{\infty} dx \, \frac{\log{x} \, \log{(1+x)}}{1+x^2} = \frac{\pi^3}{16} $$

And now, with these pieces in hand, we may go back to the result for the original contour integral and just plug the pieces in and solve. The final result is

$$\int_0^{\infty} dx \, \frac{\log^2{x}\, \log{(1+x)}}{1+x^2} = \frac{\pi^3}{16} \log{2} + \frac{\pi^2}{3} G_2 + 2 G_4 $$

I do hope this illustrated how to use contour integration in the presence of multiple branch points and powers of logarithms. It can be confusing, but if done right, has its own butlt-in checking system. (Note that the real part of the LHS and RHS had to match, otherwise we would have gotten nonsense results.)

## No Comments