DerivChain.mws

The Chain Rule

>    restart;

>   

Lesson Overview

One omission from the list of Differentiation Rules is a rule for differentiating the composition of functions. The Chain Rule fills that void. While the Chain Rule is fairly simple to state, it is important that you become proficient at its application. The examples begin with a revisitation of Example 3 from the Differentiation Rules lesson and then move on to more complicated situations.

The Differentiation  maplet [ Maplet Viewer] [ MapleNet] can be particularly useful as you develop your expertise using the Chain Rule. But, remember that you also need to be able to apply the Chain Rule by hand.

>   

Derivation and Discussion of the Chain Rule

Let F be a function formed as the composition of f with g: F(x) = f(g(x)) . (The precise requirements on f and g will be discussed later.) To determine the derivative of F in terms of f, g, and their derivatives, look at the definition:

>    F := x -> f(g(x)):
dq1 := (F(x+h)-F(x)):
dF1 := Limit( dq1/h, h=0 ):
`F'`(x) = dF1;

`F'`(x) = Limit((f(g(x+h))-f(g(x)))/h,h = 0)

Assuming g is differentiable at x , then g must be continuous at x  and so, for small values of h , g(x+h)  can be approximated by g(x)+`g'`(x)*h . Making this substitution in the difference quotient for the definition of `F'`(x)  yields:

>    q1 := g(x+h) = g(x)+`g'`(x)*h:
dq2 := eval( dq1, q1 ):
dF2 := Limit( dq2/h, h=0 ):
`F'`(x) = dF2;

`F'`(x) = Limit((f(g(x)+`g'`(x)*h)-f(g(x)))/h,h = 0)

This limit can be massaged into a form that is recognizable as a derivative if we let

>    q2 := r = `g'`(x)*h:
q2;

r = `g'`(x)*h

With this substitution we can now write

>    dF3a := eval( dq2/h, isolate(q2,h) ):
dF3 := Limit( dF3a, h=0 ):
`F'`(x) = dF3;

`F'`(x) = Limit((f(g(x)+r)-f(g(x)))/r*`g'`(x),h = 0)

This looks promising. Because `g'`(x)  is a constant (and finite) it can be factored out of the limit. Moreover, the limit as h  approaches 0 can be equivalently stated as a limit as r  approaches 0. Thus,

>    dq4 := dq3/`g'`(x):
dF4 := Limit( dq4, r=0 ) * `g'`(x):
`F'`(x) = dF4;

`F'`(x) = Limit(dq3/`g'`(x),r = 0)*`g'`(x)

Aha! The limit that remains can now be identified as the derivative of f, evaluated at g(x) : `f '`(g(x)) . This yields one form of the Chain Rule:

  `F'`(x) = `f '`(g(x))*`g'`(x)  

 

Theorem: The Chain Rule

Let f and g be differentiable functions such that `f '`(g(x))  and `g'`(x)  both exist. Then the composition of f with g, F(x) = f(g(x)) , is differentiable at x  and the derivative of F at x  is

  `F'`(x) = `f '`(g(x))*`g'`(x) .

>   

There are quite a few ways to interpret and understand the Chain Rule. One of the most useful is to think of the composition as a gear. For example, if a chain is being pulled through a 53-tooth gear and if the gear is being turned at a rate of 100 revolutions per minute then the chain passes through the gear at a rate of (53 links/revolution)(100 revolutions/min) = 5300 links/min. Note how the composite rate is the product of the individual rates.

Another way to look at the Chain Rule is to write y = F(x)  as y = f(u)  and u = g(x) . Then,

   dy/dx = dy/du*du/dx  

This perspective is very useful and can help you to remember the Chain Rule formula. You must be aware that even though it is tempting to justify this formula by canceling du  from numerator and denominator, the real ``proof'' of this result must be stated in terms of difference quotients (where we really do have fractions!). Here is a sketch of that proof (with additional steps at the beginning and end to emphasize the connection to the first form of the Chain Rule):

  `F'`(x) = dy/dx                                                       

  `` = limit(Delta*y/(Delta*x),Delta*x = 0)                                

  `` = limit(Delta*y/(Delta*u)*Delta*u/(Delta*x),Delta*x = 0)                           

  `` = limit(Delta*y/(Delta*u),Delta*u = 0)*limit(Delta*u/(Delta*x),Delta*x = 0)  

  `` = dy/du    du/dx                                        

  `` = `f '`(u)*`g'`(x)                                       

  `` = `f '`(g(x))*`g'`(x)                                   

>   

Four Examples

Example 1:   diff((x^4+3*x^2+1)^2,x)  

This function can be recognized as a composition:

  F(x) = (x^4+3*x^2+1)^2  = f(g(x))  

where f(u) = u^2  and g(x) = x^4+3*x^2+1 .

