# Evaluating $\int _0^\infty\,\frac{\ln x}{(1+x^2)^2}\,\text{d}x$ using the Residue Theorem

To evaluate this integral $$\int\limits_0^\infty\frac{\ln x}{(1+x^2)^2} \text{d}x\,,$$

Let us consider the following function. $$f(z)=\frac{\ln^2 z}{(1+z^2)^2}=\frac{\ln^2 z}{(z+i)^2(z-i)^2}\,.$$ The integral over $C_R$ and $C_\epsilon$ vanish as $R$ approaches $\infty$ and $\epsilon$ approaches $0$. So we only need to evaluate the residues $$\oint\limits_C f(z)dz = 2\pi i \sum \text{Res}\big(f(z)\big)\,.$$

The poles are $\pm i$ and of second order. Here is our chosen contour.

Let us recall the residue of an $m$-th order of pole is $$\text{Res}[f(z);z_0]=\frac{1}{(m-1)!}\lim_{z\to z_0} \frac{\text{d}^{m-1}}{\text{d}z^{m-1}}\,(z-z_0)^m\,f(z)\,.$$

Consequently the residues are $$\text{Res}[f(z);i]=\lim_{z \to i}\Bigg(\frac{2\ln z}{z(z+i)^2}-\frac{2\ln^2 z}{(z+i)^3}\Bigg)=\frac{2\cdot \left(\frac{i\pi}{2}\right)}{-4i}-\frac{2\cdot (-\frac{\pi^2}{4})}{-8i}=-\frac{\pi}{4}+i\frac{\pi^2}{16}$$ As for the other pole $$\text{Res}[f(z);-i]=\lim_{z \to -i}\Bigg(\frac{2\ln z}{z(z-i)^2}-\frac{2\ln^2 z}{(z-i)^3}\Bigg)=\frac{2\cdot \left(\frac{i3\pi}{2}\right)}{4i}-\frac{2\cdot \left(-\frac{9\pi^2}{4}\right)}{8i}=\frac{3\pi}{4}-i\frac{9\pi^2}{16}\,.$$

Adding these two together and remembering the residue theorem, we have $$\oint\limits_C f(z)\,\text{d}z = 2\pi i \cdot \left(\frac{\pi}{2}-i\frac{\pi^2}{2}\right)=i\pi^2+\pi^3$$ On the other hand, for the integrals over $C_+$ and $C_-$, $z=x$ and $z=xe^{2\pi i}$ respectively. Hence, we can write $$\int\limits_\epsilon^R\frac{\ln^2 x}{(1+x^2)^2} \,\text{d}x + \int\limits_R^\epsilon \frac{(\ln x +2\pi i)^2}{(1+x^2)^2} \,\text{d}x=i\pi^2+\pi^3\,.$$ If we let $R \to \infty$ and $\epsilon \to 0$ and change the direction of the second integral, we get $$-4\pi i\int\limits_0^\infty\frac{\ln x}{(1+x^2)^2}\,\text{d}x + 4\pi^2\int\limits_0^\infty\frac{\text{d}x}{(1+x^2)^2}=i\pi^2+\pi^3\,.$$

Comparing the real and the imaginary parts $$\int\limits_0^\infty\frac{\ln x}{(1+x^2)^2}\,\text{d}x = -\frac{\pi}{4}$$ $$\int\limits_0^\infty\frac{\text{d}x}{(1+x^2)^2} = \frac{\pi}{4}$$

• Aren't you ignoring the singularity of $\ln z$ at zero? – uniquesolution Jul 26 '18 at 7:18
• @Skiver You have a mistake, but it's kind of hard to explain. See my edit in your question. – Batominovski Jul 26 '18 at 8:09
• No I don't think ignored the singularity of $\ln z$ at zero. And @Batominovski your suggestion works. But as to why $e^{-i\pi/2}$ and $e^{i3\pi/2}$ are not the same in this case, I don't understand. I'm self teaching complex variables. Thank you for your answer. :) – Skiver Jul 26 '18 at 9:19
• There is not a unique complex logarithm. From your contour, you want your $\ln(z)$ to be holomorphic on $\mathbb{C}\setminus \mathbb{R}_{\geq 0}$. Hence, the branch cut is the positive real line. In this case, $\ln(z)=\ln(r)+\text{i}\theta$ if $z=r\exp(\text{i}\theta)$ with $\theta\in[0,2\pi)$. If you use the usual $\ln(z)$ where the argument is between $-\pi$ and $\pi$, then you cannot use the Residue Theorem, at least not with your contour, since the contour crosses the branch cut. – Batominovski Jul 26 '18 at 9:37
• Oh, I see now. Silly me. I understand my mistake completely now. Thanks a lot ;) – Skiver Jul 26 '18 at 9:40

