$\int_{0}^{\infty}\tan^{-1}\left(\frac{2x}{1+x^2}\right)\frac{x}{x^2+4}dx$ $$\int_{0}^{\infty}\tan^{-1}\left(\frac{2x}{1+x^2}\right)\frac{x}{x^2+4}dx$$
I am given solution for this definite integral is $\frac{\pi}{2}\left(\ln\frac{\sqrt2+3}{\sqrt2+1}\right)$. Any idea or approach you would use to solve this?
 A: \begin{align}
&\int_{0}^{\infty}\tan^{-1}\left(\frac{2x}{1+x^2}\right)\frac{x}{x^2+4}\ dx\\
=& \int_{0}^{\infty}\int_{\sqrt2-1}^{\sqrt2+1}\frac{x}{x^2+y^2}\frac{x}{x^2+4}\ dy \ dx\\
=& \ \frac\pi2 \int_{\sqrt2-1}^{\sqrt2+1}\frac1{y+2}dy= \frac{\pi}{2}\ln\frac{\sqrt2+3}{\sqrt2+1}
\end{align}
A: Scientia, Series A: Mathematical Sciences 31
(2021), 25-56
Sean M. Stewart generalised
$$\int_{0}^{\infty}\arctan \left(\frac{2rx}{b^2+r^2}\right)\left(\frac{x}{x^2+a^2}\right)dx=\frac{\pi}{2}\ln\left(\frac{a+\sqrt{r^2+b^2}+r}{a+\sqrt{r^2+b^2}-r}\right)$$
A: Using integration by parts, we find
$$\int_0^\infty \tan^{-1}\left(\frac{2 x} {x^2 +1}\right)\frac{x}{x^2 +4}dx=\int_0^{\infty}\frac{(x^2-1)\ln(x^2+4)}{x^4+6x^2+1}  dx.$$
Factoring the denominator as
$$x^4+6x^2+1=(x^2+3+2\sqrt{2})(x^2+3-2\sqrt{2})\\
=(x^2+(\sqrt{2}+1)^2)(x^2+(\sqrt{2}-1)^2)$$ and then applying the partial fraction decomposition, we obtain
$$\frac{\sqrt{2}+1}{2}\int_0^{\infty} \frac{\ln(x^2+4)}{x^2+(\sqrt{2}+1)^2}  dx - \frac{\sqrt{2}-1}{2}\int_0^{\infty} \frac{\ln(x^2+4)}{x^2+(\sqrt{2}-1)^2}  dx.$$
Finally we use An improper integral : $\int_{0}^\infty {\ln(a^2+x^2)\over{b^2+x^2}}dx$? $=\frac{\pi}{b} \,   \ln(a+b) $, getting
$$\frac{\pi}{2}\ln(\sqrt{2}+3)-\frac{\pi}{2}\ln(\sqrt{2}+1)=\frac{\pi}{2}\ln\left(\frac{\sqrt2+3}{\sqrt2+1}\right).$$
