Maybe-Mathematical Musings

Math, Teaching, Literature, and Life


August 16, 2018

Other Writing

Subscribe via RSS

Twitter: @ProfJayDaigle

Support my writing at Ko-Fi

Recent Posts:

An easier approach to partial fractions decomposition

I always found partial fraction decomposition incredibly annoying and tedious. But it turns out there’s a much easier way to compute it. (I learned this a couple years ago from Chris Towse).

Suppose we want to find a partial fraction decomposition for $\frac{7x+2}{(x+2)^2 (x-1)}$. The normal method is to take your fraction and write it as a sum of real numbers over your polynomial denominators:

\[ \frac{7x+2}{(x+2)^2 (x-1)} = \frac{A}{x+2} + \frac{B}{(x+2)^2} + \frac{C}{(x-1)}. \]

(For this reason, my high school calculus teacher called this the “ABC method”). Then we clear denonminators:

\[ \begin{aligned} 7x+2 &= A(x+2)(x-1) + B(x-1) + C(x+2)^2 \\ &= A(x^2+x - 2) + B(x-1) + C(x^2 + 4x +4) \\ &=(A+C) x^2 + (A + B + 4C) x + (-2A-B +4C) \end{aligned} \]

and we get a system of linear equations:

\[ \begin{aligned} A+C & = 0 \\ A+B+4C & = 7 \\ 4C - 2A -B & = 2. \end{aligned} \]

This is a system of linear equations, so we can solve it by any of the usual methods, and we get $A = -1, B = 4, C = 1$, so

\[ \frac{7x+2}{(x+2)^2(x-1)} = \frac{-1}{x+2} + \frac{4}{(x+2)^2} + \frac{1}{(x-1)}. \]

And now we can integrate or do whatever else we needed to do with our fraction.


This process can get super tedious. In particular, solving the linear system at the end isn’t difficult but it is really annoying and easy to screw up if you do it by hand. (I used NumPy instead. Computer algebra systems are your friend).

It turns out there’s a much easier way to do this. It’s motivated by complex analysis residue integrals, but you can do it without actually knowing any complex analysis.

Let’s go back to our equation from earlier:

\[ \frac{7x+2}{(x+2)^2 (x-1)} = \frac{A}{x+2} + \frac{B}{(x+2)^2} + \frac{C}{(x-1)}. \]

Instead of clearing all the denominators, let’s just clear one. If we multiply by $(x-1)$ on both sides, we get

\[ \frac{7x+2}{(x+2)^2} = \frac{A(x-1)}{x+2} + \frac{B(x-1)}{(x+2)^2} + C. \]

This doesn’t look much nicer at first, but look at what happens if we evaluate at $x=1$. The left hand side becomes $1$. On the right-hand side, the $A$ and $B$ terms go away completely, and we’re just left with $C$. So we immediately see that $C = 1$.


We can find $A$ and $B$ the same way, with a bit more care. Multiplying our equation by $x+2$ doesn’t help, because we’ll still have a factor of $x+2$ in the denominator. But if we multiply by $(x+2)^2$ we get

\[ \frac{7x+2}{x-1} = \frac{A (x+2)}{x-1} + B + \frac{C (x+2)^2}{x-1} \]

and evaluating at $x = -2$ gives $4 = B$. To get $A$, we need to do a little bit of work and subtract off the $B$ term:

\[ \begin{aligned} \frac{7x+2}{(x+2)^2 (x-1)} - \frac{4}{(x+2)^2} & = \frac{7x+2 - 4x + 4}{(x+2)^2 (x-1)} \\ &= \frac{3x+6}{(x+2)^2 (x-1)} \\ &= \frac{3}{(x+2)(x-1)} \end{aligned} \]

so

\[ \begin{aligned} \frac{3}{(x+2)(x-1)} & = \frac{A}{x+2} + \frac{C}{x-1} \\ \frac{3}{x-1} & = A + \frac{C(x+2)}{x-1} \\ -1 & = A. \end{aligned} \]


That might feel like it took longer, but that’s mostly because I actually worked through all the algebra with the new version. No NumPy here! I actually suspect the first way is more efficient if you’re doing a really big decomposition, because it paralellizes a bunch of stuff, and linear equation solvers are pretty efficient.

But for reasonable-sized problems I’d much rather do the second method, no question. And this makes me almost want to actually teach partial fraction decomposition next time I teach calc 2.


Tags: math teaching integrals calculus