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 $f(x,y)$ at the position $(x,y)$. We do,
however, know our path through mountain; as before, it is given by
$\vc{g}(t) = (t^3, t^4).$

Calculate the change in height that you'll experience along the path,
i.e., calculate the derivative of $h(t) = f(\vc{g}(t))$. In this
case, since we don't know $f$, the answer will be given in terms of
the function $f(x,y)$.

Solution: We'll just copy solution A, above. This time,
though, we must leave the matrix of partial derivatives of $f$ as
\begin{align*}
Df(x,y)=
\left[
\begin{array}{cc}
\displaystyle
\pdiff{f}{x}(x,y) &
\displaystyle
\pdiff{f}{y}(x,y)
\end{array}
\right]
\end{align*}
since we don't know what $f(x,y)$ is. We can substitute in the values
along the path $\vc{g}(t)$:
\begin{align*}
Df(\vc{g}(t)) = Df(t^3,t^4)=
\left[
\begin{array}{cc}
\displaystyle
\pdiff{f}{x}(t^3,t^4) &
\displaystyle
\pdiff{f}{y}(t^3,t^4)
\end{array}
\right].
\end{align*}
Since $D\vc{g}(t)$ is the same as in solution A, above, we calculate
the derivative of $h$ as
\begin{align*}
h'(t) = Dh(t) &= Df(\vc{g}(t)) D\vc{g}(t)\\
&= \left[
\begin{array}{cc}
\displaystyle
\pdiff{f}{x}(t^3,t^4) &
\displaystyle
\pdiff{f}{y}(t^3,t^4)
\end{array}
\right]
\left[
\begin{array}{c}
3t^2\\4t^3
\end{array}
\right]\\
&=3t^2\pdiff{f}{x}(t^3,t^4)
+4t^3\pdiff{f}{y}(t^3,t^4).
\end{align*}
We leave the answer in this form. Of course, as soon as we know what
$f(x,y)$ is, we can simply compute its partial derivatives and plug the
result into this formula.

Example 3

We continue using the same function $f(x,y) = x^2y$ to describe the
height of the mountain at position $(x,y)$. We embellish the above
examples by letting $g: \R^2 \to \R^2$ be defined by $\vc{g}(s,t) =
(t-s^2,ts^2)$. (We could think of having many paths through the
mountain that depend on a skill level $s$. Then, $(x,y)=\vc{g}(s,t)$
could be the position of a person at time $t$ with skill level $s$.)

Compute $\pdiff{}{s} (f \circ \vc{g})(s,t)$ and $\pdiff{}{t} (f \circ
\vc{g})(s,t)$, i.e., the partial derivatives with respect to $s$ and $t$ of
the height of a person in the mountains whose position is given by
$\vc{g}(s,t)$.

Solution: Let $h(s,t) = (f \circ \vc{g})(s,t) =
f(\vc{g}(s,t))$. We need to calculate $\displaystyle
\pdiff{h}{s}(s,t)$ and $\displaystyle \pdiff{h}{t}(s,t)$. The chain
rule says that
\begin{align*}
Dh(s,t) = D(f\circ \vc{g})(s,t) = Df(\vc{g}(s,t)) D\vc{g}(s,t).
\end{align*}
Since
\begin{align*}
Dh(s,t) = \left[ \pdiff{h}{s}(s,t) \quad \pdiff{h}{t}(s,t)\right],
\end{align*}
the answers we want are just the two components of $Dh(s,t)$. We just
need to calculate the matrices $Df(\vc{g}(s,t))$ and $D\vc{g}(s,t)$,
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 $f(x,y)$ and $\vc{g}(s,t)$. Then, we'll end up with the
chain rule written in component form, which may be easier to use.

The function $f(x,y)$ hasn't changed, so its matrix of partial
derivatives is
\begin{align*}
Df(x,y)=
\left[
\begin{array}{cc}
\displaystyle
\pdiff{f}{x}(x,y) &
\displaystyle
\pdiff{f}{y}(x,y)
\end{array}
\right].
\end{align*}
For the chain rule, we need this evaluated at $(x,y)=\vc{g}(s,t)$
\begin{align*}
Df(\vc{g}(s,t))=
\left[
\begin{array}{cc}
\displaystyle
\pdiff{f}{x}(\vc{g}(s,t)) &
\displaystyle
\pdiff{f}{y}(\vc{g}(s,t))
\end{array}
\right].
\end{align*}
Since $\vc{g}: \R^2 \to \R^2$, its matrix of partial derivatives is a
$2 \times 2$ matrix. If we denote its components as $\vc{g}(s,t) =
(g_1(s,t), g_2(s,t))$, its matrix of partial derivatives is
\begin{align*}
D\vc{g}(s,t)=
\left[
\begin{array}{cc}
\displaystyle\pdiff{g_1}{s}(s,t)&
\displaystyle\pdiff{g_1}{t}(s,t)\\
\displaystyle\pdiff{g_2}{s}(s,t)&
\displaystyle\pdiff{g_2}{t}(s,t)
\end{array}
\right].
\end{align*}
The chain rule $Dh(s,t) = Df(\vc{g}(s,t)) D\vc{g}(s,t)$ becomes
\begin{align*}
\left[
\begin{array}{cc}
\displaystyle
\pdiff{h}{s}(s,t) &
\displaystyle
\pdiff{h}{t} (s,t)
\end{array}
\right]
=
\left[
\begin{array}{cc}
\displaystyle
\pdiff{f}{x}\bigl(\vc{g}(s,t)\bigr) &
\displaystyle
\pdiff{f}{y}\bigl(\vc{g}(s,t)\bigr)
\end{array}
\right]
\left[
\begin{array}{cc}
\displaystyle
\pdiff{g_1}{s}(s,t) &
\displaystyle
\pdiff{g_1}{t}(s,t) \\
\displaystyle
\pdiff{g_2}{s}(s,t) &
\displaystyle
\pdiff{g_2}{t}(s,t)
\end{array}
\right]
\end{align*}
We can compute the matrix product on the right-hand side; the result
is a $1 \times 2$ matrix (i.e., the same size of $Dh(s,t)$). We
obtain one equation by matching the first component of $Dh(s,t)$ with
the first component of this multiplied-out matrix. We obtain a second
equation by matching the second component of $Dh(s,t)$ with the second
component of this multiplied-out matrix. The resulting two equations
are
\begin{align*}
\pdiff{h}{s}(s,t) &=
\pdiff{f}{x}(\vc{g}(s,t))\pdiff{g_1}{s}(s,t)
+ \pdiff{f}{y}(\vc{g}(s,t))\pdiff{g_2}{s}(s,t)\\
\pdiff{h}{t}(s,t) &=
\pdiff{f}{x}(\vc{g}(s,t))\pdiff{g_1}{t}(s,t)
+ \pdiff{f}{y}(\vc{g}(s,t))\pdiff{g_2}{t}(s,t).
\end{align*}
This is the chain rule written out in component form for $h : \R^2 \to
\R$, $f : \R^2 \to \R$, and $\vc{g} : \R^2 \to \R^2$.
It is equation () from the special case page.