# $\int_0^\infty \frac{\log(1+x^2)}{x^2} dx$ using contour integration

I am trying to evaluate

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

by using contour integration. It is possible to compute this integral using real techniques; integration by parts yields the result:

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

I have been attempting to use the integrand $f(z)= \frac{\log(1+z^2)}{z^2}$ (with any suitable branch cut in the lower half plane), and have been trying to integrate around an indented semi-circle in the upper half plane, but I feel this is perhaps the wrong approach. Firstly, when summing the integrals along the real axis, the imaginary part seems to not converge. Furthermore, the indentation integral seems difficult to evaluate. Any help would be appreciated.

• Almost sure it is a duplicate. Commented Jan 8, 2015 at 14:42
• I spent a good half hour searching, with no success. I'm happy to see an original though, if you can find a link. Commented Jan 8, 2015 at 14:53
• $$\frac{1}{2}\int^\infty_{-\infty}\frac{\ln(1+x^2)}{x^2}dx=\pi i\operatorname*{Res}_{z=0}\frac{\ln(1-iz)}{z^2}=\pi$$ Commented Jan 8, 2015 at 14:54
• What contour are you using? I understand how to expand $\log(1+z^2)$, but not how to proceed. Commented Jan 8, 2015 at 15:09
• I am just using the classic semicircular contour. $\frac{\ln(1-iz)}{z^2}$ is meromorphic in the upper-half plane. Commented Jan 8, 2015 at 15:13

Notice that by integrating by parts we have: $$I = \int_{0}^{+\infty}\frac{\log(1+x^2)}{x^2}\,dx = -\left.\frac{1}{x}\log(1+x^2)\right|_{0}^{+\infty}+\int_{0}^{+\infty}\frac{2\,dx}{1+x^2}=\color{red}{\int_{-\infty}^{+\infty}\frac{dz}{1+z^2}}$$ and the last integral is very easy to evaluate with complex or real-analytic techniques.

• Yeah I'm aware of this method. Is there a method which doesn't rely on integration by parts first? I found the integral in a complex analysis book, and the phrasing of the question makes it seem like there should be a purely complex method. Commented Jan 8, 2015 at 14:55
• @CunningTF: M.N.C.E. just gave you one in the comments. However, I think that integration by parts make things a lot easier, anyway. Commented Jan 8, 2015 at 15:06

See this answer for a way to deal with such logs using contour integration. Note that, about each branch point, we replace the offending log with a factor of $-i 2 \pi$ to account for the phase jump introduced by traversing around the branch point in a clockwise direction.

In this case, you can use a semicircular contour of radius $R$ in the upper half plane, with a detour downward from the semicircle at $\theta=\pi/2$ that avoids the branch point at $z=i$, as pictured below:

Thus, in the limit as $R \to \infty$, the contour integral is equal to

$$\int_{-\infty}^{\infty} dx \frac{\log{(1+x^2)}}{x^2} - i 2 \pi \int_{e^{i \pi/2}}^{\infty e^{i \pi/2}} \frac{dy}{y^2}$$

By Cauchy's Theorem, the contour integral is zero because there are no poles inside this contour. Thus, we have

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

• Thank you Ron, very insightful answer! Commented Jan 8, 2015 at 15:29

