# Integrate: $\int_0^\infty \frac{\log(x)}{(1+x^2)^2} \, dx$ without using complex analysis methods

Can this integral be solved without using any complex analysis methods: $$\int_0^\infty \frac{\log(x)}{(1+x^2)^2} \, dx$$

Thanks.

• Have you tried integrating by parts? Nov 25, 2013 at 22:43
• Can you tell where you're stuck? Nov 25, 2013 at 23:47

[Corrected and justified]

The change of variables $x = e^{-t}$ converts the integral to $-\int_{-\infty}^\infty te^{-t} dt \left/(1+e^{2t})^2 \right.$. Splitting into $\int_{-\infty}^0 + \int_0^\infty$ and combining $t$ with $-t$ yields $$- \int_0^\infty \frac{t(e^{-t}-e^{-3t})dt}{(1+e^{-2t})^2} = -\int_0^\infty t(e^{-t} - 3e^{-3t} + 5e^{-5t} - 7e^{-7t} + - \cdots) \, dt.$$ Integrating termwise yields $-(1 - \frac13 + \frac15 - \frac17 + - \cdots) = -\pi/4$. Termwise integration requires some justification because the sum does not converge absolutely, but no complex analysis is needed.

One way to justify the termwise integration in this setting is to write the integral as the limit as $N \rightarrow \infty$ of $$- \int_0^\infty \frac{t(e^{-t}-e^{-3t}-2e^{-(4N+1)t})dt}{(1+e^{2t})^2}.$$ Expanding $(e^{-t}-e^{-3t}-2e^{-(4N+1)t}) \left/ (1+e^{-2t})^2 \right.$ in powers of $e^{-t}$, and integrating termwise, yields $$S_N := -\left( 1 - \frac 13 + \frac15 - \frac17 + - \cdots \right. \phantom{\infty\infty\infty\infty\infty\infty\infty\infty\infty\inftyinfty\infty\infty}$$ $$\phantom{\infty\infty\infty\infty\infty} \left. - \frac1{4N-1} + \frac{4N-1}{(4N+1)^2} - \frac{4N-1}{(4N+3)^2} + \frac{4N-1}{(4N+5)^2} - \frac{4N-1}{(4N+7)^2} + - \cdots \right),$$ this time justified by absolute convergence. The series $S_N$, like $-(1 - \frac13 + \frac15 - \frac17 + - \cdots)$, is an alternating series whose terms decrease in absolute value. The two series agree through the $1/(4N-1)$ term, and both remainders are bounded in absolute value by $1/(4N+1)$. Therefore as $N \rightarrow \infty$ the new series $S_N$ approaches $-(1 - \frac13 + \frac15 - \frac17 + - \cdots) = -\pi/4$, and we're done.

• Could you precisely justify why we can swap integral with series?
– 3dok
Nov 25, 2013 at 23:36
• I just wrote out one approach (after fixing the main derivation...). Nov 26, 2013 at 0:45

Once you do the variable change in Ron Gordon's answer there's a trick that finishes it off pretty quickly. The integral is reduced to $$\int_0^1 {1 - x^2 \over (1 + x^2)^2}\log(x)\,dx$$ $$= \int_0^1 {{1\over x^2} - 1 \over ({1 \over x} + x)^2}\log(x)\,dx$$ Note that ${{1\over x^2} - 1 \over ({1 \over x} + x)^2}$ is the derivative of ${\displaystyle{1 \over {1 \over x } + x}}$. So it's natural to integrate by parts in the above, and get $$-\int_0^1{1 \over {1 \over x} + x} {1 \over x}\,dx$$ (The boundary terms here are both zero). This is the same as $$-\int_0^1 {1 \over 1 + x^2}\,dx$$ $$= -{\pi \over 4}$$

• Nifty...didn't notice that. Nov 26, 2013 at 5:48

So, consider the following:

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

Sub $x \mapsto 1/x$ in the latter integral on the RHS and get that

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

Note that

$$\frac{1-x^2}{(1+x^2)^2} = \sum_{m=0}^{\infty} (-1)^m (2 m+1) x^{2 m}$$

So we get

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

Using the fact that

$$\int_0^1 dx \, x^{2 m} \log{x} = -\frac{1}{(2 m+1)^2}$$

we get that

$$\int_0^{\infty} dx \frac{\log{x}}{(1+x^2)^2} = -\sum_{m=0}^{\infty} \frac{(-1)^m}{2 m+1} = -\frac{\pi}{4}$$

