How do you integrate $\int_{0}^\infty \frac{\log(x)^2}{(1-x^2)^2}$ using contour integration?

I have tried using the standard keyhole integral, and looking at$$\ \log(x)^3$$, but because the poles lie on the real axis, when I expand the integrand $$\ \frac{(\log(x) + 2\pi i)^3}{(1-x^2)^2}$$ I get integrals which do not converge. Am I approaching this problem wrong? When the poles are first order on the real axis, or the poles do not lie on the axis at all, contour integration seems much simpler.

This integral may be evaluated using the residue theorem. That said, the evaluation is very subtle and requires a bit of carrying around diverging quantities that cancel. Also, the contour of integration in this case should have a detour around the removable singularity. We proceed as follows.

Consider the contour integral

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

where $$C$$ is the following contour: where the bumps about the removable singularity at $$z=1$$ are semicircles of radius $$\epsilon$$ and the outer circle has a radius $$R$$. We parametrize the contour to evaluate the contour integral; accordingly, the contour integral is equal to

$$\int_{\epsilon}^{1-\epsilon} dx \frac{\log^3{x}}{(1-x^2)^2} + 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} \\ + \int_{1+\epsilon}^{R} dx \frac{\log^3{x}}{(x^2-1)^2} + i R \int_0^{2 \pi} d\theta \, e^{i \theta} \frac{\log^3{\left ( R e^{i \theta} \right )}}{\left ( R^2 e^{i 2 \theta} \right )}\\ + \int_R^{1+\epsilon} dx \frac{\left (\log{x}+i 2 \pi \right)^3}{(x^2-1)^2}+ 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} \\+ \int_{1-\epsilon}^{\epsilon} dx \frac{(\log{x}+i 2 \pi)^3}{(1-x^2)^2} + i \epsilon \int_{2 \pi}^0 d\phi\, e^{i \phi} \frac{\log^3{\left ( \epsilon e^{i \phi} \right )}}{\left ( \epsilon^2 e^{i 2 \phi} \right )}$$

As $$R \to \infty$$, the fourth integral vanishes. As $$\epsilon \to 0$$, the second and eighth integrals vanish. In this limit, however, note that the second integrals opposite number, the sixth integral, does not vanish in this limit. Rather, the logs on the branch below the positive real axis have an $$i 2 \pi$$ added to them. This includes the log attached to the bump below the positive real axis, i.e., the sixth integral. This integral evaluates as follows for small $$\epsilon$$:

$$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} = -i \frac{4 \pi^3}{\epsilon} + (2 \pi^4 + i 3 \pi^3 ) + O(\epsilon)$$

Note that in the limit as $$\epsilon \to 0$$, the integral leave us with a diverging term and a constant term. We will need these.

The first, third, fifth, and seventh integrals (those integrals above and below the real axis) combine to form the following:

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

In the second integral above, the $$PV$$ denotes a Cauchy principal value of the integral, which has a simple pole in its integrand. For the last pair of integrals, we arrange them as we would a Cauchy principal value while acknowledging that the Cauchy P.V. does not exist because of the double pole at $$x=1$$. We will evaluate this pair of integrals in the limit as $$\epsilon \to 0$$ and will produce another singularity.

\begin{align} \int_0^{1-\epsilon} \frac{dx}{(1-x^2)^2} &= \int_0^{\arcsin{(1-\epsilon)}} d\theta \, \sec^3{\theta} \\ &= \left [ \frac12 \sec{\theta} \tan{\theta} + \frac12 \log{(\sec{\theta} + \tan{\theta})} \right ]_0^{\arcsin{(1-\epsilon)}} \\ &= \frac12 \frac{1-\epsilon}{\epsilon (2-\epsilon)} + \frac14 \log{\left ( \frac{2-\epsilon}{\epsilon} \right )} \end{align}

Similarly, the reader should be able to show that

$$\int_{1+\epsilon}^{\infty} \frac{dx}{(x^2-1)^2} = \frac12 \frac{1+\epsilon}{\epsilon (2+\epsilon)} - \frac14 \log{\left ( \frac{2+\epsilon}{\epsilon} \right )}$$

Adding these two pieces and expanding about $$\epsilon = 0$$, we get an asymptotic expression for the pair of integrals that is not quite a Cauchy principal value:

$$\int_0^{1-\epsilon} \frac{dx}{(1-x^2)^2} + \int_{1+\epsilon}^{\infty} \frac{dx}{(x^2-1)^2} = \frac1{2 \epsilon} + O(\epsilon)$$

That is, there is no constant term in the above expression; rather, there is only a divergent term and vanishing terms.

