# Find the following integral (most likely substitution)

$$\int_0^1 \frac{\ln(1+x^2)}{1+x^2} \ dx$$

I tried letting $x^2=\tan \theta$ but it didn't work. What should I do?

Please don't give full solution, just a hint and I will continue.

• If $x = \tan\theta$ then $\dfrac{dx}{1+x^2} = d\theta$ and $\ln(1+x^2) = 2\ln\sec\theta$, and as $x$ goes from $0$ to $1$, $\theta$ goes from $0$ to $\pi/4$. ${}\qquad{}$ – Michael Hardy May 10 '13 at 14:38
• A pity the integrand isn't multiplied by $\,x\,$ ...The primitive of this function seems to be a nightmare, with polylogarithms of second order and stuff. It doesn't look nice. – DonAntonio May 10 '13 at 14:41
• I am afraid that this needs to be subjected to complex integration (contours, residues, Cauchy...) But then, for some this is utter joy! – imranfat May 10 '13 at 14:57
• Yeah, need polylogarithms to do $2\int_{0}^{\frac{\pi }{4}}lnsec\theta d\theta$ – please delete me May 10 '13 at 14:57
• Do you really want to delete ALL your accounts or did you click the wrong button by mistake? – Shadow Wizard Jul 28 '14 at 11:55

By using the substitution $x=1/u$ judiciously, I can show that

$$\int_0^1 dx \frac{\log{(1+x^2)}}{1+x^2} = \frac12 \int_0^{\infty} dx \frac{\log{(1+x^2)}}{1+x^2} + \int_0^1 dx \frac{\log{x}}{1+x^2}$$

The first integral may be evaluated using Cauchy's theorem over a strange contour; I evaluated it here, and it has value $\pi \log{2}$. (I will reproduce here in the Appendix below.)

The second integral may be evaluated by using the Maclurin expansion of $(1+x^2)^{-1}$:

$$\int_0^1 dx \frac{\log{x}}{1+x^2} = \sum_{k=0}^{\infty} (-1)^k \, \int_0^1 dx \, x^{2 k} \log{x} = -\sum_{k=0}^{\infty} \frac{(-1)^k}{(2 k+1)^2} = -G$$

where $G$ is Catalan's constant. Thus the integral sought is

$$\int_0^1 dx \frac{\log{(1+x^2)}}{1+x^2} = \frac{\pi}{2} \log{2} - G \approx 0.172827$$

APPENDIX

To evaluate the first integral above, we consider the integral in the complex plane

$$\oint_C dz \frac{\log{(1+z^2)}}{1+z^2}$$

where $C$ is some contour to be determined. Our first instinct is to make $C$ a simple semicircle in the upper half plane. The problem is that the branch point singularity at $z=i$ is extremely problematic, as it coincides with an ostensible pole. Nonetheless, the corresponding integral over the real line is finite (and twice the originally specified integral), so there must be a way to treat this.

The way to go with branch points like this is to avoid them. We thus have to draw $C$ so as to do that, and then use Cauchy's theorem to state that the above complex integral about $C$ is zero. Such a contour $C$ is illustrated below.

The contour integral is then taken along six different segments. I will state without proof that the integral about the two outer arcs vanishes as the radius of those arcs $R \to \infty$. We are then left with four integrals:

$$\int_{-R}^R dx \frac{\log{(1+x^2)}}{1+x^2} + \left [\int_{C_-}+\int_{C_+}+\int_{C_{\epsilon}} \right ] dz \frac{\log{(1+z^2)}}{1+z^2} = 0$$

$C_-$ is the segment to the right of the imaginary axis, down from the arc to the branch point, $C_+$ is the segment to the left of the imaginary axis, up from the branch point to the arc, and $C_{\epsilon}$ is the circle about the branch point of radius $\epsilon$.

It is crucial that we get the arguments of the log correct along each path. I note that the segment $C_-$ is "below" the imaginary axis and I assign the phase of this segment to be $2 \pi$, while I assign the phase of the segment $C_+$ to be $0$.

For the segment $C_-$, set $z=i(1+y e^{i 2 \pi})$:

$$\int_{C_-} dz \frac{\log{(1+z^2)}}{1+z^2} = i\int_R^{\epsilon} dy \frac{\log{[-y (2+y)]}+ i 2 \pi}{-y (2+y)}$$

For the segment $C_+$, set $z=i(1+y)$:

$$\int_{C_-} dz \frac{\log{(1+z^2)}}{1+z^2} = i\int_{\epsilon}^R dy \frac{\log{[-y (2+y)]}}{-y (2+y)}$$

I note that the sum of the integrals along $C_-$ and $C_+$ is

$$-2 \pi \int_{\epsilon}^R \frac{dy}{y (2+y)} = -\pi \left [ \log{R} - \log{(2 + R)} - \log{\epsilon} + \log{(2 + \epsilon)}\right]$$

For the segment $C_{\epsilon}$, set $z=i (1+\epsilon e^{-i \phi})$. The integral along this segment is

\begin{align}\int_{C_{\epsilon}} dz \frac{\log{(1+z^2)}}{1+z^2} &= \epsilon \int_{-2 \pi}^0 d\phi e^{-i \phi} \frac{\log{\left [ -2 \epsilon e^{-i \phi} \right]}}{-2 \epsilon e^{-i \phi}}\end{align}

Here we use $\log{(-1)}=-i \pi$ and the above integral becomes

\begin{align}\int_{C_{\epsilon}} dz \frac{\log{(1+z^2)}}{1+z^2} &= -\frac12 (-i \pi)(2 \pi) - \frac12 \log{2} (2 \pi) - \frac12 \log{\epsilon} (2 \pi) -\frac12 (-i) \frac12 (0-4 \pi^2) \\ &= -\pi \log{2} - \pi \log{\epsilon} \end{align}

Adding the above integrals, we have

\begin{align}\int_{-R}^R dx \frac{\log{(1+x^2)}}{1+x^2} -\pi \log{R} + \pi \log{(2 + R)} + \pi \log{\epsilon} - \pi \log{(2 + \epsilon)} -\pi \log{2} - \pi \log{\epsilon} &= 0\\ \implies \int_{-R}^R dx \frac{\log{(1+x^2)}}{1+x^2} -\pi \log{R} + \pi \log{(2 + R)} - \pi \log{(2 + \epsilon)} -\pi \log{2} &=0\end{align}

Now we take the limit as $R \to \infty$ and $\epsilon \to 0$ and we get

$$\int_{-\infty}^{\infty} dx \frac{\log{(1+x^2)}}{1+x^2} -2 \pi \log{2} = 0$$

Therefore

$$\int_{0}^{\infty} dx \frac{\log{(1+x^2)}}{1+x^2} = \pi \log{2}$$

• wow this looks amazing. – please delete me May 10 '13 at 15:40
• @AlexanderJones: thanks. I hope you can appreciate the complex integration angle. – Ron Gordon May 10 '13 at 15:46
• I wish I understand it haha. I have done all high school maths so what should I do next to work my way up to be able to understand and solve questions using the complex plane? What topics should I learn and in what order? Thank you! – please delete me May 10 '13 at 15:56
• @AlexanderJones: understand integration thoroughly, including some multivariate integrals used in line integrals and parametric functions, as well as continuity and differentiation. Perhaps know what a Cauchy Principal Value is. Then pick up a good introductory book like Churchill & Brown, although I am sure others may find a more recent and accessible reference. – Ron Gordon May 10 '13 at 15:59
• Ok, thank you! So I should basically focus on learning more calculus for now :) – please delete me May 10 '13 at 16:06

