# $\int_0^\infty \frac{\log(x)}{x^2+\alpha^2}$ using residues

I'm trying to find $\int_0^\infty \frac{\log(x)}{x^2+\alpha^2}dx$ where $\alpha>0$ is real. My approach was to take an integral along the real line from $1/R$ to $R$, around the circle counterclockwise to $-R$, along the real line to $-1/R$, and then around the circle clockwise to $1/R$. I have encountered 2 problems with this:

1. This path encloses one pole, at $z=\alpha i$. I found the residue at $z=\alpha i$ to be $\frac{\ln(\alpha)+i\pi/2}{2\alpha i}$. However, this gives me that $\int_0^\infty \frac{\log(x)}{x^2+\alpha^2}dx=\frac{\pi(\ln(\alpha)+i\pi/2)}{2\alpha}$. Since I have a real function integrated over the real line, there cannot be an imaginary part. Where did I go wrong? (Also, doing a few examples, the correct answer seems to be $\frac{\pi\ln(\alpha)}{2\alpha}$, the same as I have but without the imaginary part.)

2. At first chose my path so instead of going all the way around the upper semicircle, it only went 3/4 of the way around, as I wanted to avoid anything that might go wrong with the discontinuity of $\log(x)$ at the negative real axis. When I do this, though, I get a different answer than before (the denominator of the fraction is $\alpha(1-e^{3\pi i/4})$ instead of $2\alpha$. What am I doing wrong that gives me different answers?

• Just so you know, this doesn't need complex analysis - since $\int_0^{\infty} \frac{\ln x}{x^2+1}\, dx=0$ (this can be seen by substituting $u=\frac{1}{x}$, this integral can be manipulated a bit into that one, and it is in fact equal to $\frac{\pi\ln\alpha}{2\alpha}$. – Samir Khan Jul 27 '15 at 0:42

## 2 Answers

You were on the right track. We have

\begin{align} \int_{-\infty}^0 \frac{\log x}{x^2+\alpha^2}dx+\int_{0}^{\infty} \frac{\log x}{x^2+\alpha^2}dx&=2\pi i \left(\frac{\log (\alpha)+i\pi/2}{2i\alpha}\right)\\\\ &=\frac{\pi\log \alpha}{\alpha}+i\frac{\pi^2}{2\alpha} \end{align} \tag 1

We change variables on the first integral on the left-hand side of $(1)$ by letting $x\to -x$. Now, being careful to evaluate $\log (-x)=\log (x)+i\pi$ reveals

$$2\int_{0}^{\infty} \frac{\log x}{x^2+\alpha^2}dx+i\pi\int_0^{\infty}\frac{1}{x^2+\alpha^2}=\frac{\pi\log \alpha}{\alpha}+i\frac{\pi^2}{2\alpha}\tag 2$$

whereby equating real and imaginary parts yields of $(2)$

$$\bbox[5px,border:2px solid #C0A000]{\int_{0}^{\infty} \frac{\log x}{x^2+\alpha^2}dx=\frac{\pi\log \alpha}{2\alpha}}$$

and

$$\bbox[5px,border:2px solid #C0A000]{\int_0^{\infty}\frac{1}{x^2+\alpha^2}=\frac{\pi}{2\alpha}}$$

which agree with the answers reported by @MarkoRiedel and obtained with a semi-circular contour rather than a keyhole contour!

Integrating $$\frac{\log^2 z}{z^2+\alpha^2}$$

around a keyhole contour with the branch cut of the logarithm on the positive real axis and the argument between $0$ and $2\pi$ we get from the two residues

$$2\pi i \times \left(\frac{(\log\alpha+i\pi/2)^2}{2\alpha i} - \frac{(\log\alpha+i3\pi/2)^2}{2\alpha i}\right) \\ = \pi \frac{-\log\alpha \times 2i\pi + 2 \pi^2 }{\alpha}.$$

On the other hand the non-vanishing integrals along the contour contribute $$- 4\pi i \int_0^\infty \frac{\log x}{x^2+\alpha^2} dx \quad\text{and}\quad 4\pi^2 \int_0^\infty \frac{1}{x^2+\alpha^2} dx.$$

Comparing real and imaginary parts we thus obtain for the first integral $$\frac{1}{4\pi} \times \pi \times \frac{\log\alpha}{\alpha} 2 \pi \\ = \frac{\log\alpha}{\alpha} \frac{\pi}{2}.$$

We also get for the bonus integral $$\int_0^\infty \frac{1}{x^2+\alpha^2} dx = \frac{1}{4\pi^2} \times \pi\times \frac{2 \pi^2}{\alpha} = \frac{\pi}{2\alpha}.$$

• Thanks, I see how that works. Do you have any idea why the ways I tried didn't produce the correct answer? – Sunita Chepuri Jul 27 '15 at 3:10