# Partial fraction problem

#### chrill3123

Joined Apr 21, 2010
9
Hi

I have some partialfraction problem that I try to solve, I think I have solved for A, C, D but how to do with B .

here is the problem:

(s+1)/((s.^2)(s+2)(s-1)) = A/(s.^2)+(B/s)+C/(s+2)+D/(s-1)

C=1/12; D=2/3; A=-1/2

I think I need to solve
s+1=A(s.^2+s-2)+B(s.^3+s.^2-2s)+C(s.^3-s)+D(s.^3+2s.^2) for B but I dont know how to start

Iam very gratefull for any help

#### steveb

Joined Jul 3, 2008
2,436
Hi

I have some partialfraction problem that I try to solve, I think I have solved for A, C, D but how to do with B .

here is the problem:

(s+1)/((s.^2)(s+2)(s-1)) = A/(s.^2)+(B/s)+C/(s+2)+D/(s-1)

C=1/12; D=2/3; A=-1/2

I think I need to solve
s+1=A(s.^2+s-2)+B(s.^3+s.^2-2s)+C(s.^3-s)+D(s.^3+2s.^2) for B but I dont know how to start

Iam very gratefull for any help
I think your final equation has a slight error. It should be the following.

s+1=A(s.^2+s-2)+B(s.^3+s.^2-2s)+C(s.^3-s^2)+D(s.^3+2s.^2)

From there, you match up the coefficients of like terms and generate 4 equations involving A, B, C and D. Then you have 4 equations and 4 unknowns, which can be solved. I agree that A=-1/2. It looks to me that B will then be easy to solve with the new equations. Then you will have 2 equations and 2 unknowns involving C and D.

#### chrill3123

Joined Apr 21, 2010
9
I think I use just different method during solving it is:

C=>s=-2 (s+1)/(s.^2(s-1)) = 1/12
D=>s=1 (s+1)/(s.^3+2s^2) = 2/3
A=>s=0 (S+1)/((s+2)(s-1)) = -1/2

but how do I solve for B with that method

#### steveb

Joined Jul 3, 2008
2,436
I think I use just different method during solving it is:

C=>s=-2 (s+1)/(s.^2(s-1)) = 1/12
D=>s=1 (s+1)/(s.^3+2s^2) = 2/3
A=>s=0 (S+1)/((s+2)(s-1)) = -1/2

but how do I solve for B with that method
Can you explain your method? I don't know it. It must be right because I agree with your answers so far.

#### chrill3123

Joined Apr 21, 2010
9
Ok I´ll explain

its like this:

A/s.^2+B/s+C/(s+2)+D/(s-1)

If Iam going to solve C i make the denominator(s+2) = 0 so my s = -2
after that just solve (s+1)/(s.^2(s-1)) with s = -2 and get the answer
I do like that for all the unknowns but for B(s+1)/s I can not I have to use the
equation:
s+1=A(s.^2+s-2)+B(s.^3+s.^2-2s)+C(s.^3-s^2)+D(s.^3+2s.^2)
that I dont know how to solve

C=>s=-2 (s+1)/(s.^2(s-1)) = 1/12
D=>s=1 (s+1)/(s.^3+2s^2) = 2/3
A=>s=0 (S+1)/((s+2)(s-1)) = -1/2

but how do I solve for B with that method

#### steveb

Joined Jul 3, 2008
2,436
Ok I´ll explain

its like this:

A/s.^2+B/s+C/(s+2)+D/(s-1)

If Iam going to solve C i make the denominator(s+2) = 0 so my s = -2
after that just solve (s+1)/(s.^2(s-1)) with s = -2 and get the answer
I do like that for all the unknowns but for B(s+1)/s I can not I have to use the
equation:
s+1=A(s.^2+s-2)+B(s.^3+s.^2-2s)+C(s.^3-s^2)+D(s.^3+2s.^2)
that I dont know how to solve

C=>s=-2 (s+1)/(s.^2(s-1)) = 1/12
D=>s=1 (s+1)/(s.^3+2s^2) = 2/3
A=>s=0 (S+1)/((s+2)(s-1)) = -1/2

but how do I solve for B with that method
I have to say, that is a brilliant method that I never saw, nor thought of before. Did someone teach you that, or did you figure it out yourself? I'll definitely be adding this to my bag of tricks. Thank you! Basically, you are taking limits at the pole locations and isolating the coefficients. However, in the case of degenerate poles, it seems you will have an issue getting all coefficients.

Specifically, in this case, I don't see a way to solve for B by that method, so I think it's likely that your method provides a very nice calculation trick that does not work all the time, for all coefficients. Still, quickly solving for most coefficients is a real time saver. I think you need to keep both methods, and when you can't solve for a coefficient, then just use one of the equations from the other method. For example, in this case, the other method reveals the equation A-2B=1. Once you know A by your method, you can quickly calculate B by the other method.

Joined Jul 7, 2009
1,583
Apparently it's based on a Laurent expansion and called the residue method. I was going to say I'd never seen it either, but then I went back to my elementary calculus textbook and found the attached page. Worse, I vaguely remember seeing that and using the technique in the 60's. Now (as I've asked before on this forum), how in the hell can I remember that, but not remember what I had for lunch yesterday or which nurse I drooled on this morning? #### steveb

Joined Jul 3, 2008
2,436
Apparently it's based on a Laurent expansion and called the residue method.
Thanks for that great information. That is very interesting and a good reference to have.

So based on the wikipedia article, the OP can in fact apply the method for the case of degenerate poles. It's not quite as straightforward, and involves taking derivatives, but it does work.

I think the standard method is easier with degenerate poles, but I like the idea of combining both methods for the degenerate case.

So, for this example, the B coefficient could be obtained by multiplying the function by s^2, then taking the derivative with respect to s, and then taking the limit as s goes to zero.

$$B=\lim_{s \to 0} {{d (s^2 f(s))}\over{ds}}=\lim_{s \to 0} {{d ((s+1)/(s^2+s-2))}\over{ds}}$$,

and when I work this out I get the same value for B as with the standard method.

For degeneracy greater than 2, higher order derivatives are needed, and the method becomes more cumbersome. But, in practice those cases are rare.

Joined Jul 7, 2009
1,583
Or you can just type Apart[(s+1)/(s^2*(s+2)*(s-1))] in Mathematica.

Now, here's something cool -- sympy (a pure python computer algebra system) keeps getting better. You can run the following script:

Rich (BB code):
import sys, pprint
from sympy import *
sys.displayhook = pprint
s = Symbol('s')
pprint(apart((s+1)/(s**2*(s+2)*(s-1))))

Rich (BB code):
    1            2        3     1
---------- + --------- - --- - ----
12*(s + 2)   3*(s - 1)   4*s      2
2*s
Pretty nice for a free tool.

I commend chrill3123 for learning to do this stuff manually -- frankly, it's rather precious knowledge. For stuff in the real world, you'll use the computer tools to avoid the tedious calculations and reduce errors. But you have to know what's going on to be able to check things for reasonableness -- and your precious knowledge will help you with that.

• Chrill3

#### steveb

Joined Jul 3, 2008
2,436
Or you can just type Apart[(s+1)/(s^2*(s+2)*(s-1))] in Mathematica.

Now, here's something cool -- sympy (a pure python computer algebra system) keeps getting better.
Good info!

There is also the free symbolic processor Maxima which has the "partfrac" command. The wxMaxima implementation of Maxima has a GUI and menu tool for those that don't like to memorize commands.

Then the expensive tool is Matlab with its "residue" command. Matlab, is available to students for about $100, which is much better than the normal over$5000 professional price tag.