The problem here is to evaluate the following:

$$PV \int_0^{\infty} dx \frac{\log^2{x}}{(x-1)^2(x-4) \sqrt{x}} $$

This can be done using complex analysis, but it is a pretty involved affair, deceptively so. After struggling with the problem of how to present the solution, I am going to lay out a systematic approach that ignores the motivation behind the steps. Think of it as a tradeoff between clarity and pedagogy if that makes any sense. I am favoring clarity.

So let’s first get rid of that annoying square root by subbing $x \mapsto x^2$. The integral is then equal to

$$8 PV \int_0^{\infty} dx \frac{\log^2{x}}{(x^2-1)^2 (x^2-4)} $$

We note here that, while the pole at $x=1$ is indeed removable, the pole at $x=4$ is not. Thus the best we can do is compute this Cauchy principal value of the integral, which is the task at hand.

So let’s consider the contour integrals

$$\oint_C dz \frac{\log^{k}{z}}{(z^2-1)^2(z^2-4)} $$

where $k \in \{1,2,3 \}$ and $C$ is the following keyhole contour of outer radius $R$ and inner radius $\epsilon$, with semicircular detours of radius $\epsilon$ about the poles at $z=1$ and $z=2$:

It will become apparent as we go why we need to consider three contour integrals rather than just one.

We now evaluate the contour integral by writing out the integral across each segment. Then the contour integral is equal to

