#x^4+2x^3-1 = x^2(x^2+3x+2)-x^3-2x^2-1 =x^2(x^2+3x+2) - x(x^2+3x+2)+x^2+2x-1 = (x^2-x)(x^2+3x+2)+1(x^2+3x+2)-x-3 = (x^2-x+1)(x^2+3x+2)-(x+3)#
Thus
#{x^4+2x*3-1}/{(x+1)(x+2)} = x^2+1-{x+3}/{(x+1)(x+2)} #
We now write
# {x+3}/{(x+1)(x+2)} = A/{x+1}+B/{x+2} #
so that
#x+3 = A(x+2) + B(x+1) = (A+B)x+(2A+B)#
This leads to
#A+B = 1, qquad 2A+B = 3 implies A=2,qquad B = -1#
so that
# int {x^4+2x*3-1}/{(x+1)(x+2)} dx #
#= int [(x^2-x+1) -2/{x+1}+1/{x+2}] dx #
# = 1/3x^3-1/2x^2+x-2 log|x+1|+log|x+2|+C#