Given: #(x^4 + x^3 + x^2 + 1)/(x^2 + x - 2)#
Begin reducing by adding 0 to the numerator in the form of #-2x^2 + 2x^2#
#(x^4 + x^3 -2x^2 + 2x^2 + x^2 + 1)/(x^2 + x - 2)#
Break into two fractions:
#(x^4 + x^3 -2x^2)/(x^2 + x - 2) + (2x^2 + x^2 + 1)/(x^2 + x - 2)#
Factor #x^2# from the numerator of the first term:
#(x^2(cancel(x^2 + x -2)))/cancel(x^2 + x - 2) + (2x^2 + x^2 + 1)/(x^2 + x - 2)#
The first term becomes #x^2# and we combine like terms in the numerator of the second fraction:
#x^2 + (3x^2 + 1)/(x^2 + x - 2)#
Add 0 to the numerator of the second term in the form of #3x - 6 - 3x + 6#:
#x^2 + (3x^2 + 3x - 6 - 3x + 6 + 1)/(x^2 + x - 2)#
Break the second term into two fractions:
#x^2 + (3x^2 + 3x - 6)/(x^2 + x - 2) + (-3x + 6 + 1)/(x^2 + x - 2)#
Remove a factor of 3 from the first numerator and combine like terms in the last fraction:
#x^2 + (3(cancel(x^2 + x - 2)))/cancel(x^2 + x - 2) + (7 -3x)/(x^2 + x - 2)#
The second term becomes 3:
#x^2 + 3 + (7 -3x)/(x^2 + x - 2)#
Partial Fraction Expansion of the last term:
#(7 -3x)/(x^2 + x - 2) = A/(x + 2) + B/(x - 1)#
#7 - 3x = A(x - 1) + B(x + 2)#
Make B disappear by letting x = -2
#7 - 3(-2) = A(-2 - 1) + B(-2 + 2)#
#A# = -13/3
Make A disappear by Letting x = 1:
#7 - 3(1) = A(1 - 1) + B(1 + 2)#
#B = 4/3#
Check
#(-13/3)/(x + 2) + (4/3)/(x - 1)#
#(-13/3)/(x + 2)(x - 1)/(x - 1) + (4/3)/(x - 1)(x + 2)/(x + 2)#
#((-13/3)(x - 1)+ (4/3)(x + 2))/((x + 2)(x - 1))#
#(7 - 3x)/((x + 2)(x - 1))#
This checks
Returning to the main problem:
#int(x^4 + x^3 + x^2 + 1)/(x^2 + x - 2)dx = intx^2dx + 3intdx - 13/3int1/(x + 2)dx + 4/3int1/(x - 1)dx#
#int(x^4 + x^3 + x^2 + 1)/(x^2 + x - 2)dx = 1/3x^3 + 3x - 13/3ln(x + 2) + 4/3ln(x - 1) + C#