The Chain Rule Type 2 for Functions of Several Variables

# The Chain Rule Type 2 for Functions of Several Variables

Recall from The Chain Rule Type 1 for Functions of Several Variables page that if $z = f(x_1, x_2, ..., x_n)$ is an $n$ variable real-valued function with continuous partial derivatives and $x_1 = x_1(t)$, $x_2 = x_2(t)$, …, $x_n = x_n(t)$ are differentiable functions, then $f(x_1(t), x_2(t), ..., x_n(t))$ is solely with respect to the parameter $t$ and

(1)
\begin{align} \quad \frac{dz}{dt} = \frac{\partial z}{\partial x_1} \frac{d x_1}{dt} + \frac{\partial z}{\partial x_2} \frac{d x_2}{dt} + ... + \frac{\partial z}{\partial x_n} \frac{d x_n}{dt} \end{align}

We are now going to look at the second type of the chain rule for functions of several variables.

## The Chain Rule Type 2 for Two Variable Functions, Two Parameters

 Theorem 1 (The Chain Rule Type 2 for Two Variable Functions): Let $z = f(x, y)$ be a two variable real-valued differentiable function with continuous first partial derivatives and let $x = x(s, t)$ and $y = y(s, t)$. Then $\frac{\partial z}{\partial s} = \frac{\partial z}{\partial x} \frac{\partial x}{\partial s} + \frac{\partial z}{\partial y} \frac{\partial y}{\partial s}$, and, $\frac{\partial z}{\partial t} = \frac{\partial z}{\partial x} \frac{\partial x}{\partial t} + \frac{\partial z}{\partial y} \frac{\partial y}{\partial t}$.

Let's look at some examples

### Example 1

Let $z = -2e^y \sin x$, $x = s^3t^2$ and $y = t\cos s$. Find the partial derivatives $\frac{\partial z}{\partial s}$ and $\frac{\partial z}{\partial t}$.

We first compute the follow partial derivatives: $\frac{\partial z}{\partial x} = -2e^y \cos x$, $\frac{\partial z}{\partial y} = -2e^y \sin x$, $\frac{\partial x}{\partial s} = 3s^2t^2$, $\frac{\partial x}{\partial t} = 2s^3t$, $\frac{\partial y}{\partial s} = -t \sin s$, and $\frac{\partial y}{\partial t} = \cos s$. Applying the formula in theorem 1 and we get that:

(2)
\begin{align} \quad \quad \frac{\partial z}{\partial s} = \frac{\partial z}{\partial x} \frac{\partial x}{\partial s} + \frac{\partial z}{\partial y} \frac{\partial y}{\partial s} \\ \quad \quad \frac{\partial z}{\partial s} = [-2e^y \cos x][3s^2t^2] + [-2e^y \sin x][-t \sin s] \\ \quad \quad \frac{\partial z}{\partial s} = [-2e^{t \cos s} \cos (s^3t^2)][3s^2t^2] + [-2e^{t \cos s} \sin (s^3t^2)][-t \sin s] \\ \quad \quad \frac{\partial z}{\partial s} = -2t e^{t \cos s}\left ( 3s^2t \cos (s^3 t^2) - \sin (s^3 t^2) \sin s \right ) \end{align}
(3)
\begin{align} \quad \quad \frac{\partial z}{\partial t} = \frac{\partial z}{\partial x} \frac{\partial x}{\partial t} + \frac{\partial z}{\partial y} \frac{\partial y}{\partial t} \\ \quad \quad \frac{\partial z}{\partial t} = [-2e^y \cos x][2s^3t] + [-2e^y \sin x][\cos s] \\ \quad \quad \frac{\partial z}{\partial t} = [-2e^{t \cos s} \cos (s^3t^2)][2s^3t] + [-2e^{t \cos s} \sin (s^3 t^2)][\cos s] \\ \quad \quad \frac{\partial z}{\partial t} = -2e^{t \cos s} \left ( 2s^3t \cos (s^3 t^2) + \sin (s^3 t^2) \cos s\right ) \end{align}

