Chain rule examples
Example 1
Let and be defined by
(You can think of this as the mountain climbing example where is height of mountain at point and the path gives your position at time .) Let be the composition of with (which would give your height at time ):
Calculate the derivative (i.e., the change in height) via the chain rule.
Solution A: We’ll use the formula using matrices of partial derivatives:
We calculate the matrices of partial derivatives of and .
We need to evaluate at the point :
The derivative of is
Solution B: We’ll start immediately with the formula in component form:
We calculate
Therefore,
Example 1’
Verify the chain rule for example 1 by calculating an expression for and then differentiating it to obtain .
Solution: .
which matches the solution to Example 1, verifying that the chain rule got the correct answer.
For this simple example, doing it without the chain rule was a lot easier. However, that is not always the case. And, in the next example, the only way to obtain the answer is to use the chain rule.
Example 2
We continue the mountain climbing example of Example 1. But now, let’s say we don’t know the terrain ahead of time. This means we do not yet know the height at the position . We do, however, know our path through mountain; as before, it is given by
Calculate the chain in height that you’ll experience along the path, i.e., calculate the derivative of . In this case, since we don’t know , the answer will be given in terms of the function .
Solution: We’ll just copy solution A, above. This time, though, we must leave the matrix of partial derivatives of as
since we don’t know what is. We can substitute in the values along the path :
Since is the same as in solution A, above, we calculate the derivative of as
We leave the answer in this form. Of course, as soon as we know what is, we can simply compute its partial derivatives and plug the result into this formula.
Example 3
We continue using the same function to describe the height of the mountain at position . We embellish the above examples by letting be defined by . (We could think of having many paths through the mountain that depend on a skill level . Then, could be the position of a person at time with skill level .)
Compute and , i.e., the partial derivatives with respect to and of the height of a person in the mountains whose position is given by .
Solution: Let . We need to calculate and . The chain rule says that
Since
the answers we want are just the two components of . We just need to calculate the matrices and , then multiply them together.
To make it easier in case you have to do such a problem again, we’ll perform the matrix multiplication before writing in the specific values for and . Then, we’ll end up with the chain rule written in component form, which may be easier to use.
The function hasn’t changed, so its matrix of partial derivatives is
For the chain rule, we need this evaluated at
Since , its matrix of partial derivatives is a matrix. If we denote its components as , its matrix of partial derivatives is
The chain rule becomes
We can compute the matrix product on the right-hand side; the result is a matrix (i.e., the same size of ). We obtain one equation by matching the first component of with the first component of this multiplied-out matrix. We obtain a second equation by matching the second component of with the second component of this multiplied-out matrix. The resulting two equations are
This is the chain rule written out in component form for , , and .
Now, we compute the answer to our specific problem by substituting in for and .
Finally, we get our answers.