Use the method of partial fractions to determine the integral.
\[ \int \frac {-5x^3+5x^2+16x+36}{x^{4}+4x^3+9x^2} \d x \]

Note that the degree of the numerator is smaller than the degree of the denominator so we do not need to use long division.

First we see if we can factor the denominator.

In this case we can factor and we obtain:

\[ x^{4}+4x^3+9x^2=x^2(x^2+4x+9) \]

No obvious factorization of \(x^2+4x+9\) comes to mind but perhaps we are just not imaginative enough. How do we determine that the quadratic is irreducible?

Since we cannot see an obvious way to factor it, the polynomial is irreducible Determine if \(x^2+4x+9=0\) has any real roots.
The quadratic is irreducible because \(x^2+4x+9=0\) has no real roots. The quadratic is reducible because \(x^2+4x+9=0\) has no real roots. The quadratic is reducible because \(x^2+4x+9=0\) has real roots.

The denominator contains a repeated linear factor \(x^2\) and an irreducible quadratic factor \(x^2+4x+9\). That means we have

\[ \frac {-5x^3+5x^2+16x+36}{x^{4}+4x^3+9x^2}= \frac {A}{x} + \frac {B}{x^2} +\frac {Cx+D}{x^2+4x+9} \]
for some constants \(A\), \(B\), \(C\) and \(D\).

We need to determine these four constants.

We clear denominators by multiplying both sides of the above equation by \(\answer {x^2(x^2+4x+9)}\).

This gives us

\[ -5x^3+5x^2+16x+36=A \cdot \answer { x(x^2+4x+9)} + B \cdot \answer { (x^2+4x+9)} + (Cx+D) \cdot \answer {x^2} \]

In this case, let us determine the unknown coefficients by expanding the right hand side and then matching coefficients of like terms on both the left and right.

We expand out the right hand side and collect like terms. This gives us the polynomial

\[ (\answer {A+C})x^3+(\answer {4A+B+D})x^2+(\answer {9A+4B})x+(\answer {9B}) \]

Comparing the coefficients of powers of \(x\) on both the left and right we obtain the following system of linear equations

Comparing coefficients of \(x^3\) terms we have \(\answer {A+C}=-5\).
Comparing the \(x^2\) terms gives \(\answer {4A+B+D}=5\).
Comparing the \(x\) terms gives \(\answer {9A+4B}=16\).
Comparing the constant terms gives \(\answer {9B}=36\) .

Solving this system of linear equations gives us

\begin{align*} A&=\answer { 0 }\\ B&=\answer {4 }\\ C&=\answer { -5 }\\ D&=\answer {1 } \end{align*}

This means our original integral can be rewritten as

\[ \int \frac {-5x^3+5x^2+16x+36}{x^{4}+4x^3+9x^2} \d x= \int \frac {4}{x^2} \d x + \int \frac {-5x+1}{x^2+4x+9} \d x \]

The first integral can be computed easily as

\[ \int \frac {4}{x^2} \d x=\answer {\frac {-4}{x}+C} \]
(Use \(C\) for the constant of integration)

For now we focus on the 2nd integral

\[ \int \frac {-5x+1}{x^2+4x+9} \d x \]
It may not be obvious how to proceed. Since the denominator is a quadratic, one path forward is to try trig substitution.

First we complete the square on the denominator.

\[ x^2+4x+9=x^2+4x+4-4+9=(\answer {x+2})^2+\answer {5}. \]

Hence we should use the trig substitution \(x+2=\answer {\sqrt {5}\tan (\theta )}\).

Thus \(\d x=\answer { \sqrt {5} \sec ^{2}(\theta )} \d \theta \).

The integral in terms of \(\theta \) is:

\[ \int \frac {-5x+1}{x^2+4x+9} \d x =\int \answer {\frac {-5\sqrt {5}\tan (\theta )+11}{\sqrt {5}}} \d \theta \]

and evaluating this integral, we find:

\[ \int \frac {-5\sqrt {5}\tan (\theta )+11}{\sqrt {5}} \d \theta = \answer {\frac {11}{\sqrt {5}}\theta -5\ln (|\sec (\theta )|)+C} \]

(Leave the result in terms of \(\theta \) and use \(C\) for the constant of integration )

Reversing the substitution to find the antiderivatives in terms of \(x\) gives:

\[\int \frac {-5x+1}{x^2+4x+9} \d x =\answer {\frac {11}{\sqrt {5}}\arctan \left (\frac {x+2}{\sqrt {5}}\right ) - 5\ln \left (\frac {\sqrt {x^2+4x+9}}{\sqrt {5}}\right ) + C} \]

Now, using this result as well as the previous result gives:

\begin{align*} \int \frac {-5x^3+5x^2+16x+9}{x^{4}+4x^3+9x^2} \d x &= \int \frac {4}{x^2} \d x + \int \frac {-5x+1}{x^2+4x+9} \d x \\ &=\answer {-\frac {4}{x}+\frac {11}{\sqrt {5}}\arctan \left (\frac {x+2}{\sqrt {5}}\right ) - 5\ln \left (\frac {\sqrt {x^2+4x+9}}{\sqrt {5}}\right ) + C} \end{align*}

(Use \(C\) for the constant of integration)