$$\int_{\epsilon}^{1-\epsilon} dx \frac{\log^k{x}}{(x^2-1)^2 (x^2-4)} + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{\log^k{\left (1+\epsilon e^{i \phi} \right )}}{\left [\left (1+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (1+\epsilon e^{i \phi} \right )^2-4 \right ]} \\ + \int_{1+\epsilon}^{2-\epsilon} dx \frac{\log^k{x}}{(x^2-1)^2 (x^2-4)} + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{\log^k{\left (2+\epsilon e^{i \phi} \right )}}{\left [\left (2+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (2+\epsilon e^{i \phi} \right )^2-4 \right ]} \\ + \int_{2+\epsilon}^{R} dx \frac{\log^k{x}}{(x^2-1)^2 (x^2-4)} + i R \int_0^{2 \pi} d\theta \, e^{i \theta} \frac{\log^k{\left (R e^{i \theta} \right )}}{\left [\left (R e^{i \theta} \right )^2-1 \right ]^2 \left [\left (R e^{i \theta} \right )^2-4 \right ]} \\ + \int_{R}^{2+\epsilon} dx \frac{(\log{x}+i 2 \pi)^k}{(x^2-1)^2 (x^2-4)}+ i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{\left [\log{\left (2+\epsilon e^{i \phi} \right )} + i 2 \pi\right ]^k}{\left [\left (2+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (2+\epsilon e^{i \phi} \right )^2-4 \right ]} \\ + \int_{2-\epsilon}^{1+\epsilon} dx \frac{(\log{x}+i 2 \pi)^k}{(x^2-1)^2 (x^2-4)}+ i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{\left [\log{\left (1+\epsilon e^{i \phi} \right )} + i 2 \pi\right ]^k}{\left [\left (1+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (1+\epsilon e^{i \phi} \right )^2-4 \right ]} \\ + \int_{1-\epsilon}^{\epsilon} dx \frac{(\log{x}+i 2 \pi)^k}{(x^2-1)^2 (x^2-4)}+ i \epsilon \int_{2 \pi}^{0} d\phi \, e^{i \phi} \frac{\left [\log{\left (\epsilon e^{i \phi} \right )} + i 2 \pi\right ]^k}{\left [\left (\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (\epsilon e^{i \phi} \right )^2-4 \right ]}$$

As $R \to \infty$, the sixth integral vanishes. As $\epsilon \to 0$, the twelfth integral vanishes. Further, the six odd-numbered integrals all combine to form the principal value integral

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

We will now find the principal value integrals by going through the cases $k=1$, $k=2$, and $k=3$ in that order.

$k=1$

—–

We evaluate the second, fourth, eighth, and tenth integrals above. In this case, then, the contour integral is equal to

$$-i 2 \pi PV \int_0^{\infty} \frac{dx}{(x^2-1)^2(x^2-4)} + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{\log{\left (1+\epsilon e^{i \phi} \right )}}{\left [\left (1+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (1+\epsilon e^{i \phi} \right )^2-4 \right ]} \\ + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{\log{\left (2+\epsilon e^{i \phi} \right )}}{\left [\left (2+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (2+\epsilon e^{i \phi} \right )^2-4 \right ]} \\+ i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{\log{\left (2+\epsilon e^{i \phi} \right )} + i 2 \pi}{\left [\left (2+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (2+\epsilon e^{i \phi} \right )^2-4 \right ]} \\ + i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{\log{\left (1+\epsilon e^{i \phi} \right )} + i 2 \pi}{\left [\left (1+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (1+\epsilon e^{i \phi} \right )^2-4 \right ]}$$

Before we begin evaluation, it should be noted that the $PV$ is used in this integral loosely. As stated, even the Cauchy principal value of this integral *does not converge* in the limit as $\epsilon \to 0$. However, we will consider the limit not taken totally yet, but *almost*. (I know I am not being totally rigorous here, but I hope that I am being understood.) We will find that the $PV$ diverges in this limit, but we will also find that the divergent terms will eventual cancel in terms of the integrals we actually do need.

For what it’s worth, denote

$$I_0 = PV \int_0^{\infty} \frac{dx}{(x^2-1)^2(x^2-4)} $$

Further, by the residue theorem, the contour integral is equal to $i 2 \pi$ times the sum of the residues at the poles. For the case $k=1$, denote the sum of the residues as $R_1$, i.e., it will be better if we put off computation of these until the end. Then, evaluating each of the above four integrals for small $\epsilon$ and rearranging, we find an expression for $I_0$:

$$-i 2 \pi I_0 + i \frac{\pi}{12} -i \frac{\pi \log{2}}{36} + \left (\frac{\pi^2}{18}-i \frac{\pi \log{2}}{36} \right ) + \left (-i \frac{\pi}{3 \epsilon} + \frac{\pi^2}{18}+i \frac{\pi}{12} \right ) = i 2 \pi R_1 $$

or

$$I_0 = -\frac1{6 \epsilon} + \frac1{12}-\frac{\log{2}}{36} – i \frac{\pi}{18} – R_1 $$

Again, note the term proportional to $1/\epsilon$, which is a consequence of the non convergence of this integral. It is OK to leave this as is because it will cancel other divergences later.

$k=2$

—–

Using the notation established in the previous case, we have as the contour integral

$$-i 4 \pi I_1 +4 \pi^2 I_0 + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{\log^2{\left (1+\epsilon e^{i \phi} \right )}}{\left [\left (1+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (1+\epsilon e^{i \phi} \right )^2-4 \right ]} \\ + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{\log^2{\left (2+\epsilon e^{i \phi} \right )}}{\left [\left (2+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (2+\epsilon e^{i \phi} \right )^2-4 \right ]} \\+ i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{\left [\log{\left (2+\epsilon e^{i \phi} \right )} + i 2 \pi \right ]^2}{\left [\left (2+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (2+\epsilon e^{i \phi} \right )^2-4 \right ]} \\ + i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{\left [ \log{\left (1+\epsilon e^{i \phi} \right )} + i 2 \pi \right ]^2}{\left [\left (1+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (1+\epsilon e^{i \phi} \right )^2-4 \right ]}$$

where

$$I_1 = PV \int_0^{\infty} dx \frac{\log{x}}{(x^2-1)^2(x^2-4)} $$

In this case, $I_1$ is certainly finite. Then we expect the divergence in $I_0$ to cancel here. It will, as we will see. Invoking the residue theorem as we did above, with the sum of the residues of the $k=2$ contour integral being denoted as $R_2$, we have

$$-i 4 \pi I_1 + 4 \pi^2 \left ( -\frac1{6 \epsilon} + \frac1{12}-\frac{\log{2}}{36} – i \frac{\pi}{18} – R_1\right ) + 0 – i \frac{\pi \log^2{2}}{36} + \\ \frac{\pi^2\log{2}}{9} + i \left (\frac{\pi^2}{9} – \frac{\pi \log^2{2}}{36} \right ) + \left (\frac{2 \pi^2}{3 \epsilon} – \frac{\pi^2}{3} + i \frac{\pi^3}{9} \right ) = i 2 \pi R_2$$

or

$$I_1 = -\frac{\log^2{2}}{72} + i \pi R_1 – \frac12 R_2 $$

Note that, as expected, the divergences canceled and we are left with a nifty expression for the integral. We will do so for this last case, in which we get the integral that we finally care about.

$k=3$

——-

The contour integral is now equal to

$$-i 6 \pi I_2 + 12 \pi^2 I_1 +i 8 \pi^3 I_0 + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{\log^3{\left (1+\epsilon e^{i \phi} \right )}}{\left [\left (1+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (1+\epsilon e^{i \phi} \right )^2-4 \right ]} \\ + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{\log^3{\left (2+\epsilon e^{i \phi} \right )}}{\left [\left (2+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (2+\epsilon e^{i \phi} \right )^2-4 \right ]} \\+ i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{\left [\log{\left (2+\epsilon e^{i \phi} \right )} + i 2 \pi \right ]^3}{\left [\left (2+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (2+\epsilon e^{i \phi} \right )^2-4 \right ]} \\ + i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{\left [ \log{\left (1+\epsilon e^{i \phi} \right )} + i 2 \pi \right ]^3}{\left [\left (1+\epsilon e^{i \phi} \right )^2-1 \right ]^2 \left [\left (1+\epsilon e^{i \phi} \right )^2-4 \right ]}$$

where

$$I_2 = PV \int_0^{\infty} dx \frac{\log^2{x}}{(x^2-1)^2(x^2-4)} $$

At this point, the reader should be able to figure out how to evaluate the integrals and substitutions and apply the residue theorem so I can just state the result:

$$I_2 = \frac{\pi^2 \log{2}}{54} – \frac{\pi^2}{18} – \frac{\log^3{2}}{108} + \frac{2 \pi^2}{3} R_1 + i \pi R_2 – \frac13 R_3 $$

where $R_3 $ is the sum of the residues of the contour integral for $k=3$.

## Residue Computation ##

Finally, we have reduced the computation to the evaluation of the residues. We can combine the residue terms as we are effectively summing the residues of a single function. Thus

$$\frac{2 \pi^2}{3} R_1 + i \pi R_2 – \frac13 R_3 = \left [ \frac{d}{dz} \frac{\frac{2 \pi^2}{3} \log{z} + i \pi \log^2{z} – \frac13 \log^3{z}}{(z-1)^2 (z^2-4)} \right ]_{z=e^{i \pi}} + \frac{\frac{2 \pi^2}{3} (\log{2}+i \pi) + i \pi (\log{2}+i \pi)^2 – \frac13 (\log{2}+i \pi)^3}{(-2-1)^2(-2-2)}$$

The first term is the residue at the double pole $z=-1$, expressed so that $\arg{z} \in [0,2 \pi)$. The second term is the residue at $z=-2$. I leave the derivative computation for the reader or a CAS if the reader is so inclined. The result is

$$\frac{2 \pi^2}{3} R_1 + i \pi R_2 – \frac13 R_3 = -\frac{\pi^2}{36} + \frac{\log{2}}{108} \left (\pi^2 + \log^2{2} \right )$$

The final result

—————-

Combining the previous two results, we get an expression for $I_2$:

$$I_2 = \frac{\pi^2 \log{2}}{54} – \frac{\pi^2}{18} – \frac{\log^3{2}}{108} -\frac{\pi^2}{36} + \frac{\log{2}}{108} \left (\pi^2 + \log^2{2} \right )$$

and we may perform the cancelations. However, recall that the integral we want is $8$ times $I_2$. Thus, we finally write

$$PV \int_0^{\infty}dx \frac{\log^2{x}}{\sqrt{x} (1-x)^2 (x-4)} = \frac{2 \pi^2}{9} (-3 + \log{2})$$

which has been demonstrated by Cody and agrees with Mathematica.

This is very cool, RG. I didn’t think of breaking it up into three log powers like that. Sharp!.

Cody, I think it should be a standard technique. It is very well-known, when evaluating an integral of the form $\int_0^{\infty} dx \, f(x) \log^k {x} $ to consider the contour integral $\oint_C dz \, f(z) \log^{k+1}{z} $ about a keyhole contour. However, when you actually do it out along both branches of the real axis, you get integrals of powers of log to the $k-1$, $k-2$, down to zero. Anyone who has worked out one of these integrals knows that. My take is that the evaluation of the integrals should be done such that we perform one single residue computation at the end rather than repeated residue computations along the way. That said, I would really like to develop some scheme in which we also do single evaluations of the integrals about the poles rather than the separate ones I showed here.