Computing integral using complex analysis methods

I'm trying to compute the integral

$$\int_0^{\infty} \frac{\ln(x)}{x^2 + 1} \, dx$$

using complex analysis methods. We haven't learned residue calculus yet though, only contour integrals up through the Cauchy integral formula.

I'm trying to make use of a half circle centered at the origin of radius $R$ and then let $R$ tend to infinity, but there is a definite singularity for the $\ln(x)$ function. Does anybody have a suggestion?

• Cauchy's integral formula is a special case of the residue theorem. And it's enough for the task here. Use two semicircles with centre $0$, one with radius $R > 1$, and let $R\to \infty$, and the other with radius $0 < r < 1$ and let $r \to 0$. The standard estimate shows the integrals over the semicircles tend to $0$. Taking the principal branch of the logarithm, you can easily find the relation between the integrals over the intervals on the positive and the negative half-axis. Of course, there is a really nice real method for this integral. – Daniel Fischer Jul 24 '14 at 12:13
• You can also use the keyhole contour. – zibadawa timmy Jul 24 '14 at 13:33
• Check this. – Mhenni Benghorbal Jul 24 '14 at 13:36

It is not necessary to use complex analysis methods to solve this problem. You only need $x\to\frac{1}{x}$. In fact, letting $u=\frac{1}{x}$ gives $$\int_1^\infty\frac{\ln x}{1+x^2}dx=\int_1^0\frac{\ln \frac{1}{u}}{1+\frac{1}{u^2}}(-\frac{du}{u^2})=-\int_0^1\frac{\ln u}{1+u^2}du.$$ So $$\int_0^\infty\frac{\ln x}{1+x^2}dx=\int_0^1\frac{\ln x}{1+x^2}dx+\int_1^\infty\frac{\ln x}{1+x^2}dx=\int_0^1\frac{\ln x}{1+x^2}dx-\int_0^1\frac{\ln u}{1+u^2}du=0.$$
One way to do this would be to consider the integral $$\int_C \frac{(\log z)^2}{1+z^2}dz$$ where $C$ is the keyhole contour. By standard estimates, the integral on the outer ($R$) and inner ($r$) circular parts of the contour would be zero when we consider limiting values of $R$ and $r$. For the horizontal segment above the real axis you will get $\frac{(\log z)^2}{1+z^2} = \frac{(\log|x|)^2}{1+x^2}$. For the horizontal segment below the real axis you will have $$\frac{(\log z)^2}{1+z^2} = \frac{(\log|x|+2\pi i)^2}{1+x^2}= \frac{(\log|x|)^2 -4\pi^2 + 4\pi i log|x|}{1+x^2}$$ where we use the $0 < \arg z < 2\pi$ branch. Since the integration limits will be inverted for the two horizontal segments, hence you will be left with the desired integral, residue of $\frac{(\log z)^2}{1+z^2}$ at $z = \pm i$ and a standard integral: $\int_0^{\infty} \frac{dx}{1+x^2}$.