Putting this all together, we get an expression for the contour integral as $$\epsilon \to 0$$ and $$R \to \infty$$:

$$\oint_C dz \frac{\log^3{z}}{(z^2-1)^2} = -i 6 \pi \int_0^{\infty} dx \frac{\log^2{x}}{(1-x^2)^2} + 12 \pi^2 PV \int_0^{\infty} dx \frac{\log{x}}{(1-x^2)^2} \\ + i \frac{4 \pi^3}{\epsilon} -i \frac{4 \pi^3}{\epsilon} + (2 \pi^4 + i 3 \pi^3 ) + O(\epsilon)$$

The divergent terms cancel and we finally get, for the contour integral,

$$\oint_C dz \frac{\log^3{z}}{(z^2-1)^2} = -i 6 \pi \int_0^{\infty} dx \frac{\log^2{x}}{(1-x^2)^2} + 12 \pi^2 PV \int_0^{\infty} dx \frac{\log{x}}{(1-x^2)^2} + (2 \pi^4 + i 3 \pi^3 )$$

Now, by the residue theorem, the contour integral is also equal to $$i 2 \pi$$ times the residue at the pole $$z=-1=e^{i \pi}$$. I will leave the evaluation of this residue to the reader; keep in mind that there is a double pole at $$z=e^{i \pi}$$. Thus, by the residue theorem,

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

Equating real and imaginary parts, we finally get the result for the integral we seek, plus a bonus:

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

So while this was a bit involved, I hope the reader gets all of the subtleties in evaluating integrals with removable singularities and higher powers of log.

• very nice! would you be able to give more details on how you obtained the asymptotic expansion of integral 6? May 5 '20 at 4:57
• @JunKurosu: Thank you. To get the expansion of the sixth integral, expand both numerator and denominator of the integrated out to two terms each and then Taylor expand about $\epsilon=0$ To get an expansion of a constant term and a term linear in $\epsilon$. You will be left with two integrations over the angle $\phi$, both trivial but nonzero. May 5 '20 at 11:40

$$\int_{1}^{+\infty}\frac{\log^2(x)}{(1-x^2)^2}\,dx = \int_{0}^{1}\frac{\log^2(x)}{x^2\left(1-\frac{1}{x^2}\right)^2}\,dx=\int_{0}^{1}\frac{x^2\log^2(x)}{(1-x^2)^2}\,dx$$ so the original integral equals $$\int_{0}^{1}\frac{1+x^2}{(1-x^2)^2}\log^2(x)\,dx$$ where $$\frac{1+z}{(1-z)^2}=\sum_{n\geq 0}(2n+1)z^n\qquad \text{and}\qquad \int_{0}^{1}x^{2n}\log^2(x)\,dx =\frac{2}{(2n+1)^3}$$ lead to $$\int_{0}^{+\infty}\frac{\log^2(x)\,dx}{(1-x^2)^2} = 2 \sum_{n\geq 0}\frac{1}{(2n+1)^2}=2\left[\zeta(2)-\frac{1}{4}\zeta(2)\right]=\frac{3}{2}\zeta(2)=\color{red}{\frac{\pi^2}{4}}.$$ For the evaluation of $$\zeta(2)$$ through contour integration, you may refer to this post.

Using the principal branch of the logarithm, let's integrate the function $$f(z) = \frac{\log^{2}(z)}{(1-z^{2})^{2}}$$ around an infinitely large wedge-shaped contour that makes an angle of $$\frac{\pi}{2}$$ with the positive real axis and is indented at the origin.

(The same contour was used here to evaluate $$\int_{0}^{\infty} \frac{\log (x)}{x^{2}-1} \, \mathrm dx$$.)

Integrating around the contour, we get $$\int_{0}^{\infty} \frac{\log^{2}(x)}{(1-x^{2})^{2}} \, \mathrm dx + \int_{\infty}^{0} \frac{\left(\log(x) + \frac{i \pi}{2} \right)^{2}}{(1-(it)^{2})^{2}} \, i \, \mathrm dt =0.$$

Then equating the real parts on both sides of the equation, we get $$\int_{0}^{\infty} \frac{\log^{2}(x)}{(1-x^{2})^{2}} \, \mathrm dx = - \pi \int_{0}^{\infty}\frac{\log (t)}{(1+t^{2})^{2}} \, \mathrm d t.$$

See the answers to this question for ways to show that $$\int_{0}^{\infty} \frac{\log (t)}{(1+t^{2})^{2}} \, \mathrm dt = - \frac{\pi}{4}.$$