The integrand is an **improper rational function**. By “long division” of polynomials, we can rewrite the integrand as the sum of a polynomial and a **proper rational function** “remainder”:

Notice that
\[\frac{-1}{x^2-x-6}=\frac{-1}{(x+2)(x-3)}\]
which suggests that we try to write $\displaystyle \frac{-1}{x^2-x-6}$
as the sum of two rational functions of the form
$\displaystyle\frac{A}{x+2}$ and $\displaystyle\frac{B}{x-3}$:
\[\frac{-1}{x^2-x-6}=\frac{A}{x+2}+\frac{B}{x-3}.\]
This is called the **Partial Fraction Decomposition** for
$\displaystyle \frac{-1}{x^2-x-6}$.

Our goal now is to determine $A$ and $B$. Multiplying both sides of the equation by $(x+2)(x-3)$ to clear the fractions, \[-1=A(x-3)+B(x+2).\] There are two methods for solving for $A$ and $B$:

Collect like terms on the right:

$-1=(A+B)x+(-3A+2B).$

Now equate coefficients of

corresponding powers of $x$:

$A+B=0,\quad -3A+2B=-1.$

Solving this system,

$A=1/5$, $B=-1/5$.

The equation holds for *all* $x$.

Let $x=-2$:

$-1=A(-2-3)+B(-2+2)$

$-1=-5A\qquad\longrightarrow A=1/5$.

Now let $x=3$:

$-1=A(3-3)+B(3+2)$

$-1=5B\qquad\longrightarrow B=-1/5$.

So \[\frac{-1}{x^2-x-6}=\frac{\frac{1}{5}}{x+2}-\frac{\frac{1}{5}}{x-3}.\] Returning to the original integral, \begin{eqnarray*} \int \frac{3x^3-2x^2-19x-7}{x^2-x-6}\, dx&=&\int \left(3x+1+\frac{\frac{1}{5}}{x+2}-\frac{\frac{1}{5}}{x-3}\right)\, dx\\ &=&\frac{3}{2}x^2+x+\frac{1}{5}\ln \left|\frac{x+2}{x-3}\right|+C. \end{eqnarray*}

In the next example, we have repeated factors in the denominator, as well as an **irreducible quadratic factor**.

###### Example

We will evaluate \[\int \frac{x-1}{x^2(x^2+x+1)}\, dx.\] The integrand is a proper rational function, which we would like to decompose into proper rational functions of the form \[\frac{A}{x},\quad \frac{B}{x^2},\quad \mathrm{and}\quad \frac{Cx+D}{x^2+x+1}.\] [Notice that we have two factors of $x$ in the denominator of the integrand, leading to terms of the form $\displaystyle\frac{A}{x}$ and $\displaystyle\frac{B}{x^2}$ in the decomposition. The factor $x^2+x+1$ is irreducible and quadratic, so any proper rational function with $x^2+x+1$ as denominator has the form $\displaystyle\frac{Cx+D}{x^2+x+1}$ where $C$ or $D$ may be $0$.]

Set \[\frac{x-1}{x^2(x^2+x+1)}=\frac{A}{x}+\frac{B}{x^2}+\frac{Cx+D}{x^2+x+1}. \] Multiplying through by $x^2(x^2+x+1)$, \[x-1=Ax(x^2+x+1)+B(x^2+x+1)+(Cx+D)x^2.\] Since $x^2+x+1$ has no real roots, it is easiest to solve for $A$ and $B$ using Method 1:

Collecting like terms on the right, \[x-1=(A+C)x^3+(A+B+D)x^2+(A+B)x+B.\] Equating corresponding powers of $x$, \[ \left.\begin{array}{rcr} A+C&=&0\\ A+B+D&=&0\\ A+B&=&1\\ B&=&-1 \end{array}\right\}\quad\longrightarrow\quad \begin{array}{l} A=2\\ B=-1\\ C=-2\\ D=-1 \end{array}\quad\longrightarrow\quad \frac{2}{x}-\frac{1}{x^2}-\frac{2x+1}{x^2+x+1}. \] So \begin{eqnarray*} \frac{x-1}{x^2(x^2+x+1)}\, dx&=&\int\left(\frac{2}{x}-\frac{1}{x^2}-\frac{2x+1}{x^2+x+1}\right)\, dx\\ &=&2\ln |x|+\frac{1}{x}-\ln |x^2+x+1|+C\\ &=&\frac{1}{x}+\ln\left|\frac{x^2}{x^2+x+1}\right|+C. \end{eqnarray*}

### Key Concepts

#### Partial Fraction Decomposition of a Rational Function

- If the rational function is improper, use “long division” of
polynomials to write it as the sum of a polynomial and a proper
rational function “remainder.”

- Decompose the proper rational function as a sum of rational
functions of the form
\[\frac{A}{(x-\alpha)^k} \quad\mathrm{and}\quad \frac{Bx+C}{(x^2+\beta
x+\gamma)^k}\quad (x^2+\beta x+\gamma \mathrm{~irreducible})\]
where:
- Each factor $(x-\alpha)^m$ in the denominator of the proper rational function suggests terms \[\frac{A_1}{(x-\alpha)}+\frac{A_2}{(x-\alpha)^2}+\ldots +\frac{A_m}{(x-\alpha)^m}.\]
- Each factor $(x^2+\beta x+\gamma)^n$ suggests terms \[\frac{B_1x+C_1}{(x^2+\beta x+\gamma)}+\frac{B_2x+C_2}{(x^2+\beta x+\gamma)^2}+\ldots +\frac{B_nx+C_n}{(x^2+\beta x+\gamma)^n}.\]

- Determine the (unique) values of all the constants involved.
- Use either Method 1 or Method 2, or a combination of both.

The partial fraction decomposition is often used to rewrite a
complicated rational function integrand as a sum of terms, each of
which is straightforward to integrate.