Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Partial fractions

  1. Dec 12, 2005 #1


    User Avatar
    Homework Helper

    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:


    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 seperate 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.



    Then we can factor the denominator as:


    And so the partial fraction expansion will have the form:


    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:


    [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]


    [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:


    [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]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:


    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](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]


    To get the last 3 coefficients, you can't avoid doing a little algebra. Plugging in still helps though:


    [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]c_{1,1}+d_0+d_1=\frac{-4+7i}{1+2i}=2+3i[/tex] (*)


    [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]c_{1,1}+id_0-d_1=-2-i[/tex] (*)

    [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]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:




    So that:


    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: Dec 12, 2005
  2. jcsd
  3. Dec 12, 2005 #2


    User Avatar
    Homework Helper

    This will be by far the shortest section. We've now expressed the rational function r(z) as the sum of functions which we can integrate. So all that's left to do is integrate them:

    [tex]r(z)=\frac{c_{1,1}}{(z-b_1)}+\frac{c_{1,2}}{(z-b_1)^2}+...+\frac{c_{p,k_p}}{(z-b_p)^{k_p}}+d_0+d_1 z +...+d_{n-m} z^{n-m}[/tex]

    (where the dk will all be zero if n<m)

    Then, defining:

    [tex]R(z)=\int r(z) dz [/tex]

    We have:

    [tex]R(z)=c_{1,1}\mbox{ln}(z-b_1)+\frac{(-1)c_{1,2}}{(z-b_1)^1}+...+\frac{\frac{-1}{k_p-1}c_{p,k_p}}{(z-b_p)^{k_p-1}}+d_0 z+\frac{1}{2}d_1 z^2 +...+\frac{1}{n-m+1}d_{n-m} z^{n-m+1}[/tex]

    So in the two examples from the last section, we get:

    [tex]\int \frac{3z^2-2z+1}{z^3-2z^2-7z-4} dz=\int\left[ \frac{34/25}{z+1}-\frac{6/5}{(z+1)^2}+\frac{41/25}{z-4}\right] dz[/tex]

    [tex]=\frac{34}{25}\mbox{ln}(z+1) +\frac{6/5}{z+1}+\frac{41}{25}\mbox{ln}(z-4)[/tex]


    [tex]\int\frac{(1+i)z^4+(-2+4i)z^3+3iz-2}{z^2(z+2i)} dz=\int\left[ \frac{1}{z}+\frac{i}{z^2}+\frac{3}{z+2i}+2i+(1+i)z\right] dz[/tex]

    [tex]=\mbox{ln}(z) -\frac{i}{z}+3\mbox{ln}(z+2i)+2iz+\frac{1+i}{2}z^2[/tex]

    as you can verify by differentiating these two functions to get back to the rational functions we started with. That's the story for complex numbers, which is made simpler by the fact that every polynomial with complex coefficients has roots in the complex numbers. In the next section, we will work exclusively with real numbers, and so we'll need to find a way to carry this over that deals with the complex roots of B(x).
    Last edited: Dec 12, 2005
  4. Dec 12, 2005 #3


    User Avatar
    Homework Helper

    (Note: This method goes out of its way to ensure real numbers are used the whole way (except the very beginning, where I use complex numbers just to show that the expansion we'll use is in fact valid, but this step can be skipped). If all you're interested in is a real final answer, there is a shortcut that uses complex numbers in the intermediate steps. This will be shown in a later post).

    The procedure for real numbers is basically the same, with the caveat that the partial fraction expansion will now include the recipricals of quadratic polynomials, and powers thereof. These are integrated by substitution and using the inverse tan function, as will be discussed in the next section. For now, let's examine why we can expand a real rational function this way, and how it's done.

    The key thing to note for real polynomials is that whenever there is a complex root, its complex conjugate is also a root. To see this, assume that some complex number z is a root of a polynomial B(x). Then:

    [tex]B(z)=b_0+b_1 z +...+b_nz^n=0[/tex]

    Then taking the complex conjugate of both sides:

    [tex](b_0)^*+(b_1)^* z^* +...+(b_n)^*(z^*)^n=0[/tex]

    But since all the bk are real, bk*=bk, so this is just:

    [tex]b_0+b_1 z^* +...+b_n(z^*)^n=B(z^*)=0[/tex]

    And so the complex conjugate of z is also a root. Thus if we were to expand B into a product of monomials, it would look something like this:


    Where the rk are real, the zk are complex (which we'll take to mean that they have a non-zero imaginary part), so that there are p real roots and 2q complex ones. Now, we've decided we don't want any complex numbers in our expansion, so we need to get rid of the zk somehow. The trick is that if we multiply the pairs of monomials with conjugate roots, we get quadratic terms with real coefficients. This is because:



    where a and b are real numbers, and i is the square root of -1, and we have let z=a+bi, as we can do for any complex number. Thus the expansion of B turns into:


    Where all the coefficients are now real. Now we can proceed as before. Again, there may be multiple copies of the same binomial, but these are treated the same way. So, defining r(x)=A(x)/B(x), where A(x) and B(x) are polynomials of degree n and m respectively, and B(x) is factored as above, we write:

    [tex]r(x)=\frac{a_0 + a_1 x+...+a_n x^n}{(x-r_1)^{k_1}(x-r_2)^{k_2}...(x-r_p)^{k_p}(x^2+s_1x+t_1)^{j_1}...(x^2+s_qx+t_q)^{j_q}}[/tex]

    And we set this equal to:

    [tex]r(x)=\frac{c_{1,1}}{(x-r_1)}+\frac{c_{1,2}}{(x-r_1)^2}+...+\frac{c_{p,k_p}}{(x-r_p)^{k_p}} +\frac{d_{1,1} x +e_{1,1}}{(x^2+s_1x+t_1)}+\frac{d_{1,2} x +e_{1,2}}{(x^2+s_1x+t_1)^2}+...+\frac{d_{q,j_q} x +e_{q,j_q}}{(x^2+s_qx+t_q)^{j_q}}[/tex]

    With a polynomial of order n-m tagged on the end if n≥m, as before. Again, it is easiest to show this with an example. Define:


    It can be shown that the denominator factors as:


    (I may go over a rough sketch of how to find something like this later). So we want our expansion to look like: (using a,b,c,d,e as the unknown coefficients)


    Multiplying through by the denominator:



    Again, plugging in the roots helps somewhat, but if we want to stay in the reals, there is only one root at x=-1:




    Now, it is probably easier in cases like this to actually expand the right side and equate like terms:




    Which yields the equations:






    Which, in this contrived example, has the solution (b,c,d,e)=(0,0,0,2) (note it may seem like there are more equations than unknowns, but remember that we already solved for a. We could have done this instead using these same equations with a put back in as an unknown). Thus we get the partial fraction expansion:


    The reason we do it this way is because we can't reduce polynomials over the reals to any better than a product of binomials and monomials, ie, we can't factor the binomials any further. However, we can integrate expressions like:


    as I'll show in the next section. The reason we use two unknowns in the form ax+b in the numerator instead of just a single constant like before is (1) so that we get the right number of unknowns (2) so that each power of x appears on the right side, with some linear combination of unknowns as its coefficient, so that we're guaranteed to get a solution. For example, say you had the rational function:


    And you tried to expand it as:


    So that you have the right number of unknowns, but they're not in the form used above. Then when you multiply across by the denominator, you get:


    And there is no way to get the correct coefficient of x. I might give a more rigorous argument that the form I've given will actually always ensure there's a solution, but this thread is long enough for now.

    So in the next section, I'll show how to integrate the function once it's in this form.
    Last edited: Dec 12, 2005
  5. Dec 12, 2005 #4


    User Avatar
    Homework Helper

    OK, so now we have our real rational function as a sum of the following four types of terms:

    1. [tex]\frac{a}{x+b}[/tex]

    2. [tex]\frac{a}{(x+b)^p}[/tex]

    3. [tex]\frac{ax+b}{x^2+cx+d}[/tex]

    4. [tex]\frac{ax+b}{(x^2+cx+d)^p}[/tex]

    As I mentioned before, if you can integrate all of these, the integral of the sum is the sum of the integrals, and so you know how to integrate the whole expansion. I've already gone over how to do cases (1) and (2) in the second section. For case (3), there are two steps. First, use substitution. Define u=x2+cx+d, so that du=(2x+c)dx. We don't have this in the numerator, and so this won't finish the job, but we can use this it to eliminate the x term in the numerator:

    [tex]\int \frac{ax+b}{x^2+cx+d}dx=\int\left[\frac{a}{2}\frac{2x+c}{x^2+cx+d}+\frac{b-ca/2}{x^2+cx+d}\right]dx [/tex]



    Where we have defined e =b-ca/2. Then we have only to integrate the second term. Here's where arctan comes in. We know that the function:


    has arctan as its antiderivative. Our function isn't quite in this form, but we can get it there by completing the square. Again, the notation will get tiring if I continue abstractly, so I'll use an example. Say we want to integrate:


    We complete the square in the denominator by noting that:


    So that:


    (If you aren't familiar with this procedure of completing the square, just remember that you always put half the linear coefficient, 4 in this case, as the number added to x inside the square, so that x2+2ax+b=(x+a)2+(b-a2).)

    Now we're getting closer. Use the substitution u=(x+2)/5, du=dx/5, to give:

    [tex]\int \frac{10dx}{(x+2)^2+25}=\int \frac{50du}{(5u)^2+25}[/tex]

    [tex]=\int \frac{50du}{25(u^2+1)} = 2\int\frac{du}{u^2+1}=2\mbox{tan}^{-1}(u)[/tex]


    This should make it clear why we divided by 5 in defining u, but if you didn't catch on, you divide by the square root of the constant term in the denominator, 25 in this case. Note that this constant term must be positive, because if we had something like (x+a)2-b2, this would have the real roots ±b-a, and so could be factored further into monomials. So that completes case (3).

    For case (4), the first step is the same as before, and we will get a term like:

    [tex]\int\frac{(a/2) du}{u^p} = \frac{\frac{-a}{2(p-1)}}{(x+cx+d)^{p-1}}[/tex]

    Again, this can be done in such a way as to eliminate the x term in the numerator of the remaining term. So we'll be left with something like:


    which we need to integrate. Using essentially the same method as before, we can get this into the form:


    Unfortunately, at this point we are reduced to integrating by parts.

    (If you like, you may make the trigonometric substitution u=tanθ, du=sec2θ dθ, which will leave you with the integral of some even power of cos θ, which can then be reduced to an integral of cos(kθ) using the half angle formula repeatedly. But then you are left with a bunch of terms that look like sin(k tan-1(u)), which I don't like).

    I'll briefly present a recursive method for doing this integral. First, rewrite the integral as:


    [tex]= \frac{1}{(u^2+1)^{p-1}}-\frac{u^2}{(u^2+1)^{p}}[/tex]

    Then the second term can be integrated by parts, by taking:

    [tex]a=u/2[/tex] [tex]db=\frac{2udu}{(u^2+1)^p}[/tex]

    [tex]da=du/2[/tex] [tex]b=\frac{\frac{-1}{p-1}}{(u^2+1)^{p-1}}[/tex]

    [tex]\int\frac{u^2}{(u^2+1)^{p}}du = \frac{\frac{-u}{2(p-1)}}{(u^2+1)^{p-1}} - \int \frac{\frac{-du}{2(p-1)}}{(u^2+1)^{p-1}}[/tex]

    So that:

    [tex]\int \frac{1}{(u^2+1)^{p}}=\frac{\frac{u}{2(p-1)}}{(u^2+1)^{p-1}}+ (1-\frac{1}{2(p-1)})\int \frac{du}{(u^2+1)^{p-1}}[/tex]

    Then we can repeat this process for p-1, and so on, until we are reduced to an integral which gives us the arctan function, at which point we're done.

    Now we have a method for integrating all possible terms. The discussion may have been somewhat abstract, so here is an example, continuing the example from the last section, slightly modified so as to be more instructive. We have:


    The first term is easily integrated, so we'll ignore that for now. As for the second, first we use the substitution u=x2+3x+7, du=(2x+3)dx. To use this, we need to expand the term into:


    The first term is integrated to yield:

    [tex]\int\frac{1}{2}\frac{2x+3}{(x^2+3x+7)^2}dx = \frac{1}{2}\int\frac{du}{u^2}=\frac{-1}{2}\frac{1}{x^2+3x+7}[/tex]

    For the second term, we complete the square to get:



    Then let [itex]u=(x+3/2)/\sqrt{19/4}[/itex], [itex]du=dx/\sqrt{19/4}[/itex], so that:



    [tex]\int\frac{1}{2}\frac{dx}{(x^2+3x+7)^2}=\frac{1}{2(19/4)^{3/2}}\int\frac{du}{(u^2+1)^2} [/tex]

    Now, applying the method described above:

    [tex]\int \frac{du}{(1+u^2)^2} = \int \left[ \frac{1+u^2}{(1+u^2)^2} -\frac{u^2}{(1+u^2)^2} \right]du[/tex]

    [tex]=\int\frac{du}{1+u^2} - \frac{1}{2}\left[ \frac{-u}{1+u^2}-\int \frac{-du}{1+u^2}\right] [/tex]

    [tex]=\frac{1}{2}\mbox{tan}^{-1} u+\frac{1}{2}\frac{u}{1+u^2}[/tex]


    And so our final answer is:

    [tex]\int \left(\frac{5}{x+1}+\frac{x+2}{(x^2+3x+7)^2}\right) = 5\mbox{ln}(x+1)-\frac{1}{2}\frac{1}{x^2+3x+7}+\frac{1}{4(19/4)^{3/2}}\mbox{tan}^{-1}\left(\frac{x+3/2}{\sqrt{19/4}}\right)+\frac{1}{4(19/4)^{2}}\frac{x+3/2}{1+\frac{(x+3/2)^2}{19/4}}[/tex]


    And now you see why calculators can be useful sometimes... That's it for now. Sometime soon I'll explain the easier method to get these answers using complex numbers, and maybe give a proof of some things I handwavingly claimed. This thread helped me realize I need to get a life, but I hope it was helpful to some of you with partial fractions. See ya.
    Last edited: Dec 13, 2005
  6. Dec 20, 2005 #5


    User Avatar
    Homework Helper

    In this post, I'll go over an alternative method for computing the antiderivative of real rational functions that uses complex numbers in the intermediate steps, but leaves a real final answer. It turns out to be much quicker than the previous method for most functions, and should probably be used if you're comfortable with complex numbers, and unless the function is in a form particularly conducive to the previous method.

    Ok, so we now have two methods for computing the integrals of partial fractions. One is for real numbers and one is for complex numbers. You might have wondered what would happen if you applied the complex method to a real rational function. As should be pretty clear from the above (and from the example in the first post where we did just this), the methods will give the same answer if all the roots of the denominator are real. But what about something like this:

    [tex]r(x)=\frac{1}{1+x^2} [/tex]

    If we use the real method, we're already at the last step, and the integral is:

    [tex]R(x)=\mbox{tan}^{-1} x[/tex]

    If we use the complex method, we first need to factor the denominator:


    And then we set:


    Solving for A and B, we end up with:


    Which has the integral:


    [tex]= \frac{1}{2i}\mbox{ln}\left(\frac{x-i}{x+i}\right)[/tex]

    At this point, I should point out something I didn't make clear in the last sections. When integrating a function like:


    I've only mentioned the solution:


    But the following is also a solution, as you can verify yourself by differentiating:


    This isn't very suprising when you consider the complex valued natural log function, because then this function only differs from the previous one by a constant term [itex]\pi i[/itex]. However, it is also true for real numbers, in which case the first solution is valid for x>a and the second for x<a. This is usually succinctly expressed by:

    [tex]\int \frac{dx}{x-a} = \mbox{ln}|x-a|[/tex]

    Although it must be kept in mind that this solution is not valid at x=a, and is really only valid for either x<a or x>a, depending on where the bounds of the integral lie.

    The reason I bring this up now is because we need to realize that, in addition to:


    The following is also an indefinite integral of the original function:


    It will turn out that it is this second function gives us back the arctan function, while the first gives the negative of the arccot function. These differ by a constant (depending on which branch of each multivalued function you take), as we would expect, but we'll use the arctan function here since it's a little more familiar.

    We can prove the second function is identical with the arctan function using Euler's formula:

    [tex]e^{ix}=\mbox{cos }x+i\mbox{sin }x[/tex]

    Which gives us:

    [tex]\mbox{cos }x=\frac{1}{2}(e^{ix}+e^{-ix})[/tex]


    [tex]\mbox{sin }x=\frac{1}{2i}(e^{ix}-e^{-ix})[/tex]

    and so:

    [tex]\mbox{tan }x=-i\frac{e^{ix}-e^{-ix}}{e^{ix}+e^{-ix}}[/tex]

    Now we can invert this to get a definition of arctan involving natural logs:

    [tex]y=\mbox{tan}^{-1} x[/tex]

    [tex] x = \mbox{tan } y = -i\frac{e^{iy}-e^{-iy}}{e^{iy}+e^{-iy}}[/tex]





    [tex]y=\mbox{tan}^{-1} x =\frac{1}{2i}\mbox{ln}\left(\frac{i-x}{x+i}\right)[/tex]

    Which matches what we found above for the second function. However, we know that the first function is equal to second up to a constant, so we can freely substitute arctan in for it in an indefinite integral. So, in general, we get (by substitution) (and up to a constant):

    [tex]\mbox{tan}^{-1} (ax+b) = \frac{1}{2i}\mbox{ln}\left(\frac{ax+b-i}{ax+b+i}\right)[/tex]

    [tex] = \frac{1}{2i}\mbox{ln}\left(\frac{x+b/a-i/a}{x+b/a+i/a}\right)[/tex]

    Note that the numerator and denominator of the argument of the log are conjugates. So, working backwards, we now know that, given a function like:


    noting that if we take a=1/d and b=-ac=-c/d, we get that this is equal to:

    [tex]A \mbox{ tan}^{-1} \left(\frac{x-c}{d}\right)[/tex]

    So now we have a link between the two methods. But how do we start from a general expression containing complex arguments of natural logs to one with just real arguments of arctan?

    The key is to remember that when we start with a real rational function, we always have a symmetry under the complex conjugate operation. That is, at every step along the way, we must have an expression that will evaluate to a real number, and so taking the complex conjugate of the expression should leave it unchanged. For example, if, in our expansion, we have terms like:

    [tex]r(x) = ... + \frac{A}{x-(a+bi)} + \frac{B}{x-(a-bi)} + ...[/tex]

    it must be the case that A is the complex conjugate of B. So, in the integral we get using the complex method, we'll get the following two types of terms (always occuring in pairs as shown):

    1) [tex] (c+di) \mbox{ ln} (x-(a+bi))+(c-di) \mbox{ ln} (x-(a-bi))[/tex]

    2) [tex] \frac{c+di}{(x-(a+bi))^p} + \frac{c-di}{(x-(a-bi))^p} [/tex]

    Where a, b, c, and d are all real. For case (1), we start by grouping the terms as follows:

    [tex] c\left(\mbox{ln}(x-(a+bi)) + \mbox{ln}(x-(a+bi)) \right)+ di\left(\mbox{ln}(x-(a+bi) - \mbox{ln}(x-(a+bi)) \right) [/tex]

    [tex]=c\mbox{ ln}[(x-(a+bi))(x-(a-bi))] + di\mbox{ ln}\left(\frac{x-(a+bi)}{x-(a-bi)}\right) [/tex]

    [tex]=c\mbox{ ln}(x^2-2ax-a^2+b^2)+\frac{-2d}{2i}\mbox{ ln}\left(\frac{x-(a+bi)}{x-(a-bi)}\right)[/tex]

    and from the above expression for arctan:

    [tex]=c\mbox{ ln}(x^2-2ax-a^2+b^2)-2d \mbox{ tan}^{-1}\left(\frac{x-a}{b}\right)[/tex]

    For case (2), we do the same type of grouping:

    [tex] \frac{c+di}{(x-(a+bi))^p} + \frac{c-di}{(x-(a-bi))^p} [/tex]

    [tex] = c\left(\frac{1}{(x-(a+bi))^p} + \frac{1}{(x-(a-bi))^p} \right)+ di\left(\frac{1}{(x-(a+bi))^p} - \frac{1}{(x-(a-bi))^p} \right)[/tex]

    [tex] = c\left(\frac{(x-(a-bi))^p+(x-(a+bi))^p}{(x-(a+bi))^p(x-(a-bi))^p} \right)+ di\left(\frac{(x-(a-bi))^p-(x-(a+bi))^p}{(x-(a+bi))^p(x-(a-bi))^p}\right)[/tex]

    [tex] = \frac{R+S}{(x^2-2ax-a^2+b^2)^p}[/tex]



    which is real, since it is a real number times the sum of complex conjugates, which is real, and:


    which is real, since it is an imaginary number times the difference of complex conjugates, which is imaginary, and the product of two imaginary numbers is real. So now we have an expression with no imaginary numbers in it (assuming you expand the polynomials in the denominator and cancel off the appropriate terms), which is what we wanted.

    So we have managed to turn all of the terms containing complex numbers into terms containing only real numbers, higher degree polynomials in the denominator and log argument, and arctan functions. These are the kinds of things we would have gotten using the real method, but here we have achieved it much more easily using complex numbers in the intermediate steps.

    Here's an example. Define:


    We can factor the denominator as:


    Which means, given the denominator has a degree 1 greater than the numerator, the expansion will look like:


    which gives:

    [tex]3x^5+6x^4+8x^3+15x^2+13x+5 =

    Plugging in -1, i, and -i allows you to solve for B, C, and D, and then the other coefficients can be solved for by plugging in some other values and solving the three resulting coupled linear equations. I won't go through that again here, but the result is:


    So that:


    which can be easily integrated to yield:

    [tex]R(x)=\frac{-1}{1+x}+(1+2i)\mbox{ ln}(x+i)+(1-2i)\mbox{ ln}(x-i)+\frac{3}{2}x^2[/tex]

    We can use the technique from above to eliminate the complex numbers in the second and third terms:

    [tex](1+2i)\mbox{ ln}(x+i)+(1-2i)\mbox{ ln}(x-i)=\mbox{ ln}(x+i)+\mbox{ ln}(x-i)+2i(\mbox{ ln}(x+i)-\mbox{ ln}(x-i))[/tex]

    [tex]=\mbox{ ln}(x^2+1)+\frac{4}{2i}\mbox{ ln}\left(\frac{x-i}{x+i}\right)[/tex]

    [tex]=\mbox{ ln}(x^2+1)+4\mbox{ tan}^{-1}x[/tex]

    So that:


    Go ahead and try to do this using the purely real method. You'll see it's much harder, and this is a relatively simple example. If you're at all comfortable with complex numbers, I'd recommend doing it this way instead. But it's nice to know that there's a way to do it with just real numbers. I'll do one more post in the next day or so summarizing all I've talked about.
    Last edited: Dec 20, 2005
  7. Dec 21, 2005 #6
    hey, thanks alot for the contribution, i havent started really reading it yet. but gonna get around it soon.
  8. Dec 21, 2005 #7


    User Avatar
    Homework Helper

    Hmm,... there's a little mistake here:
    [tex]\tan x = -i \frac{e ^ {ix} - e ^ {-ix}}{e ^ {ix} + e ^ {-ix}}[/tex]
    The numerator should read:
    -i (eix - e-ix) not -i (eix - eix) = 0. :wink:
    And some of the following lines are also wrong because of this.
    Also, don't forget the constant of integration! :smile:
    By the way, you can LaTeX tangent function (or most functions by putting '\' in front of the function's name) , e.g: \tan instead of \mbox{tan} o:)
    Anyway, this is a good tutorial. :smile:
    Last edited: Dec 21, 2005
  9. Dec 21, 2005 #8


    User Avatar
    Homework Helper

    Thanks for the comments and corrections. I fixed the mistake you mentioned, VietDao, and I'm sure there's more mistakes like that. I'll go over everything again once I'm done. And, as I mentioned in the first post, I'm suppressing all the constants of integration. I've even (maybe misleadingly) said two expressions are equal when they differ by a constant, but I hope it was clear where and why I did this.
    Last edited: Dec 21, 2005
  10. Dec 21, 2005 #9


    User Avatar
    Homework Helper

    So now I'll summarize everything I've gone over in this thread. The idea is that you could learn all the core concepts in this post, and then refer to the above for more details and examples.

    Complex Rational Functions

    These are functions of the form:

    [tex]r(z)=\frac{a'_0 + a'_1 z + ... + a'_n z^n}{b'_0+b'_1 z+...+b'_m z^m}[/tex]

    Where the a'k, b'k, and z are all complex. Here's how you integrate them:

    1. Factor the denominator:

    [tex]b'_0+b'_1 z+...+b'_m z^m = b'_m (z-b_1)(z-b_2)...(z-b_m)[/tex]

    Where we may have multiple roots (ie, bi may equal bj for i≠j). We can absorb the factor of b'm into the numerator, and we'll be left with:

    [tex]r(z) = \frac{a_0 + a_1 z + ... + a_n z^n}{(z-b_1)(z-b_2)...(z-b_m)}[/tex]

    Where the ak and bk are also complex, and are not, in general, equal to their primed counterparts. Hopefully the function is given to you in this form. If not, you'll need to find the roots of the denominator, either by guessing, a calculator, the quadratic, cubic, or quartic formulas, etc.

    2. Expand the rational function as the linear combination of integrable functions:

    By "integrable functions," I mean either polynomials or reciprocals of monomials to some power, all of which we know how to integrate. There are two cases:

    a) n<m: If there are no repeated roots, we set:

    [tex]r(z)=\frac{c_1}{z-b_1} + \frac{c_2}{z-b_2} + ... + \frac{c_m}{z-b_m}[/tex]

    If, for example, b1 is repeated p times, then we set:

    [tex]r(z)=\frac{c_{11}}{z-b_1} + \frac{c_{12}}{(z-b_1)^2}+ ...+\frac{c_{1p}}{(z-b_1)^p} + \frac{c_2}{z-b_2} + ...[/tex]

    That is, we include a power of 1/(z-b1) for every integer up to the multiplicity of the root (see 1st post for more details). Note that this means there will be m terms in the expansion.

    b) n≥m: Same as above, but we also include an unknown polynomial of degree n-m:

    [tex]r(z)=\frac{c_1}{z-b_1} + \frac{c_2}{z-b_2} + ... + \frac{c_2}{z-b_2}+d_0 + d_1 z + ... +d_{n-m} z^{n-m}[/tex]

    The trick for remembering what to do in each case is (as I mentioned before): If the rational function is "bottom-heavy", ie, if the polynomial in the denominator is of a higher degree than the one in the numerator, the expansion will be all reciprocals. If, on the other hand, the function is "top-heavy," with the top outweighing the bottom by n-m, the expansion includes (in addition to the reciprocals) powers of z up to zn-m.

    3. Solve for the unknown coefficients:

    First, multiply both sides by the denominator of the rational function (we assume no repeated roots and n<m here for simplicity, but the extension should be clear):

    [tex](z-b_1)(z-b_2)...(z-b_m)r(z)=(z-b_1)(z-b_2)...(z-b_m) \left( \frac{c_1}{z-b_1} + \frac{c_2}{z-b_2} + ... + \frac{c_m}{z-b_m} \right) [/tex]

    [tex]a_0 + a_1 z + ... + a_n z^n = (z-b_2)(z-b_3)...(z-b_m)c_{1} + ... +(z-b_1)(z-b_2)...(z-b_{m-1})c_{m}[/tex]

    Then we need to solve for the ck. This is most easily done by plugging in the roots of the denominator and solving the resulting equations. If there are no repeated roots, this gets the job done, but otherwise you need to plug in other values of x and solve the coupled linear equations that result for the remaining constants.

    4. Integrate:

    Once it's in this form (see step 2), integration is pretty easy. In fact, it's easy enough that I won't go over it again. If you want the details, refer to post 2.

    Real Rational Functions - Method 1

    These are the same types of functions as before, but this time with all real coefficients, and over the real variable x:

    [tex]r(x)=\frac{a'_0 + a'_1 x + ... + a'_n x^n}{b'_0+b'_1 x+...+b'_m x^m}[/tex]

    1. Factor the denominator:

    Again, we need to factor the polynomial in the denominator. But now, if we want to stay in the real numbers, we don't necessarily have enough roots to factor the polynomial into monomials as before. Luckily, we can still factor it into monomials and binomials as follows:

    [tex]b'_0+b'_1 x+...+b'_m x^m = b'_m (x+b_1)...(x+b_p)(x^2+c_1 x+d_1)...(x^2+c_q x+d_q)[/tex]

    Where again, we may have repeated monomials, and even repeated binomials. For the rest of the method to work, these binomials must not have any real roots. If they do, we can always factor them further into two real monomials.

    Again, this leaves:

    [tex]r(x)=\frac{a_0 + a_1 x + ... + a_n x^n}{(x+b_1)...(x+b_p)(x^2+c_1 x+d_1)...(x^2+c_q x+d_q)}[/tex]

    2. Expand the rational function as the linear combination of integrable functions:

    This works exactly the same as last time, except now we have recipricals of binomials. These are included in the expansion as:

    [tex]r(x) = ...+ \frac{e_k x + f_k}{x^2+c_k x +d_k} +...[/tex]

    Again, when there are multiple copies of a monomial or binomial, each power is included in the expansion. For example, if the above binomial was included twice in the factorization of the denominator, we would also include the following term in the expansion of the rational function:

    [tex]\frac{e_{k2} x + f_{k2}}{(x^2+c_k x +d_k)^2}[/tex]

    Also, as before, if the polynomial in the numerator is of a higher degree than that in the denominator, an appropriate polynomial is added at the end of the expansion.

    3. Solve for the unknown coefficients:

    This works exactly as before. First multiply across by the denominator polynomial, then plug in roots, etc.

    4. Integrate:

    This is significantly more complicated than last time. The reciprocal monomials and the polynomial at the end are integrated straightforwardly as before, but the reciprical binomials present a problem. This is sufficiently complicated that I'll refer you to the fourth post of this thread, where I go over this about as briefly as can properly be done.

    Real Rational Functions - Method 2

    This method is somewhat easier than the first, but uses complex numbers in the intermediate steps. The idea is to use the complex method, and then convert the final answer into one involving only real numbers. So, this picks up after step 4 of the complex method.

    5. Convert to an expression containing only real numbers:

    We now have terms like:

    1) [tex]A_k \mbox{ ln}(x-b_k) + A_k^* \mbox{ ln}(x-b_k^*) [/tex]

    2) [tex] \frac{B_k}{(x-b_k)^p} + \frac{B_k^*}{(x-b_k^*)^p} [/tex]

    Where, eg, Ak, Ak*, are complex conjugates, for reasons discussed in the fifth post. By seperating the coefficients into their real and imaginary parts and grouping these terms, we can convert (1) into the log of a real binomial and the arctan of a real monomial, using:

    [tex]\frac{A}{2i}\mbox{ln}\left(\frac{x-(c+di)}{x-(c-di)}\right)=A\mbox{ tan}^{-1} \left(\frac{x-c}{d}\right)[/tex]

    Where this "equality" really only holds up to an additive constant, so the two terms aren't really equal (although their derivatives are), but they may be freely interchanged in an antiderivative. And (2) can be turned into a real rational function. This is discussed in more detail in the fifth post.

    So, that's all. If anyone wants, I can go into more detail, clarify parts that were unclear, or give more rigorous proofs of things I've said. Hope you enjoyed it.
    Last edited: Dec 21, 2005
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook