# Difficult integral involving $\arctan x$

Question: Show that$$\int\limits_0^{\infty}\mathrm dx\,\frac {\arctan x\log(1+x^2)}{x(1+x^2)}=\frac {\pi}2\log^22.$$

I can't tell if I'm being an idiot, or if this is a lot more difficult than it looks. First, I tried integration by parts using the fact that $$\frac 1{x(1+x^2)}=\frac 1x-\frac x{1+x^2}.$$

But quickly I gave up as I wasn't sure what to do with the result. I then decided to make the substitution $t=\arctan x$ to get rid of the $1+x^2$ term in the denominator. Therefore\begin{align*}\mathfrak{I} & =\int\limits_0^{\pi/2}\mathrm dt\,t\cot t\log\sec^2t=-2\int\limits_0^{\pi/2}\mathrm dt\, t\cot t \log\cos t.\end{align*}

However, I'm not exactly sure what to do after this. Should I use integration by parts? Differentiation under the integral sign? I'm having trouble getting started with this integral. Any ideas?

• If I may ask, but why the close vote? I doubt my question is off topic, and furthermore, I included my two main attempts. Other attempts would be expanding $\log$ in its taylor expansion series and a similar thing with the $\arctan$ function. Jul 14 '18 at 0:49
• After an hour I’m not optimistic for a closed form. I think you need something fancy here. Jul 14 '18 at 1:28
• Side note: The integral occurs in this question as well. Jul 14 '18 at 21:07

We can use differentiation under the integral sign and a trick to evaluate this. First define $$I(a,b) = \int_0^{\infty} \frac{\arctan{ax}}{x} \frac{\log{(1+b^2 x^2)}}{1+x^2} \, dx ,$$ so $I(a,0)=I(0,b)=0$ and $I(1,1)$ is what we want. Differentiating one with respect to $a$ and once wrt $b$ gives $$\partial_a\partial_b I = \int_0^{\infty} \frac{2bx^2 \, dx}{(1+x^2)(1+a^2x^2)(1+b^2x^2)},$$ which can be done by using partial fractions and the arctangent integral a few times. When the dust settles, $$\partial_a\partial_b I = \frac{b\pi}{(1+a)(1+b)(a+b)},$$ and thus $$I(1,1) = \int_0^1 \int_0^1 \frac{b\pi}{(1+a)(1+b)(a+b)} \, da \, db$$ But we can swap $a$ and $b$ and will get the same result for this integral by the symmetry of the region of integration, so we also have $$I(1,1) = \int_0^1 \int_0^1 \frac{a\pi}{(1+a)(1+b)(a+b)} \, da \, db.$$ Adding gives $$I(1,1) = \frac{\pi}{2}\int_0^1 \int_0^1 \frac{1}{(1+a)(1+b)} \, da \, db,$$ but this splits into a product of two copies of $\int_0^1 dy/(1+y) = \log{2}$, so $$I(1,1) = \frac{\pi}{2}(\log{2})^2$$ as desired.

• Nice answer! +1 Jul 14 '18 at 2:02
• Oh lord, I’ve completely forgotten about Feynman’s Trick! Why didn’t I think of that! Although I’m not very familiar with differentiation with two variables. How did you know to use two variables instead of say, just setting the $a$ there? To me, having $\arctan ax$ and $\log(1+b^2x^2)$ is an overcomplication. Jul 14 '18 at 3:21
• I have forgotten: when is differentiation under the integral allowed? Jul 14 '18 at 13:22
• @Frank I did try only using one derivative, but it resulted in a rather nasty log that would have required a polylogarithm to integrate. Indeed, this trick only works because $a=b$ in the limit we care about, so we can apply a symmetry to make the integral much nicer; the general case will involve polylogarithms. Jul 14 '18 at 20:10
• @Randall $\partial_a f(x,a)$ integrable and $\frac{1}{h}\int | f(x,a+h)-f(x,a) - h \partial_a f(x) | dx \to 0$ should be sufficient in general. Dominated Convergence will cover most explicit cases, including this one since there's always a $1/(1+x^2)$ involved. But everything's positive here as well, so one can also view it as an application of Tonelli to permute the order of integration. Jul 14 '18 at 20:14

