# Calculate Integral using residue theorem

I want to verify the following result using the residue theorem:

$$\int_0^\infty \frac{\log(x)}{x^2+a^2}dx = \frac{\pi}{2a}\log a, \, a > 0.$$

Here are my ideas:

At first I might want to show that this function is in fact a well defined improper Riemann integral, but I didn't come up with any nice solution yet.

I want to integrate the function $f(z) := \frac{\log(z)}{z^2+a^2}$ along the contour $C:= \gamma_1 \cup \gamma_2 \cup \gamma_3 \cup \gamma_4$ constisting of to semicircles with center at 0 around the upper half plane and radius $R$ and $\epsilon$ (resp.) as well as the intervals $[-R, -\epsilon]$ and $[\epsilon, R]$.

For the complex logarithm, use the branch $\log z = \log|z| + i\theta, \theta \in [-\pi/2, 3\pi/2)$ so we don't get any problems on the real line (is this choice correct?).

Note that I have one pole in my contour, namely $z = ia$. The Residue theorem yields $$\int_C f(z) dz= 2\pi i \text{ Res}(f, ia) = 2\pi i\lim_{z\to ia}(z-ia) \frac{\log z}{(z-ia)(z+ia)} = 2\pi i\frac{\log(ia)}{2ia} = \pi \frac{\log(a)+ i\pi/2}{a}$$ Proceeding, we choose the following parametrizations:
$$\gamma_1 : [-R,0] \to \mathbb C, \quad t\mapsto -\frac{\epsilon t}{R} + (t-\epsilon) \\ \gamma_2 : [0, R] \to \mathbb C, \quad t\mapsto -\frac{\epsilon t}{R} + (\epsilon+t) \\ \gamma_3: [0, \pi]\to \mathbb C, \quad t\mapsto \epsilon e^{it} \\ \gamma_4:[0,\pi] \to \mathbb C, \quad t \mapsto Re^{it}$$ Now here's what I am unsure about. To show that the big and the small circle vanish as $R\to \infty$ and $\epsilon \to 0$ is not too hard, but how to deal with the other integrals? Can I just say $$\int_{\gamma_1} f(z)dz = \int_0^R \frac{\log(-\frac{\epsilon}{R}t+\epsilon+t)}{(-\frac{\epsilon}{R}t + \epsilon + t)^2 + a^2}(\frac{\epsilon}{R}+1)dt \xrightarrow{\epsilon \to 0} \int_0^R \frac{\log t}{t^2 + a^2}dt$$ or what kind of reasoning should be used to interchange limit and integral?Also, I then finally I get $$\int_0^\infty \frac{\log(x)}{x^2+a^2}dx = \pi \frac{\log a + i\frac{\pi}{2}}{2a}$$ almost what I want, but where does $i\pi /2$ come from?

Thanks in advance!

• Is the real-analysis tag appropriate here? – Simply Beautiful Art Jun 6 '17 at 13:22
• I was unsure since we talk about a real integral. I can remove it though. – Staki42 Jun 6 '17 at 13:23
• Check your work on $\int_{\gamma_1}f(z)~\mathrm dz$. You should have a $\log(-t)$ in the numerator, which should cancel off the imaginary part you are confused about. – Simply Beautiful Art Jun 6 '17 at 13:26

## 3 Answers

Along the real axis, we have

\begin{align} \int_{-R}^R \frac{\log(x)}{x^2+a^2}\,dx&=\int_{-R}^0 \frac{\log(x)}{x^2+a^2}\,dx+\int_0^{R} \frac{\log(x)}{x^2+a^2}\,dx\\\\ &=\int_0^R \frac{\log(-x)+\log(x)}{x^2+a^2}\,dx\\\\ &=2\int_0^R \frac{\log(x)}{x^2+a^2}\,dx+i\pi\int_0^R\frac{1}{x^2+a^2}\,dx\\\\ &=2\int_0^R \frac{\log(x)}{x^2+a^2}\,dx+\frac{i\pi\arctan(R/a)}{a}\tag1 \end{align}

As $R\to \infty$, we find that

$$\int_{-\infty}^\infty \frac{\log(x)}{x^2+a^2}\,dx=2\int_0^\infty \frac{\log(x)}{x^2+a^2}\,dx+\frac{i\pi^2}{2a}\tag 2$$

Setting $(2)$ equal to $\frac{\pi \log(a)}{a}+i\frac{\pi^2}{2a}$, we find that

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

I thought it might be instructive to evaluate the integral of interest using real analysis only. To that end, we enforce the substitution $x\to a/x$ to find that

$$\int_0^\infty \frac{\log(x)}{x^2+a^2}\,dx=\frac1a \int_0^\infty \frac{\log(a)-\log(x)}{x^2+1}\,dx \tag2$$

For $a=1$, we see from $(2)$ that $\int_0^\infty \frac{\log(x)}{x^2+1}\,dx =0$. Thus, solving $(2)$ for integral of interest, and using $\int_0^\infty \frac{\log(x)}{x^2+1}\,dx =0$, we find that

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

as expected!

