## Logs on a dogbone

The problem is to evaluate the following integral:

$$\int_0^1 dx \frac{\log^2{x}}{\sqrt{x-x^2}}$$

The integral is well-suited to real methods but the question of whether this integral was suited at all to complex methods has kept me up for…many nights. At first, I did get the result in terms of a limit of another integral. But that limit, evaluated using asymptotic matching, rendered that problem even more difficult than a real evaluation of the original integral. No go.

But then, I had an epiphany, and I consulted a text on asymptotic expansions of integrals and was able to use a whole new technique. This technique, while making use of advanced concepts like Mellin transforms, actually rendered the approximation of the integral in question into a much simpler problem of evaluating residues. Thus, I am now able to make the case that evaluating this integral and others like it may be done using complex techniques.

It turns out that this integral can be evaluated using complex analysis techniques. And, I am happy to report, this approach leads to a formulation that I have never seen before, and the analysis involves an unexpected use of residues.

OK, so to begin we define a complex integral with an integrand and a contour of integration as follows:

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

where $C$ is the following contour:

with the large arc having radius $R$ and the small arcs having radius $\epsilon$. By Cauchy’s theorem, the integral is zero. Then again, by parametrizing the various portions of $C$, the complex integral above is also equal to

$$e^{i \pi} \int_R^{\epsilon} dx \frac{\left ( \log{x}+i \pi \right )^2}{e^{i \pi} \sqrt{x (x+1)}} + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{\left ( \log{\epsilon}+i \phi \right )^2}{\sqrt{\epsilon e^{i \phi} \left ( \epsilon e^{i \phi} – 1 \right )}} \\ + e^{-i \pi/2} \int_{\epsilon}^{1-\epsilon} dx \frac{\log^2{x}}{\sqrt{x (1-x)}} + i \epsilon \int_{\pi}^{-\pi} d\phi \, e^{i \phi} \frac{\left ( \log{\epsilon}+i \phi \right )^2}{\sqrt{ \left (1 + \epsilon e^{i \phi} \right ) \epsilon e^{i \phi}}} \\ + e^{i \pi/2} \int_{1-\epsilon}^{\epsilon} dx \frac{\log^2{x}}{\sqrt{x (1-x)}} + i \epsilon \int_0^{-\pi} d\phi \, e^{i \phi} \frac{\left ( \log{\epsilon}+i \phi \right )^2}{\sqrt{\epsilon e^{i \phi} \left ( \epsilon e^{i \phi} – 1 \right )}} \\ + e^{-i \pi} \int_{\epsilon}^R dx \frac{\left ( \log{x}-i \pi \right )^2}{e^{-i \pi} \sqrt{x (x+1)}}+ i R \int_{-\pi}^{\pi} d\theta \, e^{i \theta} \frac{\left ( \log{R} + i \theta \right )^2}{\sqrt{R e^{i \theta} \left ( R e^{i \theta} – 1 \right )}} = 0$$

In the limit as $\epsilon \to 0$, the second, fourth, and sixth integrals approach zero. We can then combine the first and seventh integrals, and the third and fifth integrals (and note the significant cancellations). We then have, after rewriting the eighth integral:

$$-i 4 \pi \int_0^R dx \, \frac{\log{x}}{\sqrt{x (1+x)}} – i 2 \int_0^1 dx \frac{\log^2{x}}{\sqrt{x (1-x)}} \\ + i \int_{-\pi}^{\pi} d\theta \, \left ( \log^2{R} + i 2 \theta \log{R} – \theta^2 \right ) \left ( 1 – \frac1{R e^{i \theta}} \right )^{-1/2} = 0$$

As $R \to \infty$, the last factor in the third integral approaches $1$, so we can ignore it. Accordingly, after rearranging the above equation, we have the following expression for the original integral:

$$\int_0^1 dx \frac{\log^2{x}}{\sqrt{x (1-x)}} = \lim_{R \to \infty} \left (-2 \pi \int_0^R dx \frac{\log{x}}{\sqrt{x (1+x)}} + \pi \log^2{R} – \frac{\pi^3}{3} \right )$$

(Begin soapbox)

In my opinion, the above represents an extraordinary expression for the original integral. Typically, a problem like this would have us express the original integral in terms of a “residue at infinity” and/or residues at finite poles. In this case, however, the logarithm has forced us to consider pieces of the contour that we have been able to throw away previously. Specifically, the pieces of the contour that connect the “dogbone” to the larger arc play a crucial role here, whereas without the logarithm we have been able to ignore those pieces.

This is where I believe the “residue at infinity” approach fails us. By leading us to think that the “dogbone” contour is the correct contour in its entirety, we would completely miss this aspect of the problem in which we must now go and figure out how to cancel the singularities in the limit as $R \to \infty$.

(End soapbox)

OK, so we now have the problem of finding the asymptotic behavior of the first integral is the equation above as $R \to \infty$. We begin by slightly rearranging the integral:

$$\int_0^R dx \frac{\log{x}}{\sqrt{x (1+x)}} = 2 \sqrt{R} \log{R} \int_0^1 \frac{dt}{\sqrt{1+R t^2}} + 4 \sqrt{R} \int_0^1 dt \frac{\log{t}}{\sqrt{1+R t^2}}$$

While we can evaluate the first integral easily, the second integral is not amenable to a simple analytical evaluation. Further, the usual approach to asymptotic analysis using asymptotic matching leads to an unwieldy analysis that would render this method useless – much more complicated than a real approach to evaluating the original integral.

Fortunately, there is a well-known approach to determining asymptotic behavior of integrals with general, smooth and integrable kernels. I will summarize the theory below, which one may find in great detail in N. Bleistein and R. Handelsman, “Asymptotic Expansions of Integrals,” Secs. 4.1-4.4.

Consider the integral

$$I(\lambda) = \int_0^{\infty} dx \, f(t) h(\lambda t)$$

where $\lambda \gt 0$ and $f$ and $h$ satisfy certain convergence properties in respective vertical strips in the complex plane. Then the following Parseval relation is true:

$$I(\lambda) = \frac1{i 2 \pi} \int_{c-i \infty}^{c+i \infty} ds \, \lambda^{-s} F(1-s) H(s)$$

where $\operatorname{Re}{s}=c$ is in a vertical strip common to both $f$ and $h$ and $F$ and $H$ are, respectively, the Mellin transforms of $f$ and $h$:

$$F(s) = \int_0^{\infty} dt \, f(t) \, t^{s-1}$$
$$H(s) = \int_0^{\infty} dt \, h(t) \, t^{s-1}$$

By using analytical continuation, the line of integration may be moved out to the right to a line $\operatorname{Re}{s}=L$, where $L \gt c$. We can complete a rectangular contour, with the horizontal pieces vanishing as $L \to \infty$. The integral may then be written, by the residue theorem, as

$$I(\lambda) = -\sum_{c \lt \operatorname{Re}{s_j} \lt L} \operatorname*{Res}_{s=s_j}\left [ \lambda^{-s} F(1-s) H(s) \right ] + \frac1{i 2 \pi} \int_{L-i \infty}^{L+i \infty} ds \, \lambda^{-s} F(1-s) H(s)$$

For $L$ large enough, the integral on the RHS is negiglible compared to the residues in the sum. We thus have the following asymptotic relation:

$$\int_0^{\infty} dt \, f(t) h(\lambda t) = -\sum_{c \lt \operatorname{Re}{s_j} \lt L} \operatorname*{Res}_{s=s_j}\left [ \lambda^{-s} F(1-s) H(s) \right ] + O \left ( \lambda^{-L} \right )$$

(For a proof, see the above reference.) And here, at last, we see a surprising appearance of residues!

We will use the above asymptotic relation for the integrals defining our limits as $R \to \infty$. In our case, $\lambda = \sqrt{R}$, $h(t) = \left ( 1+t^2 \right )^{-1/2}$, and $f_{1,2}(t)$ equals either $\theta(t) \theta(1-t)$ (1) or $\theta(t) \theta(1-t) \log{t}$ (2), where $\theta$ refers to the Heaviside step function here. Accordingly,

$$H(s) = \frac1{2 \sqrt{\pi}} \Gamma \left (\frac{s}{2} \right ) \Gamma \left (\frac{1-s}{2} \right )$$

$$F_1(1-s) = \frac1{1-s}$$
$$F_2(1-s) = -\frac1{(1-s)^2}$$

Now, note that we need only consider, for the leading asymptotic behavior of these integrals, the pole at $s=1$. (Poles at $s=3$ and beyond will have subdominant behavior.) Thus, we need only consider

$$\operatorname*{Res}_{s=1}\left [ R^{-s/2} \frac{\Gamma \left (\frac{s}{2} \right ) \Gamma \left (\frac{1-s}{2} \right )}{2 \sqrt{\pi} (1-s)} \right ] = \frac{\log{R}}{2 \sqrt{R}} + \frac{\log{2}}{\sqrt{R}}$$

$$\operatorname*{Res}_{s=1}\left [ -R^{-s/2} \frac{\Gamma \left (\frac{s}{2} \right ) \Gamma \left (\frac{1-s}{2} \right )}{2 \sqrt{\pi} (1-s)^2} \right ] = -\frac{\log^2{R}}{8 \sqrt{R}} – \frac{\log{2} \log{R}}{2 \sqrt{R}} – \frac{\pi^2 + 6 \log^2{2}}{12 \sqrt{R}}$$

