# Evaluate an improper integral involving log [duplicate]

Studying for complex analysis, I stumbled upon this problem. Evaluate $$\int_{0}^{\infty} \frac{\log(1+x^2)}{1+x^2}~dx.$$ So the integrand suggests that I need to use the function $f(z)=\frac{\log 1+z^2}{1+z^2},$ which has two branch points and two simple poles at $z=i$ and $z=-i,$ which lead me to use a semi-circle contour in the right-halfplane having branch cuts at $i$ and $-i.$ But then the process become too lengthy. Is there any other method to go by doing the problem. I was thinking of making a substitution and reducing this to a form to use Gamma function, but wasn't successful. Any help is appreciated.

## marked as duplicate by Joey Zou, Claude Leibovici, Watson, Teoc, Shuhao CaoAug 24 '16 at 19:35

• math.stackexchange.com/q/358386 – Random Variable Aug 23 '16 at 23:14
• I've found a contour integration solution. Shall I pose it? – Zack Ni Aug 23 '16 at 23:30
• Thank you. I wasn't aware of it's been solved before. – user358174 Aug 24 '16 at 12:25

Here is a straightforward methodology that relies on "Feynman's Trick" for differentiating under the integral sign. We proceed as follows.

First, let $I(a)$ be the integral defined by

$$\bbox[5px,border:2px solid #C0A000]{I(a)=\int_0^\infty \frac{\log(a+x^2)}{1+x^2}\,dx} \tag 1$$

where $I(1)=\int_0^\infty \frac{\log(1+x^2)}{1+x^2}\,dx$ is the term of interest.

Second, differentiating under the integral sign yields

\begin{align} I'(a)&=\int_0^\infty \frac{1}{(a+x^2)(1+x^2)}\,dx\\\\ &=\frac{1}{1-a}\int_0^\infty \left(\frac{1}{a+x^2}-\frac{1}{1+x^2}\right)\,dx\\\\ &=\frac{\pi}{2}\frac{1}{\sqrt{a}(\sqrt{a}+1)} \tag 2 \end{align}

Third, integrating $(2)$ reveals that $I(a)=\pi \,\log(1+\sqrt{a})+C$. Then, since $I(0)=0$, which can be seen easily by enforcing the substitution $x\to 1/x$ in $(1)$, $C=0$ and $I(a) =\pi\,\log(1+\sqrt{a})$.

Finally, we find that $I(1)=\pi \,\log(2)$ and hence

$$\bbox[5px,border:2px solid #C0A000]{\int_0^\infty \frac{\log(1+x^2)}{1+x^2}\,dx=\pi \, \log(2)}$$

in agreement with the result reported by @jackd'aurizio.

• (+1) That is for sure a slicker way of applying differentiation under the integral sign :D – Jack D'Aurizio Aug 23 '16 at 23:27
• @JackD'Aurizio Thank you! Much appreciated. – Mark Viola Aug 23 '16 at 23:30
• @Dr.MV, I haven't heard of that method before. Thank you. – user358174 Aug 24 '16 at 0:26
• @ManMath You're welcome! My pleasure. Pleased this was useful. -Mark – Mark Viola Aug 24 '16 at 1:07


\begin{align} \color{#f00}{\mathscr{I}} & = {\color{#f00}{\mathscr{I}} + \color{#f00}{\mathscr{I}} \over 2} = -\int_{0}^{\pi/2}\bracks{\ln\pars{\cos\pars{\theta}} + \ln\pars{\sin\pars{\theta}}}\,\dd\theta = -\int_{0}^{\pi/2}\ln\pars{\sin\pars{2\theta} \over 2}\,\dd\theta \\[5mm] & = \half\,\pi\ln\pars{2} - \half\int_{0}^{\pi}\ln\pars{\sin\pars{\theta}}\,\dd\theta \\[5mm] & = \half\,\pi\ln\pars{2} - \half\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta - \half\int_{\pi/2}^{\pi}\ln\pars{\sin\pars{\theta}}\,\dd\theta \\[5mm] & = \half\,\pi\ln\pars{2} - \half\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta - \half\int_{-\pi/2}^{0}\ln\pars{-\sin\pars{\theta}}\,\dd\theta \\[5mm] & = \half\,\pi\ln\pars{2} - \int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta = \half\,\pi\ln\pars{2} + \half\,\color{#f00}{\mathscr{I}} \\[5mm] & \imp\quad \color{#f00}{\mathscr{I}} = \int_{0}^{\infty}{\ln\pars{1 + x^{2}} \over 1 + x^{2}}\,\dd x = \color{#f00}{\pi\ln\pars{2}} \end{align}

Your intuition is correct: it is not difficult to compute such integral through a real-analytic method that involves differentiation under the integral sign and Euler's beta function (so $\Gamma$ function, too).

$$\int_{0}^{+\infty}\frac{\log(1+t^2)}{1+t^2}\,dt = \left.\frac{d}{d\alpha}\int_{0}^{+\infty}(1+t^2)^{\alpha-1}\,dt\right|_{\alpha=0^+} \tag{1}$$ and by setting $t=\tan\theta$ we have $$I(\alpha) = \int_{0}^{+\infty}(1+t^2)^{\alpha-1}\,dt = \int_{0}^{\pi/2}\frac{d\theta}{\cos^{2\alpha}(\theta)}=\frac{\sqrt{\pi}}{2}\cdot\frac{\Gamma\left(\frac{1}{2}-\alpha\right)}{\Gamma\left(1-\alpha\right)}.\tag{2}$$ In order to compute $I'(\alpha)$, we may exploit $$I'(\alpha)=I(\alpha)\cdot\frac{d}{d\alpha}\log I(\alpha),\qquad \frac{d}{dx}\log\Gamma(x)=\psi(x)\tag{3}$$ leading to: $$I'(\alpha) = -I(\alpha)\cdot\left[\psi\left(\frac{1}{2}-\alpha\right)-\psi(1-\alpha)\right],\qquad I'(0)=-\frac{\pi}{2}\cdot\left[\psi\left(\frac{1}{2}\right)-\psi(1)\right]\tag{4}$$ At least, the identity $$\sum_{n\geq 0}\frac{1}{(n+a)(n+b)}=\frac{\psi(a)-\psi(b)}{a-b}\tag{5}$$ proves that $\psi\left(\frac{1}{2}\right)-\psi(1)$ is related with a simple series whose value is $-2\log 2$.
Putting all together, $$\int_{0}^{+\infty}\frac{\log(1+t^2)}{1+t^2}\,dt = \color{red}{\pi\log 2}.\tag{6}$$

This is clearly not the simplest or fastest method, I went through it just to demonstrate its power and flexibility. The fastest method here is probably to directly set $t=\tan\theta$ and deduce $(6)$ from the symmetry of the integrand function or from a well known Fourier series. That technique was showed on MSE many times.

• @Jack D'Aurizio, thank you very much. – user358174 Aug 24 '16 at 0:27
• @ManMath: you're welcome. – Jack D'Aurizio Aug 24 '16 at 0:27