By the Chain Rule,

  `F'`(x) = `f '`(g(x))*`g'`(x)                                     

  `` = 2*g(x)*`g'`(x)                               

  `` = 2*(x^4+3*x^2+1)*(4*x^3+6*x)  

  `` = 4*x*(2*x^2+3)*(x^4+3*x^2+1)  .

This result agrees with the results found in Example 3 of the Differentiation Rules lesson. Maple also confirms this result:

>    q1 := (x^4+3*x^2+1)^2:
Diff( q1, x ) = factor( diff(q1,x) );

Diff((x^4+3*x^2+1)^2,x) = 4*(x^4+3*x^2+1)*x*(2*x^2+3)

>   

Example 2: diff((x^4+3*x^2+1)^20,x)  

The power and utility of the Chain Rule are not particularly apparent in Example 1. If the exponent is changed to a larger integer, say n = 20 , then the problem becomes unreasonably complicated by expansion or the product rule. The computation of this derivative using the Chain Rule is essentially unchanged from its use in Example 1.

Let

  F(x) = (x^4+3*x^2+1)^20  = f(g(x))  

where f(u) = u^20  and g(x) = x^4+3*x^2+1 .

By the Chain Rule,

  `F'`(x) = `f '`(g(x))*`g'`(x)                                           

  `` = 20*g(x)^19*`g'`(x)                                

  `` = 20*(x^4+3*x^2+1)^19*(4*x^3+6*x)  

>    q2 := (x^4+3*x^2+1)^20:
Diff( q2, x ) = factor( diff(q2,x) );

Diff((x^4+3*x^2+1)^20,x) = 40*(x^4+3*x^2+1)^19*x*(2*x^2+3)

>   

More generally, for any integer n ,

  diff((x^4+3*x^2+1)^n,x) = n*(x^4+3*x^2+1)^(n-1)*(4*x^3+6*x) .

>    q2a := (x^4+3*x^2+1)^n:
Diff( q2a, x ) = simplify( diff(q2a,x) );

Diff((x^4+3*x^2+1)^n,x) = 2*(x^4+3*x^2+1)^(n-1)*n*x*(2*x^2+3)

>   

Example 3: diff((x^4+3*x^2+1)^20,`$`(x,2))  and Other Higher Derivatives

The second derivative of a function is the derivative of the derivative of the function:

  `F''`(x) = diff(F(x),`$`(x,2))  

The first step in computing a second derivative is to compute the first derivative. This was done in Example 2. Let

  F(x) = (x^4+3*x^2+1)^20  

then the first derivative is

  `F'`(x) = 20*(x^4+3*x^2+1)^19*(4*x^3+6*x)  .

To find the second derivative, the Product and Chain rules are used:

  `F''`(x) = diff(`F'`(x),x)                                                                                                                

                       `` = 20*(diff((x^4+3*x^2+1)^19,x)*(4*x^3+6*x)+(x^4+3*x^2+1)^19*diff(4*x^3+6*x,x))  

                        `` = 20*(19(x^4+3*x^2+1)^18*(4*x^3+6*x)*(4*x^3+6*x)+(x^4+3*x^2+1)^19*(12*x^2+6))  

  `` = 20*(x^4+3*x^2+1)^18*(19*(4*x^3+6*x)^2+(x^4+3*x^2+1)*(12*x^2+6))  

  `` = 20*(x^4+3*x^2+1)^18*(316*x^6+954*x^4+714*x^2+6)                               

>    q3 := (x^4+3*x^2+1)^20:
Diff( q3, x$2 ) = factor( diff(q3,x$2) );

Diff((x^4+3*x^2+1)^20,`$`(x,2)) = 40*(3+357*x^2+477*x^4+158*x^6)*(x^4+3*x^2+1)^18

Notice that the third, fourth, fifth, and any higher-order derivative can be computed but that the computations will become increasingly complex.

>    for i from 3 to 6 do
  Diff( q3, x$i ) = factor( diff(q3,x$i) )
end do;

Diff((x^4+3*x^2+1)^20,`$`(x,3)) = 240*x*(173+7137*x^2+14101*x^4+9360*x^6+2054*x^8)*(x^4+3*x^2+1)^17

Diff((x^4+3*x^2+1)^20,`$`(x,4)) = 240*(158158*x^12+966966*x^10+2199139*x^8+2222064*x^6+874649*x^4+39576*x^2+173)*(x^4+3*x^2+1)^16
Diff((x^4+3*x^2+1)^20,`$`(x,4)) = 240*(158158*x^12+966966*x^10+2199139*x^8+2222064*x^6+874649*x^4+39576*x^2+173)*(x^4+3*x^2+1)^16

