Section 8: More Tricks with DerivativesKCT logo

© 1999 by Karl Hahn

8.5 Power Tools for Taking Derivatives

Logarithmic Differentiation & Leibniz' Rule

When the master carpenter teaches his apprentice the trade, he always starts him off using a hand-saw and a brace-and-auger. After all, the kid's got to learn the basics. But after a while, the master has to show the apprentice how to use the power tools. What is to be gained cutting a sheet of plywood with a hand-saw anyway? Once you've done it with the electric saw, you'll never want to do it any other way.

Suppose you wanted to take the derivative of

   f(x)  =  (x - 4)(x + 3)(x - 7)(x + 5)                          eq. 8.5-1
You could multiply out the polynomial and take the derivative of the result, but that's a lot of work.

Another alternative is: you could observe that this is the product of  (x - 4)  and  (x + 3)(x - 7)(x + 5)  and use the
product rule. But then you have to know the derivative of  (x + 3)(x - 7)(x + 5).  To find that you would have to observe that it, in turn, is the product of  (x + 3)  and  (x - 7)(x + 5)  and use the product rule on that. But you will still have to make a third pass at the product rule to find the derivative of  (x - 7)(x + 5)

This is turning out to be a lot of work also. And it would be even worse if the original expression had more factors to it. The reason it's a lot of work is because the product rule, as useful as it is, is a hand tool. What we need is a power tool to attack this one.

Suppose you take the natural log of both sides of equation 8.5-1.

   ln(f(x))  =  ln((x - 4)(x + 3)(x - 7)(x + 5))                  eq. 8.5-2a
Remember the property we have for the product of logs:
   ln(f(x))  =  ln(x - 4) + ln(x + 3) + ln(x - 7) + ln(x + 5)     eq. 8.5-2b
Now apply the chain rule to the left side of equation 8.5-2b and take the derivative, term by term, of the right side of equation 8.5-2b:
   f'(x)       1       1       1       1
          =        +       +       +                              eq. 8.5-3a
    f(x)     x - 4   x + 3   x - 7   x + 5
From here it's easy to solve for f'(x). Just multiply through by f(x). And we know what f(x) is because it was given in equation 8.5-1.
             æ   1       1       1       1   ö
   f'(x)  =  ç       +       +       +       ÷ (x - 4)(x + 3)(x - 7)(x + 5)
             è x - 4   x + 3   x - 7   x + 5 ø

                                                                  eq. 8.5-3b
Equation 8.5-3b is a perfectly good form for representing f'(x), but if you wanted to you could simplify it by multiplying through. Notice that each fraction cancels a different factor in the original f(x).
   f'(x)  =  (x + 3)(x - 7)(x + 5)  +  (x - 4)(x - 7)(x + 5)  +

             (x - 4)(x + 3)(x + 5)  +  (x - 4)(x + 3)(x - 7)      eq. 8.5-3c
This procedure for taking the derivative of a multiple product is called logarithmic differentiation. The f(x) does not have to be the product of binomials to work. It can be the product of any kind of functions:
   f(x)  =  x2e2xsin(x)                                           eq. 8.5-4a


   ln(f(x))  =  ln(x2) + ln(e2x) + ln(sin(x))

             =  2ln(x) + 2x + ln(sin(x))                          eq. 8.5-4b


   f'(x)     2           cos(x)     2
          =     +  2  +          =     +  2  +  cot(x)            eq. 8.5-4c
    f(x)     x           sin(x)     x


             æ 2                 ö
   f'(x)  =  ç    +  2  + cot(x) ÷ x2e2xsin(x)                     eq. 8.5-4d
             è x                 ø


   f'(x)  =  2x e2xsin(x)  +  2x2e2xsin(x)  +  x2e2xcos(x)         eq. 8.5-4e
Here are the steps for doing logarithmic differentiation of the product of multiple factors:
  1. Take the natural log of both sides, that is the log of f(x) on the left and the log of the product on the right.
  2. Apply the identity for the log of a product to the right -- that is the log of the product is the sum of the logs.
  3. Use the chain rule to take the derivative of both the left and right sides. The right side is a sum, so you can take its derivative term by term. The left side will always give you f'(x)/f(x).
  4. Multiply both sides by f(x) to isolate f'(x) on the left and an expression for f'(x) on the right.
  5. Replace f(x) with the original product that you started with.
  6. Optionally multiply the original product by the sum to simplify.
That's it. Like most power tools, this one is easy to use. But unlike the electric saw, there's no need to wear safety goggles when you do.

An Even Shorter Shortcut

After you've mastered the steps above, you can combine them all into one. Here's the plan. Suppose you have

   f(x)  =  g1(x)g2(x)g3(x)g4(x)                                  eq. 8.5-5
That is, f(x) is, in this case, the product of four functions. There's nothing magical about four -- it could be the product of any number of functions. To find f'(x), simply write the product as many times as you have factors (in this case that's four times) with plus signs between them, but in each product take the derivative of just one of the factors. It has to be a different factor in each one that you take the derivative of. So here we would have:
   f'(x)  =  g1'(x)g2(x)g3(x)g4(x)  +  g1(x)g2'(x)g3(x)g4(x)  +

             g1(x)g2(x)g3'(x)g4(x)  +  g1(x)g2(x)g3(x)g4'(x)      eq. 8.5-6
For example, say
                                     _
   f(x)  =  (x2 - 3x + 7)ln(x)tan(x)Öx                            eq. 8.5-7
Then following the abbreviated procedure, the derivative would be
                                 _                   1        _
   f'(x)  =  (2x - 3)ln(x)tan(x)Öx  +  (x2 - 3x + 7)   tan(x)Öx  +
                                                     x

                                       _                               1
             (x2 - 3x + 7)ln(x)sec2(x)Öx  +  (x2 - 3x + 7)ln(x)tan(x)    
                                                                      2Öx

                                                                  eq. 8.5-8


Exercises

1) Use logarithmic differentiation to find the derivative of

            (x + a)(x - b)
   f(x)  =                
            (x + c)(x - d)
where a, b, c, and d are all constants. Hint: Observe that this is the product of four functions. Identify them before you proceed.
View solution.

2) Use logarithmic differentiation (or use the shortcut method) to find the derivative of

            x2e-xsin(2x)
   f(x)  =              
               1 + x2
Hint: Again observe that this is the product of four functions.
View solution.


