How to solve integral : $\int\frac{\sqrt{x^2 + 1}}{x^2 + 2}dx$ How to solve integral : $\int\frac{\sqrt{x^2 + 1}}{x^2 + 2}dx$
Integration by parts or substitution?
 A: Hint:
\begin{align}
x&=\tan(u) \\
&\Rightarrow \int \frac {\sec^3(u)}{2+\tan^2(u)}du\\
s&=\sin(u)\\
&\Rightarrow \int \frac{1}{s^4-3s^2+2}ds
\end{align}
A: Let $x = \tan u$, $dx = \sec^2u ~du$. Substitute in the integral to get 
$$\int \frac{\sec^3u}{2+\tan^2u}du.$$
Now
\begin{align}
I = \int \frac{\sec^3u}{2+\tan^2u}du &=  \int \frac{\frac{1}{\cos^3u}}{2+\frac{\sin^2u}{\cos^2u}}du\\
&=\int \frac{\frac{1}{\cos^3u}}{\frac{2\cos^2u+\sin^2u}{\cos^2u}}du\\
&= \int \frac{1}{\cos u(2\cos^2u+\sin^2u)}du\\
&= \int \frac{\sec u}{(1+\cos^2u)}du\\
&= \int \frac{\sec u}{(2-\sin^2u)}du\\
&= \int \frac{\cos u}{\cos^2u(2-\sin^2u)}du\\
&= \int \frac{\cos u}{(1-\sin^2u)(2-\sin^2u)}du\\
\end{align}
Now, Let $v = \sin u$, $dv = \cos u~ du$, then
\begin{align}
I &= \int \frac{1}{(1-v^2)(2-v^2)}dv = \int \frac{1}{(1-v)(1+v)(\sqrt{2}-v)(\sqrt{2}+v)}dv\\
&= \int \frac{-\frac{1}{2}}{(1-v)} + \frac{\frac{1}{2}}{(1+v)} + \frac{\frac{1}{\sqrt{8}}}{(\sqrt{2}-v)}+ \frac{-\frac{1}{\sqrt{8}}}{(\sqrt{2}+v)}dv\\
&= \frac{1}{2} \ln(1-v) - \frac{1}{2} \ln(1+v) -\frac{1}{\sqrt{8}} \ln(\sqrt{2}-v) + \frac{1}{\sqrt{8}} \ln(\sqrt{2}+v)\\
&= \frac{1}{2} \ln(1-\sin u) - \frac{1}{2} \ln(1+\sin u) -\frac{1}{\sqrt{8}} \ln(\sqrt{2}-\sin u) + \frac{1}{\sqrt{8}} \ln(\sqrt{2}+\sin u)
\end{align}
Therefore 
\begin{align}
I &= \frac{1}{2} \ln(1-\frac{x}{\sqrt{1+x^2}}) - \frac{1}{2} \ln(1+\frac{x}{\sqrt{1+x^2}}) -\frac{1}{\sqrt{8}} ~~\ln(\sqrt{2}-\frac{x}{\sqrt{1+x^2}}) \\
&+ \frac{1}{\sqrt{8}} \ln(\sqrt{2}+\frac{x}{\sqrt{1+x^2}}) + C
\end{align}
