Integrate $\int\frac{dx}{(x^2+1)\sqrt{x^2+2}}$ I would like some guidance regarding the following integral:
$$\int\frac{dx}{(x^2+1)\sqrt{x^2+2}}$$
EDIT: The upper problem was derived from the following integral $$\int\frac{\sqrt{x^2+2}}{x^2+1}dx$$
Where I rationalized the numerator which followed into: $$\int\frac{dx}{\sqrt{x^2+2}}+\int\frac{dx}{(x^2+1)\sqrt{x^2+2}}$$
 A: If you aren't aware of the posted formula for calculating an integral of this form (which would completely understandable!), we can start with more familiar approaches, such as using trigonometric substitution.
Try putting $x = \sqrt 2\tan \theta$. Then $$dx = \sqrt 2 \sec^2 \theta\,d\theta$$
$$\text{ and }\,x^2 + 1 = 2\tan^2 \theta + 1 = \tan^2 \theta + \tan^2 \theta + 1 = \tan^2 \theta + \sec^2 \theta$$
$$\begin{align}\int \frac{dx}{(x^2 + 1)\sqrt {x^2 + 2}} &=\int \frac{\sqrt 2\sec^2 \theta\,d\theta}{(\tan^2 \theta+\sec^2 \theta)\sqrt{2\tan^2 \theta + 2}}\\ \\ 
&= \int \frac{\sec^2 \theta\,d\theta}{(\tan^2 \theta+\sec^2 \theta)\underbrace{\sqrt{\tan^2 \theta + 1}}_{\large = \,\sqrt{\sec^2 x}}}\\ \\ &=\int \frac{ \sec^2 \theta\,d\theta}{(\tan^2 \theta + \sec^2 \theta)\sec\theta} \\ \\ 
&= \int \dfrac{\sec \theta\,d\theta}{\tan^2 \theta + \sec^2 \theta}\cdot\left(\frac{\cos^2 \theta}{\cos^2 \theta}\right) \\ \\ &= \int\frac{\cos \theta\,d\theta}{\sin^2\theta + 1} \\ \\
&= \int\frac{d(\sin \theta)}{(\sin \theta)^2 + 1}\\ \\ &= \tan^{-1}(\sin \theta) + C \end{align}$$
Now, in terms of $x$, we have $$x = \sqrt 2\tan\theta \implies \tan\theta = \dfrac x{\sqrt 2} \implies \sin \theta = \frac{x}{\sqrt{x^2 + 2}}$$
That gives us the final answer in terms of $x$: $$\tan^{-1}(\sin \theta) + C = \tan^{-1}\left(\frac{x}{\sqrt{x^2 + 2}}\right) + C$$
A: There is a general formula for it. $$\int \frac{dx}{(x^2+1)\sqrt{x^2+a}}=\frac{1}{\sqrt{a-1}}\tan^{-1}\left(\frac{\sqrt{a-1}x}{\sqrt{x^2+a}}\right)+C\tag{1}$$
$a=2$ gives $$\int \frac{dx}{(x^2+1)\sqrt{x^2+2}}=\tan^{-1}\left(\frac{x}{\sqrt{x^2+2}}\right)+C$$

Formula $(1)$ can be proven by substitution : $t=1/x$, $s=\sqrt{at^2+1}$.
\begin{align}\int \frac{dx}{(x^2+1)\sqrt{x^2+a}}&=-\int\frac{t}{(t^2+1)\sqrt{at^2+1}}dt\\&=-\int\frac{1}{s^2+a-1}ds\\&=\frac1{\sqrt{a-1}}\tan^{-1}\left(\frac{\sqrt{a-1}}{s}\right)+C\\&=\frac{1}{\sqrt{a-1}}\tan^{-1}\left(\frac{\sqrt{a-1}x}{\sqrt{x^2+a}}\right)+C\end{align}
For a more general method of computing these types of integrals, one can use the Euler substitution to transform into the integration of a rational function.
A: Kinda messy, but gets the answer.
Lets write $x^2+2=t \rightarrow x^2+1=t-1 \ and \ x=\pm\sqrt{t-2}$.
For the case $x=\sqrt{t-2}$ we will get $\displaystyle \frac{dt}{dx}=2x \rightarrow dx=\frac{dt}{2x}=\frac{dt}{2\sqrt{t-2}}$.
Now $$\int{\frac{dx}{(x^2+1) \sqrt{x^2+2}}}=\int\frac{\frac{dt}{2\sqrt{t-2}}}{(t-1)\sqrt{t}}=\frac{1}{2}\int\frac{1}{(t-1)\sqrt{t^2-2t}}dt=\frac{1}{2}\int\frac{1}{(t-1)\sqrt{(t-1)^2-1}}dt$$
Define $t-1=m \rightarrow dt=dm$ we get $\displaystyle \frac{1}{2}\int\frac{1}{m\sqrt{m^2-1}}dm$.
Define $\displaystyle p=\sqrt{m^2-1} \rightarrow \frac{dp}{dm}=\frac{2m}{2\sqrt{m^2-1}}=\frac{m}{p} \rightarrow dm=\frac{dp\cdot{p}}{m}$, hence $$\frac{1}{2}\int\frac{1}{m\sqrt{m^2-1}}dm=\frac{1}{2}\int\frac{1}{mp}\cdot{\frac{dp\cdot{p}}{m}}=\frac{1}{2}\int\frac{1}{m^2}dp=\frac{1}{2}\int\frac{1}{p^2+1}dp=\frac{1}{2}arctan(p)+C$$
We know that $p=\sqrt{m^2-1}=\sqrt{(t-1)^2-1}=\sqrt{(x^2+1)^2-1}$.
A: substitute $y = \frac{x}{\sqrt{x^2+2}}$
