Ahmed integral revisited $\int_0^1 \frac{\tan ^{-1}\left(\sqrt{x^2+4}\right)}{\left(x^2+2\right) \sqrt{x^2+4}} \, dx$

To evaluate that integral we can use Feynman's trick: $$I=\int _0^1\frac{\arctan \left(\sqrt{x^2+4}\right)}{\left(x^2+2\right)\sqrt{x^2+4}}\:dx$$ $$I\left(a\right)=\int _0^1\frac{\arctan \left(a\sqrt{x^2+4}\right)}{\left(x^2+2\right)\sqrt{x^2+4}}\:dx$$ $$I'\left(a\right)=\int _0^1\frac{1}{\left(x^2+2\right)\left(a^2x^2+4a^2+1\right)}\:dx=\frac{1}{2a^2+1}\int _0^1\frac{1}{x^2+2}-\frac{a^2}{a^2x^2+4a^2+1}\:dx$$ $$=\frac{1}{2a^2+1}\left(\frac{\arctan \left(\frac{1}{\sqrt{2}}\right)}{\sqrt{2}}-\frac{a\arctan \left(\frac{a}{\sqrt{4a^2+1}}\right)}{\sqrt{4a^2+1}}\right)$$ Now lets integrate again: $$\int _1^{\infty }I'\left(a\right)\:da=\frac{\arctan \left(\frac{1}{\sqrt{2}}\right)}{\sqrt{2}}\int _1^{\infty }\frac{1}{2a^2+1}\:da-\underbrace{\int _1^{\infty }\frac{a\arctan \left(\frac{a}{\sqrt{4a^2+1}}\right)}{\sqrt{4a^2+1}\left(2a^2+1\right)}\:da}_{a=\frac{1}{x}}$$ $$\frac{\pi }{2}\int _0^1\frac{1}{\left(x^2+2\right)\sqrt{x^2+4}}dx-I\:=\frac{\arctan \left(\frac{1}{\sqrt{2}}\right)}{2\sqrt{2}}\left(\frac{\pi \sqrt{2}}{2}-\sqrt{2}\arctan \left(\sqrt{2}\right)\right)-\int _0^1\frac{\arctan \left(\frac{1}{\sqrt{x^2+4}}\right)}{\left(x^2+2\right)\sqrt{x^2+4}}\:dx$$ $$=\frac{\pi \arctan \left(\frac{1}{\sqrt{2}}\right)}{4}-\frac{\arctan \left(\frac{1}{\sqrt{2}}\right)\arctan \left(\sqrt{2}\right)}{2}-\frac{\pi }{2}\int _0^1\frac{1}{\left(x^2+2\right)\sqrt{x^2+4}}\:dx+\underbrace{\int _0^1\frac{\arctan \left(\sqrt{x^2+4}\right)}{\left(x^2+2\right)\sqrt{x^2+4}}\:dx}_{I}$$ $$-2I\:=\frac{\pi \:\arctan \left(\frac{1}{\sqrt{2}}\right)}{4}-\frac{\arctan \left(\frac{1}{\sqrt{2}}\right)\arctan \left(\sqrt{2}\right)}{2}-\pi \underbrace{\int _0^1\frac{1}{\left(x^2+2\right)\sqrt{x^2+4}}\:dx}_{t=\arctan \left(\frac{x}{\sqrt{x^2+4}}\right)}$$ $$I\:=-\frac{\pi \:\arctan \left(\frac{1}{\sqrt{2}}\right)}{8}+\frac{\arctan \left(\frac{1}{\sqrt{2}}\right)\arctan \left(\sqrt{2}\right)}{4}+\frac{\pi }{4}\int _0^{\arctan \left(\frac{1}{\sqrt{5}}\right)}\:dt$$ $$\boxed{I=-\frac{\pi \:\arctan \left(\frac{1}{\sqrt{2}}\right)}{8}+\frac{\arctan \left(\frac{1}{\sqrt{2}}\right)\arctan \left(\sqrt{2}\right)}{4}+\frac{\pi }{4}\arctan \left(\frac{1}{\sqrt{5}}\right)}$$

This numerically agrees with Wolfram Alpha.


Let

$$ I(a)=\int_0^1 \frac{\arctan(a\sqrt{x^2+4})}{(x^2+2)\sqrt{x^2+4}}dx,I(0)=0,I=I(1)$$

\begin{align} I'(a)&=\int_0^1 \frac{1}{(x^2+4)[1+a^2(x^2+4)]}dx \\ &=\int_0^1 \frac{1}{x^2+4}dx-a^2\int_0^1 \frac{1}{1+a^2(x^2+4)}dx \\ &=\frac{1}{2} \arctan \frac{1}{2}-\frac{a}{\sqrt{1+4a^2}}\arctan \frac{a}{\sqrt{1+4a^2}} \\ \end{align}

Note

$$ \int \frac{a}{\sqrt{1+4a^2}}\arctan \frac{a}{\sqrt{1+4a^2}} da $$ $$ =\frac{1}{4} \int \arctan \frac{a}{\sqrt{1+4a^2}} d(\sqrt{1+4a^2}) $$

Using integration by parts,then I believe you can finish it


\begin{align} J&=\int_0^1 \frac{\arctan\left(\sqrt{x^2+4}\right)}{\left(x^2+2\right) \sqrt{x^2+4}} \, dx\\ K&=\int_0^1 \int_0^1 \frac{1}{(x^2+2)(y^2+2)}dxdy \\ &=\int_0^1 \int_0^1 \frac{1}{4+x^2+y^2}\left(\frac{1}{2+x^2}+\frac{1}{2+y^2}\right)dxdy\\ &=2\int_0^1 \int_0^1 \frac{1}{(4+x^2+y^2)(2+x^2)}dxdy\\ &=2 \int_0^1 \left[\frac{\arctan\left(\frac{y}{\sqrt{4+x^2}}\right)}{(2+x^2)\sqrt{4+x^2}}\right]_{y=0}^{y=1} dx\\ &=2\int_0^1 \frac{\arctan\left(\frac{1}{\sqrt{4+x^2}}\right)}{(2+x^2)\sqrt{4+x^2}}dx\\ &=\pi \int_0^1 \frac{1}{(2+x^2)\sqrt{4+x^2}}dx-2J\\ &=\frac{\pi}{2} \left[\arctan\left(\frac{x}{\sqrt{4+x^2}}\right)\right]_0^1-2J\\ &=\frac{\pi}{2}\arctan\left(\frac{1}{\sqrt{5}}\right)-2J\\ \end{align}

On the other hand,

\begin{align}K&=\left(\int_0^1 \frac{1}{2+x^2}dx\right)^2\\ &=\left(\frac{1}{\sqrt{2}}\left[\arctan\left(\frac{x}{\sqrt{2}}\right)\right]_0^1\right)^2\\ &=\frac{1}{2}\arctan^2\left(\frac{1}{\sqrt{2}}\right) \end{align}

Therefore,

$\displaystyle \boxed{J=\frac{\pi}{4}\arctan\left(\frac{1}{\sqrt{5}}\right)-\frac{1}{4}\arctan^2\left(\frac{1}{\sqrt{2}}\right)}$