Substitute $x=\tan(\theta)$: \begin{align} \int_0^1\frac{\log(1+x^2)}{1+x^2}\,\mathrm{d}x &=2\int_0^{\pi/4}\log(\sec(\theta))\,\mathrm{d}\theta\\ &=-2\int_0^{\pi/4}\log(\cos(\theta))\,\mathrm{d}\theta\\ &=-\int_0^{\pi/4}\left[\log(1+e^{i2\theta})+\log(1+e^{-i2\theta})-2\log(2)\right]\,\mathrm{d}\theta\\ &=\frac\pi2\log(2)+2\int_0^{\pi/4}\sum_{k=1}^\infty(-1)^k\frac{\cos(2k\theta)}{k}\,\mathrm{d}\theta\\ &=\frac\pi2\log(2)+\sum_{k=1}^\infty(-1)^k\frac{\sin(k\pi/2)}{k^2}\\ &=\frac\pi2\log(2)-\sum_{k=0}^\infty\frac{(-1)^k}{(2k+1)^2}\\ &=\frac\pi2\log(2)-\mathrm{G}\\ \end{align} where $\mathrm{G}$ is Catalan's Constant.

Integral Over $\mathbf{[0,\infty]}$ The domain of the trigonometric integral above becomes $[0,\pi/2]$ and this translates to the sum $$\pi\log(2)+\sum_{k=1}^\infty(-1)^k\frac{\sin(k\pi)}{k^2}=\pi\log(2)$$

HINT:

Putting $x=\tan t, x=0\implies t=0$ and $x=1\implies t=\frac\pi4$ considering the principal values of $\arctan$

So, $$\int_0^1 \frac{\ln(1+x^2)}{1+x^2} \ dx=\int_0^\frac\pi42\ln\sec tdt=-2\int_0^\frac\pi4\ln\cos tdt$$

$$I=\int_0^\frac\pi4\ln\cos tdt =\int_0^\frac\pi4\ln\cos\left(\frac\pi4+0- t\right)dt=\int_0^\frac\pi4\{\ln(\cos t+\sin t) -\ln \sqrt2\}dt$$ as $\cos\left(\frac\pi4+0- t\right)=\frac{\cos t+\sin t}{\sqrt2}$ and $\ln \frac ab=\ln a-\ln b$

$$2I=\int_0^\frac\pi4\{\ln(\cos t+\sin t)^2 -\ln 2\}dt=\int_0^\frac\pi4\ln(1+\sin2t)dt-\ln 2\int_0^\frac\pi4dt$$

Putting $u=2t$ in $$\int_0^\frac\pi4\ln(1+\sin2t)dt=\frac12\int_0^\frac\pi2\ln(1+\sin u)du$$

Now, use this.

• I see that my answer starts out like yours, but then I use the identity I found when writing this answer. (+1) – robjohn Mar 11 '14 at 14:37


With $\ds{x \equiv \tan\pars{\theta}}$: \begin{align}&\color{#c00000}{\int_{0}^{1}{\ln\pars{1 +x^{2}} \over 1 + x^{2}} \,\dd x} =-\int_{0}^{\pi/4}\ln\pars{\cos^{2}\pars{\theta}}\,\dd\theta \\[3mm]&=-\int_{0}^{\pi/4}\ln\pars{{2\sin\pars{\theta}\cos\pars{\theta} \over 2}\,{\cos\pars{\theta} \over \sin\pars{\theta}}}\,\dd\theta =-\int_{0}^{\pi/4}\ln\pars{\half\,\sin\pars{2\theta}\cot\pars{\theta}}\,\dd\theta \\[3mm]&=-\int_{0}^{\pi/4}\ln\pars{\cot\pars{\theta}}\,\dd\theta -\half\int_{0}^{\pi/2}\ln\pars{\half\,\sin\pars{\theta}}\,\dd\theta \\[3mm]&=-G + {\pi \over 4}\,\ln\pars{2} -\half\,\color{#00f}{\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta} \qquad\qquad\qquad\qquad\qquad\qquad\qquad\quad\pars{1} \end{align} where we used one of the Integral Representations of Catalan Constant $\ds{G}$. Namely $$G \equiv \int_{0}^{\pi/4}\ln\pars{\cot\pars{\theta}}\,\dd\theta$$

Let's evaluate the $\ds{\color{#00f}{\mbox{remaining integral}}}$: \begin{align}&\color{#00f}{\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}} \,\dd\theta} =\half\bracks{\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta +\int_{0}^{\pi/2}\ln\pars{\sin\pars{{\pi \over 2} - \theta}}\,\dd\theta} \\[3mm]&=\half\int_{0}^{\pi/2}\ln\pars{\half\,\sin\pars{2\theta}}\,\dd\theta ={1 \over 4}\int_{0}^{\pi}\ln\pars{\half\,\sin\pars{\theta}}\,\dd\theta \\[3mm]&={1 \over 4}\int_{0}^{\pi/2}\ln\pars{\half\,\sin\pars{\theta}} \,\dd\theta +{1 \over 4}\int_{\pi/2}^{\pi}\ln\pars{\half\,\sin\pars{\theta}}\,\dd\theta \\[3mm]&=\half\int_{0}^{\pi/2}\ln\pars{\half\,\sin\pars{\theta}}\,\dd\theta =-\,{\pi \over 4}\,\ln\pars{2} +\half\color{#00f}{\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta} \\[3mm]&\imp\quad \color{#00f}{\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta} =-\,{\pi \over 2}\,\ln\pars{2} \end{align}

This result is replaced in $\pars{1}$: $$\color{#66f}{\large\int_{0}^{1}{\ln\pars{1 +x^{2}} \over 1 + x^{2}} \,\dd x = \half\,\pi\ln\pars{2} - G}$$

The substitution and complex variable methods used here are excellent, but this is the perfect problem for using Feynman's differentiation under the integral trick. Once we apply the substitution that Ron Gordon did, we look to evaluate the integral $$I(t) = \int^{\infty}_0 \, \frac{\log{(1+x^2)}}{1+x^2} \, \mathrm{d}x.$$ Introduce a parameter $t$, such that $$I(t) = \int^{\infty}_0 \, \frac{\log{(1+tx^2)}}{1+x^2} \, \mathrm{d}x.$$ Note that choosing where to introduce this new parameter into the function is a bit of an art! If we differentiate under the integral w.r.t. $t$, then $$I'(t) = \int^{\infty}_0 \, \frac{x^2}{(1+tx^2)(1+x^2)} \, \mathrm{d}x.$$ Using partial fractions on this gives $$I'(t) = \int^{\infty}_0 \, \frac{1}{(1-t)(1+tx^2)} - \frac{1}{(1-t)(1+x^2)} \, \mathrm{d}x.$$ These are now the standard $\arctan$ integral, so $$I'(t) = \frac{\pi}{2\sqrt{t}(1-t)}-\frac{\pi}{2(1-t)}.$$ Integrating with respect to $t$ gives us $$I(t) =\frac{\pi}{2}\log{\left(\frac{1+\sqrt{t}}{1-\sqrt{t}}\right)} -\frac{\pi}{2}\log{(1-t)}+c.$$ To determine the constant, we note that $I(0)=0$, so $c=0$. Combining the logarithms gives that $$I(t) =\frac{\pi}{2}\log{(1+\sqrt{t})^2} = \pi \log{(1+\sqrt{t})}.$$ This gives us a value for an entire family of integrals! Setting $t=1$ gives us the value of the original integral, $$I(1) = \pi \log 2.$$

Edit - I tried to apply the technique to the original integral and it failed badly with $t$ in that position, but maybe there are other places to put it that make it work!

• I see from Ron Gordon's answer we can get the integral on $[0,1]$ from this integral. – robjohn Mar 11 '14 at 15:05
• I'm not sure what you mean. I am evaluating one of Ron's intermediate integrals slightly differently, I just like this technique and wanted to share :) – Bennett Gardiner Mar 13 '14 at 9:41
• Ah, I was just noting that you can get the integral in the question from this integral using the method in Ron's answer. Just saying the same thing you are from a different point of view. – robjohn Mar 13 '14 at 9:46
• Ah yes, cool. Your answer is also nice! – Bennett Gardiner Mar 13 '14 at 9:47