Solve the following integral: $ \int \frac{x^2}{x^2+x-2} dx $ Solve the integral: $ \int \frac{x^2}{x^2+x-2} dx $
I was hoping that writing it in the form $ \int 1 - \frac{x-2}{x^2+x-2} dx $ would help but I'm still not getting anywhere.
In the example it was re-written as $ \int 1 - \frac{4}{3x+6} - \frac{1}{3x-3} dx $
but I am not sure how this was accomplished. Any ideas? I am more interested in the method than the answer.

While partial fraction expansion is certainly the natural choice, here is a slightly different approach that continues from the OP's attempt.
$$\begin{align}
\frac{x^2}{x^2+x-2}&=1-\frac{x-2}{x^2+x-2}\\\\
&=1-\frac12 \frac{2x-4}{x^2+x-2}\\\\
&=1-\frac12 \frac{2x+1-5}{x^2+x-2}\\\\
&1-\frac12 \frac{2x+1}{x^2+x-2}+ \frac{5/2}{x^2+x-2}\\\\
&=1-\frac12 \frac{2x+1}{x^2+x-2}+ \frac{5/2}{(x+1/2)^2-(3/2)^2}
\end{align}$$
Now, the first term is trivial to integrate.  The second term is a perfect differential since the numerator is the derivative of the denominator.  And the last term is set up for a hyperbolic trigonometric substitution.
