- #1
- 2,570
- 2
So, what I'm going to do in this thread is show a general method for finding the antiderivative (ie, indefinite integral) of any rational function. Here, a rational function is a function of the form P(x)/Q(x), where P(x) and Q(x) are polynomials, and the antiderivative of a function f(x) is the function F(x) such that d(F(x))/dx=f(x), where F(x) is unique up to an additive constant (which will be suppressed in this thread).
I'll break the thread up into 4 sections. The first half will be concerned with complex polynomials (ie, the coefficients and variable may be complex), and the second will be restricted to real numbers. Each half will be broken up into a section describing how to transform the rational function into an integrable form, and a section on how to integrate it. Here we go.
We'll start with complex polynomials, because they're actually a little simpler. Let A(z) and B(z) be two polynomials, where A has order n and B has order m, and let r(z)=A(z)/B(z). Here z is a complex variable. By the fundamental theorem of algebra, B has exactly m roots (counting multiple roots multiple times), and so we may factor it into m monomials as follows:
[tex]B(z) = b_0 (z-b'_1)(z-b'_2)...(z-b'_m)[/tex]
Where b0 is the coefficient of the leading order term in B. We can absorb this into A, so it will be ignored from here on. Now, let's be more explicit about the multiple roots. Let there be p distinct roots, and let bi have multiplicity ki, so that m is the product of all the ki's. Then:
[tex]B(z)=(z-b_1)^{k_1}(z-b_2)^{k_2}...(z-b_p)^{k_p}[/tex]
We will write A in the ordinary way. Then:
[tex]r(z)=\frac{a_0 + a_1 z + ... + a_n z^n}{(z-b_1)^{k_1}(z-b_2)^{k_2}...(z-b_p)^{k_p}}[/tex]
It's not immediately obvious how to integrate this function. But there are some special cases we can integrate. For example, when b is constant, r(z) is just a normal polynomial, which is easily integrated. When a is constant and b has only one distinct root, r(z) looks like 1/(z-b)k for some natural number k, which is also easily integrated, using the natural log if k=1. Also, note that if we can integrate any two functions, the integral of the sum of the two functions is just the sum of the integrals of the individual functions, which is just to say that integration is a linear operation. So if we can get r(z) into a form where it is the sum of these functions we know how to integrate, we can do r(z) with no problem.
So how do we do this? There are two separate cases we need to consider: n<m and n≥m. First, assume n<m. Then the rational function is "bottom-heavy", and we would expect its partial fraction expansion to be all denominator. This isn't a rigorous argument, but it does turn out to be true, and it helps you remember what to do in each case. The partial fraction expansion will consist of a linear combination of the recipricals of all the monomials making up B. In the case of multiple roots, all powers of the reciprical up to the multiplicity of the root are included in the sum. In other words, we set:
[tex]r(z)=\frac{c_{1,1}}{(z-b_1)} + \frac{c_{1,2}}{(z-b_1)^2} + ... +\frac{c_{1,k_1}}{(z-b_1)^{k_1}} + \frac{c_{2,1}}{(z-b_2)} + ... +\frac{c_{p,k_p}}{(z-b_p)^{k_p}}[/tex]
and then solve for all the ci,j. At this point, the notation is getting cumbersome, so I'm going to proceed with a specific example. It should be clear how the general argument would run. I'll start off with an easy example with all real coefficients, but don't forget that this applies equally well to complex numbers, as I'll show in the second example.
Let:
[tex]r(z)=\frac{3z^2-2z+1}{z^3-2z^2-7z-4}[/tex]
Then we can factor the denominator as:
[tex]r(z)=\frac{3z^2-2z+1}{(z+1)^2(z-4)}[/tex]
And so the partial fraction expansion will have the form:
[tex]r(z)=\frac{c_{1,1}}{(z+1)}+\frac{c_{1,2}}{(z+1)^2}+\frac{c_{2,1}}{(z-4)}[/tex]
Now, to solve for these coefficients, we multiply through by B, in this case, (z+1)2(z-4):
[tex]r(z)(z+1)^2(z-4) = 3z^2-2z+1 = c_{1,1}(z+1)(z-4) + c_{1,2}(z-4) + c_{2,1}(z+1)^2[/tex]
Now, if you like, you can expand the right side, collect terms, and equate like powers of z. You then have m linear equations for m unknowns. (note: in this case, all powers of z on the right side have non-zero coefficients on the left side. This won't be the case if n<m-1, but in that case, you would just set the coefficient on the right side to zero). That should assure you that the solution exists in all cases, but there is an easier way to do it in practice. Note that the equality must hold at all z, and so in particular at z=-1 and z=4. Plugging in the roots of B simplifes things a lot:
z=-1:
[tex]3(-1)^2-2(-1)+1 = c_{1,1}(0) + c_{1,2}(-1-4) + c_{2,1}(0)^2[/tex]
[tex]6 = c_{1,2}(-5)[/tex]
[tex]c_{1,2} = -6/5[/tex]
z=4:
[tex]3(4)^2-2(4)+1 = c_{1,1}(0) + (-6/5)(0) + c_{2,1}(4+1)^2[/tex]
[tex]41 = 25c_{2,1}[/tex]
[tex]c_{2,1} = 41/25 [/tex]
For terms which have a monomial for each distinct root, this trick won't work, but you can still plug in a convenient value of z:
z=0:
[tex]3(0)^2-2(0)+1 = c_{1,1}(1)(-4) + (-6/5)(-4) + (41/25)(1)^2[/tex]
[tex]1=-4c_{1,1} +24/5 +41/25 [/tex]
[tex]4c_{1,1}=(-25/25+120/25+41/25)=136/25[/tex]
[tex]c_{1,1}=34/25 [/tex]
So we are left with the result:
[tex]r(z)=\frac{3z^2-2z+1}{z^3-2z^2-7z-4}=\frac{34/25}{(z+1)} - \frac{6/5}{(z+1)^2}+\frac{41/25}{(z-4)} [/tex]
I'm sure you can all integrate this, but I'll still go over it in the next section. Also, in the case of real numbers, the integration step is more difficult, so I think it deserves its own section.
Now, the case n≥m is a simple extension of this. In addition to all the fractional terms included above, we add a polynomial of order n-m:
[tex]r(x)= ... + d_0 + d_1 z + ... + d_{n-m} z^{n-m}[/tex]
(Note that if n=m, this is just an extra constant.) In other words, the rational functon is now top heavy, with the top outweighing the bottom by n-m, so you would expect partial fraction expansion to include terms up to zn-m. Now, proceeding as before, multiply both sides by B(z). Remember that there were m coefficients to solve for in the previous case, so now there are an additional n-m+1, or n+1 total. So, equating like powers as before, we now have n+1 equations for n+1 unknowns (since a0,...,anzn constitute n+1 terms), and again a unique solution will exist. The same trick helps here too, since plugging in any root of B will cause all the dk terms to be suppressed.
As an example, consider the following rational function:
[tex]r(z)=\frac{(1+i)z^4+(-2+4i)z^3+3iz-2}{z^2(z+2i)}[/tex]
Since n-m=4-3=1, we want to expand this as:
[tex]r(z)=\frac{c_{1,1}}{z} +\frac{c_{1,2}}{z^2}+\frac{c_{2,1}}{(z+2i)} +d_0 +d_1 z [/tex]
Multiplying through by B(z):
[tex](1+i)z^4+(-2+4i)z^3+3iz-2 = c_{1,1} z(z+2i) +c_{1,2}(z+2i) +c_{2,1}z^2 + (d_0 + d_1 z)z^2(z+2i) [/tex]
Plugging in z=0:
[tex]-2=c_{1,1} (0) +c_{1,2}(2i) +c_{2,1}(0)^2 + (d_0 + d_1 (0))(0)[/tex]
[tex]c_{1,2}=i[/tex]
z=-2i:
[tex](1+i)(-2i)^4+(-2+4i)(-2i)^3+3i(-2i)-2 = c_{1,1} (0) +c_{1,2}(0) +c_{2,1}(-2i)^2 + (d_0 + d_1 (-2i))(0) [/tex]
[tex]16(1+i)+8i(-2+4i)+6-2=-12= -4c_{2,1}[/tex]
[tex]c_{2,1}=3[/tex]
To get the last 3 coefficients, you can't avoid doing a little algebra. Plugging in still helps though:
z=1:
[tex](1+i)(1)^4+(-2+4i)(1)^3+3i(1)-2 = c_{1,1}(1)(1+2i) +i(1+2i) +3(1)^2 + (d_0 + d_1 (1))((1)^2(1+2i))[/tex]
[tex]1+i-2+4i+3i-2=-3+8i=c_{1,1}(1+2i)+i-2+3+(1+2i)d_0+(1+2i)d_1[/tex]
[tex]c_{1,1}+d_0+d_1=\frac{-4+7i}{1+2i}=2+3i[/tex] (*)
z=i:
[tex](1+i)(i)^4+(-2+4i)(i)^3+3i(i)-2 = c_{1,1}(i)(i+2i) +i(i+2i) +3(i)^2 + (d_0 + d_1 (i))((i)^2(i+2i))[/tex]
[tex]1+i+2i+4-3-2=-3c{1,1}-3-3-3id_0+3d_1[/tex]
[tex]c_{1,1}+id_0-d_1=-2-i[/tex] (*)
z=-i
[tex](1+i)(-i)^4+(-2+4i)(-i)^3+3i(-i)-2 = c_{1,1}(-i)(-i+2i) +i(-i+2i) +3(-i)^2 + (d_0 + d_1 (-i))((-i)^2(-i+2i))[/tex]
[tex](1+i)-2i-4+3-2=c_{1,1}-1-3-id_0-d_1[/tex]
[tex]c_{1,1}-id_0-d_1=2-i[/tex] (*)
The (*) equations can be solved using linear algebra or any method you like, but I'll just tell you that in this example the solutions are:
[tex]c_{1,1}=1[/tex]
[tex]d_0=2i[/tex]
[tex]d_1=1+i[/tex]
So that:
[tex]r(z)=\frac{(1+i)z^4+(-2+4i)z^3+3iz-2}{z^2(z+2i)}=\frac{1}{z}+\frac{i}{z^2}+\frac{3}{z+2i}+2i+(1+i)z[/tex]
That's all there is to it. In the next section I'll briefly go over how to integrate the functions once they're in this form, and then I'll move on to real numbers. (Also, if anyone has any other information on the topic, or sees any errors I may have made, please share it here).
I'll break the thread up into 4 sections. The first half will be concerned with complex polynomials (ie, the coefficients and variable may be complex), and the second will be restricted to real numbers. Each half will be broken up into a section describing how to transform the rational function into an integrable form, and a section on how to integrate it. Here we go.
We'll start with complex polynomials, because they're actually a little simpler. Let A(z) and B(z) be two polynomials, where A has order n and B has order m, and let r(z)=A(z)/B(z). Here z is a complex variable. By the fundamental theorem of algebra, B has exactly m roots (counting multiple roots multiple times), and so we may factor it into m monomials as follows:
[tex]B(z) = b_0 (z-b'_1)(z-b'_2)...(z-b'_m)[/tex]
Where b0 is the coefficient of the leading order term in B. We can absorb this into A, so it will be ignored from here on. Now, let's be more explicit about the multiple roots. Let there be p distinct roots, and let bi have multiplicity ki, so that m is the product of all the ki's. Then:
[tex]B(z)=(z-b_1)^{k_1}(z-b_2)^{k_2}...(z-b_p)^{k_p}[/tex]
We will write A in the ordinary way. Then:
[tex]r(z)=\frac{a_0 + a_1 z + ... + a_n z^n}{(z-b_1)^{k_1}(z-b_2)^{k_2}...(z-b_p)^{k_p}}[/tex]
It's not immediately obvious how to integrate this function. But there are some special cases we can integrate. For example, when b is constant, r(z) is just a normal polynomial, which is easily integrated. When a is constant and b has only one distinct root, r(z) looks like 1/(z-b)k for some natural number k, which is also easily integrated, using the natural log if k=1. Also, note that if we can integrate any two functions, the integral of the sum of the two functions is just the sum of the integrals of the individual functions, which is just to say that integration is a linear operation. So if we can get r(z) into a form where it is the sum of these functions we know how to integrate, we can do r(z) with no problem.
So how do we do this? There are two separate cases we need to consider: n<m and n≥m. First, assume n<m. Then the rational function is "bottom-heavy", and we would expect its partial fraction expansion to be all denominator. This isn't a rigorous argument, but it does turn out to be true, and it helps you remember what to do in each case. The partial fraction expansion will consist of a linear combination of the recipricals of all the monomials making up B. In the case of multiple roots, all powers of the reciprical up to the multiplicity of the root are included in the sum. In other words, we set:
[tex]r(z)=\frac{c_{1,1}}{(z-b_1)} + \frac{c_{1,2}}{(z-b_1)^2} + ... +\frac{c_{1,k_1}}{(z-b_1)^{k_1}} + \frac{c_{2,1}}{(z-b_2)} + ... +\frac{c_{p,k_p}}{(z-b_p)^{k_p}}[/tex]
and then solve for all the ci,j. At this point, the notation is getting cumbersome, so I'm going to proceed with a specific example. It should be clear how the general argument would run. I'll start off with an easy example with all real coefficients, but don't forget that this applies equally well to complex numbers, as I'll show in the second example.
Let:
[tex]r(z)=\frac{3z^2-2z+1}{z^3-2z^2-7z-4}[/tex]
Then we can factor the denominator as:
[tex]r(z)=\frac{3z^2-2z+1}{(z+1)^2(z-4)}[/tex]
And so the partial fraction expansion will have the form:
[tex]r(z)=\frac{c_{1,1}}{(z+1)}+\frac{c_{1,2}}{(z+1)^2}+\frac{c_{2,1}}{(z-4)}[/tex]
Now, to solve for these coefficients, we multiply through by B, in this case, (z+1)2(z-4):
[tex]r(z)(z+1)^2(z-4) = 3z^2-2z+1 = c_{1,1}(z+1)(z-4) + c_{1,2}(z-4) + c_{2,1}(z+1)^2[/tex]
Now, if you like, you can expand the right side, collect terms, and equate like powers of z. You then have m linear equations for m unknowns. (note: in this case, all powers of z on the right side have non-zero coefficients on the left side. This won't be the case if n<m-1, but in that case, you would just set the coefficient on the right side to zero). That should assure you that the solution exists in all cases, but there is an easier way to do it in practice. Note that the equality must hold at all z, and so in particular at z=-1 and z=4. Plugging in the roots of B simplifes things a lot:
z=-1:
[tex]3(-1)^2-2(-1)+1 = c_{1,1}(0) + c_{1,2}(-1-4) + c_{2,1}(0)^2[/tex]
[tex]6 = c_{1,2}(-5)[/tex]
[tex]c_{1,2} = -6/5[/tex]
z=4:
[tex]3(4)^2-2(4)+1 = c_{1,1}(0) + (-6/5)(0) + c_{2,1}(4+1)^2[/tex]
[tex]41 = 25c_{2,1}[/tex]
[tex]c_{2,1} = 41/25 [/tex]
For terms which have a monomial for each distinct root, this trick won't work, but you can still plug in a convenient value of z:
z=0:
[tex]3(0)^2-2(0)+1 = c_{1,1}(1)(-4) + (-6/5)(-4) + (41/25)(1)^2[/tex]
[tex]1=-4c_{1,1} +24/5 +41/25 [/tex]
[tex]4c_{1,1}=(-25/25+120/25+41/25)=136/25[/tex]
[tex]c_{1,1}=34/25 [/tex]
So we are left with the result:
[tex]r(z)=\frac{3z^2-2z+1}{z^3-2z^2-7z-4}=\frac{34/25}{(z+1)} - \frac{6/5}{(z+1)^2}+\frac{41/25}{(z-4)} [/tex]
I'm sure you can all integrate this, but I'll still go over it in the next section. Also, in the case of real numbers, the integration step is more difficult, so I think it deserves its own section.
Now, the case n≥m is a simple extension of this. In addition to all the fractional terms included above, we add a polynomial of order n-m:
[tex]r(x)= ... + d_0 + d_1 z + ... + d_{n-m} z^{n-m}[/tex]
(Note that if n=m, this is just an extra constant.) In other words, the rational functon is now top heavy, with the top outweighing the bottom by n-m, so you would expect partial fraction expansion to include terms up to zn-m. Now, proceeding as before, multiply both sides by B(z). Remember that there were m coefficients to solve for in the previous case, so now there are an additional n-m+1, or n+1 total. So, equating like powers as before, we now have n+1 equations for n+1 unknowns (since a0,...,anzn constitute n+1 terms), and again a unique solution will exist. The same trick helps here too, since plugging in any root of B will cause all the dk terms to be suppressed.
As an example, consider the following rational function:
[tex]r(z)=\frac{(1+i)z^4+(-2+4i)z^3+3iz-2}{z^2(z+2i)}[/tex]
Since n-m=4-3=1, we want to expand this as:
[tex]r(z)=\frac{c_{1,1}}{z} +\frac{c_{1,2}}{z^2}+\frac{c_{2,1}}{(z+2i)} +d_0 +d_1 z [/tex]
Multiplying through by B(z):
[tex](1+i)z^4+(-2+4i)z^3+3iz-2 = c_{1,1} z(z+2i) +c_{1,2}(z+2i) +c_{2,1}z^2 + (d_0 + d_1 z)z^2(z+2i) [/tex]
Plugging in z=0:
[tex]-2=c_{1,1} (0) +c_{1,2}(2i) +c_{2,1}(0)^2 + (d_0 + d_1 (0))(0)[/tex]
[tex]c_{1,2}=i[/tex]
z=-2i:
[tex](1+i)(-2i)^4+(-2+4i)(-2i)^3+3i(-2i)-2 = c_{1,1} (0) +c_{1,2}(0) +c_{2,1}(-2i)^2 + (d_0 + d_1 (-2i))(0) [/tex]
[tex]16(1+i)+8i(-2+4i)+6-2=-12= -4c_{2,1}[/tex]
[tex]c_{2,1}=3[/tex]
To get the last 3 coefficients, you can't avoid doing a little algebra. Plugging in still helps though:
z=1:
[tex](1+i)(1)^4+(-2+4i)(1)^3+3i(1)-2 = c_{1,1}(1)(1+2i) +i(1+2i) +3(1)^2 + (d_0 + d_1 (1))((1)^2(1+2i))[/tex]
[tex]1+i-2+4i+3i-2=-3+8i=c_{1,1}(1+2i)+i-2+3+(1+2i)d_0+(1+2i)d_1[/tex]
[tex]c_{1,1}+d_0+d_1=\frac{-4+7i}{1+2i}=2+3i[/tex] (*)
z=i:
[tex](1+i)(i)^4+(-2+4i)(i)^3+3i(i)-2 = c_{1,1}(i)(i+2i) +i(i+2i) +3(i)^2 + (d_0 + d_1 (i))((i)^2(i+2i))[/tex]
[tex]1+i+2i+4-3-2=-3c{1,1}-3-3-3id_0+3d_1[/tex]
[tex]c_{1,1}+id_0-d_1=-2-i[/tex] (*)
z=-i
[tex](1+i)(-i)^4+(-2+4i)(-i)^3+3i(-i)-2 = c_{1,1}(-i)(-i+2i) +i(-i+2i) +3(-i)^2 + (d_0 + d_1 (-i))((-i)^2(-i+2i))[/tex]
[tex](1+i)-2i-4+3-2=c_{1,1}-1-3-id_0-d_1[/tex]
[tex]c_{1,1}-id_0-d_1=2-i[/tex] (*)
The (*) equations can be solved using linear algebra or any method you like, but I'll just tell you that in this example the solutions are:
[tex]c_{1,1}=1[/tex]
[tex]d_0=2i[/tex]
[tex]d_1=1+i[/tex]
So that:
[tex]r(z)=\frac{(1+i)z^4+(-2+4i)z^3+3iz-2}{z^2(z+2i)}=\frac{1}{z}+\frac{i}{z^2}+\frac{3}{z+2i}+2i+(1+i)z[/tex]
That's all there is to it. In the next section I'll briefly go over how to integrate the functions once they're in this form, and then I'll move on to real numbers. (Also, if anyone has any other information on the topic, or sees any errors I may have made, please share it here).
Last edited: