Hunter Liu's Website

An Integral Trick from the Sewers of New York

Date Written: September 20, 2023; Last Modified: September 20, 2023

I came across the following problem when studying for UCLA’s analysis qual:

Problem 1.

For real numbers \(a, b>0\), compute \[\int_{0}^{\infty}\frac{\log x}{(x+a)^2+b^2}dx.\]

As with many problems of this type, one should consider the function \[f(z)=\frac{\operatorname{Log}(z)}{(z+a)^2+b^2},\] which is a meromorphic function on the complex plane. For this problem, we’ll take \(\operatorname{Log}\) to be the principal branch of the complex logarithm with a branch cut along the nonnegative real axis. This will allow us to apply the residue theorem to the following contour; the poles have been marked:

Let \(\gamma\) be the full closed contour, understood to depend on \(\epsilon\) and \(R\); we have that \[\oint_{\gamma} f(z) dz = 2 \pi i\sum_{z\in\operatorname{Int}(\gamma)}\operatorname{Res}(f; z).\] As \(R\to\infty\), we get \(\left\lvert z \right\rvert=R\) on \(\gamma_{2}\), hence a simple estimate yields \[\int_{\gamma_2} f(z) dz = O_R\left( \frac{\log R}{R^2}\cdot 2\pi R \right)\to 0.\] On the other hand, as \(\epsilon\to 0\), we have that \[\int_{\gamma_4}f(z) dz = O_{\epsilon}\left( \frac{\log \epsilon}{a^2+b^2}\cdot 2\pi \epsilon \right)\to 0.\] In these limits, both \(\gamma_1\) and \(\gamma_3\) “approach” the real axis. The denominators will approach \((x+a)^2+b^2\), but the numerators will approach \(\log x\) and \(\log x+2\pi i\) on the two paths respectively. Accounting for the signs, what we are left with is \[\int_{0}^{\infty}\frac{\log x}{(x+a)^2+b^2}dx - \int_{0}^{\infty}\frac{\log x+2\pi i}{(x+a)^2+b^2}= 2\pi i \left( \operatorname{Res}(f; -a+bi) + \operatorname{Res}(f; -a-bi)\right).\]
But this is actually no good: all the \(\log\)’s cancel out, leaving us with an equation that does not involve the original integral whatsoever.

I got stuck on this problem here, and it was only when Elias pulled up a mysterious set of solutions from the internet that we discovered this dirty integral trick.

Rather than considering the above choice of \(f\), we will take \[f(z)=\frac{(\operatorname{Log} z)^2}{(z+a)^2+b^2}.\] All the same arguments work — the additional factor of \(\operatorname{Log} z\) does not influence the limiting behaviour of the circular integrals. This time, however, you get that \(f(x)=\frac{(\log x)^2}{(x+a)^2+b^2}\) on \(\gamma_1\) while \(f(x)=\frac{(\log x)^2+4\pi i\log x-4\pi^2}{(x+a)^2+b^2}\) on \(\gamma_3\). Thus, upon subtracting the two, one gets \[\int_{0}^{\infty}\frac{4\pi^2-4\pi i\log x}{(x+a)^2+b^2}dx = 2\pi i \left( \operatorname{Res}\left( f; -a+bi \right)+ \operatorname{Res}\left( f; -a-bi \right) \right). \] Written another way, \[\int_{0}^{\infty}\frac{\log x}{(x+a)^2+b^2}dx = \frac{\pi}{i} \int_{0}^{\infty}\frac{dx}{(x+a)^2+b^2}-\frac{1}{2} \left( \operatorname{Res}\left( f; -a+bi \right)+ \operatorname{Res}\left( f; -a-bi \right) \right).\] Everything on the right can be computed by hand!

The tl;dr is: when performing contour integration with \(\operatorname{Log}z\), it’s sometimes important to square it.