# slightly tricky integral

was asked to evaluate $\displaystyle\int_0^\infty \dfrac{\log(x)}{1+x^2} dx = I$

firstly, I got the solution using the substitution $t = \dfrac{1}{x}$ and then getting $\displaystyle\int_0^\infty \dfrac{\log(x)}{1+x^2} dx = -\displaystyle\int_0^\infty \dfrac{\log(x)}{1+x^2} dx$ so $I = -I \implies I = 0$ however this substitution was a lucky guess more than anything, so how would I go about it using this way?

let $x = \tan(\theta)$ then this transforms $I$ to $$\displaystyle \int_0^\frac{\pi}{2} \log(\tan(\theta))\,d\theta = \int_0^\frac{\pi}{2} \log(\sin(\theta))\,d\theta - \int_0^\frac{\pi}{2} \log(\cos(\theta))\,d\theta =$$ $$=\int_0^\frac{\pi}{2} \log(\sin(\theta))\,d\theta - \int_0^\frac{\pi}{2} \log(\sin(\dfrac{\pi}{2} -\theta))\,d\theta$$ how would I go from there?

-
I've added a way to do it without trigonometric substitutions, and I've up-voted Felix Marin's answer. –  Michael Hardy Jan 3 at 0:21
This question has reappeared twice recently -- see math.stackexchange.com/questions/656090/… -- and each time elicited a very slick solution that's worth taking a look at. –  Barry Cipra Jan 30 at 0:26

You would reverse the direction of the second integral and be done, because the derivative of $\pi/2-\theta$ cancels with the sign from the reversal of the interval.

So, with $\varphi=\pi/2-\theta$ you have:

\begin{align}&\int_0^\frac{\pi}{2} \log(\sin(\theta))\,d\theta - \int_0^\frac{\pi}{2} \log(\sin(\dfrac{\pi}{2} -\theta))\,d\theta\\ =&\int_0^\frac{\pi}{2} \log(\sin(\theta))\,d\theta - \int_\frac{\pi}{2}^0 \log(\sin(\varphi))\,(-d\varphi) \\ =&\int_0^\frac{\pi}{2} \log(\sin(\theta))\,d\theta - \int_0^{\frac{\pi}{2}} \log(\sin(\varphi))\,d\varphi\\ =&0\end{align}

-


-

Here's a way to do it without trigonometric substitutions. We do use a simple trigonometric identity: the sum of the arctangents of a positive number and its reciprocal is a right angle.

\begin{align} \int_{1/A}^A \frac{\log x}{1+x^2} \, dx & = \int_{1/A}^A \underbrace{(\log x)}_{u}\underbrace{\left(\frac{dx}{1+x^2}\right)}_{dv} = uv-\int v\,du \\[10pt] & = \left[(\log x) (\arctan x)\right]_{1/A}^A - \int_{1/A}^A (\arctan x)\left(\frac{dx}{x}\right) \\[10pt] & = (\log A)\left(\arctan A + \arctan\frac1A\right)-\int_{1/A}^A (\arctan x)\left(\frac{dx}{x}\right) \\[10pt] & = \frac\pi2\log A - \int_{1/A}^A (\arctan x)\left(\frac{dx}{x}\right) \tag1 \\[10pt] & = \frac\pi2\log A-\int_{1/A}^A \left( \frac\pi2 - \arctan\frac 1 x \right)\left(\frac{dx}{x}\right) \\[10pt] & = \frac\pi2\log A + \int_A^{1/A} \left(\frac\pi2 - \arctan u \right)\left(\frac{du}{u}\right) \\[10pt] & = \frac\pi2\log A-\int_{1/A}^A \left(\frac\pi2 - \arctan u \right)\left(\frac{du}{u}\right) \\[10pt] & = \frac\pi2\log A-\int_{1/A}^A \left(\frac\pi2 - \arctan x \right)\left(\frac{dx}{x}\right) \\[10pt] & = -\frac\pi2 \log A + \int_{1/A}^A (\arctan x) \left(\frac{dx}{x}\right) \tag2 \end{align}

So $(1)$ is equal to $(2)$, but their sum is $0$. Therefore each of them is $0$. Finally, let $A\to\infty$.

-

A standard way to evaluate integrals with a log factor is to take a contour which is basically a disk slit along the positive real axis, but replace log by log squared. Then it is a a standard residue computation. In addition, the obvious substitution $u=1/x$ makes it clear that the integral from $0$ to $1$ equals minus the integral from $1$ to $\infty,$ so the whole integral is $0.$

-