How to evaluate Ahmed's integral?

Let $$I = \int_{0}^{1} \frac{\tan^{-1}(\sqrt{2+x^2})}{(1+x^2)\sqrt{2+x^2}}\text{d}x$$

and $$ f(t) = \int_{0}^{1} \frac{\tan^{-1}(t\sqrt{2+x^2})}{(1+x^2)\sqrt{2+x^2}}dx$$

such that $f(1)$ = $I$.

$$\Rightarrow f'(t) = \int_{0}^{1} \frac{\text{d}x}{(1+x^2)\sqrt{2+x^2}}\frac{\text{d}}{\text{d}t}\tan^{-1}(t\sqrt{2+x^2})$$

$$= \int_{0}^{1} \frac{\text{d}x}{(1+x^2)\sqrt{2+x^2}}\frac{\sqrt{2+x^2}}{{1+ (t\sqrt{2+x^2})^{2}}}$$

$$= \int_{0}^{1} \frac{\text{d}x}{(1+x^2){(1+ 2t^2+t^2x^2)}}$$

Let $$\frac{1}{(1+x^2)(1+ 2t^2+t^2x^2)} \equiv \frac{A}{(1+x^2)} + \frac{B}{(1+ 2t^2+t^2x^2)} $$

So,

$$A(1+ 2t^2+t^2x^2) + {B}{(1+x^2)} \equiv 1 $$

Put $x=0$ to obtain $A(1+2t^2)+B=1$

and $x=1$ to obtain $A(1+3t^2)+2B=1$

On solving those two, we get $$A = \frac{1}{1+t^2}, B = \frac{-t^2}{1+t^2}$$

So, our integral

$$\int_{0}^{1} \frac{\text{d}x}{(1+x^2){(1+ 2t^2+t^2x^2)}} = \int_{0}^{1} {\frac{A}{(1+x^2)} + \int_{0}^{1}\frac{B}{(1+ 2t^2+t^2x^2)}}$$

Putting the values of $A$ and $B$,

$$f'(t) = \frac{1}{1+t^2}\int_{0}^{1} \frac{\text{d}x}{1+x^2} - \frac{t^2}{1+t^2}\int_{0}^{1}\frac{\text{d}x}{1+ 2t^2+t^2x^2}$$

$$\Rightarrow f'(t) = \frac{1}{1+t^2}(\tan^{-1}x)\Biggr|_{0}^{1} - \frac{t}{1+t^2} \int_{x=0}^{x=1}\frac{\text{d}(tx)}{1+ 2t^2+(tx)^2} $$

Let $tx$ = $ u$

$$f'(t) = \frac{1}{1+t^2}(\tan^{-1}(1) - \tan^{-1}(0)) - \frac{t}{1+t^2} \int_{u=0}^{u=t}\frac{\text{d}(u)}{(\sqrt{1+ 2t^2})^{2}+(u)^2} $$

So,

$$f'(t) = \frac{1}{1+t^2}\frac{\pi}4 - \frac{t}{1+t^2} \frac{1}{\sqrt{1+ 2t^2}} \tan^{-1}{\frac{u}{\sqrt{1+ 2t^2}}} \Biggr|_{0}^{t} $$

$$\Rightarrow \frac{\text{d}f}{\text{d}t} = \frac{1}{1+t^2}\frac{\pi}4 - \frac{t}{1+t^2} \frac{1}{\sqrt{1+ 2t^2}} \tan^{-1}{\frac{t}{\sqrt{1+ 2t^2}}}$$

$$\Rightarrow \text{d}f = \frac{\pi}{4}\frac{\text{d}t}{1+t^2}- \frac{t}{1+t^2} \frac{1}{\sqrt{1+ 2t^2}} \tan^{-1}{\frac{t}{\sqrt{1+ 2t^2}}}\text{d}t$$

Integrating both sides from $1$ to $\infty$,

