I am trying to teach myself the residue theorem, and one of the problems I am looking at is $$\int_0^\infty \frac{(\ln{x})^2}{1+x^2}dx$$

With a branch point at $0$, and a branch cut extending down the negative imaginary axis, this leads to a contour integral (containing a poles at $\pm i$), looking like an upside down U. In turn, this contour integral can be broken up into four smaller integrals. The bottom two integrals (running along the real axis) are used to "solve" the problem by setting them equal to the residue (times appropriate prefactor). However, the integrals on the inside and outside curved portions of the "U" can be eliminated, as they are equal to $0$.

I do not know how to calculate the integral of these two curves, and as such cannot see why they are $0$. The solutions I am looking at simply state "via the l'Hospital's rule" without any calculations shown. Disregarding the backstory, below is the integral I am trying to solve, which is the inside of the U shape.

$\lim \limits_{r \to 0}\int_\pi^0 \frac{(\ln{z})^2}{1+z^2} d\theta$, where $z$ is the complex number represented by $z = re^{i\theta}$


Let $f(z) = (\log z)^2/(1 + z^2)$ and $0 < \epsilon < 1 < R$. Suppose the upper and lower circular arcs of the contour have radii $R$ and $\epsilon$, respectively. Since $f(z)$ is analytic inside and on the contour, except at the simple pole at $z = i$, by the residue theorem, the integral of $f(z)$ along the entire contour is $$2\pi i\operatorname{Res}_{z = i} f(z) = 2\pi i\frac{(\log i)^2}{2i} = \pi\left(\frac{\pi}{2}i\right)^2 = -\frac{\pi^3}{4}.$$ On the upper arc, $\lvert (\log z)^2\rvert \le \ln^2 R + \pi^2$ and $\lvert 1 + z^2\rvert \ge R^2-1$. Since the length of the arc is $\pi R$, by the ML inequality the integral of $f(z)$ along this arc is bounded by $$\left(\frac{\ln^2 R + \pi^2}{R^2 - 1}\right)\pi R,$$ which tends to $0$ are $R \to \infty$. Similarly, the integral of $f(z)$ along the lower arc is bounded by $$\left(\frac{\ln^2 \epsilon + \pi^2}{1 - \epsilon^2}\right)\pi \epsilon,$$ which tends to $0$ as $\epsilon \to 0$. Therefore, $$\lim_{\epsilon\to 0,\, R\to \infty} \left(\int_{-R}^{-\epsilon} f(z)\, dz + \int_\epsilon^R f(z)\, dz\right) = -\frac{\pi^3}{4}.\tag{*}$$ For all $z$ in the segment $[-R,-\epsilon]$, $\log z = \ln(-z) + \pi i$; using the parametrization $z = -x$, $\epsilon \le x \le R$, we find $$\int_{-R}^{-\epsilon} f(z)\, dz = \int_{\epsilon}^R \frac{(\ln x + \pi i)^2}{1 + x^2}\, dx = \int_\epsilon^R \frac{(\ln x)^2-\pi^2}{1 + x^2}\, dx + 2\pi i \int_\epsilon^R \frac{\ln x\, dx}{1 + x^2}\, dx.$$ Thus $$\int_{-R}^{-\epsilon} f(z) \, dz + \int_\epsilon^R f(z)\, dz = 2\int_\epsilon^R \frac{(\ln x)^2}{1 + x^2}\, dx - \int_\epsilon^R \frac{\pi^2}{1 + x^2}\, dx + 2\pi i\int_\epsilon^R \frac{\ln x}{1 + x^2}\, dx.$$ By statement (*) we must have $$2\int_0^\infty \frac{(\ln x)^2}{1 + x^2}\, dx - \int_0^\infty \frac{\pi^2}{1 + x^2}\, dx = -\frac{\pi^3}{4},$$ and so $$\int_0^\infty \frac{(\ln x)^2}{1 + x^2}\, dx = \frac{\pi^2}{2}\int_0^\infty \frac{dx}{1 + x^2} - \frac{\pi^3}{8} = \frac{\pi^3}{4} -\frac{\pi^3}{8} = \frac{\pi^3}{8}.$$

  • $\begingroup$ Thanks, this is great! Could you clarify the numerator in the ML inequality? I'm guessing something with the polar form of z and the triangle inequality, but I can't see where the cross term goes off to. $\endgroup$ – user363165 Aug 27 '16 at 3:31
  • $\begingroup$ @user363165 we have $\log z = \ln\lvert z\rvert + i\operatorname{arg}(z)$ where $-\pi < \operatorname{arg}(z) \le \pi$. So since (on the upper arc) $\lvert z\rvert = R$ and $0 \le \operatorname{arg}(z) \le \pi$, then $$\lvert (\log z)^2\rvert = \lvert \log z\rvert^2 = \ln^2 R + \operatorname{arg}(z)^2 \le \ln^2 R + \pi^2$$ $\endgroup$ – kobe Aug 27 '16 at 4:12

