Antiderivative of $\frac{(x+2)^2}{\sqrt{1-\frac{1}{x^2}}}$ I am struggling to find the general antiderivative of the following function $f$:
$$f(x)=\frac{(x+2)^2}{\sqrt{1-\frac{1}{x^2}}}$$
I am trying to find the improper integral from $1$ to $2$. I’m aware that the function is undefined at $1$ and I know the method to carry out.  I am just unsure on finding the general antiderivative of $f$. 
I tried substitution of $1/x$ but I was unable to proceed further. 
Can anyone help – I’ve spent a few days on this problem and don’t seem to be getting anywhere. Thanks.
 A: The function is only defined for $x<-1$ or $x>1$.
Let's to the latter case, where the function can be rewritten as
$$
\frac{x(x+2)^2}{\sqrt{x^2-1}}
$$
Here a substitution $x=\cosh t$ (with $t>0$) seems good, because then $dx=\sinh t\,dt$ and $\sqrt{\cosh^2t-1}=\sinh t$, so the integral becomes
$$
\int\cosh t(\cosh t+2)^2\,dt
$$
which is essentially elementary:
\begin{align}
&\int \cosh^3t\,dt=\int(\sinh^2t+1)\cosh t\,dt=\frac{\sinh^3t}{3}+\sinh t \\[6px]
&\int 4\cosh^2t\,dt=\int 4\frac{\cosh2t+1}{2}\,dt=\sinh2t+2t \\[6px]
&\int 4\cosh t\,dt=4\sinh t
\end{align}
For $x<-1$, it is similar.
A: Hint: Rewrite this as $$\int \frac{ x(x+2)^2 }{\sqrt{x^2 -1}} \, dx .$$
The form of the square root suggests that we use the trigonometric substitution $x = \sec \theta$. The integral then becomes
$$\int \sec^4(\theta) + 4\sec^3(\theta) + 4\sec^2(\theta) \, d\theta,$$
which can be evaluated with standard methods. (Let $u = \tan(\theta)$ and $\sec^2(\theta) = \tan^2(\theta)+1$ for the first one, and use integration by parts with $u = \sec(\theta)$ and $dv = \sec^2(\theta)$ for the second one.)
A: $$\frac{(x+2)^2}{\sqrt{1-\dfrac1{x^2}}}=\frac{(x+4)(x^2-1)+5x+4}{\sqrt{x^2-1}}=x\sqrt{x^2-1}+4\sqrt{x^2-1}+\frac{5x}{\sqrt{x^2-1}}+\frac4{\sqrt{x^2-1}}.$$
Among these four terms, three have a quasi-immediate antiderivative,
$$I=\frac13(x^2-1)^{3/2}+4\int\sqrt{x^2-1}\,dx+5\sqrt{x^2-1}+4\text{ arcosh}(x).$$
Now by parts,
$$J=\int\sqrt{x^2-1}\,dx=x\sqrt{x^2-1}-\int\frac{x^2}{\sqrt{x^2-1}}dx=x\sqrt{x^2-1}-\int\frac{x^2-1+1}{\sqrt{x^2-1}}dx
\\=x\sqrt{x^2-1}-\text{arcosh}(x)-J.$$