$$\lim_{y \rightarrow \infty} f(y) - f(1) = \frac{\pi}{4}\int_{1}^{\infty}\frac{\text{d}t}{1+t^2}- \int_{1}^{\infty} \frac{t}{1+t^2} \frac{1}{\sqrt{1+ 2t^2}} \tan^{-1}{\frac{t}{\sqrt{1+ 2t^2}}}\text{d}t$$

$$ = \lim_{y \rightarrow \infty} f(y) - I = \frac{\pi}{4}(\tan^{-1}t)\Biggr|_{1}^{\infty} - \int_{1}^{\infty} \frac{t}{1+t^2} \frac{1}{\sqrt{1+ 2t^2}} \tan^{-1}{\frac{t}{\sqrt{1+ 2t^2}}}\text{d}t$$

$$ = \lim_{y \rightarrow \infty} f(y) - I = \frac{\pi}{4}(\frac{\pi}{2}-\frac{\pi}{4}) - \int_{1}^{\infty} \frac{t}{1+t^2} \frac{1}{\sqrt{1+ 2t^2}} \tan^{-1}({\frac{t}{\sqrt{1+ 2t^2}})}\text{d}t$$

$$ = \lim_{y \rightarrow \infty} f(y) - I = \frac{\pi^{2}}{16} - \int_{1}^{\infty} \frac{t}{1+t^2} \frac{1}{\sqrt{1+ 2t^2}} \tan^{-1}({\frac{t}{\sqrt{1+ 2t^2}})}\text{d}t \tag1$$

$$ \lim_{y \rightarrow \infty} f(y) = \lim_{y \rightarrow \infty} \int_{0}^{1} \frac{\tan^{-1}(y\sqrt{2+x^2})}{(1+x^2)\sqrt{2+x^2}}dx$$

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

Putting $x=\sqrt{2}\tan \theta$, when $x=0$, $\theta = 0$ and when $x=1$, $\theta = \tan^{-1}(\frac{1}{\sqrt{2}}) $ , also $\text{d}x =\sqrt{2}\sec^2\theta \text{d}\theta $

Substituting, we get

$$\lim_{y \rightarrow \infty} f(y) = \frac{\pi}{2}\int_{0}^{\tan^{-1}(\frac{1}{\sqrt{2}})}\frac{\sqrt{2}\sec^2\theta}{(1+2\tan^2\theta)(\sqrt{2}\sec\theta)}\mathrm d\theta\\ =\int_{0}^{\tan^{-1}(\frac{1}{\sqrt{2}})}\frac{\sec \theta}{1+2\tan^2\theta}\mathrm d\theta $$

$$ = \frac{\pi}{2}\int_{0}^{\tan^{-1}(\frac{1}{\sqrt{2}})}\frac{\frac{1}{\cos\theta}\text{d}\theta}{1+2\frac{\sin^2\theta}{\cos^2\theta}}$$

$$ =\frac{\pi}{2} \int_{0}^{\tan^{-1}(\frac{1}{\sqrt{2}})}\frac{\cos\theta}{\cos^2\theta+2{\sin^2\theta}}\text{d}\theta$$

$$ = \frac{\pi}{2}\int_{\theta = 0}^{\theta = \tan^{-1}(\frac{1}{\sqrt{2}})}\frac{\cos\theta}{1+{\sin^2\theta}}\text{d}\theta$$

Let $\phi = \sin\theta$, so $\text{d}\phi = \cos\theta\text{d}\theta$

When $\theta = 0$, $\phi = 0$, and when $\theta = \tan^{-1}(\frac{1}{\sqrt{2}})$, $\phi = \sin(\tan^{-1}(\frac{1}{\sqrt{2}})) = \frac{1}{\sqrt{3}}$

So,

$$ \lim_{y \rightarrow \infty} f(y) = \frac{\pi}{2}\int_{\phi = 0}^{\phi = \frac{1}{\sqrt{3}}} \frac{\text{d}\phi}{1 + \phi^2}$$

$$= \frac{\pi}{2}tan^{-1}{\phi} \Biggr|_{0}^{\frac{1}{\sqrt{3}}} = \frac{\pi}{2}(\frac{\pi}{6}-0) = \frac{\pi^2}{12} $$

