How do you evaluate the integral $\int\frac{x^2-1}{(x^4+3 x^2+1) \tan^{-1}\left(\frac{x^2+1}{x}\right)}\,dx$? i'm required to evaluate this integral. I've tried factorizing but it doesn't lead me to anywhere. 
$$\int\frac{x^2-1}{(x^4+3 x^2+1) \tan^{-1}\left(\frac{x^2+1}{x}\right)}\,dx$$
I've also tried letting $u = \frac{x^2+1}{x}$, $du/dx$ gets me $1-\frac{1}{x^2}$ but it doesn't seem to be working either.
Hope to receive some advise/ solutions on how to start tackling the question
 A: Notice, substitute $\text{u}=\text{f}\left(\text{x}\right)$ and $\text{d}\text{u}=\text{f}\space'\left(\text{x}\right)\space\text{d}\text{x}$:
$$\int\frac{\text{f}\space'\left(\text{x}\right)}{\text{f}\left(\text{x}\right)}\space\text{d}\text{x}=\int\frac{1}{\text{u}}\space\text{d}\text{u}=\ln\left|\text{u}\right|+\text{C}=\ln\left|\text{f}\left(\text{x}\right)\right|+\text{C}$$
Now, when:
$$\text{f}\left(\text{x}\right)=\arctan\left\{x+\frac{1}{x}\right\}$$
And:
$$\text{f}\space'\left(\text{x}\right)=\frac{x^2-1}{x^4+3x^2+1}$$

So, when you want to prove the result:
$$\int\frac{\frac{x^2-1}{x^4+3x^2+1}}{\arctan\left\{x+\frac{1}{x}\right\}}\space\text{d}\text{x}=\int\frac{x^2-1}{\left(x^4+3x^2+1\right)\arctan\left\{x+\frac{1}{x}\right\}}\space\text{d}\text{x}=\ln\left|\arctan\left\{x+\frac{1}{x}\right\}\right|+\text{C}$$
A: An useful identity to remember is
$$\frac{dx}{x} = \frac{d(x+x^{-1})}{x-x^{-1}} = \frac{d(x-x^{-1})}{x + x^{-1}}$$
Using the first part of this identity, you can rewrite the integral as
$$\begin{align}
 & \int \frac{x(x^2-1)}{(x^4+3x^2+1)\tan^{-1}\left(x + x^{-1}\right)}\frac{d(x+x^{-1})}{x-x^{-1}}\\
= & \int \frac{x^2 d(x+x^{-1})}{(x^4+3x^2+1)\tan^{-1}\left(x + x^{-1}\right)}\\
= & \int \frac{d(x+x^{-1})}{(x^2+x^{-2}+3)\tan^{-1}\left(x + x^{-1}\right)}\\
= & \int \frac{d(x+x^{-1})}{((x+x^{-1})^2+1)\tan^{-1}\left(x + x^{-1}\right)}\\
= & \int \frac{d\tan^{-1}\left(x + x^{-1}\right)}{\tan^{-1}\left(x + x^{-1}\right)}\\
= &\log\tan^{-1}\left(x + x^{-1}\right) + \text{constant}.
\end{align}
$$
A: Hint: use $u = \arctan(\frac {x^2 + 1}{x})$
