Why is $\int_{0}^{\infty} \frac {\ln x}{1+x^2} \mathrm{d}x =0$?

When I see an $1 + x^2$ in the denominator it's tempting to let $\theta = \arctan(x)$ and $d\theta = {1 \over 1 + x^2} dx$. When you do that here the integral becomes $$\int_0^{\pi \over 2} \ln(\tan(\theta))\,d\theta$$ $$= \int_0^{\pi \over 2} \ln(\sin(\theta))\,d\theta - \int_0^{\pi \over 2} \ln(\cos(\theta))\,d\theta$$ The two terms cancel because $\cos(\theta) = \sin({\pi \over 2} - \theta)$.

Also, if you do enough of these, you learn that doing the change of variables from $x$ to ${1 \over x}$ converts a ${dx \over 1 + x^2}$ into $-{dx \over 1 + x^2}$, so it becomes one of the "tricks of the trade" for integrals with $1 + x^2$ in the denominator. An example: show this trick can be used to show that the following integral is independent of $r$: $$\int_0^{\infty} {dx \over (1 + x^2)(1 + x^r)}$$


I'm not exactly sure what kind of theory behind the integral you're looking for, but to me the points that pop out are that $dx/x=d(\log x)$ and $1+x^2=(1/x+x)x$ so that we have

$$\frac{\log x}{1+x^2}dx=\frac{u\, du}{e^{-u}+e^u} $$

after the change of variables $u=\log x$. As $x$ ranges over $(0,\infty)$, $u$ ranges over $\Bbb R$, and the integrand in the right-hand side, $u/(e^{-u}+e^u)$, is an antisymmetric aka odd function of $u$. Integrals of odd functions on intervals that are symmetric about the origin are always zero.


In hindsight, one can extract a general principle from this example. Let $f(x)$ be a say continuous function. Suppose also that $$\frac{1}{x}f\left(\frac{1}{x}\right)=-xf(x)$$ for all relevant $x$. Then for any $b\ne 0$, $$\int_{1/b}^b f(x)\,dx=0.\tag{$1$}$$

Under the same conditions, if the improper integral converges, we have $$\int_0^\infty f(x)\,dx=0.$$

The proof of either result is the same as the proof by anon in the particular case $f(x)=\frac{\log x}{1+x^2}$. For $(1)$, break up the integral into two parts, $1/b$ to $1$ and $1$ to $b$. For the integral between $1/b$ and $1$, make the change of variable $u=1/x$.

Remark: If a trick or idea solves a concrete problem, one can reverse engineer and identify the problems for which essentially the same idea works. In this case, the reverse engineering does not seem to produce something of general interest. Instead, one should just draw the general lesson: Symmetry is your friend. Exploit it. (That rewording of Polya didn't come out sounding quite right.)