MORE CHAIN RULE

7. MORE CHAIN RULE

Above we have considered z = f (x, y), where x and y are functions of t. Now suppose z = f (x, y) as before, but x and y are each functions of two variables s and t. Then z is a function of s and t and we want to find ∂z/∂s and ∂z/∂t. We show by some examples how to do problems like this.

204 Partial Differentiation Chapter 4

Example 1. Find ∂z/∂s and ∂z/∂t given

y = s − t. We take differentials of each of the three equations to get dz = y dx + x dy,

z = xy,

x = sin(s + t),

dy = ds − dt. Substituting dx and dy into dz, we get

dx = cos(s + t)(ds + dt),

dz = y cos(s + t)(ds + dt) + x(ds − dt)

= [y cos(s + t) + x] ds + [y cos(s + t) − x] dt. Now if s is constant, ds = 0, z is a function of one variable t, and we can divide

(7.1) by dt [see (5.1) and the discussion following it]. For dz ÷dt on the left we write ∂z/∂t because that is the notation which properly describes what we are finding, namely, the rate of change of z with t when s is constant. Thus we have

∂z ∂t = y cos(s + t) − x

and similarly

∂z = y cos(s + t) + x. ∂s

Notice that in (7.1) the coefficient of ds is ∂z/∂s and the coefficient of dt is ∂z/∂t [also compare (5.3)]. If you realize this, you can simply read off ∂z/∂s and ∂z/∂t from (7.1).

We can do problems with more variables in the same way.

Example 2. Find ∂u/∂s, ∂u/∂t, given u = x 2 + 2xy − y ln z and x=s+t 2 ,y=s−t 2 , z = 2t.

We find

du = 2x dx + 2x dy + 2y dx − dz − ln z dy

y = (2x + 2y)(ds + 2t dt) + (2x − ln z)(ds − 2t dt) − (2 dt) z

2y

= (4x + 2y − ln z) ds + 4yt + 2t ln z − dt.

Then ∂u

If we want just one derivative, say ∂u/∂t, we can save some work by letting ds = 0 to start with. To make it clear that we have done this, we write

y du s = (2x + 2y)(2t dt) + (2x − ln z)(−2t dt) − (2 dt) z

2y

= 4yt + 2t ln z −

dt.

Section 7 More Chain Rule 205

The subscript s indicates that s is being held constant. Then dividing by dt, we have ∂u/∂t as before. We could also use derivatives instead of differentials. By an equation like (5.1), we have

where we have written all the t derivatives as partials since u, x, y, and z depend on both s and t. Using (7.2), we get

∂u y 2y = (2x + 2y)(2t) + (2x − ln z)(−2t) + −

(2) = 4yt + 2t ln z − . ∂t

z It is sometimes useful to write chain rule formulas in matrix form (for matrix

multiplication, see Chapter 3, Section 6). Given, as above, u = f (x, y, z), x(s, t), y(s, t), z(s, t), we can write equations like (7.2) in the following matrix form:

 ∂x ∂x 

  ∂s ∂t   

∂u  ∂u ∂u (7.3)  =  ∂y ∂y   .

[Sometimes (7.3) is written in the abbreviated form

∂(u)

∂(u) ∂(x, y, z)

∂(s, t)

∂(x, y, z) ∂(s, t)

which is reminiscent of

but be careful of this for two reasons: (a) It may be helpful in remembering the formula but to use it you must understand that it means the matrix product (7.3). (b) The symbol ∂(u, v)/∂(x, y) usually means a determinant rather than a matrix of partial derivatives—see Chapter 5, Section 4].

Again in these problems, you may say, why not just substitute? Look at the following problem.

Example 3. Find dz/dt given z = x − y and

x 2 +y 2 =t 2 , x sin t = ye y .

From the z equation, we have

dz = dx − dy.

We need dx and dy; here we cannot solve for x and y in terms of t. But we can find dx and dy in terms of dt from the other two equations and this is all we need. Take differentials of both equations to get