Power Tool for Taking Higher Derivatives of Products (Leibniz's Rule)

Note that Leibniz' Rule is not taught in many first year calculus classes. If that is the case in your class you can consider this to be optional material. You should, however, recognize that Leibniz' Rule is a very useful shortcut and it is not that difficult. So you might want to learn it anyway.

We go back to the derivative of the product of just two factors. You learned a while back that to do that you use the product rule. But that just gives you the first derivative. What if you want to know the second, third, or fourth derivatives and so on. You can end up applying the product rule many times because each derivative will have more products in it than the last. Take, for example,

   f(x)  =  x5sin(3x)

   f'(x)  =  5x4sin(3x)  +  3x5cos(3x)

   f"(x)  =  20x3sin(3x)  +  15x4cos(3x)  +

              15x4cos(3x) -  9x5sin(3x)
Just the thought of doing the third derivative this way is already starting to make me feel tired. But notice that the second and third terms of the second derivative are the same. It's very much like when you take
   (a + b)2  =  a2 + ab + ab + b2
and the second and third terms are repeated. Leibniz noticed the same thing back in the 17th century. Indeed he was able to show that the mechanics for taking the nth derivative of a product was entirely analogous to taking the nth power of a binomial. And that gives you a useful shortcut for taking high order derivatives of a product. Leibniz' rule is this: If  f(x) = g(x)h(x),  then
                n   ænö
   f(n)(x)  =   å   èkø g(n-k)(x)h(n)(x)                            eq. 8.5-9
               k=0
where
   ænö        n!
   èkø  =          
           k!(n-k)!
Or in other words, it's a binomial coefficient. Also g(n-k)(x) is the n-kth derivative of g(x). And h(n)(x) is the nth derivative of h(x). Note that the zeroth derivative of a function is the function itself.

Equation 8.5-9 might still look pretty opaque to you, so let's do an example. We'll take the fourth derivative of  x5sin(3x).  Of course we will have to know the first through the fourth derivatives of x5 and of sin(3x), but they are easy.

   g(x)  =  x5               h(x)  =  sin(3x)

   g'(x)  =  5x4             h'(x)  =  3 cos(3x)

   g"(x)  =  20x3            h"(x)  =  -9 sin(3x)

   g(3)(x)  =  60x2          h(3)(x)  =  -27 cos(3x)

   g(4)(x)  =  120x          h(4)(x)  =  81 sin(3x)

                 Table 8.5-1
You also have the binomial coefficients for exponent of 4 are:
   æ4ö       æ4ö       æ4ö       æ4ö       æ4ö
   è0ø = 1   è1ø = 4   è2ø = 6   è3ø = 4   è4ø = 1

                      Table 8.5-2
Applying the sum shown in equation 8.5-9, you have for the fourth derivative of  f(x) = g(x)h(x)

   f(4)(x)  =  g(4)(x)h(x)  +  4g(3)(x)h'(x)  +  6g"(x)h"(x)  +

                                        4g'(x)h(3)(x)  +  g(x)h(4)(x)
And substituting  g(x) = x5  and  h(x) = sin(3x) and using the derivatives listed in
Table 8.5-1, you have
   f(4)(x)  =  120x sin(3x)  +  720x2 cos(3x)  -  1080 x3 sin(3x)  -

                                           540 x4 cos(3x)  +  81 sin(3x)

Here again is a table of binomial coefficients:

Table 4b-1: Binomial Coefficients (n £ 12)

  n:      b0   b1   b2    b3   b4   b5   b6    b7   b8   b9   b10  b11   b12
  1:       1    1
  2:       1    2    1
  3:       1    3    3    1
  4:       1    4    6    4    1
  5:       1    5   10   10    5    1
  6:       1    6   15   20   15    6    1
  7:       1    7   21   35   35   21    7    1
  8:       1    8   28   56   70   56   28    8    1
  9:       1    9   36   84  126  126   84   36    9    1
 10:       1   10   45  120  210  252  210  120   45   10    1
 11:       1   11   55  165  330  462  462  330  165   55   11    1
 12:       1   12   66  220  495  792  924  792  495  220   66   12    1

where the bk in the nth row of the table is the binomial coefficient

   ænö        n!
   èkø  =          
           k!(n-k)!


Coached Exercise

Use Leibniz' Rule together with the table of binary coefficients above to find the first four derivatives of

            e-x
   f(x)  =     
             x

Step 1: This is the product of what two functions? Identify them and call them g(x) and h(x). See this step done.

Step 2: Find the first four derivatives of g(x) and h(x). You will need these in order to apply Leibniz's Rule. See this step done.

Step 3: Marry the products derivatives of g(x) and h(x) to the appropriate coefficients in the table. The first derivative will use the first row of the table, the second derivative the second row, and so on. Use the fourth derivative that we did above as a guide. See this step done.


Proof of Leibniz' Rule

This proof is optional material. You won't need to know it for class, and you don't even need to know it in order to be able to use Leibniz' Rule effectively. But if you want to know why Leibniz' rule works, here's why.

Leibniz' Rule is quite easy to prove by induction. You just have to be willing to pay close attention to indexed variables. You have to show that the coefficients that you end up with in front of each term have the same properties as the binomial coefficients. The properties that seal the proof is

  ænö          ænö
  è0ø  =  1    ènø  =  1
and
  æn+1ö     ænö     æ n ö
  è k ø  =  èkø  +  èk-1ø
If cn,k is the coefficient for the kth term of the nth derivative of g(x)h(x), then we have to prove that
   cn+1,0  =  cn+1,n+1  =  1
for any counting number, n, given that
   cn,0  =  cn,n  =  1
And we have to prove that
   cn+1,k  =  cn,k + cn,k-1
for any counting number, n, and for  1 £ k £ n,  where k is also a counting number. These are the inductive properties of the binomial coefficients, so if Leibniz' Rule is to work, they must also be the inductive properties of the c's.

With that in mind, consider that the nth derivative of g(x)h(x) must be something in the form of.

   cn,0g(x)h(n)(x) + cn,1g'(x)h(n-1)(x) + cn,2g"(x)h(n-2)(x) + ... + cn,ng(n)h(x)
At this point we don't have to know anything about what the values of the c's are.

To find the n+1st derivative, you take the derivative of the above. To do that you must apply the product rule to each term in the above expression (remember that the cn,k terms are constants). That will yield two terms for each term above. I shall call them the "left term" and the "right term." A left term is what you get by taking one of the products and taking the derivative of the left-hand factor of a term but leaving the right-hand factor alone. Likewise the right term is what you get by taking the derivative of the right-hand factor of a term but leaving the left-hand factor alone. The product rule tells us that when you take the derivative of each term, it will yield a left term and a right term.

Here is the sum of all the left terms deriving from taking the derivative of the expression above:

   cn,0g'(x)h(n)(x) + cn,1g"(x)h(n-1)(x) + cn,2g(3)(x)h(n-2)(x) + ... + cn,ng(n+1)h(x)
And here is the sum of all the right terms deriving from taking the derivative of the expression above:
   cn,0g(x)h(n+1)(x) + cn,1g'(x)h(n)(x) + cn,2g"(x)h(n-1)(x) + ... + cn,ng(n)h'(x)
When you add both of these sums together you get the terms of the n+1st derivative of g(x)h(x). To add them, you gather like terms, and in this way you derive the cn+1,k coefficients from the cn,k coefficients. You will find that the term, cn,0g(x)h(n+1)(x) stands by itself, so  cn+1,0 = cn,0 = 1

Likewise cn,ng(n+1)(x)h(x) stands by itself as well, so  cn+1,n+1 = cn,n = 1

With every other term, you find that a left term groups with a right term when you gather like terms. They always end up as

   cn,k-1g(k)(x)h(n-k)(x)  +  cn,kg(k)(x)h(n-k)(x)

       left term                right term
Since these must add up to the kth term of the n+1st derivative, it is clear that you must have
   cn+1,k  =  cn,k + cn,k-1
which was what we had to prove to show that the c's behave in the same way as do binomial coefficients.

So we have proved that from the nth rung of the ladder we can get to the n+1st rung. You still have to prove that you can get to the first rung, but that's easy. We know that

   æ1ö     æ1ö
   è0ø  =  è1ø  =  1
Well you only have to prove that
   c1,0  =  c1,1  =  1
And that is easy to do because it follows directly from the product rule.


Return to Table of Contents

Move on to not available yet

email me at hahn@netsrq.com