• Does one need to justify the interchanging of sum and limit here? Nov 26, 2013 at 0:47
• @CameronWilliams: kind of a loaded question - of course we have to justify it! The question you want to ask is, is it self-evident? Well, the sum converges for all $x$ in the integration region, and each integral converges, so by some principle that I cannot name off the top of my head, we should be able to interchange the sum and integral. Nov 26, 2013 at 0:52
• That's exactly what I thought. I was just making sure that I wasn't off base. Nov 26, 2013 at 0:54
• Actually I think the justification is not immediate here because the sum does not converge absolutely. (That's the same issue that I noted at the end of my answer $-$ indeed our derivations (now that I've corrected mine) are basically isomorphic under $x=e^{-t}$.) Nov 26, 2013 at 1:11
• @NoamD.Elkies: I figured something like that, as we ended up in the same place (the Gregory sum). I see, you are right, the sum isn't absolutely convergent. I guess one way to justofy is to use a finite sum and then take the limit as the number of terms becomes infinite See math.stackexchange.com/questions/83721/… Nov 26, 2013 at 1:17

Here is an approach.

$$F(s)= \int_{0}^{\infty}\frac{x^{s-1}}{(1+x^2)^2}dx= -\frac{1}{4}\,{\frac { \left( s-2 \right) \pi }{\sin \left(\pi \,s/2 \right) }}$$

$$\implies F'(s)= \int_{0}^{\infty}\frac{x^{s-1}\ln(x)}{(1+x^2)^2}dx= -\frac{1}{4}\,\frac{d}{ds}{\frac { \left( s-2 \right) \pi }{\sin \left(\pi \,s/2 \right) }} .$$

Now, differentiate and take the limit as $s\to 1$. The answer should be $-\frac{\pi}{4}$.

Note: Here is the technique how you find $F(s)$. It is based on the $\beta$ function.

• This is pretty, but then we still need to evaluate the definite integral $\int_0^\infty x^{s-1} dx/(1+x^2)^2$ without complex analysis. Nov 25, 2013 at 22:53
• @NoamD.Elkies: See the note. Nov 25, 2013 at 22:56
• Hm, so this comes down to the identity $\Gamma(s) \Gamma(1-s) = \pi \, / \sin \pi s$, which is most easily/usually proved via complex analysis, though yes, you can prove the product formulas for $\Gamma$ and $\sin$ in other ways (the former via Bohr-Mollerup) $-$ so technically you're right, though it's still a lot of theory to establish for one integral. Nov 25, 2013 at 23:01
• @NoamD.Elkies: that is a very well-known identity. Not sure how much of the wheel needs to be reinvented here. For example, you didn't prove your termwise identity...and nobody should ask you to, as it is well known. Nov 25, 2013 at 23:17

Here is a rather elementary method to approach this problem:

Consider $$I(a)= \int^{\infty}_0 \frac{\log(x)}{x^2+a^2} \,\mathrm{d}x$$ Realize that on differentiating under the integral sign with respect to $a$, we have $$I'(a)= \int^{\infty}_0 -2a. \frac{\log(x)}{(x^2+a^2)^2} \,\mathrm{d}x$$