An alternative approach. Since

$$\int_{0}^{+\infty}\frac{\log^2 x}{1+x^2}\,dx = 2\int_{0}^{1}\frac{\log^2 x}{1+x^2}\,dx\tag{1}$$ by applying the substitution $x\to\frac{1}{x}$ on the interval $(1,+\infty)$, and $$ \int_{0}^{1} x^k\log^2(x)\,dx = \frac{2}{(k+1)^3} \tag{2}$$ it follows that $$\int_{0}^{+\infty}\frac{\log^2 x}{1+x^2}\,dx = 4\sum_{n\geq 0}^{+\infty}\frac{(-1)^n}{(2n+1)^3} = \color{red}{\frac{\pi^3}{8}}\tag{3} $$ where the last equality is a consequence of this identity involving Euler numbers.

  • $\begingroup$ I think the OP is only interested in the residue solution $\endgroup$ – Yuriy S Aug 23 '16 at 10:20
  • $\begingroup$ Maybe others are not. $\endgroup$ – Jack D'Aurizio Aug 23 '16 at 10:23
  • $\begingroup$ That's a good meta question to ask - but I'm sure the specific question needs to be taken into account, not only the title $\endgroup$ – Yuriy S Aug 23 '16 at 10:27
  • $\begingroup$ @YuriyS: the linked identity exploits the residue theorem, anyway, just in a slight different way, i.e. combined with differentiation under the integral sign. So, not an off-topic answer anyway, I believe. $\endgroup$ – Jack D'Aurizio Aug 23 '16 at 10:29
  • $\begingroup$ Also, there is yet an answer exploiting the residue theorem "the canonical way". So what would be the purpose of essentially writing the same things twice? $\endgroup$ – Jack D'Aurizio Aug 23 '16 at 10:30

Here is another complex analysis approach. First, we note that

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

which can be shown by enforcing the substitution $x\to 1/x$.

Let $I$ be the integral of interest given by

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

We now analyze the integral $J$ given by

$$J=\oint_C \frac{\log^3(z)}{1+z^2}\,dz$$

where $C$ is the classical keyhole contour with the keyhole is along the branch cut, chosen to be the non-negative real axis. First, using the residue theorem, we can write

$$\begin{align} J&=2\pi i \text{Res}\left(\frac{\log^3(z)}{1+z^2}, z=\pm i\right)\\\\ &=2\pi i \left(\frac{\log^3(e^{i\pi/2})}{2i}+\frac{\log^3(e^{i3\pi/2})}{-2i}\right) \\\\ &=i\frac{13\pi^4}{4} \tag 3 \end{align}$$

Note that the integrals over the circular contours centered at the origin and (i) with radius $R \to \infty$ and (ii) with radius $\epsilon \to 0$ around the branch point approach $0$. Hence, we can write

