Integration of Rational Functions Using Partial Fractions



Today: 7.4: Integration of rational functions and Supp. 4: Partial fraction expansion
Next: 7.7: Approximate integration

Our goal today is to compute integrals of the form

$\displaystyle \int \frac{P(x)}{Q(x)} dx$

by decomposing $ f=\frac{P(x)}{Q(x)}$. This is called partial fraction expansion.

Theorem 5.5.1 (Fundamental Theorem of Algebra over the Real Numbers)   A real polynomial of degree $ n\geq 1$ can be factored as a constant times a product of linear factors $ x-a$ and irreducible quadratic factors $ x^2+bx+c$.

Note that $ x^2+bx+c = (x-\alpha)(x-\bar{\alpha})$, where $ \alpha=z+iw$, $ \bar{\alpha} = z-iw$ are complex conjugates.

Types of rational functions $ f(x) = \frac{P(x)}{Q(x)}$. To do a partial fraction expansion, first make sure $ \deg(P(x)) < \deg(Q(x))$ using long division. Then there are four possible situation, each of increasing generality (and difficulty):

  1. $ Q(x)$ is a product of distinct linear factors;

  2. $ Q(x)$ is a product of linear factors, some of which are repeated;

  3. $ Q(x)$ is a product of distinct irreducible quadratic factors, along with linear factors some of which may be repeated; and,

  4. $ Q(x)$ is has repeated irreducible quadratic factors, along with possibly some linear factors which may be repeated.

The general partial fraction expansion theorem is beyond the scope of this course. However, you might find the following special case and its proof interesting.

Theorem 5.5.2   Suppose $ p$, $ q_1$ and $ q_2$ are polynomials that are relatively prime (have no factor in common). Then there exists polynomials $ \alpha_1$ and $ \alpha_2$ such that

$\displaystyle \frac{p}{q_1 q_2} = \frac{\alpha_1}{q_1} + \frac{\alpha_2}{q_2}.
$

Proof. Since $ q_1$ and $ q_2$ are relatively prime, using the Euclidean algorithm (long division), we can find polynomials $ s_1$ and $ s_2$ such that

$\displaystyle 1 = s_1 q_1 + s_2 q_2 .$

Dividing both sides by $ q_1 q_2$ and multiplying by $ p$ yields

$\displaystyle \frac{p}{q_1 q_2} = \frac{\alpha_1}{q_1} + \frac{\alpha_2}{q_2},
$

which completes the proof. $ \qedsymbol$

Example 5.5.3   Compute

$\displaystyle \int \frac{x^3 - 4x -10}{x^2-x-6} dx.$

First do long division. Get quotient of $ x+1$ and remainder of $ 3x-4$. This means that

$\displaystyle \frac{x^3 - 4x -10}{x^2-x-6}
= x + 1 + \frac{3x - 4}{x^2-x-6}.
$

Since we have distinct linear factors, we know that we can write

$\displaystyle f(x) = \frac{3x - 4}{x^2-x-6} = \frac{A}{x-3} + \frac{B}{x+2},
$

for real numbers $ A,B$. A clever way to find $ A,B$ is to substitute appropriate values in, as follows. We have

$\displaystyle f(x) (x-3) = \frac{3x-4}{x+2} = A + B\cdot \frac{x-3}{x+2}.
$

Setting $ x=3$ on both sides we have (taking a limit):

$\displaystyle A = f(3) = \frac{3\cdot 3 - 4}{3+2} = \frac{5}{5} = 1.
$

Likewise, we have

$\displaystyle B = f(-2) = \frac{3\cdot (-2) - 4}{-2-3} = 2.
$

Thus

$\displaystyle \int \frac{x^3 - 4x -10}{x^2-x-6} dx$ $\displaystyle = \int x + 1 + \frac{1}{x-3} + \frac{2}{x+2}$    
  $\displaystyle = \frac{x^2 + 2x}{2} + 2\log\left\vert x + 2\right\vert + \log\left\vert x - 3\right\vert + c.$    

Example 5.5.4   Compute the partial fraction expansion of $ \frac{x^2}{(x-3)(x+2)^2}$. By the partial fraction theorem, there are constants $ A,B,C$ such that

$\displaystyle \frac{x^2}{(x-3)(x+2)^2}
= \frac{A}{x-3} + \frac{B}{x+2} + \frac{C}{(x+2)^2}.
$

Note that there's no possible way this could work without the $ (x+2)^2$ term, since otherwise the common denominator would be $ (x-3)(x+2)$. We have

$\displaystyle A$ $\displaystyle = \left[ f(x) (x-3)\right]_{x=3} = \frac{x^2}{(x+2)^2}\vert _{x=3} = \frac{9}{25},$    
$\displaystyle C$ $\displaystyle = \left[ f(x) (x+2)^2\right]_{x=-2} = -\frac{4}{5}.$    

This method will not get us $ B$! For example,

$\displaystyle f(x) (x+2) = \frac{x^2}{(x-3)(x+2)} = A\cdot\frac{x+2}{x-3} + B + \frac{C}{x+2}.
$

While true this is useless.

Instead, we use that we know $ A$ and $ C$, and evaluate at another value of $ x$, say 0.

$\displaystyle f(0) = 0 = \frac{\frac{9}{25}}{-3} + \frac{B}{2}
+ \frac{-\frac{4}{5}}{(2)^2},
$

so $ B=\frac{16}{25}$. Thus finally,