Define $$f(a,b) = \int \limits_0^\infty \frac{\arctan(a x) \ln (1+ b^2 x^2)}{x (1+x^2)} \, \mathrm{d} x$$ for $0 \leq a , b \leq 1$ . Then $f(1,1) = \mathfrak{I}$ and $f(0,b) = f(a,0) = 0$ . For $0< a,b<1$ we can differentiate under the integral sign to find $$\partial_a \partial_b f(a,b) = 2 b \int \limits_0^\infty \frac{x^2}{(1+a^2 x^2)(1+b^2 x^2)(1+x^2)} \, \mathrm{d} t = \frac{\pi b}{(1+a)(1+b)(a+b)} \, .$$ The integral can be evaluated using the residue theorem, for example. Now integrate again and exploit the symmetry of the derivative to obtain \begin{align} \mathfrak{I} &= f(1,1) = \pi \int \limits_0^1 \int \limits_0^1 \frac{b}{(1+a)(1+b)(a+b)} \, \mathrm{d}a \, \mathrm{d}b = \pi \int \limits_0^1 \int \limits_0^1 \frac{a}{(1+a)(1+b)(a+b)} \, \mathrm{d}a \, \mathrm{d}b \\ &= \frac{\pi}{2} \int \limits_0^1 \int \limits_0^1 \frac{a+b}{(1+a)(1+b)(a+b)} \, \mathrm{d}a \, \mathrm{d}b = \frac{\pi}{2} \int \limits_0^1 \int \limits_0^1 \frac{1}{(1+a)(1+b)} \, \mathrm{d}a \, \mathrm{d}b \\ &= \frac{\pi}{2} \ln^2 (2) \, . \end{align}

Notice:

$$\Im(\log^2(1+ix))=\Im\left(\left(\frac{1}{2}\log(1+x^2)+i\arctan(x)\right)^2\right)=\frac{1}{2}\log(1+x^2)\arctan(x)$$

The integral in question is therefore (use parity) $$I=\Im\int_{\mathbb{R}}\underbrace{\frac{\log^2(1+ix)}{x(1+x^2)}}_{f(x)}$$

Integrate around a big semicircle in the lower halfplane (to avoid the branchcut) yields

$$I=\Im \left(2\pi i\text{Res}(f(z),z=-i)\right)=\frac{\pi}{2}\log^2(2)$$

where the residue is easy to calculate since the pole is simple.

The vansihing of the contrbutions at infinity follows from the fact that $R|f(Re^{i\phi})|\sim \log^2(R)/R^2$ in sector of $\mathbb{C}$ we are interested in.