So, $$ \lim_{y \rightarrow \infty} f(y) = \frac{\pi^2}{12} \tag2$$

Putting this back in $(1)$, We get

$$\frac{\pi^2}{12} - I = \frac{\pi^{2}}{16} - \int_{1}^{\infty} \frac{t}{1+t^2} \frac{1}{\sqrt{1+ 2t^2}} \tan^{-1}({\frac{t}{\sqrt{1+ 2t^2}})}\text{d}t$$

$$ \Rightarrow \frac{\pi^2}{12} - I = \frac{\pi^{2}}{16} + \int_{1}^{\infty} \frac{1}{1+(\frac{1}{t})^2} \frac{1}{\sqrt{2+(\frac{1}{t})^2}} \tan^{-1}(\frac{1}{\sqrt{2+(\frac{1}{t})^2}})\frac{-\text{d}t}{t^2}$$

Now let $\frac{1}{t} = z$

$$ \Rightarrow \frac{\pi^2}{12} - I = \frac{\pi^{2}}{16} + \int_{1}^{0} \frac{1}{1+z^2} \frac{1}{\sqrt{2+z^2}} \tan^{-1}(\frac{1}{\sqrt{2+z^2}})\text{d}z$$

$$\Rightarrow \frac{\pi^2}{12} - I = \frac{\pi^{2}}{16} + \int_{1}^{0} \frac{1}{1+z^2} \frac{1}{\sqrt{2+z^2}} (\frac{\pi}{2}-\tan^{-1}{\sqrt{2+z^2}})\text{d}z$$

$$ \Rightarrow \frac{\pi^2}{12} - I = \frac{\pi^{2}}{16} + \frac{\pi}{2}\int_{1}^{0} \frac{\text{d}z}{(1+z^2){\sqrt{2+z^2}}} - \int_{1}^{0} \frac{1}{1+z^2} \frac{1}{\sqrt{2+z^2}}\tan^{-1}{\sqrt{2+z^2}}\text{d}z$$

$$\Rightarrow \frac{\pi^2}{12} - I = \frac{\pi^{2}}{16} -( \frac{\pi}{2}\frac{\pi}{6})+I$$

$$\Rightarrow \frac{\pi^2}{6} -\frac{\pi^{2}}{16} = 2I$$

$$\Rightarrow I = \frac{\pi^2}{96}$$

So, $$\int_{0}^{1} \frac{\tan^{-1}(\sqrt{x^2+2})}{(\sqrt{x^2+2}) (x^2+1)} \ dx = \frac{5 \pi^2}{96}$$


A few ways to evaluate it can be found here

Zafar Ahmed, Knut Dale, George Lamb: Definitely an Integral: 10884. The American Mathematical Monthly 109(7): 670-671 (2002)

http://www.jstor.org/stable/pdfplus/3072448.pdf


I am not sure how far it is from the actual solution, but here is mine.
Let $I$ be your integral in question.

Consider \begin{align} J= \int_{0}^{1} \int_{0}^{x} \frac{x}{(x^2+1)(x^2+(2+x^2)y^2)} \ dy \ dx. \end{align}Evaluating $J$ in the order presented gives us that

\begin{align} J= \int_{0}^{1} \frac{\tan^{-1}\left(\frac{y\sqrt{x^2+2}}{x}\right)}{(x^2+1) \sqrt{x^2+2}} \Big|_{y=0}^{y=x} \ dx=I. \end{align}

On the other hand, we reverse the order of integration, justified by Fubini's theorem.

\begin{align} J= \int_{0}^{1} \int_{y}^{1} \frac{x}{(x^2+1)(x^2+y^2(x^2+2))} \ dx \ dy. \end{align}

Using partial fractions (or Mathematica), we see that