• That makes sense, I accidentally thought that the integral was symmetric. Could you possibly say anything about exchanging the limits and that the integral is well-defined? – Staki42 Jun 6 '17 at 13:51
• The integral is well defined since $\log(x)$ is integrable on $[,1]$ (so, there is no problem at $0$) and since $\log(x)<\sqrt{x}$, $\frac{\log(x)}{x^2+a^2}=O\left(\frac{1}{x^{3/2}}\right)$ as $x\to \infty$. – Mark Viola Jun 6 '17 at 13:59
• Thank you very much! Does that also justify that I can just exchange Integral and limit or do I need to apply some theorem like dominated convergence? I wouldn't really want to find an integrable majorant... – Staki42 Jun 6 '17 at 14:10
• Change the parameterization to $t$ so that the integral becomes $\int_{\epsilon}^R \frac{\log(t)}{t^2+a^2}\,dt$. Then, there is no need to interchange the order of integration and limits. – Mark Viola Jun 6 '17 at 14:25
• You're welcome. My pleasure. If one insists on using the parameterization, then noting that the integrand as a function of $\epsilon$ and $t$ is continuous on $[0,R]$ for $\epsilon>0$. Therefore since it is continuous on the closed bounded interval, it is uniformly continuous there. This is enough to justify the interchange of the limit on $\epsilon$ and the integral on $t$. – Mark Viola Jun 6 '17 at 14:33

For any $a>0$, through the substitution $x=a e^t$ we have

$$I(a) = \int_{0}^{+\infty}\frac{\log x}{a^2+x^2}\,dx = \frac{1}{2a}\int_{-\infty}^{+\infty}\frac{\log a+ t}{\cosh t}\,dt \tag{1}$$ and $\frac{t}{\cosh t}$ is an odd integrable function over $\mathbb{R}$. It follows that $$I(a) = \frac{\log a}{2a}\int_{-\infty}^{+\infty}\frac{dt}{\cosh t}=\frac{\log a}{2a}\left[2\arctan\tanh\frac{t}{2}\right]^{+\infty}_{-\infty}=\color{red}{\frac{\pi\log a}{2a}} \tag{2}$$ without even resorting to the residue theorem, but just exploiting symmetry.

• It's even easier to exploit symmetry through the substitution $x\to a/x$. ;-)) – Mark Viola Jun 6 '17 at 17:17
• @MarkViola: of course, this is almost the same. – Jack D'Aurizio Jun 6 '17 at 17:17
• Yes, it is the same upon letting $x=a\sinh(t)$ in the integral $\int_0^\infty \frac{1}{x^2+a^2}\,dx=\frac{\pi}{2a}$ – Mark Viola Jun 6 '17 at 17:25
• How did $\int_{0}^{\infty}$ change to $\int_{-\infty}^{\infty}$ m – Mockingbird Jun 13 '17 at 8:09
• I think mockingbird meant how did $\int_{0}^{\infty}$ become $\int_{-\infty}^{\infty}$? – Partha Sarker Jun 13 '17 at 8:15

Using a semi-circular contour in the upper half plane that rests on the real axis we obtain

$$\int_0^\infty \frac{1}{x^2+a^2} \; dx = \frac{1}{2} \int_{-\infty}^\infty \frac{1}{x^2+a^2} \; dx \\ = \frac{1}{2} \times 2\pi i \frac{1}{2\times ai} = \frac{\pi}{2a}.$$

Next using a keyhole contour with the slot on the positive real axis and the branch of the logarithm where $0\le \arg\log z\lt 2\pi$ (branch cut on the positive real axis) we obtain integrating

$$f(z) = \frac{\log^2 z}{z^2+a^2}$$

the integrals

$$\int_0^\infty \frac{\log^2 x}{x^2+a^2} \; dx + \int_\infty^0 \frac{\log^2 x + 4\pi i \log x - 4\pi^2 }{x^2+a^2} \; dx \\ = 2\pi i \left(\frac{\log^2(ai)}{2\times ai} + \frac{\log^2(-ai)}{2\times -ai}\right).$$

This yields

$$-4\pi i \int_0^\infty \frac{\log x}{x^2+a^2} \; dx + 4\pi^2 \times \frac{\pi}{2a} = \frac{\pi}{a} ((\log a + \pi i/ 2)^2 - (\log a + 3\pi i/2)^2) \\ = \frac{\pi}{a} (\log a \times \pi i (1-3) + \pi^2 (-1/4 + 9/4)).$$

We thus obtain

$$4\pi i \int_0^\infty \frac{\log x}{x^2+a^2} \; dx = 4\pi^2 \times \frac{\pi}{2a} - \frac{\pi}{a} (-\log a \times 2\pi i + 2 \pi^2) \\ = \frac{\pi}{a} \log a \times 2\pi i.$$

Dividing by $4\pi i$ we finally obtain

$$\bbox[5px,border:2px solid #00A000]{ \frac{\pi}{2a}\log a.}$$

The bounds on the circular components that we used here were

$$2\pi R \times \frac{\log^2 R}{R^2} \rightarrow 0 \quad\text{and}\quad 2\pi \epsilon \times \frac{\log^2 \epsilon}{a^2} \rightarrow 0.$$