$\displaystyle \int \frac{x^2}{(x-3)(x+2)^2}$ $\displaystyle = \int \frac{\frac{9}{25}}{x-3} + \frac{\frac{16}{25}}{x+2} + \frac{-\frac{4}{5}}{(x+2)^2}.$    
  $\displaystyle = \frac{9}{25} \ln\vert x-3\vert + \frac{16}{25}\ln\vert x+2\vert + \frac{\frac{4}{5}}{x+2} +$   constant$\displaystyle .
$    

Example 5.5.5   Let's compute $ \int \frac{1}{x^3+1} dx$. Notice that $ x+1$ is a factor, since $ -1$ is a root. We have

$\displaystyle x^3 + 1 = \left(x + 1\right)\left(x^2 - x + 1\right).
$

There exist constants $ A,B,C$ such that

$\displaystyle \frac{1}{x^3+1} =
\frac{A}{x+1} + \frac{Bx+C}{x^2-x+1}.
$

Then

$\displaystyle A = f(x)(x+1)\vert _{x=-1} = \frac{1}{3}.
$

You could find $ B,C$ by factoring the quadratic over the complex numbers and getting complex number answers. Instead, we evaluate $ x$ at a couple of values. For example, at $ x=0$ we get

$\displaystyle f(0) = 1 = \frac{1}{3} + \frac{C}{1},
$

so $ C=\frac{2}{3}$. Next, use $ x=1$ to get $ B$.

$\displaystyle f(1) = \frac{1}{1^3 + 1}$ $\displaystyle = \frac{\frac{1}{3}}{(1) + 1} + \frac{B(1) + \frac{2}{3}}{(1)^2 - (1) + 1}$    
$\displaystyle \frac{1}{2}$ $\displaystyle = \frac{1}{6} + B + \frac{2}{3},$    

so

$\displaystyle B = \frac{3}{6} - \frac{1}{6} - \frac{4}{6} = -\frac{1}{3}.
$

Finally,

$\displaystyle \int \frac{1}{x^3+1} dx$ $\displaystyle = \int \frac{\frac{1}{3}}{x+1} - \frac{\frac{1}{3} x}{x^2-x-1} + \frac{\frac{2}{3}}{x^2-x-1} dx$    
  $\displaystyle = \frac{1}{3}\ln\vert x+1\vert - \frac{1}{3} \int\frac{x-2}{x^2-x+1} dx$    

It remains to compute

$\displaystyle \int\frac{x-2}{x^2-x+1} dx.
$

First, complete the square to get

$\displaystyle x^2 - x + 1 = \left(x-\frac{1}{2}\right)^2 + \frac{3}{4}.
$

Let $ u=(x-\frac{1}{2})$, so $ du=dx$ and $ x=u + \frac{1}{2}$. Then

$\displaystyle \int\frac{u - \frac{3}{2}}{u^2 +\frac{3}{4}} du$ $\displaystyle = \int \frac{udu}{u^2 + \frac{3}{4}} - \frac{3}{2} \int\frac{1}{u^2 + \left(\frac{\sqrt{3}}{2}\right)^2} du$    
  $\displaystyle = \frac{1}{2}\ln\left\vert u^2 + \frac{3}{4}\right\vert - \frac{3}{2} \cdot \frac{2}{\sqrt{3}} \tan^{-1}\left( \frac{2u}{\sqrt{3}} \right) + c$    
  $\displaystyle = \frac{1}{2}\ln\left\vert x^2-x+1\right\vert - \sqrt{3} \tan^{-1} \left(\frac{2x-1}{\sqrt{3}}\right) + c$    

Finally, we put it all together and get

$\displaystyle \int \frac{1}{x^3+1} dx$ $\displaystyle = \frac{1}{3}\ln\vert x+1\vert - \frac{1}{3} \int\frac{x-2}{x^2-x+1} dx$    
  $\displaystyle = \frac{1}{3}\ln\vert x+1\vert - \frac{1}{6} \ln\left\vert x^2-x+1\right\vert + \frac{\sqrt{3}}{3} \tan^{-1} \left(\frac{2x-1}{\sqrt{3}}\right) + c$    



Discuss second quiz problem.

Problem: Compute $ \int cos^2(x) e^{-3x} dx$ using complex exponentials. The answer is

$\displaystyle -\frac{1}{6}e^{-3x} + \frac{1}{13} e^{-3x}\sin(2x) -
\frac{3}{26} e^{-3x} \cos(2x) + c.
$

Here's how to get it.

$\displaystyle \int \cos^2(x) e^{-3x} dx$ $\displaystyle = \int \frac{e^{2ix} + 2 + e^{-2ix}}{4} e^{-3x} dx$    
  $\displaystyle = \frac{1}{4} \left[ \frac{e^{(2i-3)x}}{2i-3} - \frac{2}{3} e^{-3x} + \frac{e^{(-2i-3)x}}{-2i-3}\right] + c$    
  $\displaystyle = -\frac{1}{6} e^{-3x} + \frac{e^{-3x}}{4} \left[ \frac{e^{2ix}}{2i-3} - \frac{e^{-2ix}}{2i+3}\right] + c$    

Simplify the inside part requires some imagination:

$\displaystyle \frac{e^{2ix}}{2i-3} - \frac{e^{-2ix}}{2i+3}$ $\displaystyle = \frac{1}{13} (-2i e^{2ix} - 3e^{2ix} + 2i e^{-2ix} - 3 e^{-2ix})$    
  $\displaystyle = \frac{1}{13}\left( 4\sin(2x) - 6\cos(2x) \right)$    

William Stein 2006-03-15