2x dx + 2y dy = 2t dt, sin t dx + x cos t dt = (ye y +e y )dy.

206 Partial Differentiation Chapter 4

Rearrange terms:

x dx + y dy = t dt, sin t dx − (y + 1)e y dy = −x cos t dt.

Solve for dx and dy (in terms of dt) by determinants:

t dt

−t(y + 1)e y + xy cos t dx =

−x cos t dt −(y + 1)e y

dt,

−x(y + 1)e y − y sin t

sin t −(y + 1)e y

and similarly for dy. Substituting dx and dy into the formula for dz and dividing by dt, we get dz/dt. A computer may save us some time with the algebra.

We can also do problems like this when x and y are given implicitly as functions of two variables s and t.

Example 4. Find ∂z/∂s and ∂z/∂t given

z=x 2 + xy, x 2 +y 3 = st + 5, x 3 2 =s 2 −y 2 +t .

We have dz = 2x dx + x dy + y dx. To find dx and dy from the other two equations, we take differentials of each equation:

2x dx + 3y 2 dy = s dt + t ds,

3x 2 dx − 2y dy = 2s ds + 2t dt. We can solve these two equations for dx and dy in terms of ds and dt to get

s dt + t ds

3y 2

2s ds + 2t dt −2y (−2ys − 6ty 2 ) dt + (−2yt − 6sy 2 ) ds dx =

2x 3y 2

−4xy − 9x 2 y 2

3x 2 −2y

and a similar expression for dy. We substitute these values of dx and dy into dz and find dz in terms of ds and dt just as in Example 1; we can then write ∂z/∂s and ∂z/∂t just as we did there (Problem 11). Notice that if we want only one derivative, say ∂z/∂t, we could save some algebra by putting ds = 0 in (7.4). Also note that we can save some algebra if we want the derivatives only at one point. Suppose we were asked for ∂z/∂s and ∂z/∂t at x = 3, y = 1, s = 1, t = 5. We substitute these values into (7.4) to get

6 dx + 3 dy = dt + 5 ds,

27 dx − 2 dy = 10 dt + 2 ds.

We solve these equations for dx and dy and substitute into dz just as before, but the algebra is easier with the numerical coefficients (Problem 11).

Section 7 More Chain Rule 207

So far, we have been assuming that the independent variables were “natural” pairs like x and y, or s and t. For example, we wrote ∂x/∂s above, taking it for granted that the variable held constant was t. In some applications (particularly thermodynamics), it is not at all clear what the other independent variable is and we have to be more explicit. We write (∂x/∂s) t ; this means that s and t are the two independent variables, that x is thought of as a function of them, and then x is differentiated partially with respect to s. Suppose we try to find from the three equations of Example 4 a rather peculiar looking derivative.

Example 5. Given the equations of Example 4, find (∂s/∂z) x . First, let us see that the question makes sense. There are five variables in the

three equations. If we give values to two of them, we can solve for the other three; that is, there are two independent variables, and the other three are functions of these two. If z and x are the independent ones, then s, t, and y are functions of z and x; we should be able to find their partial derivatives, for example (∂s/∂z) x which we wanted. To carry out the necessary work, we first rearrange equations (7.4) and the dz equation to get

−x dy = (2x + y) dx − dz,

t ds + s dt − 3y 2 dy = 2x dx, 2s ds + 2t dt + 2y dy = 3x 2 dx.

From these three equations we could solve for ds, dt, and dy in terms of dx and dz (by determinants or by elimination—the same methods you use to solve any set of linear equations). Then we could find any partial derivative of s(x, z), t(x, z), or y(x, z) with respect to x to z. For example, to find (∂y/∂z) x , we get from the first equation

Note that we would not need to differentiate all three equations if we wanted only this derivative; you should always look ahead to see how much differentiation is necessary! To find (∂s/∂z) x , we must solve the three equations for ds in terms of dx and dz; we can save ourselves some work [if we want only (∂s/∂z) x ] by putting dx = 0 to start with. To make it clear that we have done this we write ds x and dz x . Then we get