## The Chain Rule Type 2 for n Variable Functions, m Parameters

The chain rule type 2 can also be generalized to a function $z = f(x_1, x_2, ..., x_n)$ of $n$ variables for which each variable $x_j$ $j = 1, 2, ..., n$ is expressed in terms of the $m$ variables $t_1, t_2, ..., t_m$.

 Theorem 2: Let $z = f(x_1, x_2, ..., x_n)$ be an $n$ variable real-valued differentiable function with continuous first partial derivatives and let $x_1 = x_1(t_1, t_2, ..., t_m)$, $x_2 = x_2(t_1, t_2, ..., t_m)$, …, $x_n = x_n(t_1, t_2, ..., t_m)$ be differentiable functions of $t_1, t_2, ..., t_m$. Then $\frac{\partial z}{\partial t_i} = \frac{\partial z}{\partial x_1} \frac{\partial x_1}{\partial t_i} + \frac{\partial z}{\partial x_2} \frac{\partial x_2}{\partial t_i} + ... + \frac{\partial z}{\partial x_n} \frac{\partial x_n}{\partial t_i}$ for $i = 1, 2, ..., m$.
 Definition: Let $z = f(x_1, x_2, ..., x_n)$ be an $n$ variable real-valued differentiable function with continuous first partial derivatives and let $x_1 = x_1(t_1, t_2, ..., t_m)$, $x_2 = x_2(t_1, t_2, ..., t_m)$, …, $x_n = x_n(t_1, t_2, ..., t_m)$ be differentiable functions of $t_1, t_2, ..., t_m$. $z$ is called the Dependent Variable, $x_1, x_2, ..., x_n$ are called the Intermediate Variables or Primary Variables, and $t_1, t_2, ..., t_m$ are called the Independent Variables, Secondary Variables or Parameters.

Memorizing the formula provided in theorem 2 can be a hassle, though fortunately, it can easily be simplified with a tree diagram:

### Example 2

Let $w = x^2y\cos (z)$, and let $x = 2s^3t \sin (u)$, $y = 3e^{s}e^{2t}u^2$, and $z = 3\cos (s) t^2 e^u$. Find $\frac{\partial w}{\partial t}$.

We first note that:

(4)
\begin{align} \quad \quad \frac{\partial w}{\partial t} = \frac{\partial w}{\partial x} \frac{\partial x}{\partial t} + \frac{\partial w}{\partial y} \frac{\partial y}{\partial t} + \frac{\partial w}{\partial z} \frac{\partial z}{\partial t} \end{align}

Also, $\frac{\partial w}{\partial x} = 2xy \cos (z)$, $\frac{\partial x}{\partial t} = 2s^3 \sin (u)$, $\frac{\partial w}{\partial y} = x^2 \cos (z)$, $\frac{\partial y}{\partial t} = 6e^{s}e^{2t}u^2$, $\frac{\partial w}{\partial z} = -x^2 y \sin (z)$, and $\frac{\partial z}{\partial t} = 6 \cos (s) t e^u$. Therefore:

(5)
\begin{align} \quad \quad \frac{\partial w}{\partial t} = [2xy \cos (z)][2s^3 \sin (u)] + [x^2 \cos (z)][6e^{s}e^{2t}u^2] + [-x^2 y \sin (z)][6 \cos (s) t e^u] \\ \quad \quad \frac{\partial w}{\partial t} = [2(2s^3t \sin (u))(3e^{s}e^{2t}u^2) \cos (3 \cos (s) t^2 e^u)][2s^3 \sin (u)] + [(2s^3t \sin (u))^2 \cos (3 \cos (s) t^2 e^u)][6e^{s}e^{2t}u^2] \\ + [-(2s^3t \sin (u))^2 (3e^{s}e^{2t}u^2) \sin (3 \cos (s) t^2 e^u)][6 \cos (s) t e^u] \end{align}