# The Chain Rule

Suppose and are functions of several variables, where the number of outputs of f equals the number of inputs of g. You can "chain" f and g together to make the composite function :

That is, .

The derivative of is given by the Chain Rule. It is exactly what you'd expect, based on your experience with functions of one variable.

Theorem. Suppose is differentiable at c, and is differentiable at . Then is differentiable at c, and

In fact, can be represented by an matrix, while can be represented by an matrix. The product on the right is the product of two matrices; it makes sense, because the n columns of are compatible with the n rows of .

Example. Suppose

(a) Use the Chain Rule to compute .

(b) Find and .

(a) Here is a picture which shows the dependencies of the variables:

For example, changing s causes x, y, and z to change, which in turn causes u and v to change.

First, compute and :

Next, multiply to obtain , being careful to put on the left:

If you wish, you can substitute

This gives

Note: This kind of substitution becomes messy when the functions are at all complicated, so I'll often leave the derivative as a product of matrices with "different variables",

(b) Here is how to interpret the matrix for . The composite function is . Therefore,

So, for example,

I'll check this directly.

Alternatively, if all you need is one of the partials (say ), you can use the variable dependency picture to get the formula. Consider all paths in the picture from u to s. Label each path with the corresponding partial derivative. For example, the path from u to y is labelled with .

Now to get , multiply along each path and add the results:

Example. Suppose that , , , and

Find and .

First,

Now

It follows that .

Example. Suppose

Find .

Note: I'm leaving the answer in terms of x, y, z, and t. If you really needed everything in terms of t, you could substitute using the x, y, and z-equations.

Example. Suppose and are defined by

Find and .

Note: I'm leaving the answer in terms of x, y, z, s, and t. If you really needed everything in terms of s and t, you could substitute using the x, y, and z-equations.

Contact information