# Integral $\int_0^\infty \frac{\arctan(x^2)}{x^4+x^2+1}dx$

Accidentally while trying to evaluate a similar integral, I think originally found here, I have taken the denominator instead of $$x^4+4x^2+1$$ as $$x^4+x^2+1$$ and stumbled into the following integral: $$J=\int_0^\infty \frac{(x^2-1)\arctan(x^2)}{x^4+x^2+1}dx$$ I think this have a closed form because the linked one has a simple closed form: $$\displaystyle{\frac{\pi^2}{12\sqrt{2}}}$$, also if there is $$\arctan x$$ instead of $$\arctan(x^2)$$ then we have: $$\int_0^\infty \frac{\arctan x}{x^4+x^2+1}dx=\frac{\pi^2}{8\sqrt{3}}-\frac{2}{3}G+\frac{\pi}{12}\ln(2+\sqrt{3})$$

Some proofs are found here: Using $$\int_0^{\infty} \frac{\tan^{-1}(x^2)}{x^2+a^2} \ dx$$ or using residues. Anyway I started by splitting into two integrals and substituting $$x=\frac{1}{t}$$: $$\int_0^\infty \frac{x^2\arctan(x^2)}{x^4+x^2+1}dx=\int_0^\infty \frac{\frac{\pi}{2}-\arctan\left(x^2\right)}{x^4+x^2+1}dx\Rightarrow J=\frac{\pi^2}{4\sqrt{3}}-2\int_0^\infty \frac{\arctan(x^2)}{x^4+x^2+1}dx$$ Well, now the main issue is to evaluate: $$\displaystyle{I=\int_0^\infty \frac{\arctan(x^2)}{x^4+x^2+1}dx}$$

Using the same method as in the second link I arrived at: $$I=\left(\frac{1-i\sqrt 3}{2}\right)f\left(\sqrt{\frac{1+i\sqrt 3}{2}}\right)+\left(\frac{1+i\sqrt 3}{2}\right)f\left(\sqrt{\frac{1-i\sqrt 3}{2}}\right)$$ Where $$\displaystyle{f(a)=\int_0^{\infty} \frac{\tan^{-1}(x^2)}{x^2+a^2}=\frac{\pi}{2a}\left(\tan^{-1}(\sqrt{2}a+1)+\tan^{-1}(\sqrt{2}a-1)-\tan^{-1}(a^2)\right)},\,$$ but I don't see how to simplify further.

I also tried the "straight forward" way, by employing Feynman's trick to the following integral: $$I(b)=\int_0^\infty \frac{\arctan(bx)^2}{x^4+x^2+1}dx\rightarrow \frac{d}{db}I(b)=\int_0^\infty \frac{2bx^2}{(x^4+x^2+1)(1+b^4x^4)}dx$$ $$=\frac{2b}{b^8-b^4+1}\int_0^\infty \frac{x^2}{x^4+x^2+1}dx-\frac{b^5}{b^8-b^4+1}\int_0^\infty \frac{dx}{x^2+x+1}+$$$$+\frac{2b^5}{b^8-b^4+1}\int_0^\infty\frac{dx}{1+b^4x^4}+\frac{b^9-b^5}{b^8-b^4+1}\int_0^\infty \frac{x^2}{1+b^4x^4}dx$$ $$=\frac{\pi}{\sqrt 3}\frac{b}{b^8-b^4+1}-\frac{2\pi}{3\sqrt 3}\frac{b^5}{b^8-b^4+1}+\frac{\pi}{\sqrt 2}\frac{b^4}{b^8-b^4+1}+\frac{\pi}{2\sqrt 2}\frac{b^6-b^2}{b^8-b^4+1}$$ Now since $$I(0)=0$$ we have: $$\displaystyle{I=I(1)-I(0)=\int_0^1 \left(\frac{d}{db}I(b)\right)db}$$

Integrating the first two parts is okay-ish, but for the last two I have no idea on how to proceed, also it seems that only elementary constants appear thus I believe the integral can be approached in a nicer way. I would love to get some help, if it's possible without using residues since I am not great there.

