# Calculate $\int _0^\infty \frac{\ln x}{(x^2+1)^2}dx$

Calculate $$\int _0^\infty \dfrac{\ln x}{(x^2+1)^2}dx.$$ I am having trouble using Jordan's lemma for this kind of integral. Moreover, can I multiply it by half and evaluate $\frac{1}{2}\int_0^\infty \frac{\ln x}{(x^2+1)^2}dx$?

• Definitely you can, but what's point? Jul 2 '15 at 10:43
• What do you mean by "what's point"?
– E Be
Jul 2 '15 at 10:45
• I meant what advances will be after multiplying by $1/2$? Jul 2 '15 at 10:46
• It would be easier to evaluate around the upper half plane $\int_{-R}^{R}$ as $R$ goes to $\infty$.
– E Be
Jul 2 '15 at 10:49
• Hint: use $x \to \tan z$ to simplify the integral to $\int_0^{\pi/2}\cos^2z\log\tan z dz$. Jul 2 '15 at 12:16

Here is a 'real-analysis route'.

Step 1. We have $$\int_0^{+\infty}\frac{\ln x}{x^2+1} dx=0 \tag1$$ as may be seen by writing \begin{align} \int_0^{+\infty}\frac{\ln x}{x^2+1} dx&=\int_0^1\frac{\ln x}{x^2+1} dx+\int_1^{+\infty}\frac{\ln x}{x^2+1} dx\\\\ &=\int_0^1\frac{\ln x}{x^2+1} dx-\int_0^1\frac{\ln x}{\frac{1}{x^2}+1} \frac{dx}{x^2}\\\\ &=0. \end{align} Step 2. Assume $a>0$. We have $$\int_0^{+\infty}\frac{\ln x}{x^2+a^2} dx=\frac{\pi}{2}\frac{\ln a}{a} \tag2$$ as may be seen by writing \begin{align} \int_0^{+\infty}\frac{\ln x}{x^2+a^2} dx&= \int_0^{+\infty}\frac{\ln (a \:u)}{(a \:u)^2+a^2} (a \:du)\\\\ &=\frac1a\int_0^{+\infty}\frac{\ln a +\ln u}{u^2+1} du\\\\ &=\frac{\ln a}{a}\int_0^{+\infty}\frac{1}{u^2+1} du+\frac1{a}\int_0^{+\infty}\frac{\ln u}{u^2+1} du\\\\ &=\frac{\ln a}{a}\times \frac{\pi}2+\frac1{a}\times 0\\\\ &=\frac{\pi}{2}\frac{\ln a}{a}. \end{align} Step 3. Assume $a>0$. We have $$\int_0^{+\infty}\frac{\ln x}{(x^2+a^2)^2} dx=\frac{\pi}{4}\frac{\ln a-1}{a^3} \tag3$$ since sufficient conditions are fulfilled to differentiate both sides of $(2)$.

Putting $a:=1$ in $(3)$ gives

$$\int_0^{+\infty}\frac{\ln x}{(x^2+1)^2} dx=\color{blue}{-\frac{\pi}{4}}.$$

• Well done. But I don't understand your reasoning in step 3. Could you explain it?
– E Be
Jul 2 '15 at 13:44
• @OlivierOloa "Feynman's Trick" comes to the rescue once more! +1 Jul 2 '15 at 15:21
• Nice alternative to complex analysis approach! (+1) Jul 2 '15 at 15:21
• @UdiBehar Yes, the explanation for step 3 is the following. On the left hand side of $(2)$, differentiating under the integral sign gives $$\partial_a \left(\frac{\ln x}{x^2+a^2}\right)=-2a \frac{\ln x}{(x^2+a^2)^2}$$ On the right hand side of $(2)$, differentiating gives $$\partial_a \left(\frac{\pi}{2}\frac{\ln a}{a} \right)=\frac{\pi}{2}\frac{1-\ln a}{a^2}.$$ Thus, identifying, we obtain $(3)$. Hoping it is Ok for you. Thanks! Jul 2 '15 at 18:21

Here is how to do it using complex analysis.

First of all in this case you can't compute $\frac{1}{2}\int_{-\infty}^\infty \frac{\ln x}{(x^2+1)^2}$ since it does not equal your integral (why?).

Now take $R>1$, $r<1$ and $\gamma$ a "keyhole" contour as shown below Lets take the branch cut of the logarithm with domain $\mathbb{C} \setminus \{iy: y \leq 0\}$, in which one $\ln(x) \in \mathbb{R}$ if $x \in \mathbb{R}^+$.