= −(2sy + 6ty

−x(2t 2 2

We could use a computer to save us some algebra in this problem.

208 Partial Differentiation Chapter 4

Example 6. Let x, y be rectangular coordinates and r, θ be polar coordinates in a plane. Then the equations relating them are

Suppose we want to find ∂θ/∂x. Remembering that if y = f (x), dy/dx and dx/dy are reciprocals, you might be tempted to find ∂θ/∂x by taking the reciprocal of ∂x/∂θ, which is easier to find than ∂θ/∂x. This is wrong. From (7.6) we get

−y/x 2 y

From x = r cos θ we get

These are not reciprocals. You should think carefully about the reason for this; ∂θ/∂x means (∂θ/∂x) y , whereas ∂x/∂θ means (∂x/∂θ) r . In one case y is held constant and in the other case r is held constant; this is why the two derivatives are not reciprocals. It is true that (∂θ/∂x) y and (∂x/∂θ) y are reciprocals. But to find (∂x/∂θ) y directly, we have to express x as a function of θ and y. We find x = y cot θ, so we get

y 2 /r 2 =− y , y which is the reciprocal of ∂θ/∂x in (7.7).

This is a general rule: ∂u/∂v and ∂v/∂u are not usually reciprocals; they are reciprocals if the other independent variables (besides u or v) are the same in both cases.

You can see this clearly from the equations involving differentials. From the equa- tion θ = arc tan(y/x), we can find

y 2 x dy − y dx (7.10)

From x = r cos θ, we get

(7.11) dx = cos θ dr − r sin θ dθ = dr − y dθ.

From (7.10), if y is constant, dy = 0, and we can write

dθ y =−

dx y ,

Section 7 More Chain Rule 209

where the y subscript indicates that y is constant. From (7.12), we then find either

and these are reciprocals. From (7.11), however, we can find (∂x/∂θ) r or (∂θ/∂x) r ; these are again reciprocals of each other, but are different from the derivatives found from (7.12).

It is interesting to write equations like (7.11) in matrix notation: 

where A stands for the square matrix in (7.13). Similarly, we can write

we have written the square matrix as A −1 since by (7.13),

Then, finding A −1 (Problem 9) and using (7.14), we have  ∂r

We can simply read off the four partial derivatives of r, θ, with respect to x, y, from equation (7.15). (Also see Problem 9.) Also using (7.5), and specifically noting that x and y are independent variables, we have:

[In the notation mentioned just after (7.3), we could write

AA −1

∂(x, y)

∂(r, θ)

= unit matrix ;

∂(r, θ) ∂(x, y)

thus, although the individual pairs of partial derivatives discussed above are not reciprocals, the two matrices of partial derivatives are inverses.]

210 Partial Differentiation Chapter 4

PROBLEMS, SECTION 7

1. If x = yz and y = 2 sin(y + z), find dx/dy and d 2 x/dy 2 .

2. If P = r cos t and r sin t − 2te r = 0, find dP/dt. 3. If z = xe −y and x = cosh t, y = cos s, find ∂z/∂s and ∂z/∂t.

4. If w = e −r 2 −s 2 , r = uv, s = u + 2v, find ∂w/∂u and ∂w/∂v. 5. If u = x 2 y 3 z and x = sin(s + t), y = cos(s + t), z = e st , find ∂u/∂s and ∂u/∂t. 6. If w = f (x, y) and x = r cos θ, y = r sin θ, find formulas for

∂w/∂r, ∂w/∂θ, and ∂ 2 w/∂r 2 .

7. If x = r cos θ and y = r sin θ, find (∂y/∂θ) r and (∂y/∂θ) x . Also find (∂θ/∂y) x in two ways (by eliminating r from the given equations and then differentiating, or by taking differentials in both equations and then eliminating dr). When are ∂y/∂θ and ∂θ/∂y reciprocals?

8. If xs 2 + yt 2 = 1 and x 2 s+y 2 t = xy − 4, find ∂x/∂s, ∂x/∂t, ∂y/∂s, ∂y/∂t, at (x, y, s, t) = (1, −3, 2, −1). Hint: To simplify the work, substitute the numerical values just after you have taken differentials.

9. Verify (7.16) in three ways: (a)

Differentiate equations (7.6). (b)

Take differentials of (7.5) and solve for dr and dθ. (c)

Find A −1 in (7.15) from A in (7.13); note that this is (b) in matrix notation. 10. If x 2 +y 2 2 = 2st − 10 and 2xy = s 2 −t , find ∂x/∂s, ∂x/∂t, ∂y/∂s, ∂y/∂t at

(x, y, s, t) = (4, 2, 5, 3). 11. Finish Example 4 above, both for the general case and for the given numerical values.

Substitute the numerical values into your general formulas to check your answers. 12. If w = x + y with x 3 + xy + y 3 = s and x 2 y + xy 2 = t, find ∂w/∂s, ∂w/∂t. 13. If m = pq with a sin p −p = q and b cos q +q = p, find (∂p/∂q) m , (∂p/∂q) a , (∂p/∂q) b ,

(∂b/∂a) p , (∂a/∂q) m . 14. If u = x 2 +y 2 + xyz and x 4 +y 4 +z 4 = 2x 2 y 2 z 2 + 10, find (∂u/∂x) z at the point

(x, y, z) = (2, 1, 1). 15. Given x 2 u−y 2 v = 1, and x + y = uv. Find (∂x/∂u) v , (∂x/∂u) y .

16. Let w = x 2 + xy + z 2 .

(a)

If x 3 + x = 3t, y 4 + y = 4t, z 5 + z = 5t, find dw/dt.

(b)

If y 3 + xy = 1 and z 3 − xz = 2, find dw/dx.

(c)

If x 3 z+z 3 y+y 3 x = 0, find (∂w/∂x) y . 17. If p 3 + sq = t, and q 3 + tp = s, find (∂p/∂s) t , (∂p/∂s) q at (p, q, s, t) = (−1, 2, 3, 5). 18. If m = a + b and n = a 2 +b 2 find (∂b/∂m) n and (∂m/∂b) a . 19. If z = r + s 2 ,x+y=s 3 +r 3 − 3, xy = s 2 −r 2 , find (∂x/∂z) s , (∂x/∂z) r , (∂x/∂z) y

at (r, s, x, y, z) = (−1, 2, 3, 1, 3). 20. If u 2 +v 2 =x 3 −y 3 + 4, u 2 −v 2 =x 2 y 2 + 1, find (∂u/∂x) y , (∂u/∂x) v , (∂x/∂u) y ,

(∂x/∂u) v at (x, y, u, v) = (2, −1, 3, 2).

Section 8 Application of Partial Differentiation to Maximum and Minimum Problems 211

21. Given x 2 +y 2 +z 2 = 6, and w 3 +z 3 = 5xy + 12, find the following partial derivatives at the point (x, y, z, w) = (1, −2, 1, 1). «

22. If w = f (ax + by), show that b

Hint: Let ax + by = z.

23. If u = f (x − ct) + g(x + ct), show that

24. If z = cos(xy), show that x

25. The formulas of this problem are useful in thermodynamics. (a)

Given f (x, y, z) = 0, find formulas for

(b) Show that

If x, y, z are each functions of t, show that = and

corresponding formulas for

26. Given f (x, y, z) = 0 and g(x, y, z) = 0, find a formula for dy/dx. 27. Given u(x, y) and y(x, z), show that

28. Given s(v, T ) and v(p, T ), we define c p = T (∂s/∂T ) p ,c v = T (∂s/∂T ) v . (The c’s are specific heats in thermodynamics.) Show that