Consider the integrand function:
x^3/(x^2-x-2)
Factorize the denominator:
x^2-x-2 = (x+1)(x-2)
Now add ans subtract 1 to the numerator:
x^3/(x^2-x-2) = (x^3+1-1)/((x+1)(x-2)) = (x^3+1)/((x+1)(x-2)) -1/((x+1)(x-2))
Use the factorization: (x^3+1) = (x+1)(x^2-x+1) so that we can simplify:
(1) x^3/(x^2-x-2) = ( (x+1)(x^2-x+1) )/((x+1)(x-2)) -1/((x+1)(x-2)) = (x^2-x+1) /(x-2) -1/((x+1)(x-2))
Now note that:
x^2-x+1 = x^2-x-2 +3 = (x-2)(x+1) +3
so :
(x^2-x+1) /(x-2) = ((x-2)(x+1) +3)/(x-2) = x+1 +3/(x-2)
and that using partial fractions:
1/((x+1)(x-2)) = A/(x+1) +B/(x-2)
1/((x+1)(x-2)) = (Ax-2A+Bx+B)/((x+1)(x-2))
{(A+B = 0),(-2A+B = 1):}
{(A = -1/3),(B = 1/3):}
Substitute this in (1) to have:
x^3/(x^2-x-2) =x+1 +3/(x-2) +1/(3(x+1))-1/(3(x-2))
x^3/(x^2-x-2) =x+1 +1/(3(x+1))+8/(3(x-2))
We can now integrate:
int x^3/(x^2-x-2)dx = x^2/2+x +1/3ln abs(x+1) +8/3 ln abs (x-2) +C
E