Now, on one side the Residue theorem tells us that if $f(z)=\frac{\ln(z)}{(z^2+1)^2}$ $$\int_\gamma f(z)dz = 2\pi i \cdot \text{Res}(f(z), i) = 2\pi i \left( \lim_{z\to i} \frac{d}{dz}\left[ (z-i)^2 \frac{\ln(z)}{(z+1)^2(z-i)^2}\right]\right) = -\frac{\pi}{2}+ i \frac{\pi^2}{4}$$ On the other side is easily seen that the integral over the half semicircle connecting $R$ with $-R$ (lets call it $I_{C_1}$) goes to zero as $R$ goes to infinity, since $$|I_{C_1}|=\left|\int_0^\pi \frac{\ln(Re^{it})iRe^{it}}{(R^2e^{2it}+1)^2}dt\right| \underset{R \to \infty}{\longrightarrow} 0$$ And that the one over semicircle connecting $-r$ with $r$ (this one will be called $I_{C_2}$) goes to zero as $r$ goes to $0$ because $$|I_{C_2}|=\left|\int_\pi^0 \frac{\ln(re^{it})ire^{it}}{(r^2e^{2it}+1)^2}dt\right| \underset{r \to 0}{\longrightarrow} 0$$ Hence \begin{align} \int_\gamma f(z)dz & = \int_r^R \frac{\ln(x)}{(x^2+1)^2}dx + \int_{-R}^{-r} \frac{\ln(x)}{(x^2+1)^2}dx + I_{C_1} + I_{C_2} \\ & = \int_r^R \frac{\ln(x)}{(x^2+1)^2}dx - \int_{R}^{r} \frac{\ln(-y)}{(y^2+1)^2}dy + I_{C_1} + I_{C_2}\\ & = \int_r^R \frac{\ln(x)}{(x^2+1)^2}dx + \int_{r}^{R} \frac{\ln(-y)}{(y^2+1)^2}dy + I_{C_1} + I_{C_2}\\ & = \int_r^R \frac{\ln(x)}{(x^2+1)^2}dx + \int_{r}^{R} \frac{\ln|y| + i \pi}{(y^2+1)^2}dy + I_{C_1} + I_{C_2}\\ & = 2\int_r^R \frac{\ln(x)}{(x^2+1)^2}dx + i \pi \underbrace{\int_{r}^{R} \frac{dy}{(y^2+1)^2} }_{J}+ I_{C_1} + I_{C_2}\\ \end{align} However, as an indefinite integral $J$ can be compute by trigonometric substitution, as follows, let $y=\tan(u)$ then $$\int \frac{dy}{(y^2+1)^2} = \int \cos^2(u) du = \frac{1}{4}\sin(2u)+\frac{1}{2}u = \frac{1}{4}\sin(2\tan^{-1}(y))+\frac{1}{2}\tan^{-1}(y)$$ Hence we have $$\lim_{R\to \infty}\lim_{r\to 0}J=\int_0^\infty \frac{dy}{(y^2+1)^2} = \frac{1}{4}\sin(\pi)+\frac{\pi}{4} - \left( \frac{1}{4}\sin(0)+0\right) = \frac{\pi}{4}$$ Therefore, finally we conclude that \begin{align} -\frac{\pi}{2}+ i \frac{\pi^2}{4} & = \lim_{R\to \infty}\lim_{r\to 0} \left( \int_\gamma f(z)dz \right) \\ & = \lim_{R\to \infty}\lim_{r\to 0} \left( 2\int_r^R \frac{\ln(x)}{(x^2+1)^2}dx + i \pi \int_{r}^{R} \frac{dy}{(y^2+1)^2}+ I_{C_1} + I_{C_2}\right) \\ & = 2 \int_0^\infty \frac{\ln(x)}{(x^2+1)^2}dx + i \pi \left(\frac{\pi}{4}\right) + 0 + 0 \end{align}

Thus $$\int_0^\infty \frac{\ln(x)}{(x^2+1)^2}dx = \frac{1}{2}\left( -\frac{\pi}{2}+ i \frac{\pi^2}{4} -i \frac{\pi^2}{4} \right) = -\frac{\pi}{4}$$

• it seems that our approachs are quite close Jul 3 '15 at 9:56
• @tired Yes they are essentially the same answer, perhaps the advantage on mine is that one only need to compute the residue at $z=i$ instead of the two residues as you did ! Jul 3 '15 at 17:27

