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

[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.


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 ${\displaystyle {{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}$$


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}$$


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.


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.