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.

Since $x^2+x-2 = (x-1)(x+2)$, we can use partial fraction decomposition:
$$\frac{x-2}{x^2+x-2} = \frac{A}{x-1} + \frac{B}{x+2}.$$
Then $x-2 = A(x+2) + B(x-1)$.
Equating the coefficients of each power of $x$, we have that $1=A+B$, and $-2=2A-B$.
Solving for $A$ and $B$ decomposes our original rational expression into two simple fractions.
