Can this integral be solved with contour integral or by some application of residue theorem? $$\int_0^\infty \frac{\log (1+x)}{1+x^2}dx = \frac{\pi}{4}\log 2 + \text{Catalan constant}$$

It has two poles at $\pm i$ and branch point of $-1$ while the integral is to be evaluated from $0\to \infty$. How to get $\text{Catalan Constant}$? Please give some hints.


Solution 1:

\begin{align*} \int_{0}^{\infty} \frac{\log (x + 1)}{x^2 + 1} \, dx &= \int_{0}^{1} \frac{\log (x + 1)}{x^2 + 1} \, dx + \int_{1}^{\infty} \frac{\log (x + 1)}{x^2 + 1} \, dx \\ &= \int_{0}^{1} \frac{\log (x + 1)}{x^2 + 1} \, dx + \int_{0}^{1} \frac{\log (x^{-1} + 1)}{x^2 + 1} \, dx \quad (x \mapsto x^{-1}) \\ &= 2 \int_{0}^{1} \frac{\log (x + 1)}{x^2 + 1} \, dx - \int_{0}^{1} \frac{\log x}{x^2 + 1} \, dx \end{align*}

For the first integral, we plug

$$ u = \frac{1-x}{1+x}, \quad dx = - \frac{2}{(u+1)^2} \, du. $$

Then it is easy to find that

$$ \int_{0}^{1} \frac{\log (x + 1)}{x^2 + 1} \, dx = \int_{0}^{1} \frac{\log 2 - \log (u + 1)}{u^2 + 1} \, du = \frac{\pi}{4}\log 2 - \int_{0}^{1} \frac{\log (u + 1)}{u^2 + 1} \, du $$

and hence

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

For the second integral, we plug $x = e^{-t}$ and we have

\begin{align*} \int_{0}^{1} \frac{\log x}{x^2 + 1} \, dx &= - \int_{0}^{\infty} \frac{t e^{-t}}{1 + e^{-2t}} \, dt = - \sum_{n=0}^{\infty} (-1)^{n} \int_{0}^{\infty} t \, e^{-(2n+1)t} \, dt \\ &= - \sum_{n=0}^{\infty} \frac{(-1)^{n}}{(2n+1)^{2}} = - G, \end{align*}

where $G$ is the Catalan constant.

Therefore we have

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

Solution 2:

If you're still interested in approaches that use contour integration, consider the function $$f(z) = \frac{\log(1+z) \log(-z)}{1+z^{2}}.$$

Using the principal branch of the logarithm, there is a branch cut along $[0,\infty)$ and a branch cut along $(-\infty, -1]$.

Then integrating counterclockwise around a keyhole contour deformed around the branch cuts (see here for a picture),

$$ \begin{align} &\int_{\infty}^{0} \frac{\log(1+x) \big(\log(x) + i \pi \big)}{1+x^{2}} \ dx + \int_{0}^{\infty} \frac{\log(1+x) \big(\log (x) - i \pi \big)}{1+x^{2}} \ dx \\ &+\int_{-\infty}^{-1} \frac{\big(\log|1+x| + i \pi \big) \log(-x)}{1+x^{2}} \ dx + \int_{-1}^{-\infty} \frac{\big(\log|1+x| - i \pi \big) \log(-x)}{1+x^{2}} \ dx \\ &= - 2 \pi i \int_{0}^{\infty} \frac{\log(1+x)}{1+x^{2}} \ dx + 2 \pi i \int_{1}^{\infty} \frac{\log(x)}{1+x^{2}} \ dx \\ &= 2 \pi i \big( \text{Res} [f(z), i] + \text{Res} [f(z), -i] \big) \\ &= 2 \pi i \left(\frac{\log(1+i) \log(-i)}{2i} + \frac{\log(1-i)\log(i)}{-2i} \right) \\ &= 2 \pi i \left( - \frac{\pi}{4} \log(2)\right) . \end{align}$$

Therefore,

$$ \begin{align} \int_{0}^{\infty} \frac{\log(1+x)}{1+x^{2}} \ dx &= \frac{\pi}{4} \log(2) + \int_{1}^{\infty} \frac{\log (x)}{1+x^{2}} \ dx \\ &= \frac{\pi}{4} \log(2) - \int_{1}^{0} \frac{\log(\frac{1}{u})}{1+ (\frac{1}{u})^{2}} \frac{1}{u^{2}} \ du \\ &= \frac{\pi}{4} \log(2) - \int^{1}_{0} \frac{\log u}{1+u^{2}} \ du \\ &= \frac{\pi}{4} \log(2) + G . \end{align}$$