How to solve this indefinite integral with $\arctan$? $$\int \frac{(x^2-1)\;\text{d}x}{(x^4+3x^2+1) \tan^{-1}{\left(\frac{x^2+1}{x}\right)}}$$
We should divide numerator and denominator by $ x^2 $ and put $z=x+\frac{1}{x}$ but I'm still not getting the answer. Please help!
 A: I will give you a hint: You should substitute $ u = \tan^{-1}\left(x + \frac{1}{x}\right) $ and then find $ \text{d}u $ and you will come up with an easy to compute expression.  
Solution should be like $\log(u) + \text{const}.$, and then you can change back to $x$.
A: Consider the integral:
\begin{align}
I(a) = \int \frac{(x^2 - 1) \, dx}{(x^4 + a x^2+ 1) \, \tan^{-1}\left(\frac{x^2+1}{x}\right) }.
\end{align}
The integral can be seen in the form
\begin{align}
I(a) = \int \frac{\left(\frac{x^2-1}{x^2}\right) \, dx}{\left( a -1 + \left( x + \frac{1}{x} \right)^2 \right) \, \tan^{-1}\left(x + \frac{1}{x} \right)}.
\end{align}
Make the substitution $u = x + \frac{1}{x}$ to obtain
\begin{align}
I(a) &= \int \frac{du}{(a-1 + u^2) \, \tan^{-1}(u)}.
\end{align}
Making the substitution $t = \tan^{-1}(u)$ leads to
\begin{align}
I(a) = \int \frac{\sec^{2}(t) \, dt}{(a-1 + \tan^{2}(t)) \, t} = \int \frac{dt}{t \, (1 + (a-2) \cos^{2}(t))}. 
\end{align}
This result shows that if $a \neq 2$ then the integral has no closed form result. If $a=2$ then
\begin{align}
I(2) &= \ln(t) = \ln(\tan^{-1}(u)) = \ln\left(\tan^{-1}\left(x + \frac{1}{x}\right)\right).
\end{align}