Diff((x^4+3*x^2+1)^20,`$`(x,5)) = 18240*x*(1260+99295*x^2+1452717*x^4+4347165*x^6+5646195*x^8+3711495*x^10+1216215*x^12+158158*x^14)*(x^4+3*x^2+1)^15
Diff((x^4+3*x^2+1)^20,`$`(x,5)) = 18240*x*(1260+99295*x^2+1452717*x^4+4347165*x^6+5646195*x^8+3711495*x^10+1216215*x^12+158158*x^14)*(x^4+3*x^2+1)^15
Diff((x^4+3*x^2+1)^20,`$`(x,5)) = 18240*x*(1260+99295*x^2+1452717*x^4+4347165*x^6+5646195*x^8+3711495*x^10+1216215*x^12+158158*x^14)*(x^4+3*x^2+1)^15

Diff((x^4+3*x^2+1)^20,`$`(x,6)) = 273600*(790790*x^18+7342335*x^16+28185350*x^14+57460809*x^12+66179421*x^10+41851845*x^8+12614735*x^6+1144710*x^4+27671*x^2+84)*(x^4+3*x^2+1)^14
Diff((x^4+3*x^2+1)^20,`$`(x,6)) = 273600*(790790*x^18+7342335*x^16+28185350*x^14+57460809*x^12+66179421*x^10+41851845*x^8+12614735*x^6+1144710*x^4+27671*x^2+84)*(x^4+3*x^2+1)^14

Further, note that differentiation reduces the degree of a polynomial by 1. This, since F(x) = (x^4+3*x^2+1)^20  is a polynomial of degree 80, the 80-th derivative of F, F^`(80)` , should be have degree 80-80=0

>    Diff( q3, x$80 ) = diff( q3, x$80 );

Diff((x^4+3*x^2+1)^20,`$`(x,80)) = 71569457046263802294811533723186532165584657342365752577109445058227039255480148842668944867280814080000000000000000000
Diff((x^4+3*x^2+1)^20,`$`(x,80)) = 71569457046263802294811533723186532165584657342365752577109445058227039255480148842668944867280814080000000000000000000

In fact, this constant is 80!

>    evalb( diff(q3,x$80) = 80! );

true

All derivatives of degree higher than the degree of the polynomial will be zero:

>    Diff( q3, x$81 ) = diff( q3, x$81 );

Diff((x^4+3*x^2+1)^20,`$`(x,81)) = 0

>   

Example 4: diff(((x-Pi)/(x^2-4))^7,x)  

There are two obvious approaches to this problem. This expression can be differentiated as is by using the Chain Rule to differentiate the outer power and then using the Quotient Rule to differentiate the rational expression. An alternate approach is to rewrite the expression as the quotient of two 7th powers. With this approach the Quotient Rule is applied first and the Chain Rule will be needed twice -- once for the 7th power in the numerator and once for the 7th power in the denominator. Preferring to minimize the number of times the Chain Rule is appled, the first approach is adopted here:

Define f(u) = u^7  and g(x) = (x-Pi)/(x^2-4)  so that F(x) = f(g(x)) . Now,

  `F'`(x) = `f '`(g(x))*`g'`(x)                          

  `` = 7*g(x)^6*diff((x-Pi)/(x^2-4),x)  

                            `` = 7*((x-Pi)/(x^2-4))^6    (1*(x^2-4)-2*x*(x-Pi))/((x^2-4)^2)  

               = 7*((x-Pi)/(x^2-4))^6    (-x^2+2*Pi*x-4)/((x^2-4)^2)  

Confirmation of the accuracy of this response can be obtained from Maple;

>    q4 := ( (x-Pi)/(x^2-4) )^7:
Diff( q4, x ) = simplify( diff( q4, x ) );

Diff((x-Pi)^7/(x^2-4)^7,x) = 7*(-x+Pi)^6*(-x^2-4+2*x*Pi)/(x^2-4)^8

Notice that this derivative is not defined at where x^2-4 = 0 , i.e. x = 2  and x = -2 .

>   

Lesson Summary

Functions formed by composition of two or more functions can be differeniated with the Chain Rule. The key to being able to use the Chain Rule effectively is the identification of the functions involved in the composition. The ability to recognize these functions is another key in the development of your differentiation skills.

Higher-order derivatives are defined by repeated differentiation. This process can be continued so long as the derivatives exist. For polynomials, it was discovered that differentiation reduces the degree by one. In particular, any derivative of order higher than the degree of the polynomial will be zero. Derivatives of rational functions and reciprocals of polynomials - almost anything that require use of the Quotient Rule to differentiate - will involve higher and higher order polynomials in the denominator.

>   

What's Next?

The Differentiation  maplet [ Maplet Viewer] [ MapleNet] can be used to help you develop your ability to determine the most appropriate Differentiation Rule to use at each step in a differentiation problem. Since you are expected to be able to compute derivatives manually you need to be able to apply the rules by hand as well. Use the practice problems in the online homework assignment to improve - and monitor -  your skills before completing the online homework and the textbook homework assignment.

Our list of Differentiation Rules is nearly complete. The lesson on Differentiation of Trigonometric Functions will complete our list - at least for this course. This lesson also provides opportunities to continue to practice all of the rules for evaluating derivatives.

>   

>   

>