The Chain Rule for Differentiable Functions Examples 1

# The Chain Rule for Differentiable Functions Examples 1

Recall from The Matrix Form of the Chain Rule for Compositions of Differentiable Functions from Rn to Rm page that if $S \subseteq \mathbb{R}^n$ is open, $\mathbf{g} : S \to \mathbb{R}^p$, and $\mathbf{f} : R(\mathbf{g}) \to \mathbb{R}^m$ where:

(1)
\begin{align} \quad (x_1, x_2, ..., x_n) \to_{\mathbf{g}} (y_1, y_2, ..., y_m) \to_{\mathbf{f}} (z_1, z_2, ..., z_p) \end{align}

Then for each $k \in \{ 1, 2, ..., p \}$ and $j \in \{ 1, 2, ..., n \}$ we have that the partial derivative of $z_k$ with respect to $x_j$ can be computed as:

(2)
\begin{align} \quad \frac{\partial z_k}{\partial x_j} = \sum_{i=1}^{m} \frac{\partial z_k}{\partial y_i} \frac{\partial y_i}{\partial x_j} \end{align}

We will now look at some examples of applying this property.

## Example 1

**Let $f(x, y) = x^2 + y^2$ and let $x(r, \theta) = r \cos \theta$, $y(r, \theta) = r \sin \theta$. Find $\displaystyle{\frac{\partial f}{\partial r}}$ and $\displaystyle{\frac{\partial f}{\partial \theta}}$ using the chain rule and by direct substitution.**

From the chain rule we have that:

(3)
\begin{align} \quad \frac{\partial f}{\partial r} &= \frac{\partial f}{\partial x} \frac{\partial x}{\partial r} + \frac{\partial f}{\partial y} \frac{\partial y}{\partial r} \\ &= (2x)(\cos \theta) + (2y)(\sin \theta) \\ &= 2(r \cos \theta)(\cos \theta) + 2(r \sin \theta)(\sin \theta) \\ &= 2r\cos^2 \theta + 2r \sin^2 \theta \\ &= 2r \end{align}

And also:

(4)
\begin{align} \quad \frac{\partial f}{\partial \theta} &= \frac{\partial f}{\partial x} \frac{\partial x}{\partial \theta} + \frac{\partial f}{\partial y} \frac{\partial y}{\partial \theta} \\ &= (2x) (-r \sin \theta) + (2y)(r \cos \theta) \\ &= (2r \cos \theta)(-r \sin \theta) + (2r \sin \theta)(r \cos \theta) \\ &= -2r^2 \cos \theta \sin \theta + 2r^2 \sin \theta \cos \theta \\ &= 0 \end{align}

By direct substitution we have that:

(5)
\begin{align} \quad f(x, y) = x^2 + y^2 = (r \cos \theta)^2 + (r \sin \theta)^2 = r^2 \cos^2 \theta + r^2 \sin^2 \theta = r^2(\cos^2 \theta + \sin^2 \theta) = r^2 = f(r, \theta) \end{align}

Therefore $\displaystyle{\frac{\partial f}{\partial r} = 2r}$ and $\displaystyle{\frac{\partial f}{\partial \theta} = 0}$ as above.

## Example 2

**Let $f(x, y, z) = x^2ye^z$, $x(s, t) = s^2t$, $y(s, t) = st^2$, and $z(s, t) = \sin (st)$. Find $\displaystyle{\frac{\partial f}{\partial s}}$ by first using the chain rule and then by direct substitution.**

We have that:

(6)
\begin{align} \quad \frac{\partial f}{\partial s} &= \frac{\partial f}{\partial x} \frac{\partial x}{\partial s} + \frac{\partial f}{\partial y} \frac{\partial y}{\partial s} + \frac{\partial f}{\partial z} \frac{\partial z}{\partial s} \\ &= (2xye^z)(2st) + (x^2e^z)(t^2) + (x^2ye^z)(t \cos (st)) \\ &= 2(s^2t)(st^2)e^{\sin (st)}(2st) + (s^2t)^2e^{\sin (st)} (t^2) + (s^2t)^2(st^2)e^{\sin (st)} t \cos (st) \\ &= 4s^4t^4e^{\sin (st)} + s^4t^4 e^{\sin (st)} + s^5t^5 e^{\sin (st)} \cos (st) \\ &= 5s^4t^4e^{\sin (st)} + s^5t^5 e^{\sin (st)} \cos (st) \end{align}

By direct substitution we have that:

(7)
\begin{align} \quad f(x, y, z) = x^2ye^z = (s^2t)^2(st^2)e^{\sin (st)} = s^5t^4e^{\sin (st)} = f(s, t) \end{align}

Therefore we have that:

(8)
\begin{align} \quad \frac{\partial f}{\partial s} &= t^4(5s^4 e^{\sin (st)} + s^5 e^{\sin (st)} \cdot t \cos (st)) \\ &= 5s^4t^4 e^{\sin (st)} + s^5t^5 e^{\sin (st)} \cos (st) \end{align}