Here is the basic partial fraction equation:
#(3x^4+x^3+20x^2+3x+31)/((x+1)(x^2+4)^2) = A/(x+1) + (Bx+C)/(x^2+4)+(Dx+E)/((x^2+4)^2)#
Multiply both sides by #(x+1)(x^2+4)^2#
#3x^4+x^3+20x^2+3x+31 = A(x^2+4)^2 + (Bx+C)(x+1)(x^2+4)+(Dx+E)(x+1)#
We need 5 equations.
Let #x = -1#:
#3(-1)^4+(-1)^3+20(-1)^2+3(-1)+31 = A((-1)^2+4)^2 + (B(-1)+C)(-1+1)((-1)^2+4)+(D(-1)+E)(-1+1)#
#3(-1)^4+(-1)^3+20(-1)^2+3(-1)+31 = A((-1)^2+4)^2 + (Bx+C)(-1+1)(x^2+4)+(Dx+E)(-1+1)#
#50 = 25A+0B+0C+0D+0E#
#A = 2#
The first line in the augmented matrix is:
#[(1,0,0,0,0,|,2)]#
Let #x = 0#:
31 = #3(0)^4+(0)^3+20(0)^2+3(0)+31 = A((0)^2+4)^2 + (B(0)+C)(0+1)((0)^2+4)+(D(0)+E)(0+1)#
#31 = 16A + 0B+ 4C + 0D+E#
The next line in the augmented matrix is:
#[(1,0,0,0,0,|,2),
(16,0,4,0,1,|,31)
]#
Let x = 1:
31 = #3(1)^4+(1)^3+20(1)^2+3(1)+31 = A((1)^2+4)^2 + (B(1)+C)(1+1)((1)^2+4)+(D(1)+E)(1+1)#
#58 = 25A + 10B+ 10C + 2D+2E#
#[(1,0,0,0,0,|,2),
(16,0,4,0,1,|,31),
(25,10,10,2,2,|,58)
]#
This is enough to show you how to do it.
You solve the matrix and obtain values for all 5 variables
You find that #A = 2, B = 1, C = 0 , D=0, and E=-1
Here is the results broken into 3 integrals:
#int(3x^4+x^3+20x^2+3x+31)/((x+1)(x^2+4)^2)dx = 2int1/(x+1)dx+intx/(x^2+4)dx-int1/(x^2+4)^2dx#
The first integral is the natural logarithm:
#int(3x^4+x^3+20x^2+3x+31)/((x+1)(x^2+4)^2)dx = 2ln(x+1)+intx/(x^2+4)dx-int1/(x^2+4)^2dx#
For the second integral let #u = x^2+4#, then #du = 2xdx# and it, too, becomes a natural logarithm:
#int(3x^4+x^3+20x^2+3x+31)/((x+1)(x^2+4)^2)dx = 2ln(x+1)+1/2ln(x^2+4)-int1/(x^2+4)^2dx#
For the third integral, let #x = 2tan(u)#, and #dx = 2sec^2(u)du# and it becomes the following:
#int(3x^4+x^3+20x^2+3x+31)/((x+1)(x^2+4)^2)dx = 2ln(x+1)+1/2ln(x^2+4)-1/16((2x)/(x^2+4)+ tan^-1(x/2)) +C#