## Integrals with Log, Part V

Evaluate

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

This innocent-looking integral is actually kind of a bear. The way I attack it is to express the integral in terms of two separate integrals: one that may be evaluated by extension into the complex plane, and a familiar one easily evaluated. The integral in the complex plane will have its own issues, but at least I have found a method of attack.

To begin, by using the substitution $x=1/u$ judiciously, I can show that

$$\int_0^1 dx \frac{\log{(1+x^2)}}{1+x^2} = \frac12 \int_0^{\infty} dx \frac{\log{(1+x^2)}}{1+x^2} + \int_0^1 dx \frac{\log{x}}{1+x^2}$$

The first integral may be evaluated using Cauchy’s theorem over a strange contour, and I will show that it has value $\pi \log{2}$.

The second integral may be evaluated by using the Maclurin expansion of $(1+x^2)^{-1}$:

$$\int_0^1 dx \frac{\log{x}}{1+x^2} = \sum_{k=0}^{\infty} (-1)^k \, \int_0^1 dx \, x^{2 k} \log{x} = -\sum_{k=0}^{\infty} \frac{(-1)^k}{(2 k+1)^2} = -G$$

where $G$ is Catalan’s constant. Thus the integral sought is

$$\int_0^1 dx \frac{\log{(1+x^2)}}{1+x^2} = \frac{\pi}{2} \log{2} – G \approx 0.172827$$

Now, to evaluate the first integral above, we consider the integral in the complex plane

$$\oint_C dz \frac{\log{(1+z^2)}}{1+z^2}$$

where $C$ is some contour to be determined. Our first instinct is to make $C$ a simple semicircle in the upper half plane. The problem is that the branch point singularity at $z=i$ is extremely problematic, as it coincides with an ostensible pole. Nonetheless, the corresponding integral over the real line is finite (and twice the originally specified integral), so there must be a way to treat this.

The way to go with branch points like this is to avoid them. We thus have to draw $C$ so as to do that, and then use Cauchy’s theorem to state that the above complex integral about $C$ is zero. Such a contour $C$ is illustrated below.

The contour integral is then taken along six different segments. I will state without proof that the integral about the two outer arcs vanishes as the radius of those arcs $R \to \infty$. We are then left with four integrals:

$$\int_{-R}^R dx \frac{\log{(1+x^2)}}{1+x^2} + \left [\int_{C_-}+\int_{C_+}+\int_{C_{\epsilon}} \right ] dz \frac{\log{(1+z^2)}}{1+z^2} = 0$$

$C_-$ is the segment to the right of the imaginary axis, down from the arc to the branch point, $C_+$ is the segment to the left of the imaginary axis, up from the branch point to the arc, and $C_{\epsilon}$ is the circle about the branch point of radius $\epsilon$.

It is crucial that we get the arguments of the log correct along each path. I note that the segment $C_-$ is “below” the imaginary axis and I assign the phase of this segment to be $2 \pi$, while I assign the phase of the segment $C_+$ to be $0$.

For the segment $C_-$, set $z=i(1+y e^{i 2 \pi})$:

$$\int_{C_-} dz \frac{\log{(1+z^2)}}{1+z^2} = i\int_R^{\epsilon} dy \frac{\log{[-y (2+y)]}+ i 2 \pi}{-y (2+y)}$$

For the segment $C_+$, set $z=i(1+y)$:

$$\int_{C_-} dz \frac{\log{(1+z^2)}}{1+z^2} = i\int_{\epsilon}^R dy \frac{\log{[-y (2+y)]}}{-y (2+y)}$$

I note that the sum of the integrals along $C_-$ and $C_+$ is

$$-2 \pi \int_{\epsilon}^R \frac{dy}{y (2+y)} = -\pi \left [ \log{R} – \log{(2 + R)} – \log{\epsilon} + \log{(2 + \epsilon)}\right]$$

For the segment $C_{\epsilon}$, set $z=i (1+\epsilon e^{-i \phi})$. The integral along this segment is

\begin{align}\int_{C_{\epsilon}} dz \frac{\log{(1+z^2)}}{1+z^2} &= \epsilon \int_{-2 \pi}^0 d\phi e^{-i \phi} \frac{\log{\left [ -2 \epsilon e^{-i \phi} \right]}}{-2 \epsilon e^{-i \phi}}\end{align}

Here we use $\log{(-1)}=-i \pi$ and the above integral becomes

\begin{align}\int_{C_{\epsilon}} dz \frac{\log{(1+z^2)}}{1+z^2} &= -\frac12 (-i \pi)(2 \pi) – \frac12 \log{2} (2 \pi) – \frac12 \log{\epsilon} (2 \pi) -\frac12 (-i) \frac12 (0-4 \pi^2) \\ &= -\pi \log{2} – \pi \log{\epsilon} \end{align}

Adding the above integrals, we have

\begin{align}\int_{-R}^R dx \frac{\log{(1+x^2)}}{1+x^2} -\pi \log{R} + \pi \log{(2 + R)} + \pi \log{\epsilon} – \pi \log{(2 + \epsilon)} -\pi \log{2} – \pi \log{\epsilon} &= 0\\ \implies \int_{-R}^R dx \frac{\log{(1+x^2)}}{1+x^2} -\pi \log{R} + \pi \log{(2 + R)} – \pi \log{(2 + \epsilon)} -\pi \log{2} &=0\end{align}

Now we take the limit as $R \to \infty$ and $\epsilon \to 0$ and we get

$$\int_{-\infty}^{\infty} dx \frac{\log{(1+x^2)}}{1+x^2} -2 \pi \log{2} = 0$$

Therefore

$$\int_{0}^{\infty} dx \frac{\log{(1+x^2)}}{1+x^2} = \pi \log{2}$$

• Bennett Gardiner wrote:

Hi Ron. I absolutely love the site you’ve put together, and your skill with definite integrals is extremely impressive, especially using contour methods!

I like this problem, so I wrote up another solution on the MSE page – turns out this is a great problem to use Feynman’s trick on!

I’m not sure if you know of this method or just prefer the hard way of doing things :p

Anyway, I’ll be following you around on MSE no doubt – looking for more of your lovely solutions!

• rlgordonma@yahoo.com wrote:

Bennett, you are too kind, but thanks. What I like about M.SE are the many and varied ways of attacking these integrals. I hope to see you around, too. – Ron

• I just noticed this, Ron. I was curious about the best way to go about dealing with an integral like this that has the overlapping pole and branch. I have been trying to evaluate
log(1-exp(-2pi x))/(x^2+1)= pi-pi/2*log(2pi) and hit a snag because it has the same issue. Except, it also has a singularity about 0 as well. Do you think the same sort of idea may work with this one with an extra circle around the origin?.

• Bennett Gardiner wrote:

Hey Ron.

What’s the deal with this one – http://math.stackexchange.com/questions/524358/evaluating-int-01-frac-log-x-log-left1-x4-right1x2dx ?

None of the methods I know or have learnt from your blog seem to help. Yet the answer is tantalisingly simple.