$$\begin{align} J&\to \int_0^\infty \frac{\log^3(x)}{1+x^2}\,dx-\int_0^\infty \frac{(\log(x)+i2\pi)^3}{1+x^2}\,dx\\\\ &=\color{blue}{-i6\pi \int_0^\infty \frac{\log(x)}{1+x^2}\,dx} +\color{red}{12\pi^2\int_0^\infty \frac{\log(x)}{1+x^2}\,dx}+\color{green}{i8\pi^3\int_0^\infty \frac{1}{1+x^2}\,dx}\\\\ &=\color{blue}{-i6\pi \,I}+\color{red}{i8\pi^3\,(0)}+\color{green}{i4\pi^4} \tag 4 \end{align}$$

where we used $(1)$ and $(2)$ to arrive at $(4)$.

Finally, setting $(3)$ and $(4)$ equal and solving for $I$ yields the coveted result



$\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{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{\mathrm{i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\Li}[1]{\,\mathrm{Li}_{#1}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

Note that $\ds{\color{#f00}{\int_{0}^{\infty}{\ln^{2}\pars{x} \over x^{2} + 1}\,\dd x} = \lim_{\mu \to 0}\,\partiald[2]{}{\mu}\int_{0}^{\infty}{x^{\mu} \over x^{2} + 1}\,\dd x}$.

The RHS integral is evaluated along a key-hole contour $\ds{\mc{KH}}$ with the $\ds{z^{\mu}}$-branch cut along the 'negative $\ds{x}$ axis'. Namely, $\ds{-\pi < \,\mrm{arg}\pars{z} < \pi}$.

\begin{align} \int_{\mc{KH}}\,\,{z^{\mu} \over z^{2} + 1}\,\dd z & = 2\pi\ic\pars{{\expo{-\pi\mu\ic/2} \over -\ic - \ic} + {\expo{\pi\mu\ic/2} \over \ic + \ic}} = 2\pi\ic\sin\pars{{\pi \over 2}\,\mu} \label{1}\tag{1} \\[5mm] \mbox{Moreover,} &\ \\ \int_{\mc{KH}}\,\,{z^{\mu} \over z^{2} + 1}\,\dd z & = \int_{-\infty}^{0}{\pars{-x}^{\,\mu}\expo{\pi\mu\ic} \over x^{2} + 1}\,\dd x + \int_{0}^{-\infty}{\pars{-x}^{\,\mu}\expo{-\pi\mu\ic} \over x^{2} + 1}\,\dd x \\[5mm] & = \expo{\pi\mu\ic}\int_{0}^{\infty}{x^{\mu} \over x^{2} + 1}\,\dd x - \expo{-\pi\mu\ic}\int_{0}^{\infty}{x^{\mu} \over x^{2} + 1}\,\dd x \\[5mm] & = 2\ic\sin\pars{\pi\mu}\int_{0}^{\infty}{x^{\mu} \over x^{2} + 1}\,\dd x \label{2}\tag{2} \end{align}

With \eqref{1} and \eqref{2}, $$ \int_{0}^{\infty}{x^{\mu} \over x^{2} + 1}\,\dd x = {2\pi\ic\sin\pars{\pi\mu/2} \over 2\ic\sin\pars{\pi\mu}} = {\pi \over 2}\,\sec\pars{{\pi \over 2}\,\mu} $$ and \begin{align} &\color{#f00}{\int_{0}^{\infty}{\ln^{2}\pars{x} \over x^{2} + 1}\,\dd x} = {\pi \over 2}\,\lim_{\mu \to 0}\,\partiald[2]{\sec\pars{\pi\mu/2}}{\mu} \\[5mm] = &\ {\pi \over 2}\,\lim_{\mu \to 0}\bracks{% {\pi^{2} \over 4}\,\sec^{3}\pars{{\pi \over 2}\,\mu} + {\pi^{2} \over 4}\,\sec\pars{{\pi \over 2}\,\mu} \tan^{2}\pars{{\pi \over 2}\,\mu}} = \color{#f00}{\pi^{3} \over 8} \approx 3.8758 \end{align}


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.