A faster complex analysis computation: rewrite the integral as the real part of a contour integral $$I=\frac12\Re \int_C\frac{\ln z\,dz}{\left(z^2+1\right)^2},$$ where $C$ goes from $-\infty$ to $\infty$ slightly above the negative part of the real axis ($\Re$ kills the imaginary part of the logarithm). But now all we have to do is to pull $C$ to $i\infty$ so that $$I=\frac12\Re\left(2\pi i \operatorname{res}_{z=i}\frac{\ln z}{\left(z^2+1\right)^2}\right)=-\frac{\pi}{4}.$$

Let's look at the complex function

$$f(z)=\frac{\log^2(z)}{(z^2+1)^2}$$

First observe that (putting the branch cut along the positive real axis) for $x>0$ $$f(x+i \delta)=\frac{\log^2(x)}{(x^2+1)^2}\\ f(x-i \delta)=\frac{\log^2(x)+4\pi i \log(x)-4\pi^2}{(x^2+1)^2}\quad (*)\\$$

with $\delta\rightarrow0_+$

You may integrate $f(z)$ around a keyhole contour with slit along the positive real axis. It holds by residue theorem, that

$$\oint f(z)dz=\int_0^{\infty}f(x+i \delta)dx+\int_{\infty}^0f(x-i \delta)dx+\\\lim_{r\rightarrow0}r\int_{\psi\in[3\pi/2,\pi/2]}e^{i\psi}f(r e^{i\psi})d\psi+\lim_{R\rightarrow\infty}R\int_{\phi\in(0,2\pi]}e^{i\phi}f(Re^{i\phi})d\phi\\=2\pi i\sum_i\text{res}(f(z),z=z_i)$$

It is easily shown that the last two contributions, which are the small semic circle around the origin and the big circle which closes the contour, vanish. Furthermore we know that the residues are located at $z_i=\pm i$.

So using (*) we can conclude that (the sum of residues is straightforwardly calculated by $\text{res}(f(z),z_0)=\lim_{z\rightarrow z_0 }\partial_z[(z-z_0) f(z)]$ if one has in mind that $\log(i)=\pi/2$ and $\log(-i)=\frac{3\pi i}{2}$ for our choice of branches)

$$-4\pi i\int_0^{\infty}\frac{ \log(x)}{(x^2+1)^2}+4\pi^2\underbrace{\int_0^{\infty}\frac{1}{(x^2+1)^2}}_{J}=\pi^3+i\pi^2$$

where $J$ can be calculated through $$J=-\partial_a\int_0^{\infty}\frac{1}{x^2+a}\big|_{a=1}=-\partial_a\frac{\pi }{2 \sqrt{a}}\big|_{a=1}=\frac{\pi}{4}$$

Now we are ready to state our final result: $$\int_0^{\infty}\frac{\log(x)}{(x^2+1)^2}=\frac{1}{-4\pi i }\left(i \pi^2-4\pi^2 \frac{\pi}{4}+\pi^3\right)=-\frac{\pi}{4}$$

in agreement with @Olivier Oloa's answer

\begin{align} I&=\int _0^\infty \dfrac{\ln x}{(x^2+1)^2}dx\\ &=\int _0^1 \dfrac{\ln x}{(x^2+1)^2}dx+\int _1^\infty \dfrac{\ln x}{(x^2+1)^2}dx\\ &=\int _0^1 \dfrac{\ln x}{(x^2+1)^2}dx-\int _0^1 \dfrac{x^2\ln x}{(x^2+1)^2}dx\\ &=\int _0^1 \dfrac{(1-x^2)\ln x}{(x^2+1)^2}dx\\ &=\int _0^1 \sum_{j=0}^{\infty}(-1)^j (2 j+1) x^{2 j}\ln xdx\\ &=\sum_{j=0}^{\infty}(-1)^j (2 j+1)\int _0^1 x^{2 j}\ln xdx\\ &=-\sum_{j=0}^{\infty}(-1)^j \frac{2 j+1}{(2j+1)^2}\\ &=-\sum_{j=0}^{\infty}(-1)^j \frac{1}{2j+1}\\ &=-\frac{\pi}{4} \end{align} where at last you may recall the expansion for $\arctan$.

• Well done! (+1) Jul 10 '15 at 22:02
• Many thanks Olivier! Jul 11 '15 at 8:06