• You also need that the integrand is even (to change the integral into one over $\mathbb{R}$), and that the singularity at zero is removable (so it doesn't contribute to the integral at all). Jul 14 '18 at 20:17

\begin{align}J&=\int_0^\infty \frac{\ln(1+x^2)\arctan x}{x(1+x^2)}dx\\ &=\int_0^1 \frac{\ln(1+x^2)\arctan x}{x(1+x^2)}dx+\int_1^\infty \frac{\ln(1+y^2)\arctan y}{y(1+y^2)}dy\\ &\overset{x=\frac{1}{y}}=\int_0^1 \frac{\ln(1+x^2)\arctan x}{x(1+x^2)}dx+\int_0^1 \frac{x\ln\left(\frac{1+x^2}{x^2}\right)\arctan\left( \frac{1}{x}\right)}{1+x^2}dx\\ &=\int_0^1 \frac{\ln(1+x^2)\arctan x}{x}dx-2\int_0^1 \frac{x\ln(1+x^2)\arctan x}{1+x^2}dx+2\int_0^1 \frac{x\ln x\arctan x}{1+x^2}dx+\\ &\frac{\pi}{2}\int_0^1 \frac{x\ln(1+x^2)}{1+x^2}dx-\pi\int_0^1 \frac{x\ln x}{1+x^2}dx\\ &\overset{\text{IBP}}=\int_0^1 \frac{\ln(1+x^2)\arctan x}{x}dx-2\int_0^1 \frac{x\ln(1+x^2)\arctan x}{1+x^2}dx+\\&\Big[\ln(1+x^2)\ln x\arctan x\Big]_0^1-\int_0^1 \frac{\ln(1+x^2)\arctan x}{x}dx-\int_0^1 \frac{\ln(1+x^2)\ln x}{1+x^2}dx+\\&\frac{\pi}{2}\int_0^1 \frac{x\ln(1+x^2)}{1+x^2}dx-\pi\int_0^1 \frac{x\ln x}{1+x^2}dx\\ &=-2\int_0^1 \frac{x\ln(1+x^2)\arctan x}{1+x^2}dx-\int_0^1 \frac{\ln(1+x^2)\ln x}{1+x^2}dx+\frac{\pi}{2}\int_0^1 \frac{x\ln(1+x^2)}{1+x^2}dx-\\&\pi\int_0^1 \frac{x\ln x}{1+x^2}dx\\ K&=\int_0^1 \frac{2x\ln(1+x^2)\arctan x}{1+x^2}dx\\ &\overset{\text{IBP}}=\Big[\ln(1+x^2)^2\arctan x\Big]_0^1-K-\int_0^1 \frac{\ln^2(1+x^2)}{1+x^2}dx\\ K&=\frac{\pi\ln^2 2}{8}-\frac{1}{2}\int_0^1 \frac{\ln^2(1+x^2)}{1+x^2}dx\\ J&=-\frac{\pi\ln^2 2}{8}+\frac{1}{2}\int_0^1 \frac{\ln^2(1+x^2)}{1+x^2}dx-\int_0^1 \frac{\ln(1+x^2)\ln x}{1+x^2}dx+\frac{\pi}{2}\int_0^1 \frac{y\ln(1+y^2)}{1+y^2}dy-\\&\pi\int_0^1 \frac{y\ln y}{1+y^2}dy\\ &\overset{x=y^2}=-\frac{\pi\ln^2 2}{8}+\frac{1}{2}\int_0^1 \frac{\ln^2(1+x^2)}{1+x^2}dx-\int_0^1 \frac{\ln(1+x^2)\ln x}{1+x^2}dx+\frac{\pi}{4}\int_0^1 \frac{\ln(1+x)}{1+x}dx-\\&\frac{\pi}{4}\int_0^1 \frac{\ln x}{1+x}dx\\ &=\frac{1}{2}\int_0^1 \frac{\ln^2(1+y^2)}{1+y^2}dy-\int_0^1 \frac{\ln(1+y^2)\ln y}{1+y^2}dy-\frac{\pi}{4}\int_0^1 \frac{\ln x}{1+x}dx\\ &\overset{y=\tan t}=2\int_0^{\frac{\pi}{4}}\ln^2\left(\cos t\right)dt-2\int_0^{\frac{\pi}{4}}\ln^2\left(\cos t\right)dt+2\int_0^{\frac{\pi}{4}}\ln\left(\cos t\right)\ln\left(\sin t\right)dt-\\&\frac{\pi}{4}\int_0^1 \frac{\ln x}{1+x}dx\\ &=2\int_0^{\frac{\pi}{4}}\ln\left(\cos t\right)\ln\left(\sin t\right)dt-\frac{\pi}{4}\int_0^1 \frac{\ln x}{1+x}dx\\ &=\frac{1}{2}\left(\int_0^{\frac{\pi}{4}}\ln^2(\sin t\cos t)dt-\int_0^{\frac{\pi}{4}}\ln^2\left(\tan u\right)du\right)-\frac{\pi}{4}\int_0^1 \frac{\ln x}{1+x}dx\\ &\overset{u=2t}=\frac{1}{4}\int_0^{\frac{\pi}{2}}\ln^2\left(\frac{\sin u}{2}\right)du-\frac{1}{2}\int_0^{\frac{\pi}{4}}\ln^2\left(\tan u\right)du-\frac{\pi}{4}\int_0^1 \frac{\ln x}{1+x}dx\\ &=\frac{1}{4}\int_0^{\frac{\pi}{2}}\ln^2\left(\sin u\right)du-\frac{\ln 2}{2}\int_0^{\frac{\pi}{2}}\ln\left(\sin u\right)du+\frac{\pi\ln^2 2}{8}-\frac{1}{2}\int_0^{\frac{\pi}{4}}\ln^2\left(\tan u\right)du-\\&\frac{\pi}{4}\int_0^1 \frac{\ln x}{1+x}dx\\ L&=\int_0^{\frac{\pi}{2}}\ln^2\left(\sin u\right)du\\ &=\frac{1}{4}\left(2\int_0^{\frac{\pi}{2}}\ln^2\left(\sin u\right)du+2\int_0^{\frac{\pi}{2}}\ln^2\left(\cos u\right)du\right)\\ &=\frac{1}{4}\left(\int_0^{\frac{\pi}{2}}\ln^2\left(\cos u\sin u\right)du+\int_0^{\frac{\pi}{2}}\ln^2\left(\tan u\right)du\right)\\ &\overset{t=2u}=\frac{1}{4}\left(\frac{1}{2}\int_0^{\pi}\ln^2\left(\frac{\sin t}{2}\right)dt+\int_0^{\frac{\pi}{2}}\ln^2\left(\tan u\right)du\right)\\ &=\frac{1}{8}\int_0^{\pi}\ln^2\left(\sin t\right)dt-\frac{\ln 2}{4}\int_0^{\pi}\ln\left(\sin t\right)dt+\frac{\pi\ln^2 2}{8}+\frac{1}{4}\int_0^{\frac{\pi}{2}}\ln^2\left(\tan u\right)du\\ &=\frac{1}{8}\left(L+\int_{\frac{\pi}{2}}^\pi\ln^2\left(\sin v\right)dv\right)-\frac{\ln 2}{4}\int_0^{\pi}\ln\left(\sin t\right)dt+\frac{\pi\ln^2 2}{8}+\frac{1}{4}\int_0^{\frac{\pi}{2}}\ln^2\left(\tan u\right)du\\ &\overset{t=\pi-v}=\frac{1}{4}L-\frac{\ln 2}{4}\int_0^{\pi}\ln\left(\sin t\right)dt+\frac{\pi\ln^2 2}{8}+\frac{1}{4}\int_0^{\frac{\pi}{2}}\ln^2\left(\tan u\right)du\\ L&=-\frac{\ln 2}{3}\int_0^{\pi}\ln\left(\sin t\right)dt+\frac{\pi\ln^2 2}{6}+\frac{1}{3}\int_0^{\frac{\pi}{2}}\ln^2\left(\tan u\right)du\\ &=-\frac{\ln 2}{3}\int_0^{\frac{\pi}{2}}\ln\left(\sin t\right)dt-\frac{\ln 2}{3}\int_{\frac{\pi}{2}}^{\pi}\ln\left(\sin v\right)dv+\frac{\pi\ln^2 2}{6}+\frac{1}{3}\int_0^{\frac{\pi}{2}}\ln^2\left(\tan u\right)du\\ &\overset{t=\pi-v}=-\frac{2\ln 2}{3}\int_0^{\frac{\pi}{2}}\ln\left(\sin t\right)dt+\frac{\pi\ln^2 2}{6}+\frac{1}{3}\int_0^{\frac{\pi}{2}}\ln^2\left(\tan u\right)du\\ \end{align}

Therefore,

\begin{align}J&=\frac{1}{6}\pi\ln^2 2-\frac{\pi}{4}\int_0^1 \frac{\ln x}{1+x}dx-\frac{2\ln 2}{3}\int_0^{\frac{\pi}{2}}\ln\left(\sin t\right)dt+\frac{1}{12}\int_0^{\frac{\pi}{2}}\ln^2\left(\tan t\right)dt-\\&\frac{1}{2}\int_0^{\frac{\pi}{4}}\ln^2\left(\tan t\right)dt\\ &=\frac{1}{6}\pi\ln^2 2-\frac{\pi}{4}\int_0^1 \frac{\ln x}{1+x}dx-\frac{2\ln 2}{3}\int_0^{\frac{\pi}{2}}\ln\left(\sin t\right)dt+\\&\frac{1}{12}\left(\int_0^{\frac{\pi}{4}}\ln^2\left(\tan t\right)dt+\int_{\frac{\pi}{4}}^{\frac{\pi}{2}}\ln\left(\tan u\right)du\right)-\frac{1}{2}\int_0^{\frac{\pi}{4}}\ln^2\left(\tan t\right)dt\\ &\overset{t=\frac{\pi}{2}-v}=\frac{1}{6}\pi\ln^2 2-\frac{\pi}{4}\int_0^1 \frac{\ln x}{1+x}dx-\frac{2\ln 2}{3}\int_0^{\frac{\pi}{2}}\ln\left(\sin t\right)dt-\frac{1}{3}\int_0^{\frac{\pi}{4}}\ln^2\left(\tan t\right)dt\\ &=\frac{1}{6}\pi\ln^2 2-\frac{\pi}{4}\times -\frac{\pi^2}{12}-\frac{2\ln 2}{3}\times -\frac{\pi\ln 2}{2}-\frac{1}{3}\times \frac{\pi^3}{16}\\ &=\boxed{\frac{\pi\ln^2 2}{2}} \end{align}

I assume that:

\begin{align}\int_0^{\frac{\pi}{4}}\ln^2\left(\tan t\right)dt&=\frac{\pi^3}{16}\\ \int_0^1 \frac{\ln x}{1-x}dx&=-\zeta(2)=-\frac{\pi^2}{6}\\ \int_0^{\frac{\pi}{2}}\ln\left(\sin t\right)dt&=-\frac{\pi\ln 2}{2}\\ \int_0^1 \frac{\ln x}{1+x}dx&=\int_0^1 \frac{\ln x}{1-x}dx-\int_0^1 \frac{2y\ln y}{1-y^2}dy\\ &\overset{y=x^2}=\frac{1}{2}\int_0^1 \frac{\ln x}{1-x}dx=-\frac{\pi^2}{12} \end{align}