First, let's take a look at our denominator, (x-1)(x^2+2x+5) to ensure it is completely factored.
(x-1) is a linear factor; nothing more can be done.
x^2+2x+5 is quadratic, let's see if we can factor it:
b^2-4ac where b=2,c=5,a=1, =4-4(5)(1)<0
Negative discriminant means this quadratic has no real roots, so it's factored as far as possible.
Now, recall that when decomposing a fraction, a linear factor in the denominator (x+a) shows up the following way:
A/(x+a) where A is a constant coefficient we must determine.
Recall that quadratic factors in the denominator show up the following way:
(Ax+B)/(ax^2+bx+c)
Where A, B are the constant coefficients we must determine.
Decomposing (x^2+9x+30)/((x-1)(x^2+2x+5))
yields
(x^2+9x+30)/((x-1)(x^2+2x+5))=A/(x-1)+(Bx+C)/(x^2+2x+5)
Let's add up the righthand side by using (x-1)(x^2+2x+5) as a common denominator:
(x^2+9x+30)/((x-1)(x^2+2x+5))=(A(x^2+2x+5))/((x-1)(x^2+2x+5))+((Bx+C)(x-1))/((x-1)(x^2+2x+5))
(x^2+9x+30)/((x-1)(x^2+2x+5))=(A(x^2+2x+5)+(Bx+C)(x-1))/((x-1)(x^2+2x+5))
Now, we can set our numerators equal:
x^2+9x+30=A(x^2+2x+5)+(Bx+C)(x-1)
We can determine A by setting x=1:
1+9+30=A(1+2+5)+(Bx+C)(1-1)
40=8A
A=5
We cannot determine B and C by this method, however, so let's multiply out everything on the right:
x^2+9x+30=Ax^2+2Ax+5A+Bx^2-Bx+Cx-C
Group terms with the same degree of x (or lack of x) together and factor out the common factor:
x^2+9x+30=Ax^2+Bx^2+2Ax-Bx+Cx+5A-C
x^2+9x+30=x^2(A+B)+x(2A-B+C)+5A-C
We now have the following equations:
A+B=1 (Because 1 is the coefficient of x^2 on the left)
5A-C=30 (Because 30 is the constant term on the left)
We know A=5, so
A+B=1->5+B=1->B=-4
5A-C=30->5(5)-C=30->25-C=30->C=-5
Plugging A=5,B=-4,C=-5 into A/(x-1)+(Bx+C)/(x^2+2x+5)
Yields
5/(x-1)+(-4x-5)/(x^2+2x+5)
Thus,
int(x^2+9x+30)/((x+1)(x^2+2x+5)dx)=int(5/(x-1)+(-4x-5)/(x^2+2x+5))dx
Split it up and factor out constants:
5intdx/(x-1)+int(-4x-5)/(x^2+2x+5)dx
Factor out -1 from -4x-5
5intdx/(x-1)-int(4x+5)/(x^2+2x+5)dx