It follows that the required integral $$\int^{\infty}_0 \frac{\log(x)}{(x^2+1)^2} \mathrm{d}x = \frac{-I'(1)}{2}.$$

Now, let us calculate $I(a)$. Set $x=a \tan(\theta)$ where $a>0$. Thus, $$I(a)= \int^{\frac{\pi}{2}}_0 \log(a \tan\theta) \,\mathrm{d}\theta$$

$$I(a)= \int^{\frac{\pi}{2}}_0 \log(a) + \log( \tan\theta) \,\mathrm{d}\theta$$

It is trivial (by replacing $\theta$ with $\frac{\pi}{2}-\theta$) to show that $$\int^{\frac{\pi}{2}}_0 \log( \tan\theta) \,\mathrm{d}\theta = 0.$$

Thus, $$I(a)= \int^{\frac{\pi}{2}}_0 \log(a) \, \mathrm{d}\theta = \frac{\pi \log(a)}{2a}$$

And, $$I'(a)=\frac{\pi}{2a^2} (1-\log(a))$$

Finally, the required integral is $$\int^{\infty}_0 \frac{\log(x)}{(x^2+1)^2} \,\mathrm{d}x = \frac{-I'(1)}{2}=-\frac{\pi}{4}$$

And we are done.

$x \to 1/x$. We then have $$I = \int_0^{\infty}\dfrac{\log(x)}{(1+x^2)^2}dx = \int_0^1\dfrac{\log(x)}{(1+x^2)^2}dx + \int_1^{\infty}\dfrac{\log(x)}{(1+x^2)^2}dx$$ $$\int_1^{\infty}\dfrac{\log(x)}{(1+x^2)^2}dx = \int_1^0 \dfrac{x^2\log(x)}{(1+x^2)^2}dx$$ Hence, $$I = \int_0^1 \dfrac{1-x^2}{(1+x^2)^2}\log(x)dx = \int_0^1 (1-x^2)\left(\sum_{k=0}^{\infty} (k+1)(-1)^k x^{2k} \right)\log(x)dx$$ We now have $$\int_0^1 x^{2n} \log(x) dx = -\dfrac1{(2n+1)^2}$$ Hence, $$I = \sum_{k=0}^{\infty}(k+1)(-1)^k\left(-\dfrac1{(2k+1)^2} + \dfrac1{(2k+3)^2}\right)= -\dfrac{\pi}4$$

To get the last step, note that $$(k+1)\left(\dfrac1{(2k+1)^2} - \dfrac1{(2k+3)^2}\right) = \dfrac14 \left(\dfrac1{2k+1} - \dfrac1{2k+3} + \dfrac1{(2k+1)^2} + \dfrac1{(2k+3)^2} \right)$$

Use the Beta function (all results regarding $\beta$ are derivable by real methods)!

$$\beta (x,y)\stackrel{1}{=}\int_{0}^{\infty}\frac{t^{x-1}dt}{(1+t)^{x+y}}\stackrel{2}{=}\frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}$$ , and letting $y=2-x$ and $t=u^2$ in the first equality, $$\beta(x,2-x)=2\int_{0}^\infty\frac{u^{2x-1}du}{(1+u^2)^2}.$$ If we differentiate this with respect to $x$ (c.f. Leibniz integral rule), we obtain $$\frac{d}{dx}\beta(x,2-x)=2\int_0^\infty\frac{\partial}{\partial x}\frac{u^{2x-1}du}{(1+u^2)^2}$$ $$=4\int_0^\infty \log(x)\frac{u^{2x-1}du}{(1+u^2)^2}.$$ To kill the $u$ term in the numerator, let $x=\frac{1}{2}$, divide by four, and use the second equality: $$I=\int_0^\infty \frac{\log(u)du}{(1+u^2)^2}=\frac{1}{4}\frac{d}{dx} \beta\left(\frac{1}{2}, \frac{3}{2}\right)$$ $$=\frac{1}{4}\frac{d}{dx}\frac{\Gamma(x)\Gamma(2-x)}{\Gamma(2)}_{x=2}.$$ Obviously $\Gamma(2)=1!=1$, and $\Gamma(x)\Gamma(1-x)=\frac{\pi}{\sin(\pi x)}$, together with $\Gamma(2-x)=(1-x)\Gamma(1-x)$, $$I=\frac{1}{4} \frac{d}{dx}(1-x) \frac{\pi}{\sin( \pi x)}=\frac{-\pi}{4}.$$

This method is easily applied to the integral $$I(a,b,c)=\int_0^\infty \frac{\log^a(u)du}{(1+u^b)^c}, a \in \mathbb{N}, c \text{ is a nice number},$$ make the substitution $t=u^b$ in equality $1$, let $y=c-x$ and differentiate $a$ times with respect to $x$ (in fact, I strongly suspect partial derivatives could be used to drop the restriction that $a \in \mathbb{N}$, although I'm not sure whether partial derivatives of the Gamma function are well known). Then all that remains is to find a nicer form for $\Gamma(x)\Gamma(c-x)$ which you can take the $a$th derivative of, which mostly exists only for integral or some rational values of $c$, which is why I stipulated that $c$ has to be nice.

$\newcommand{\+}{^{\dagger}} \newcommand{\angles}{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\down}{\downarrow} \newcommand{\ds}{\displaystyle{#1}} \newcommand{\expo}{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\isdiv}{\,\left.\right\vert\,} \newcommand{\ket}{\left\vert #1\right\rangle} \newcommand{\ol}{\overline{#1}} \newcommand{\pars}{\left(\, #1 \,\right)} \newcommand{\partiald}[]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[]{\,\sqrt[#1]{\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}{\underline{#1}} \newcommand{\verts}{\left\vert\, #1 \,\right\vert} \newcommand{\wt}{\widetilde{#1}}$ $\ds{\int_{0}^{\infty}{\ln\pars{x} \over \pars{1 + x^{2}}^{2}}\,\dd x:\ {\large ?}}\quad$ " without using any complex analysis methods$\ds{\ldots}$ "

1. First, we evaluate the integral $\ds{\pars{~\mbox{with}\ \mu > 0~}}$: \begin{align} \int_{0}^{\infty}{\ln\pars{x} \over \mu + x^{2}}\,\dd x& ={1 \over \root{\mu}} \int_{0}^{\infty}{\ln\pars{\root{\mu}\bracks{x/\root{\mu}}} \over 1 + \pars{x/\root{\mu}}^{2}}\,{\dd x \over \root{\mu}} ={1 \over \root{\mu}} \int_{0}^{\infty}{\ln\pars{\root{\mu}x} \over 1 + x^{2}}\,\dd x \\[3mm]&={\ln\pars{\mu} \over 2\root{\mu}}\ \underbrace{\int_{0}^{\infty}{\dd x \over 1 + x^{2}}}_{\ds{\pi \over 2}}\ +\ {1 \over \root{\mu}}\ \underbrace{\int_{0}^{\infty}{\ln\pars{x} \over 1 + x^{2}}\,\dd x}_{\ds{0}} \qquad\qquad\qquad\pars{1} \end{align}
• The first integral in $\pars{1}$ right hand side is trivially found with the change of variables $\ds{x = \tan\pars{\theta}}$.
• In the second one, we make the change $\ds{x \mapsto 1/x}$ such that the integral just changes its sign. It shows that it vanishes out.
$$\begin{array}{|c|}\hline\\ \ds{\quad\int_{0}^{\infty}{\ln\pars{x} \over \mu + x^{2}}\,\dd x ={\ln\pars{\mu} \over \root{\mu}}\,{\pi \over 4}\quad} \\ \\ \hline \end{array}\tag{2}$$
2. Second, differentiate both members of $\pars{2}$ respect of $\ds{\mu}$: $$-\int_{0}^{\infty}{\ln\pars{x} \over \pars{\mu + x^{2}}^{2}}\,\dd x =\bracks{{1 \over \mu^{3/2}} - {\ln\pars{\mu} \over 2\mu^{3/2}}}\,{\pi \over 4}$$
3. Then, set $\ds{\mu = 1}$ in both members: $$\color{#66f}{\large% \int_{0}^{\infty}{\ln\pars{x} \over \pars{1 + x^{2}}^{2}}\,\dd x =-\,{\pi \over 4}}$$

An alternative approach is to enforce the substitution $x=\tan\theta$ then exploit the fact that the Fourier (cosine) series of $\log\tan\theta$ and $\cos^2\theta$ are pretty simple. Since for any $\theta\in\left(0,\frac{\pi}{2}\right)$ $$\log\tan\theta = 2\sum_{k\geq 0}\frac{\cos((4k+2)\theta)}{(2k+1)} \tag{A}$$ $$\cos^2\theta = \frac{1}{2}+\frac{\cos(2\theta)}{2} \tag{B}$$ $$\int_{0}^{\pi/2}\cos(2m\theta)\cos(2n\theta)\,d\theta =\frac{\pi}{4}\delta(m,n)\tag{C}$$ the identity $$\int_{0}^{+\infty}\frac{\log(x)}{(1+x^2)^2}\,dx = \color{red}{-\frac{\pi}{4}}$$ is a straightforward consequence of $(C)$.

This approach also shows that $\int_{0}^{1}\frac{\log(x)}{(1+x^2)^{k+1}}\,dx$ just depends on the binomial transform of $\frac{(-1)^k}{2k+1}$. As shown here, the binomial transform of $\frac{1}{2k+1}$ is given by $\frac{4^k}{(2k+1)\binom{2k}{k}}$. With similar techniques one may prove that for any $k\in\mathbb{N}^+$

$$\int_{0}^{+\infty}\frac{\log(x)\,dx}{(1+x^2)^{k+1}}=\color{red}{-\frac{\pi\binom{2k}{k}}{2\cdot 4^k}\sum_{m=1}^{k}\frac{1}{2m-1}}\approx -\frac{\sqrt{\pi}\log(2k)}{4\sqrt{k}}\tag{D}$$ which, of course, also follows by applying Feynman's trick to the integral representation of the Beta function.

A really easy method using the substitution $x=\tan t$ offered by Jack D'Aurizio but followed by elementary integration by parts without using Fourier series.

\begin{align} &\int_0^\frac{\pi}{2}\cos^2x\ln\tan x dx=\frac12 \int_0^\frac\pi2 \cos2x\ln\tan xdx\\ =&\frac14\sin2x\ln\tan x\bigg|^\frac{\pi}{2}_0-\frac14\int_0^\frac{\pi}2\frac{\sin 2x}{\sin x \cos x}dx=-\frac14\int_0^\frac\pi22dx=\color{blue}{-\frac\pi 4} \end{align}

Integrate by parts \begin{align} & \int_0^\infty \frac{\log x}{(1+x^2)^2} dx =\int_0^\infty \frac{\log x}{2x}d\left( \frac{x^2}{1+x^2} \right) \\ \overset{IBP}= &-\frac12 \int_0^\infty \frac{1}{1+x^2}dx+\frac12 \int_0^\infty \underset{x\to \frac1x} {\frac{\log x}{1+x^2}}dx = -\frac12\cdot\frac\pi2+0= -\frac{\pi}4 \end{align}