3.4. THE CHAIN RULE
3.4
241
The Chain Rule
You will recall from Calculus I that we apply the chain rule when we have the d f (g (x)). The composition of two functions, for example when computing dx 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 (x; y) where both x and y are functions of one or more other 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 dz @z dx @z dy = + 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. Each path is the partial derivative of the variable on top with respect to the variable at the bottom. 2. Multiply all the partials which appear on a path. 3. Add all these products collected on each path.
242
CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES
z
x
y
t
t Figure 3.6: z = f (x (t) ; y (t))
In our case, we obtain the following: There are two paths from z to t. The @z dx . The second path is z ! y ! t which …rst one is z ! x ! t which gives @x dt @z dy @z dx @z dy dz gives . Adding these gives + which is . @y dt @x dt @y dt dt 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 3.4.1 Find du dt
du if u = x2 dt
y 2 and x = t2
=
@u dx @u dy + @x dt @y dt 2x2t 2y3 cos t
=
4xt
=
= =
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
3.4. THE CHAIN RULE
243
w
x
y
t
t
z
t
Figure 3.7: w = f (x (t) ; y (t) ; z (t))
3.4.2
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 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 3.4.2 Let z = sin (x + y) where x = 2st and y = s2 + t2 . Find @s @z and . @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)
244
CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES
z
x
y
s
t
s
t
Figure 3.8: z = f (x (s; t) ; y (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 3.4.3 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 3.4.4 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
245
@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
246
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
247
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
=
@F @x @F @y
=
Fx Fy
dy if 2xy y 3 + 1 x 2y = 0. dx Using the notation above, F (x; y) = 2xy y 3 + 1 x 2y
Example 3.4.5 Find
dy dx
= =
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
248
CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES
get @F dx @F @z + =0 @x dx @z @x Now,
@x = 1 so, we get @x
@F @z @F + =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 3.4.6 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 3.3.10 on page 229.
3.4.5
Problems
For the problems below, do the following: Find
dw using the chain rule. dt
Find
dw by …rst expressing w as a function of t. dt
Evaluate
dw at the given value of t. dt
1. w = x2 + y 2 , x = cos t, y = sin t, t = . 2. w =
x y 1 + , x = cos2 t, y = sin2 t, z = , t = 3. z z t
3.4. THE CHAIN RULE 3. w = 2yex
249
ln z, x = ln t2 + 1 , y = tan
1
t, z = et , t = 1.
For the problems below, do the following: Find
@z @z and using the chain rule. @u @v
Find
@z @z and by …rst expressing z as a function of u and v. @u @v
Evaluate
@z @z and at the given point (u; v). @u @v
4. z = 4ex ln y, x = ln (u cos v), y = u sin v, (u; v) = 2;
4
.
For the problems below, do the following: Find
@w @w and using the chain rule. @u @v
Find
@w @w and by …rst expressing w as a function of u and v. @u @v
Evaluate
@w @w and at the given point (u; v). @u @v
5. w = xy + yz + xz, x = u + v, y = u
v, z = uv, (u; v) =
1 ;1 . 2
For the problems below, do the following: Find
@u @u @u , and using the chain rule. @x @y @z
Find
@u @u @u , and by …rst expressing u as a function of u and v. @x @y @z
Evaluate 6. u =
p q
@u @u @u , and at the given point (x; y; z). @x @y @z
q , p = x + y + z, q = x r
y + z, r = x + y
z, (x; y; z) =
p
3; 2; 1 .
Draw a tree diagram and write a formula for the each derivative below. 7.
dz for z = f (x; y), x = g (t), y = h (t). dt
8.
@w @w and for w = h (x; y; z), x = f (u; v), y = g (u; v) and z = k (u; v). @u @v
9.
@w @w and for w = g (x; y), x = g (u; v) and y = k (u; v). @u @v
250
CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES
10.
@z @z and for z = f (x; y), x = g (t; s) and y = h (t; s). @t @s
11.
@w @w and for w = g (u), u = h (s; t). @s @t
12.
@w @w and for w = f (x; y), x = g (r) and y = h (s). @r @s
dy Assuming the relations below de…ne y as an implicit function of x, …nd dx at the given point. 13. x3
2y 2 + xy = 0, (1; 1)
14. x2 + xy + y 2
7 = 0, (1; 2)
Assuming the relations below de…ne z as an implicit function of x and y, @z @z …nd and at the given point. @x @y 15. z 3
xy + yz + y 3
2 = 0, (1; 1; 1).
16. sin (x + y) + sin (y + z) + sin (x + z) = 0, ( ; ; ). @w when r = 1, s = @r z = sin (r + s).
17. Find
2
1, if w = (x + y + z) , x = r s, y = cos (r + s),
Additional problems. 18. If z = f (x; y) where f is di¤erentiable, x = g (t), y = h (t), g (3) = 2, dz g 0 (3) = 5, h (3) = 7, h0 (3) = 4, fx (2; 7) = 6, fy (2; 7) = 8, …nd dt when t = 3. 19. The pressure of 1 mole of perfect gas is increasing at a rate of 0.05 kPa/s and the temperature is increasing at a rate of 0.15 K/s. Knowing that dV P V = 8:31T …nd when P = 20kP a and T = 320K. dt 20. If z = f (x; y) where x = r cos and y = r sin @z @z and . @r @ 2 @z 2. Show that + @x 1. Find
@z @y
2
=
@z @r
2
+
1 r2
@z @
@z @z + = 0 (hint: let u = x @x @y chain rule to compute the partial derivatives).
21. If z = f (x
y), show that
2
y then use the
3.4. THE CHAIN RULE
3.4.6
251
Answers
For the problems below, do the following: Find
dw using the chain rule. dt
Find
dw by …rst expressing w as a function of t. dt
Evaluate
dw at the given value of t. dt
1. w = x2 + y 2 , x = cos t, y = sin t, t = .
dw dt
= =
w = cos2 t + sin2 t = 1 hence dw dt 2. w =
@w dx @w dy + @x dt @y dt 0 dw = 0. dt
=0 t=
x y 1 + , x = cos2 t, y = sin2 t, z = , t = 3. z z t dw dt
= =
@w dx @w dy @w dz + + @x dt @y dt @z dt 1
w=t Hence
dw dt 3. w = 2yex
dw =1 dt =1
t=3
ln z, x = ln t2 + 1 , y = tan
dw dt
= =
1
t, z = et , t = 1.
@w dx @w dy @w dz + + @x dt @y dt @z dt 4t tan 1 t + 1
252
CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES
w = 2 tan So
dw dt
1
t t2 + 1
dw = 4t tan dt 1
= 4 tan
1+1=
1
t
t+1
+1
t=1
For the problems below, do the following: Find
@z @z and using the chain rule. @u @v
Find
@z @z and by …rst expressing z as a function of u and v. @u @v
Evaluate
@z @z and at the given point (u; v). @u @v
4. z = 4ex ln y, x = ln (u cos v), y = u sin v, (u; v) = 2;
@z @u
= =
4
.
@z @x @z @y + @x @u @y @u 4 cos v (ln (u sin v) + 1)
and @z @v
= =
@z @x @z @y + @x @v @y @v 4u sin v ln (u sin v) +
4u cos2 v sin v
z = 4u cos v ln (u sin v) So
@z = 4 cos v (ln (u sin v) + 1) @u
and @z = @v
4u sin v ln (u sin v) +
4u cos2 v sin v
p @z 2; = 2 (ln 2 + 2) @u 4 p @z 2; = 2 2 (ln 2 2) @v 4
3.4. THE CHAIN RULE
253
For the problems below, do the following: Find
@w @w and using the chain rule. @u @v
Find
@w @w and by …rst expressing w as a function of u and v. @u @v
Evaluate
@w @w and at the given point (u; v). @u @v
5. w = xy + yz + xz, x = u + v, y = u
@w @u
= =
v, z = uv, (u; v) =
1 ;1 . 2
@w @x @w @y @w @z + + @x @u @y @u @z @u 4uv + 2u
and @w @v
= =
@w @x @w @y @w @z + + @x @v @y @v @z @v 2 2v + 2u w = u2
So
and
v 2 + 2u2 v
@w = 2u + 4uv @u @w = @v @w
and @w
2v + 2u2
1 ;1 2 @u
1 ;1 2 @v
=3
=
3 2
For the problems below, do the following: Find
@u @u @u , and using the chain rule. @x @y @z
Find
@u @u @u , and by …rst expressing u as a function of u and v. @x @y @z
254
CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES Evaluate
6. u =
p q
@u @u @u , and at the given point (x; y; z). @x @y @z
q , p = x + y + z, q = x r
@u @x
= =
y + z, r = x + y
z, (x; y; z) =
@u @p @u @q @u @r + + @p @x @q @x @r @x 0
and @u @y
= =
@u @p @u @q @u @r + + @p @y @q @y @r @y z 2
(z
y)
and @u @z
= =
@u @p @u @q @u @r + + @p @z @q @z @r @z y 2
(z
y) u=
So
and
and
y z
y
@u =0 @x @u z = 2 @y (z y) @u = @z (z @u
p
@u
p
and
and @u
y 2
y)
3; 2; 1 =0 @x 3; 2; 1 =1 @y
p
3; 2; 1 = @z
2
p
3; 2; 1 .
3.4. THE CHAIN RULE
255
Draw a tree diagram and write a formula for the each derivative below. 7.
8.
dz for z = f (x; y), x = g (t), y = h (t). dt dz @z dx @z dy = + dt @x dt @y dt @w @w and for w = h (x; y; z), x = f (u; v), y = g (u; v) and z = k (u; v). @u @v @w @x @w @y @w @z @w = + + @u @x @u @y @u @z @u and
9.
@w @w and for w = g (x; y), x = g (u; v) and y = k (u; v). @u @v @w @w @x @w @y = + @u @x @u @y @u and
10.
12.
@w @x @w @y @w = + @v @x @v @y @v
@z @z and for z = f (x; y), x = g (t; s) and y = h (t; s). @t @s @z @z @x @z @y = + @t @x @t @y @t and
11.
@w @w @x @w @y @w @z = + + @v @x @v @y @v @z @v
@z @x @z @y @z = + @s @x @s @y @s
@w @w and for w = g (u), u = h (s; t). @s @t dw @u @w = @s du @s and @w dw @u = @t du @t @w @w and for w = f (x; y), x = g (r) and y = h (s). @r @s @w @w dx = @r @x dr and @w @w dy = @s @y ds
256
CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES
dy Assuming the relations below de…ne y as an implicit function of x, …nd dx at the given point. 13. x3
2y 2 + xy = 0, (1; 1) dy = dx
3x2 + y 4y + x
Hence 4 dy (1; 1) = dx 3 14. x2 + xy + y 2
7 = 0, (1; 2) dy = dx
2x + y x + 2y
Hence dy (1; 2) = dx
4 5
Assuming the relations below de…ne z as an implicit function of x and y, @z @z and at the given point. …nd @x @y 15. z 3
xy + yz + y 3
2 = 0, (1; 1; 1). @z = @x
3z 2
y +y
So @z (1; 1; 1) 1 = @x 4 and @z = @y
x + z + 3y 2 3z 2 + y
So @z (1; 1; 1) = @y
3 4
16. sin (x + y) + sin (y + z) + sin (x + z) = 0, ( ; ; ). @z Fx = = @x Fz
1
@z Fy = = @y Fz
1
and
3.4. THE CHAIN RULE
257
@w when r = 1, s = @r z = sin (r + s).
2
17. Find @w @r
= =
1, if w = (x + y + z) , x = r s, y = cos (r + s),
@w @x @w @y @w @z + + @x @r @y @r @z @r 2 (r s + cos (r + s) + sin (r + s)) (1
So
sin (r + s) + cos (r + s))
@w (1; 1) = 12 @r
Additional Problems 18. If z = f (x; y) where f is di¤erentiable, x = g (t), y = h (t), g (3) = 2, dz g 0 (3) = 5, h (3) = 7, h0 (3) = 4, fx (2; 7) = 6, fy (2; 7) = 8, …nd dt when t = 3. dz @f (x; y) dx (t) @f (x; y) dy (t) = + dt @x dt @y dt When t = 3, we have dz dt
=
(6) (5) + ( 8) ( 4)
=
62
19. The pressure of 1 mole of perfect gas is increasing at a rate of 0.05 kPa/s and the temperature is increasing at a rate of 0.15 K/s. Knowing that dV P V = 8:31T …nd when P = 20kP a and T = 320K. dt 8:31T We have V = so P dV @V dT @V dP = + dt @T dt @P dt = 0:270 08L=s 20. If z = f (x; y) where x = r cos and y = r sin 1. (a) Find
@z @z and . @r @ @z @r
= =
@z @x @z @y + @x @r @y @r @z @z cos + sin @x @y
and @z @
= =
@z @x @z @y + @x @ @y @ @z @z r sin + r cos @x @y
258
CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES 2
@z @z + @x @y The right hand side is
2
(b) Show that
@z @r
2
+
1 r2
@z @
=
2
=
cos
=
@z @x
@z @r
2
+
1 r2
@z @z + sin @x @y 2
+
@z @y
2
@z @ 2
+
1 r2
r sin
@z @z + r cos @x @y
2
@z @z + = 0 (hint: let u = x y then use the @x @y chain rule to compute the partial derivatives). @z dz @u dz @z dz @u dz Let u = x y, then = = and = = . @x du @x du @y du @y du Therefore,
21. If z = f (x
y), show that
@z @z + @x @y
= =
fx = cos (x + ct)
dz du 0
dz du
2 sin (2x + 2ct)
so fxx
Hence the result.
=
sin (x + ct)
4 cos (2x + 2ct)
=
(sin (x + ct) + 4 cos (2x + 2ct))
2