Saturday, 8 June 2019

algebra precalculus - Integration by partial fractions; how and why does it work?




Could someone take me through the steps of decomposing
2x2+11xx2+11x+30
into partial fractions?



More generally, how does one use partial fractions to compute integrals
P(x)Q(x)dx
of rational functions (P(x) and Q(x) are polynomials) ?







This question is asked in an effort to cut down on duplicates. See Coping with *abstract* duplicate questions.



Also see List of Generalizations of Common Questions.


Answer



What you are trying to do is a partial fraction decomposition.



Idea. Imagine your calculator is broken and a bunch of hoodlums stop you on the street, and demand at knifepoint that you compute 191105 as a decimal (part of their initiation into the Mathies Gang, you see), or else they will slit your throat. Unfortunately, since your calculator is broken, you can really only do divisions if the divisor is a single digit number (so you can use your fingers to do the operations; you're very good with those, because you know the multiplication tables of single digit numbers...). Luckily, you do notice that 105=3×5×7. Is there some way you can save your neck using this observation?



Well, you do know that 191=105+86, so at least you know that 191105=1+86105, so that takes care of the integer part of the fraction. What about 86105? Aha! Here's a clever idea: maybe 86105 is really the result of a sum of fractions! If you had a sum of fractions of the form

A3+B5+C7
then to write it as a single fraction you would find the common denominator, 105, and then do a bunch of operations, and end up with a fraction something105. If you can find an A, B, and C so that the something is 86, then instead of computing 86105 you can do A3, B5, and C7 (which you can do, since the denominators are single digit numbers), and then add those decimals to get the answer. Can we? We do a bit of algebra:
A3+B5+C7=35A+21B+15C105
so you want 35A+21B+15C=86. As luck would have it, A=B=1 and C=2 works, so
86105=13+15+27.
And now, all is well:
191105=1+86105 =1+13+15+27 =1+(0.3333)+(0.2)+(0.285714285714¯285714)
and you can give those dangerous hoodlums their answer, and live to derive another day.





Your problem. You want to do something similar with the polynomial quotient, with denominators that "easy"; in this case, degree 1. The first task is to make the fraction "less than 1", by making sure the denominator has degree less than the numerator. You do this with polynomial long division (see also this recent answer). Doing the long division mentally, we have: to get 2x2 from x2+11x+30 we multiply by 2:
2x2+11x=(x2+11x+30)(2+)
that produces unwanted 11x+60, (well, you get 22x+60, but you do want 11x of those, so you only have a leftover of 11x+60); nothing to do about them, except cancel them out after the product is done. So you have
2x2+11x=(x2+11x+30)(2)(11x+60).
So you can write
2x2+11xx2+11x+30=2+(11x+60)x2+11x+30.

Now we got the "integer part", and we work on the "fraction part". The denominator factors as (x+5)(x+6), so we want to think of that fraction as the end result of doing a sum of the form
Ax+5+Bx+6.
Because the sum is "smaller than 1" (numerator of degree smaller than the denominator) each of these fractions should also be "smaller than one". So both the A and B will be constants.

So we have:
11x60x2+11x+30=Ax+5+Bx+6 =A(x+6)(x+5)(x+6)+B(x+5)(x+6)(x+5) =A(x+6)+B(x+5)(x+5)(x+6) =Ax+6A+Bx+5Bx2+11x+30=(A+B)x+(6A+5B)x2+11x+30.
For this to work out, you need (A+B)x+(6A+5B)=11x60. That means we need A+B=11 (so the xs agree) and 6A+5B=60 (so the constant terms agree).



That means A=11B (from the first equation). Plugging into the second equation, we get
60=6A+5B=6(11B)+5B=666B+5B=66B.
So that means that B=6066=6. And since A+B=11, then A=5.



(An alternative method for finding the values of A and B is the Heaviside cover-up method; from the fact that
11x60=A(x+6)+B(x+5)
we know that the two sides must take the same value for every value of x; if we plug in x=6, this will "cover up" the A on the right and we simply get B(6+5)=B; this must equal 11(6)60=6; so 6=B, hence B=6. Then plugging in x=5 "covers up" the B to give us 11(5)60=A(5+6), or 5=A. So we obtain A=5, B=6, same as before.)




That is,
11x60x2+11x+30=5x+5+6x+6.



Putting it all together, we have:
2x2+11xx2+11x+30=2+11x60x2+11x+30=25x+56x+6.
And ta da! Your task is done. You've decomposed the quotient into partial fractions.



Caveat. You need to be careful if the denominator has repeated factors, or has factors that are of degree 2 and cannot be further factored (e.g., x2+1); I talk about that below in the general discussion.




Now, let's hope the Mathies Gang doesn't ask for a proof of Goldbach's Conjecture from its next batch of pledges...






General Idea.



So let's discuss this idea for the general problem of integrating a rational function; that is, a function of the form
P(x)Q(x)
where P(x)=anxn++a1x+a0 and Q(x)=bmxm++b1x+b0 are polynomials.




Integrating polynomials is easy, so the first task is to do long division in order to write the fraction as a polynomial plus a rational function in which the numerator has degree smaller than the denominator. So we will consider only the case where n<m going forward.



First, let us make sure we can actually do those fractions with "easy denominators." To me, "easy denominator" means (i) linear, ax+b; (ii) power of a linear polynomial, (ax+b)n; (iii) irreducible quadratic; (iv) power of an irreducible quadratic. So let's talk about how to integrate those:




  1. When Q(x) has degree 1 and P(x) is constant. For example, something like
    32x5dx.
    These integrals are very easy to do: we do a change of variable u=2x5, so du=2dx. We simply get
    32x5dx=3dx2x5=312duu=32ln|u|+C=32ln|2x5|+C.


  2. In fact, the idea above works whenever the denominator is a power of a degree 1 polynomial and the numerator is a constant. If we had something like

    3(2x5)6dx
    then we can let u=2x5, du=2dx and we get
    3(2x5)6dx=312duu6=32u6dx=32(15u5)+C=310(2x5)5+C.


  3. What if the denominator is an irreducible quadratic? Things get a little more complicated. The simplest example of an irreducible quadratic is x2+1, and the easiest numerator is 1. That integral can be done directly:
    1x2+1dx=arctan(x)+C.
    If we have an irreducible quadratic of the form x2+a, with a>0, then we can always write it as x2+b2 with b=a; then we can do the following: factor out b2 from the denominator,
    dxx2+b2=dxb2((xb)2+1);
    and now setting u=xb, so du=1bdx, we get:
    dxx2+b2=1b1(xb)2+1(1b)dx=1b1u2+1du,

    and now we can do the integral easily as before.
    What if we have a more general irreducible quadratic denominator? Something like x2+x+1, or something else with an x term?



    The magic phrase here is *Completing the square". We can write x2+x+1 as
    x2+x+1=(x2+x+14)+34=(x+12)2+34.
    Then setting w=x+12, we end up with an integral that looks just like the previous case! For instance,
    dxx2+x+1=dx(x+12)2+34=dww2+34,
    and we know how to deal with these.



    So: if the denominator is an irreducible quadratic, and the numerator is a constant, we can do the integral.



  4. What if the denominator is an irreducible quadratic, but the numerator is not constant? Since we can always do the long division, then we can take the numerator to be of degree 1. If we are lucky, it's possible we can do it with a simple substitution; for example, to do
    2x+3x2+3x+4dx
    (note the denominator is irreducible quadratic), we can just let u=x2+3x+4, since du=(2x+3)dx, exactly what we have in the numerator, so
    2x+3x2+3x+4dx=duu=ln|u|+C=ln|x2+3x+4|+C=ln(x2+3x+4)+C.
    If we are not lucky? Well, we can always make our own luck. For instace, if we had
    3xx2+3x+4dx
    then we can't just make the substitution u=x2+3x+4; but if we wanted to do that anyway, we would need 2x+3 in the numerator; so we play a little algebra game:
    3xx2+3x+4=3(xx2+3x+4)=3(12(2x)x2+3x+4)=32(2xx2+3x+4)(still not quite right)=32(2x+33x2+3x+4)=32(2x+3x2+3x+43x2+3x+4).
    What have we accomplished? The first summand, 2x+3x2+3x+4, is an integral we can do with a simple substitution; and the second summand, 3x2+3x+4, is an integral that we just saw how to do! So in this way, we can solve this kind of integral. We can always rewrite the integral as a sum of an integral that we can do with a substitution, and an integral that is as in case 3 above.


  5. What if the denominator is a power of an irreducible quadratic? Something like (x2+3x+5)4? If the numerator is of degree at most 1, then we can play the same game as we just did to end up with a sum of two fractions; the first one will have numerator which is exactly the derivative of x2+3x+5, and the second will have a numerator that is constant. So we just need to figure out how to do an integral like
    2dx(x2+3x+5)5
    with constant numerator and a power of an irreducible quadratic in the denominator.



    By completing the square as we did in 3, we can rewrite it so that it looks like

    dw(w2+b2)5.
    Turns out that if you do integration by parts, then you get a Reduction formula that says:
    dw(w2+b2)n=12b2(n1)(w(w2+b2)n1+(2n3)dw(w2+b2)n1)
    By using this formula repeatedly, we will eventually end up in an integral where the denominator is just w2+b2... and we already know how to do those. So all is well with the world (with a lot of work, at least).




Okay. Do we now need to go and discuss what to do when the denominator is a cubic polynomial, then a fourth degree polynomial, then a fifth degree polynomial, etc.?



No! We can play the same game we did with fractions above, and take an arbitrary rational function and rewrite it as a sum of fractions, with each fraction a power of a degree 1 or an irreducible quadratic polynomial. The key to this is the Fundamental Theorem of Algebra, which says that every polynomial with real coefficients can be written as a product of linear and irreducible quadratic polynomials. In fact, one of the major reasons why people wanted to prove the Fundamental Theorem of Algebra was to make sure that we could do integrals of rational functions in the manner we are discussing.




So here is a method for integrating a rational function:




To compute
P(x)Q(x)dx
where P(x) and Q(x) are polynomials:




  1. If deg(P) is equal to or greater than deg(Q), perform long division and rewrite the fraction as a polynomial plus a proper fraction (with numerator of degree strictly smaller than the denominator). Integrate the polynomial (easy).


  2. Completely factor the denominator Q(x) into linear terms and irreducible quadratics. This can be very hard to do in practice. In fact, this step is the only obstacle to really being able to do these integrals always, easily. Factoring a polynomial completely and exactly can be very hard. The Fundamental Theorem of Algebra says that there is a way of writing Q(x) that way, but it doesn't tell us how to find it.



  3. Rewrite the fraction as a sum of fractions, each of which has a denominator which is either a power of linear polynomial or of an irreducible quadratic. (More about this below.)


  4. Do the integral of each of the fractions as discussed above.





How do we rewrite as a sum?



Write Q(x) as a product of powers of distinct polynomials, each linear or irreducible quadratic; e.g., Q(x)=x(2x1)(x+2)3(x2+1)(x2+2)2.



For each power (ax+b)n, use n fractions of the form:

A1ax+b+A2(ax+b)2++An(ax+b)n,
where A1,,An are constants-to-be-determined-later.



For each power of an irreducible quadratic, (ax2+bx+c)m, use m fractions of the form:
C1x+D1ax2+bx+c+C2x+D2(ax2+bx+c)2++Cmx+Dm(ax2+bx+c)m,
where C1,D1,,Cm,Dm are constants-to-be-determined-later.



So in the example above, we Q(x)=x(2x1)(x+2)3(x2+1)(x2+2)2, we would get:
+Ax(corresponding to the factor x)+B2x+1(corresponding to the factor 2x1)+Cx+2+D(x+2)2+E(x+2)3(corresponding to the factor (x+2)3)+Gx+Hx2+1(corresponding to the factor x2+1)+Jx+Kx2+2+Lx+M(x2+2)2(corresponding to the factor (x2+2)2)



And now, the final step: how do we figure out what all those constants-to-be-determined-later are? We do the operation and compare it to the original! Let's say we are trying to calculate
3x2x(x+2)2(x2+1)dx
(not the same as above, but I want to do something small enough that we can do it).




We set it up as above; then we do the algebra. We have:
3x2x(x+2)2(x2+1)=Ax+Bx+2+C(x+2)2+Dx+Ex2+1=A(x+2)2(x2+1)+Bx(x+2)(x2+1)+Cx(x2+1)+(Dx+E)x(x+2)2x(x+2)2(x2+1).
Now we have two options: we can do the algebra in the numerator and write it as a polynomial. Then it has to be identical to 3x2. For example, the coefficient of x4 in the numerator would be A+B+D, so we would need A+B+D=0; the constant term would be 4A, so 4A=2; and so on.



The other method is the Heaviside cover-up method. Since the two expressions have to be the same, the numerator has to be the same as 3x2 when evaluated at every value of x. If we pick x=0 and plug it into the left numerator, we get 2; if we plug it into the right hand side, we get A(2)2(1)=4A, so 4A=2, which tells us what A is. If we plug in x=2, th left h and side is 3(2)2=8, the right hand side is C(2)((2)2+1)=10C, so 10C=8, which tells us what C is; we can then simplify and continue doing this (you'll note I selected points where a lot of the summands on the right simply evaluate to 0) until we get the value of all the coefficients.



And once we've found all the coefficients, we just break up the integral into a sum of integrals, each of which we already know how to do. And so, after a fair amount of work (but mainly just busy-work), we are done.



No comments:

Post a Comment

real analysis - How to find limhrightarrow0fracsin(ha)h

How to find lim without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...