• ISC yields $$J = \pi\left( \log(1+\sqrt{2}) - \frac{1}{2}\log(2+\sqrt{3}) \right).$$ – Sangchul Lee Nov 3 '18 at 22:00
• @SangchulLee, quite nice. I believe with some effort this form can be straightforwardly obtained from the OP's value by separating real and imaginary parts in all the functions – Yuriy S Nov 3 '18 at 22:07
• I believe it is way easier to invoke Feynman's trick. By writing $\arctan(x^2)$ as $\int_{0}^{1}\frac{x^2}{1+a^2 x^4}\,da$ and switching the the order of integration, then mapping $a$ into $u^2$, the evaluation of the original integral boils down to the evaluation of the integral of a rational function, which can be performed through partial fraction decomposition. – Jack D'Aurizio Nov 3 '18 at 22:43
• @JackD'Aurizio not like I did when I considered $I(b)$? – Zacky Nov 3 '18 at 22:49
• Sure, and since $b^8-b^4+1 = \Phi_{24}(b)$ you only need to compute residues at the $24$-th primitive roots of unity. – Jack D'Aurizio Nov 3 '18 at 22:55

Complete answer now!$$I=\int_0^\infty \frac{{\arctan(x^2)}}{x^4+x^2+1}dx {\overset{x=\frac1{t}}=} \int_0^\infty \frac{\arctan\left(\frac{1}{t^2}\right)}{\frac{1}{t^4}+\frac{1}{t^2}+1}\frac{dt}{t^2}\overset{t=x}=\int_0^\infty \frac{{x^2\left(\frac{\pi}{2}-\arctan(x^2)\right)}}{x^4+x^2+1}dx$$ Now if we add the result with the original integral $$I$$ we get: $$2I=\frac{\pi}{2}\int_0^\infty \frac{x^2}{x^4+x^2+1}dx+\int_0^\infty \frac{(1-x^2)\arctan(x^2)}{x^4+x^2+1}dx$$ $$\Rightarrow I = \frac12 \cdot \frac{\pi}{2}\cdot \frac{\pi}{2\sqrt 3}-\frac12 \int_0^\infty \frac{(x^2-1)\arctan(x^2)}{x^4+x^2+1}dx=\frac{\pi^2}{8\sqrt 3} -\frac12 J$$
Now in order to calculate $$J\,$$ we start by performing IBP: $$J=\int_0^\infty \frac{(x^2-1)\arctan\left(x^2\right)}{x^4+x^2+1}dx =\int_0^\infty \arctan(x^2) \left(\frac12 \ln\left(\frac{x^2-x+1}{x^2+x+1}\right)\right)'dx=$$ $$=\underbrace{\frac{1}{2}\ln\left(\frac{x^2-x+1}{x^2+x+1}\right)\arctan(x^2)\bigg|_0^\infty}_{=0}+\int_0^\infty \frac{x}{1+x^4}\ln\left(\frac{x^2+x+1}{x^2-x+1}\right)dx$$ Substituting $$x=\tan\left(t\right)$$ and doing some simplifications yields: $$J=\int_0^\frac{\pi}{2} \frac{2\sin (2t)}{3+\cos(4t)}\ln\left(\frac{2+\sin (2t)}{2-\sin (2t)}\right)dt\overset{2t=x}=\int_0^\pi \frac{\sin x}{3+\cos(2x)}\ln\left(\frac{2+\sin x}{2-\sin x}\right)dx=$$ $$=2\int_0^\frac{\pi}{2}\frac{\sin x}{3+\cos(2x)}\ln\left(\frac{2+\sin x}{2-\sin x}\right)dx=\int_0^\frac{\pi}{2}\frac{\cos x}{1+\sin^2 x}\ln\left(\frac{2+\cos x}{2-\cos x}\right)dx =$$ $$=\frac12\int_0^\pi \frac{\cos x}{1+\sin^2 x}\ln\left(\frac{2+\cos x}{2-\cos x}\right)dx\overset{\large{\tan\left(\frac{x}{2}\right)=t}}=\int_0^\infty \frac{1-t^2}{t^4+6t^2+1}\ln\left(\frac{\color{blue}{t^2+3}}{\color{red}{3t^2+1}}\right)dt$$
Splitting the integral into two parts followed by the substitution $$\,\displaystyle{t=\frac{1}{x}}\,$$ in the second part gives: $$\int_0^\infty \frac{1-t^2}{t^4+6t^2+1}\ln(\color{red}{3t^2+1})dt =\int_0^\infty \frac{x^2-1}{x^4+6x^2+1}\ln\left(\color{red}{\frac{x^2+3}{x^2}}\right)dx$$ $$\Rightarrow J=\int_0^\infty \frac{1-x^2}{x^4+6x^2+1} \ln(\color{blue}{1+x^3})dx - \int_0^\infty \frac{1-x^2}{x^4+6x^2+1} {\left(\ln(\color{red}{x^2})-\ln(\color{red}{x^2+3})\right)}dx=$$ $$=2\int_0^\infty \frac{1-x^2}{x^4+6x^2+1}\ln\left(\color{purple}{\frac{x^2+3}{x}}\right)dx=2\int_0^\infty \left(\frac12\arctan\left(\frac{2x}{1+x^2}\right)\right)'\ln\left(\frac{x^2+3}{x}\right)dx=$$ $$=\underbrace{\arctan\left(\frac{2x}{1+x^2}\right)\ln\left(\frac{x^2+3}{x}\right)\bigg|_0^\infty}_{=0}-\int_0^\infty \arctan\left(\frac{2x}{1+x^2}\right)\left(\frac{2x}{x^2+3}-\frac{1}{x}\right)dx$$ $$\Rightarrow J=\int_0^\infty \arctan\left(\frac{2x}{1+x^2}\right)\frac{dx}{x}-\int_0^\infty \arctan\left(\frac{2x}{1+x^2}\right) \frac{2x}{x^2+3}dx=J_1-J_2$$
$$J_1=\int_0^\infty \arctan\left(\frac{2x}{1+x^2}\right)\frac{dx}{x}\overset{\large{x=\tan\left(\frac{t}{2}\right)}}=\int_0^\pi \frac{\arctan( \sin t)}{\sin t} dt\overset{t=x}=2\int_0^\frac{\pi}{2} \frac{\arctan( \sin x)}{\sin x} dx$$ In general, we have the following relation: $$\frac{\arctan x}{x}=\int_0^1 \frac{dy}{1+(xy)^2} \Rightarrow \color{red}{\frac{\arctan(\sin x)}{\sin x}=\int_0^1 \frac{dy}{1+(\sin^2 x )y^2}}$$ $$J_1 = 2\color{blue}{\int_{0}^{\frac{\pi}{2}}} \color{red}{\frac{\arctan\left(\sin x\right)}{\sin x}}\color{blue}{dx}=2\color{blue}{\int_0^\frac{\pi}{2}}\color{red}{\int_0^1 \frac{dy}{1+(\sin^2 x )y^2}}\color{blue}{dx}=2\color{red}{\int_0^1} \color{blue}{\int_0^\frac{\pi}{2}}\color{purple}{\frac{1}{1+(\sin^2 x )y^2}}\color{blue}{dx}\color{red}{dy}$$ $$=2\int_0^1 \frac{\arctan\left(\sqrt{1+y^2}\cdot\tan(x)\right) }{\sqrt{1+y^2}} \bigg|_0^\frac{\pi}{2}=\pi\int_0^1 \frac{dy}{\sqrt{1+y^2}}=\boxed{\pi\ln\left(1+\sqrt 2\right)}$$
In order to evaluate $$J_2$$ we return the integral before was integrated by parts. $$J_2=2\int_0^\infty \arctan\left(\frac{2 x} {x^2 +1}\right)\frac{x}{x^2 +3}dx=2\int_0^{\infty}\frac{(x^2-1)\ln(x^2+3)}{x^4+6x^2+1} dx=$$ $$=(\sqrt 2+1)\int_0^{\infty} \frac{\ln(x^2+3)}{x^2+\left(\sqrt 2+1\right)^2} \ dx - (\sqrt 2-1)\int_0^{\infty} \frac{\ln(x^2+3)}{x^2+\left(\sqrt 2-1\right)^2} dx$$ Using the following identity that is valid for $$a\ge 0, b>0$$:$$\int_0^{\infty} \frac{\ln(x^2+a^2)}{x^2+b^2} \ dx = \frac{\pi}{b}\ln(a+b)$$ $$\Rightarrow J_2=\pi\ln\left(\frac{\sqrt{3}+\sqrt{2}+1}{\sqrt{3}+\sqrt{2}-1}\right)=\boxed{\frac{\pi} {2}\ln(2+\sqrt 3)}$$ So we found that:$$J=\boxed{\pi \ln(1+\sqrt 2) - \frac{\pi} {2} \ln(2+\sqrt 3)}\Rightarrow I= \large\boxed{\frac{\pi^2} {8 \sqrt 3}+\frac{\pi}{4}\ln(2+\sqrt 3)-\frac{\pi}{2} \ln(1+\sqrt 2)}$$