\begin{align} J=\int_{0}^{1} \frac{\ln \left( \frac{2(y^4+3y^2)}{(y^2+1)(1+3y^2)} \right)}{2(y^2-1)} \ dy, \end{align} which can then be split apart into \begin{align} J=\int_{0}^{1} \frac{\ln \left( \frac{2}{y^2+1} \right)}{2(y^2-1)} \ dy + \int_{0}^{1} \frac{\ln \left( y^2 \right)}{2(y^2-1)} \ dy + \int_{0}^{1} \frac{\ln \left( \frac{y^2+3}{3y^2+1} \right)}{2(y^2-1)} \ dy. \end{align} Denote \begin{align} &J_1= \int_{0}^{1} \frac{\ln \left( \frac{2}{y^2+1} \right)}{2(y^2-1)} \ dy, \\ &J_2=\int_{0}^{1} \frac{\ln \left( y^2 \right)}{2(y^2-1)} \ dy ,\\ &J_3=\int_{0}^{1} \frac{\ln \left( \frac{y^2+3}{3y^2+1} \right)}{2(y^2-1)} \ dy, \end{align} and consider the double integrals \begin{align} &K_1= -\int_{0}^{1} \int_{0}^{1} \frac{x}{(1+x^2y^2)(1+x^2)} \ dx \ dy , \\ &K_2= \int_{0}^{1} \int_{0}^{\infty} \frac{x}{(1+x^2y^2)(1+x^2)} \ dx \ dy , \\ &K_3= \int_{0}^{1} \int_{0}^{1} \frac{3x}{(3+x^2y^2)(3+x^2)} \ dx \ dy , \\ &K_4= \int_{0}^{1} \int_{0}^{1} \frac{3x}{(1+3x^2y^2)(1+3x^2)} \ dx \ dy. \end{align} Evaluating the double integrals as they are with partial fractions(or Mathematica), we find that \begin{align} &J_1=K_1 , \\ &J_2=K_2 , \\ &J_3=K_3-K_4 . \end{align} Now reverse the order of integration for each double integral. Then \begin{align} &K_1= -\int_{0}^{1} \int_{0}^{1} \frac{x}{(1+x^2y^2)(1+x^2)} \ dy \ dx = \int_{0}^{1} \frac{-\tan^{-1}(x)}{1+x^2} \ dx = -\frac{\pi^2}{32} \\ &K_2= \int_{0}^{\infty} \int_{0}^{1} \frac{x}{(1+x^2y^2)(1+x^2)} \ dy \ dx = \int_{0}^{\infty} \frac{\tan^{-1}(x)}{(1+x^2)} \ dx = \frac{\pi^2}{8} \\ &K_3= \int_{0}^{1} \int_{0}^{1} \frac{3x}{(3+x^2y^2)(3+x^2)} \ dy \ dx = \int_{0}^{1} \frac{\tan^{-1}\left(\frac{x}{\sqrt{3}} \right)}{\sqrt{3}(3+x^2)} \ dx = \frac{\pi^2}{72}\\ &K_4= \int_{0}^{1} \int_{0}^{1} \frac{3x}{(1+3x^2y^2)(1+3x^2)} \ dy \ dx = \int_{0}^{1} \frac{\sqrt{3} \tan^{-1}\left(x\sqrt{3} \right)}{(1+3x^2)} \ dx = \frac{\pi^2}{18}, \end{align} which can be confirmed by $u$ substitutions. Putting everything together, we see that \begin{align*} & I= -\frac{\pi^2}{32}+\frac{\pi^2}{8}+\frac{\pi^2}{72}-\frac{\pi^2}{18}\\ &= \frac{5\pi^2}{96}. \end{align*} Hence, \begin{align} \int_{0}^{1} \frac{\tan^{-1}(\sqrt{x^2+2})}{(\sqrt{x^2+2}) (x^2+1)} \ dx = \frac{5 \pi^2}{96}. \end{align}

Remark

$J_2$ is an integral commonly used to solve the Basel Problem. Many Stack Exchange users (including myself) have posted solutions in Different methods to compute $\sum\limits_{k=1}^\infty \frac{1}{k^2}$ . Also you can view Daniele Ritelli's and Luigi Pace's solutions on JSTOR (I believe).