The above residues were evaluated by noting that the pole at $s=1$ is a double pole in the former integrand and a triple pole in the latter integrand. Now we may take these results and plug them into the limit expression for the original integral:

\begin{align} \int_0^1 dx \frac{\log^2{x}}{\sqrt{x (1-x)}} &= \lim_{R \to \infty} \left (-2 \pi \int_0^R dx \frac{\log{x}}{\sqrt{x (1+x)}} + \pi \log^2{R} – \frac{\pi^3}{3} \right ) \\ &= \lim_{R \to \infty} \left (-2 \pi \left [ 2 \sqrt{R} \log{R} \int_0^1 \frac{dt}{\sqrt{1+R t^2}} + 4 \sqrt{R} \int_0^1 dt \frac{\log{t}}{\sqrt{1+R t^2}} \right ] + \pi \log^2{R} – \frac{\pi^3}{3} \right ) \\ &= \lim_{R \to \infty} \left (-2 \pi \left [ 2 \sqrt{R} \log{R} \left ( \frac{\log{R}}{2 \sqrt{R}} + \frac{\log{2}}{\sqrt{R}} \right ) + 4 \sqrt{R} \left (-\frac{\log^2{R}}{8 \sqrt{R}} – \frac{\log{2} \log{R}}{2 \sqrt{R}} – \frac{\pi^2 + 6 \log^2{2}}{12 \sqrt{R}} \right ) \right ] + \pi \log^2{R} – \frac{\pi^3}{3} \right ) \\ &= \lim_{R \to \infty} \left (-2 \pi \log^2{R} – 4 \pi \log{2} \log{R} + \pi \log^2{R} + 4 \pi \log{2} \log{R} + \frac{2 \pi^3 + 12 \pi \log^2{2}}{3} + \pi \log^2{R} – \frac{\pi^3}{3} \right ) \end{align}

Note that all terms depending on $R$ cancel, and we finally have

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

I know this was a long read, but I hope by introducing the Mellin transform approach to determining the limit we needed, the approach ended up expressing the original integral in terms of other integrals that could be evaluated – or in this case, approximated, more simply. I think it led to completely new places to which I have never been, and I hope this leads the way to more interesting integral evaluations using complex analysis.

### Real integral evaluation via the residue theorem with two branch points and a log-squared term

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 […]

### A simple but nifty inequality

Problem: Given $f:[0,1] \to \mathbb{R}$ is integrable over $[0,1]$, and that $$\int_0^1 dx \, f(x) = \int_0^1 dx \, x f(x) = 1$$ show that $$\int_0^1 dx \, f(x)^2 \ge 4$$ The way to the solution here is not trivial. I started by always recognizing that, with integral inequalities, it never hurts to start with […]

### Another crazy integral, another clinic on using the Residue Theorem

The problem posed here is to show that $$\int_0^{\infty} dx \, \frac{\coth^2{x}-1}{\displaystyle (\coth{x}-x)^2+\frac{\pi^2}{4}} = \frac{4}{5}$$ The OP actually seemed to know what he was doing but could not get the correct residue that would allow him to get the stated result. In showing a link to Wolfram Alpha, the OP revealed that he […]

### Another integral that Mathematica cannot do

The integral to evaluate is $$\int_0^{\infty} dx \frac{\sin{\left (\pi x^2 \right )}}{\sinh^2{(\pi x)}} \cosh{(\pi x)}$$ Given the trig functions in the integrand, it makes sense to use the residue theorem based on a complex integral around a rectangular contour. As has been my experience with these integrals, the integrand of the complex integral will not […]

### Computing an integral over an absolute value using Cauchy’s theorem

The problem is to compute the following integral: $$\int_{-1}^1 dx \frac{|x-y|^{\alpha}}{(1-x^2)^{(1+\alpha)/2}}$$ I will show how to compute this integral using Cauchy’s theorem. It was remarked that it should not be possible to use Cauchy’s theorem, as Cauchy’s theorem only applies to analytic functions, and an absolute value certainly does not qualify. True. Nevertheless, for the […]

### Integral with two branch cuts II

The problem here is to compute $$\int_0^\infty \log(1+tx)t^{-p-1}dt$$ where $p\in(0,1)$ and $x>0$. This is a great problem for contour integration. Just tricky enough to be really interesting. What makes it interesting is that there are two functions in the integrand needing their own separate branch cuts. One must keep in mind that each function only […]

### Integral with two branch cuts

The problem is to evaluate the following integral: $$\int_{-1}^1 dx \frac{\log{(x+a)}}{(x+b) \sqrt{1-x^2}}$$ where $a \gt 1$ and $|b| \lt 1$. It should be obvious to those who spend time around these integrals that this integral does not converge as stated. However, we only have a simple pole at $x=-b$ so that we can compute […]