3.4. THE CHAIN RULE 3.4 139 The Chain Rule You will recall from Calculus I that we apply the chain rule when we have the d composition of two functions, for example when computing dx f (g (x)). The chain rule applies in similar situations when dealing with functions of several variables. For example, f (x; y) is a function of two variables. However, we may be computing the partials of f (u; v) where both u and v are functions of one or more variables. We look at di¤erent cases. 3.4.1 Partials of f (x; y) where x and y are functions of one other variable t Before we start, let us remind the reader that if a variable depends on several variables then the derivatives are partial derivatives and we will use the partial @z but if a variable depends only on one other variable, derivative notation as in @x dx we will use the notation from calculus of functions of one variable as in . dt Now, suppose we have z = f (x; y), x = g (t), y = h (t). Then, in this case we can also think of z as a function of t. So, there is only one derivative to dz compute, . It can be computed as follows: dt @z dx @z dy dz = + dt @x dt @y dt (3.1) To remember this formula, we can use a tree structure shown in …gure 3.6 as follows. 1. Draw the tree from top to bottom. Assuming z = f (x; y), x = g (t), y = h (t), we start with z. 2. From z, we draw a branch for each variable z depends on, x and y in this case, so we draw two branches. 3. From each of these variables, we repeat the procedure, that is draw a branch for each variable it depends on. Both x and y only depend on t, so we draw one branch from each. The tree is interpreted as follows. Since z is ultimately a function of t, look at all the paths from z to t. 1. Multiply all the partials which appear on a path. 2. Add all these products collected on each path. In our case, we obtain the following: There are two paths from z to t. The @z dx …rst one is z ! x ! t which gives . The second path is z ! y ! t which @x dt @z dy @z dx @z dy dz gives . Adding these gives + which is . @y dt @x dt @y dt dt 140 CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES z x y t t Figure 3.6: z = f (x (t) ; y (t)) Similarly, if w = f (x; y; z) and x; y; z are functions of t, then the corresponding tree structure is shown in …gure 3.7. Again, w is ultimately a function of t. So, there is only one derivative to dw compute, . Using the interpretation outlines above, we obtain the following dt formula: @w dx @w dy @w dz dw = + + dt @x dt @y dt @z dt and so on. Example 244 Find du if u = x2 dt du dt = @u dx @u dy + @x dt @y dt 2x2t 2y3 cos t = 4xt = = = 3.4.2 y 2 and x = t2 6 y cos t 2 4 t 4t 3 1, y = 3 sin t. 1 t 4t 6 (3 sin t) cos t 18 sin t cos t Partials of f (x; y) where x and y are functions of two variables s and t We can use the same tree structure as above to compute partial derivatives in this case. Suppose we have z = f (x; y), x = g (s; t), y = h (s; t). So, in this case, z is a function of s and t. So, there are two partial derivatives to compute: @z @z and . The corresponding tree structure is shown in …gure 3.8. @s @t 3.4. THE CHAIN RULE 141 w x y t z t t Figure 3.7: w = f (x (t) ; y (t) ; z (t)) z x s y t s Figure 3.8: z = f (x (s; t) ; y (s; t)) t 142 CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES The …rst partials of z with respect to x or t are computed as follows: @z @s @z @t @z @x @z @y + @x @s @y @s @z @x @z @y + @x @t @y @t = = (3.2) (3.3) @z Example 245 Let z = sin (x + y) where x = 2st and y = s2 + t2 . Find and @s @z . @t @z @s @z @x @z @y + @x @s @y @s = cos (x + y) (2t) + cos (x + y) (2s) = = 2t cos 2st + s2 + t2 + 2s cos st + s2 + t2 = 2 cos (s + t) 2 (s + t) and @z @t = @z @x @z @y + @x @t @y @t cos (x + y) (2s) + cos (x + y) (2t) = 2 cos (s + t) = Example 246 Let u = x2 @u @u and . @s @t @u @s = = @u @t 2 2xy + 2y 3 where x = s2 ln t and y = 2st3 . Find @u @x @u @y + @x @s @y @s (2x 2y) (2s ln t) + = 2s2 ln t = @u @x @u @y + @x @t @y @t = 2s2 ln t (s + t) 2x + 6y 2 4st3 (2s ln t) + 4st3 s2 t + 2t3 2s2 ln t + 24s2 t6 2s2 ln t + 24s2 t6 Example 247 Given z = f (x; y), x = r2 + s2 and y = 2rs …nd 2t3 6st2 @z @2z and @r @r2 3.4. THE CHAIN RULE Computation of 143 @z . @r @z @r = = Computation of @2z @r2 @z @x @z @y + @x @r @y @r @z @z 2r + 2s @x @y @2z @r2 @ @r @ @r @z @r @z @z 2r + 2s = @x @y @r @z @ @z = 2 + 2r +2 @r @x @r @x @z @ @z @ @z = 2 + 2r + 2s @x @r @x @r @y = @s @r @z @y + 2s @ @r @z @y (3.4) We compute separately @ @r @z @x = = @ @z @x @ + @x @x @r @y @2z @2z 2r 2 + 2s @x @y@x @z @x @ @x @z @y @y @r (3.5) and @ @r @z @y @z @x @ + @y @r @y @2z @2z = 2r + 2s 2 @x@y @y = @y @r (3.6) If f has continuous second partial derivatives, then combining Equations 3.4, 3.5 and 3.6 gives 2 2 @2z @z @2z 2@ z 2@ z = 2 + 4r + 8rs + 4s @r2 @x @x2 @y@x @y 2 If f does not have continuous partial derivatives, then we cannot combine the mixed partials, and we get an expression slightly more complicated: @2z @z @2z @2z @2z @2z =2 + 4r2 2 + 4rs + 4rs + 4s2 2 2 @r @x @x @y@x @x@y @y 144 CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES F x y x x Figure 3.9: F (x; f (x)) 3.4.3 General Case Suppose f is a function of n variables x1 , x2 , :::, xn and each xi is in turn a function of m variables t1 , t2 , :::, tm . f is then a function of m variables. The m …rst partials of f are: @f @f @x1 @f @x2 @f @xn = + + ::: + @ti @x1 @ti @x2 @ti @xn @ti for each i = 1; 2; :::; m. 3.4.4 Implicit Di¤erentiation The chain rule can be used to derive a simpler method for …nding the derivative of an implicitly de…ned function. y de…ned implicitly as a function of x in a relation of the form F (x; y) = 0 Suppose that F (x; y) = 0 de…nes y as an implicit function of x we will call dy . We do so by di¤erentiating both sides of y = f (x). We wish to …nd dx F (x; y) = 0 with respect to x. The right side is easy to di¤erentiate and we will skip the details here! To di¤erentiate the left side with respect to x, F (x; y), we will use the chain rule, remembering that F (x; y) = F (x; f (x)). So, F is ultimately a function of x. The corresponding tree structure is shown in …gure 3.9.We obtain: 3.4. THE CHAIN RULE 145 F x y x z y x y Figure 3.10: F (x; y; f (x; y)) @F dx @F + @x dx @y @F @F + @x @y dy dx dy dx dy dx = 0 = 0 dy if 2xy y 3 + 1 dx Using the notation above, F (x; y) = 2xy Example 248 Find dy dx = = @F @x @F @y = x Fx Fy = 2y = 0. y3 + 1 x 2y Fx Fy 2x 2y 1 3y 2 2 z de…ned implicitly as a function of x and y in a relation of the form F (x; y; z) = 0 Suppose that F (x; y; z) = 0 de…nes z as an implicit function of x and y that is F (x; y; z) = F (x; y; f (x; y)). We can use a tree structure to …nd the partial derivatives. It is shown in …gure 3.10. The dotted lines indicate that if x were a function of y, it is where we would have drawn a branch. Since x and y are the independent variables, they do not depend on each other. So, x is not a function of y and y is not a function of x. If we di¤erentiate each side with respect to x, using the tree structure, we 146 CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES get @F @x @F @z + =0 @x @x @z @x Now, @x = 1 so, we get @x @F @F @z + =0 @x @z @x That is @z = @x @F @x @F @z = Fx Fz @z = @y @F @y @F @z = Fy Fz Similarly, we can show that Example 249 Find @z if z is de…ned implicitly by @x x3 + y 3 + z 3 + 6xyz = 1 Using the formula above with F (x; y; z) = x3 + y 3 + z 3 + 6xyz @z @x = = = 1, we see that Fx Fz 3x2 + 6yz 3z 2 + 6xy x2 + 2yz z 2 + 2xy Compare this solution with the solution of example 234 on page 134. 3.4.5 Assignment Do odd# 1 - 33 at the end of 11.4 in your book.