$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\dsc}[1]{\displaystyle{\color{red}{#1}}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\Li}[1]{\,{\rm Li}_{#1}} \newcommand{\norm}[1]{\left\vert\left\vert\, #1\,\right\vert\right\vert} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$ Note that \begin{align}&\color{#66f}{\large% \int_{0}^{\infty}{\ln\pars{1 + x^{2}} \over x^{2}}\,\dd x} =\half\int_{0}^{\infty}{\ln\pars{1 + x} \over x^{3/2}}\,\dd x =\half\int_{1}^{\infty}\pars{x - 1}^{-3/2}\,\,\ln\pars{x}\,\dd x \qquad\pars{1} \end{align} We evaluate the integral, in the RHS, by performing the contour integral $$\oint_{\gamma}\pars{z - 1}^{-3/2}\,\,\ln\pars{z}\,\dd z$$ along the path $\ds{\gamma}$ depicted below:

which shows two branch cuts. Namely: \begin{align} \begin{array}{rclrcll} \pars{z - 1}^{-3/2} & = &\verts{z - 1}^{-3/2} \exp\pars{-\,{3 \over 2}\,\,{\rm Arg}\pars{z - 1}\ic}\,, & z & \not= & 1 \,, & \phantom{-}0 < \,{\rm Arg}\pars{z - 1} < 2\pi \\[5mm] \ln\pars{z}&=&\ln\pars{\verts{z}} + \ic\,{\rm Arg}\pars{z}\,,& z &\not = & 0\,, & -\pi < \,{\rm Arg}\pars{z} < \pi \end{array} \end{align} Obviously, the integral along $\ds{\gamma}$ vanishes out because there are not any poles inside the contour. For simplicity, we omit the contribution of the arcs $\ds{C_{R}}$, of radius $\ds{R}$, and the 'small' semicircles, of radius $\ds{\epsilon}$, around $\ds{z=0}$ and $\ds{z=1}$: They don't yield any contribution in the limits $\ds{R\ \to\ \infty\,,\ \epsilon\ \to\ 0^{+}}$. Then, \begin{align} 0&=\oint_{\gamma}\pars{z - 1}^{-3/2}\,\,\ln\pars{z}\,\dd z =\overbrace{\int_{1}^{\infty}\pars{x - 1}^{-3/2}\ln\pars{x}\,\dd x} ^{\ds{\mbox{along}\ \dsc{C_{++}}}} \\[5mm]&+\overbrace{% \int_{-\infty}^{0}\pars{1 - x}^{-3/2}\expo{-3\pi\ic/2} \bracks{\ln\pars{x} + \ic\pi}\,\dd x} ^{\ds{\mbox{along}\ \dsc{C_{-+}}}}\ +\ \overbrace{% \int^{-\infty}_{0}\pars{1 - x}^{-3/2}\expo{-3\pi\ic/2} \bracks{\ln\pars{x} - \ic\pi}\,\dd x} ^{\ds{\mbox{along}\ \dsc{C_{--}}}} \\[5mm]&+\overbrace{\int^{1}_{\infty}\pars{x - 1}^{-3/2} \expo{-3\pi\ic}\ln\pars{x}\,\dd x} ^{\ds{\mbox{along}\ \dsc{C_{+-}}}}\ =\ 2\int_{1}^{\infty}\pars{x - 1}^{-3/2}\ln\pars{x}\,\dd x \\[5mm]&\phantom{=}+2\pi\ic\expo{-3\pi\ic/2}\int_{-\infty}^{0} \pars{1 - x}^{-3/2}\,\dd x =2\int_{1}^{\infty}\pars{x - 1}^{-3/2}\ \ln\pars{x}\,\dd x -\left.{4\pi \over \root{1 - x}}\,\right\vert_{\, x\ \to\ -\infty}^{\, x\ =\ 0} \\[5mm]&=2\int_{1}^{\infty}\pars{x - 1}^{-3/2}\ \ln\pars{x}\,\dd x - 4\pi \quad\imp\quad \boxed{\ds{\quad\int_{1}^{\infty}\pars{x - 1}^{-3/2}\ \ln\pars{x}\,\dd x =2\pi\quad}} \end{align}

Replacing this result in expression $\pars{1}$, we'll find:

\begin{align}&\color{#66f}{\large% \int_{0}^{\infty}{\ln\pars{1 + x^{2}} \over x^{2}}\,\dd x} =\color{#66f}{\Large\pi} \end{align}

• Another really good answer. Thank you. Commented Jan 9, 2015 at 11:31
• @CunningTF I'm glad you found it useful. Thanks. Commented Jan 9, 2015 at 21:22

It may be worth pointing out that the real technique (parts) works even more generally, as we have the exact anti-derivative

$$$$\int \frac{\log(1+x^{2})}{x^{2}}dx = 2\arctan(x)-\frac{\log(x^{2}+1)}{x}$$$$

which can be verified by differentiating both sides with respect to x. This implies $$$$\int_{-T}^{T}\frac{\log(1+x^{2})}{x^{2}}dx = 4\arctan(T)-2\frac{\log(T^{2}+1)}{T}$$$$

Then if you send $$T \to \infty$$ using $$\arctan(T) \to \frac{\pi}{2}$$, you get the claimed answer. Can the complex analysis techniques also be used to prove the finite T result here?

Since $$\frac{log(1+x^2)}{x^2} = \lim_{y \to 0} \frac{log(1+x^2)}{x^{2}+y^2}$$ almost everywhere, and the latter function is equal to $$2\, \Re \frac{log(1-ix)}{x^{2}+y^{2}}$$ on the real line, we may write the integral as $$\Re\lim_{y \to 0}\int_{-\infty}^{\infty} \! \frac{log(1-ix)}{x^{2}+y^{2}} \, \mathrm{d}x.$$ To avoid the branch cut, the contour is closed above the real line (usual D-shape) and we get the result $$\Re\lim_{y \to 0}2 \pi i Res_{x=iy}\frac{log(1-ix)}{x^{2}+y^{2}}=\Re\lim_{y \to 0}2 \pi i \frac{log(1+y)}{2 i y}=\pi.$$