# integrate the following function: $\int_{0}^{\infty} \frac{\log{x}}{x^{2}+a^{2}} \ dx$

How do I integrate the following function: $$\int_{0}^{\infty} \frac{\log{x}}{x^{2}+a^{2}} \ dx$$ Integrating by parts looks very difficult.

-

I think this will work.

\begin{align*} \int_{0}^{\infty} \frac{\log{x}}{x^{2}+a^{2}} \ dx &= \int_{0}^{a} \frac{\log{x}}{x^{2}+a^{2}} \ dx + \int_{a}^{\infty} \frac{\log{x}}{x^{2}+a^{2}} \ dx \\\ &= \int_{0}^{a} \frac{\log{x}}{x^{2}+a^{2}} \ dx + \int_{a}^{0} \frac{\log(a^{2}/t)}{(a^{2}/t)^{2} + a^{2}} \cdot \biggl(-\frac{a^2}{t^2}\biggr) \ dt \\\ &= \int_{0}^{a} \frac{\log{x}}{x^{2}+a^{2}} \ dx + \int_{0}^{a} \frac{2\:\log{a} - \log{t}}{t^{2}+a^{2}} \ dt \\\ &= \int\limits_{0}^{a} \frac{2\:\log{a}}{t^{2}+a^{2}} \ dt \end{align*}

-

First step: The change of variable $x=au$ yields $$I(a)=\int_0^{+\infty}\frac{\log x}{x^2+a^2}\mathrm dx=\int_0^{+\infty}\frac{\log a+\log u}{u^2+1}\frac{\mathrm du}a=\frac1a\left(\frac{\pi}2\log a+I(1)\right).$$ Second step: Decomposing $I(1)$ into an integral on $(0,1)$ and an integral on $(1,+\infty)$ and using the change of variables $x=1/z$ in the $(0,1)$ part yields $I(1)=0$.

Conclusion: For every $a\gt0$, $I(a)=\dfrac{\pi}2\dfrac{\log a}a$.

-

The integral evaluates to $\frac{\pi\log a}{2a}.$ Here is an elementary solution.

First, we evaluate it when $a=1$. Consider $\int_{1}^{\infty}\frac{\log u}{u^{2}+1}du$, and notice that by substituting $u=\frac{1}{v}$ we have $$\int_{1}^{\infty}\frac{\log u}{u^{2}+1}du=-\int_{0}^{1}\frac{\log v}{1+v^{2}}dv$$ and hence $$\int_{0}^{\infty}\frac{\log u}{u^{2}+1}du=0.$$

Now, returning to the general case, letting $x=au$, we have $$\int_{0}^{\infty}\frac{\log x}{x^{2}+a^{2}}dx=\frac{1}{a}\int_{0}^{\infty}\frac{\log a}{u^{2}+1}du+\frac{1}{a}\int_{0}^{\infty}\frac{\log u}{u^{2}+1}du.$$ We know the second integral is $0$, and the first is $\frac{\pi}{2}$ since it is $\arctan(x)$, so we conclude that

$$\int_{0}^{\infty}\frac{\log x}{x^{2}+a^{2}}dx=\frac{\pi\log a}{2a}.$$

Remark: This method relied on a substitution trick. A more general approach is to use a key-hole contour integral around the branch cut $(0,\infty)$.

-
I had exactly the same solution typed up as well but Didier beat us to it =[. – Ragib Zaman May 29 '12 at 15:18
The keyhole contour is tricky; the obvious way to do it leads to an unfortunate cancellation. I think the most straightforward way to do this with contours is to compute p.v.$\int_{-\infty}^\infty \frac{\log |x| \, dx}{x^2+a^2}$ via something semicircular. – Micah May 29 '12 at 15:59