# 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 '14 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 '14 at 0:26

## 4 Answers

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}

-

$\newcommand{\+}{^{\dagger}}% \newcommand{\angles}[1]{\left\langle #1 \right\rangle}% \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}% \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}% \newcommand{\ceil}[1]{\,\left\lceil #1 \right\rceil\,}% \newcommand{\dd}{{\rm d}}% \newcommand{\ds}[1]{\displaystyle{#1}}% \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}% \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}% \newcommand{\fermi}{\,{\rm f}}% \newcommand{\floor}[1]{\,\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}[1]{\left\vert #1\right\rangle}% \newcommand{\ol}[1]{\overline{#1}}% \newcommand{\pars}[1]{\left( #1 \right)}% \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}}% \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}% \newcommand{\sech}{\,{\rm sech}}% \newcommand{\sgn}{\,{\rm sgn}}% \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}}% \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$ \begin{align} &\color{#0000ff}{\large\int_{0}^{\pi/2}\ln\pars{\tan\pars{\theta}}\,\dd\theta} = \half\bracks{% \int_{0}^{\pi/2}\ln\pars{\tan\pars{\theta}}\,\dd\theta + \int_{0}^{\pi/2}\ln\pars{\tan\pars{{\pi \over 2} - \theta}}\,\dd\theta} \\[3mm]&= \int_{0}^{\pi/2}\ln\pars{\tan\pars{\theta}\cot\pars{\theta}}\,\dd\theta = \int_{0}^{\pi/2}\ln\pars{1}\,\dd\theta = \color{#0000ff}{\large 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) \vphantom{\frac 1 1} \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.$

-