## The Chain Rule for Functions of Two Variables

#### Introduction

In physics and chemistry, the pressure P of a gas is related to the volume V, the number of moles of gas n, and temperature T of the gas by the following equation:

where R is a constant of proportionality. We can easily find how the pressure changes with volume and temperature by finding the partial derivatives of P with respect to V and P, respectively. But, now suppose volume and temperature are functions of time (with n constant): V=V(t) and T=T(t). We wish to know how the pressure P is changing with time. To do this we need a chain rule for functions of more than one variable. We will find that the chain rule is an essential part of the solution of any related rate problem.

#### The Chain Rule

If x=x(t) and y=y(t) are differentiable at t and z=f(x(t),y(t)) is differentiable at (x(t),y(t)), then z=f(x(t),y(t) is differentiable at t and

This can be proved directly from the definitions of z being differentiable at (x(t),y(t)) and x and y being differentiable at t.

#### Example

For the function z(x,y)=yx^2+x+y with x(t)=log(t) and y(t)=t^2, we have

#### Example

For our introductory example, we can now find dP/dt:

#### Implicit Differentiation

A special case of this chain rule allows us to find dy/dx for functions F(x,y)=0 that define y implicity as a function of x. Suppose x is an independent variable and y=y(x). Differentiating both sides with respect to x (and applying the chain rule to the left hand side) yields

or, after solving for dy/dx,

provided the denominator is non-zero. For example, if F(x,y)=x^2+sin(y) +y=0, then

which implies

#### An Extension of the Chain Rule

We may also extend the chain rule to cases when x and y are functions of two variables rather than one. Let x=x(s,t) and y=y(s,t) have first-order partial derivatives at the point (s,t) and let z=f(s,t) be differentiable at the point (x(s,t),y(s,t)). Then z has first-order partial derivatives at (s,t) with

The proof of this result is easily accomplished by holding s constant and applying the first chain rule discussed above and then repeating the process with the variable t held constant.

#### Example

Let z(x,y)=x^2+y^2 with x(r,theta)=rcos(theta) and y(r,theta)=rsin(theta). The partials of z with respect to r and theta are

where in the computation of the first partial derivative we have used the identity

#### The Chain Rule for Functions of More than Two Variables

We may of course extend the chain rule to functions of n variables each of which is a function of m other variables. This is most easily illustrated with an example. Suppose f=f(x_1,x_2,x_3,x_4) and x_i=x_i(t_1,t_2,t_3) (i.e., we have set n=4 and m=3). Then, for example, the partial derivative of f with respect to t_2 is