## 2 Answers

Let $f(z):=\dfrac{\big(\ln(z)\big)^2}{\left(1+z^2\right)^2}$ for $z\in\mathbb{C}\setminus\mathbb{R}_{\leq 0}$ (i.e., the chosen branch cut of $\ln(z)$ is the negative real line). For a real number $\epsilon$ such that $0<\epsilon<1$, define $\gamma_\epsilon$ to be the contour $$\left[\epsilon,\frac{1}{\epsilon}\right]\cup A_\epsilon \cup \left[\frac{1}{\epsilon}\,\exp\big(\text{i}(\pi-\epsilon)\big),\epsilon\,\exp\big(\text{i}(\pi-\epsilon)\big)\right]\cup A'_\epsilon\,,$$ where $A_\epsilon$ is the arc in the upper half-plane (namely, the set of complex numbers with nonnegative imaginary parts) of the circle centered at $0$ with radius $\frac{1}{\epsilon}$ starting from $\frac{1}{\epsilon}$ to $\frac{1}{\epsilon}\,\exp\big(\text{i}(\pi-\epsilon)\big)$ (i.e., in the counterclockwise direction), and $A'_\epsilon$ is the arc in the upper half-plane of the circle centered at $0$ with radius $\epsilon$ starting from $\epsilon\,\exp\big(\text{i}(\pi-\epsilon)\big)$ to $\epsilon$ (i.e., in the clockwise direction).

We note that $$\lim_{\epsilon\to0^+}\,\oint_{\gamma_\epsilon}\,f(z)\,\text{d}z=2\pi\text{i}\,\text{Res}_{z=\text{i}}\big(f(z)\big)=2\pi\text{i}\,\left(-\frac{\pi}{4}+\frac{\pi^2\text{i}}{16}\right)=-\frac{\pi^3}{8}-\frac{\pi^2\text{i}}{2}\,.$$ Furthermore, $$\lim_{\epsilon\to0^+}\,\oint_{\gamma_\epsilon}\,f(z)\,\text{d}z=2\pi\text{i}\,\int_0^\infty\,\frac{\ln(x)}{\left(1+x^2\right)^2}\,\text{d}x+\,\int_0^\infty\,\frac{2\big(\ln(x)\big)^2-\pi^2}{\left(1+x^2\right)^2}\,\text{d}x\,.$$ Consequently, $$\int_0^\infty\,\frac{\ln(x)}{\left(1+x^2\right)^2}\,\text{d}x=\frac{1}{2\pi\text{i}}\left(-\frac{\pi^2\text{i}}{2}\right)=-\frac{\pi}{4}\,.$$

In fact, with the same contour, we can see that $$\int_0^\infty\,\frac{1}{\left(1+x^2\right)^2}\,\text{d}x=\pi\text{i}\,\text{Res}_{z=\text{i}}\left(\frac{1}{\left(1+z^2\right)^2}\right)=\pi\text{i}\,\left(-\frac{\text{i}}{4}\right)=\frac{\pi}{4}\,.$$ Therefore, $$\int_0^\infty\,\frac{\big(\ln(x)\big)^2}{\left(1+x^2\right)^2}\,\text{d}x=\frac{\pi^2}{2}\,\int_0^\infty\,\frac{1}{\left(1+x^2\right)^2}\,\text{d}x-\frac{\pi^3}{16}=\frac{\pi^3}{8}-\frac{\pi^3}{16}=\frac{\pi^3}{16}\,.$$

Although the OP is specifically asking to evaluate the integral using the residue theorem, I thought it might be instructive and of interest to present a way forward using real analysis only. It is to that end that we proceed.

Enforcing the substitution $x\mapsto \sqrt x$ reveals

\begin{align} \int_0^\infty \frac{\log(x)}{(1+x^2)^2}\,dx&=\frac14\int_0^\infty \frac{\log(x)}{\sqrt{x}(1+x)^2}\,dx\\\\ &=\frac14\left.\left(\frac{d}{dt}\int_0^\infty \frac{x^t}{(1+x)^2}\,dx\right)\right|_{t=-1/2}\\\\ &=\frac14\left.\left(\frac{d}{dt}B\left(t+1,1-t\right)\right)\right|_{t=-1/2}\\\\ &=\frac14\left.\left(\frac{d}{dt}\frac{\Gamma(1+t)\Gamma(1-t)}{\Gamma(2)}\right)\right|_{t=-1/2}\\\\ &=\frac14\left.\frac{d}{dt}\left(t\Gamma(t)\Gamma(1-t)\right)\right|_{t=-1/2}\\\\ &=\frac14\left.\frac{d}{dt}\left(\frac{t\pi}{\sin(\pi t)}\right)\right|_{t=-1/2}\\\\ &=\frac\pi4 \end{align}