The Chain Rule

You probably remember the derivatives of $\sin (x)$, $x^{8}$, and $e^{x}$. But what about functions like $\sin (2x-1)$, $(3x^{2}-4x+1)^{8}$, or $e^{-x^{2}}$? How do we take the derivative of compositions of functions? The Chain Rule allows us to use our knowledge of the derivatives of functions $f(x)$ and $g(x)$ to find the derivative of the composition $f(g(x))$:

 Suppose a function $g(x)$ is differentiable at $x$ and $f(x)$ is differentiable at $g(x)$. Then the composition $f(g(x))$ is differentiable at $x$. Letting $y=f(g(x))$ and $u=g(x)$, $$\frac{dy}{dx}=\frac{dy}{du}\cdot\frac{du}{dx}.$$ Using alternative notation, \begin{eqnarray*} \frac{d}{dx}\left[ f(g(x)) \right] & = & f'(g(x))g'(x), \\ \frac{d}{dx}\left[ f(u) \right] & = & f'(u)\frac{du}{dx}. \end{eqnarray*}

#### Proof

The three formulations of the Chain Rule given here are identical in meaning. In words, the derivative of $f(g(x))$ is the derivative of $f$, evaluated at $g(x)$, multiplied by the derivative of $g(x)$.

#### Examples

• To differentiate $\sin (2x-1)$, we identify $u=2x-1$. Then
\begin{eqnarray*} \frac{d}{dx}\left[ \sin(2x-1)\right] & = & \frac{d}{du} \left[ \sin (u) \right] \cdot \frac{d}{dx} \left[ 2x-1 \right] \\ & = & \cos (u) \cdot 2 \\ & = & 2 \cos (2x-1). \end{eqnarray*}  \begin{eqnarray*} f(x) & = & \sin (x) \\ g(x) & = & 2x-1 \\ f(g(x)) & = & \sin (2x-1) \end{eqnarray*}

• To differentiate $\left( 3x^{2} - 4x + 1 \right)^{8}$, we identify $u=3x^2-4x+1$. Then
\begin{eqnarray*} \frac{d}{dx} \left[\left( 3x^{2} - 4x + 1 \right)^{8}\right] & = & \frac{d}{du}\left[ u^8 \right] \cdot \frac{d}{dx}\left[ 3x^2-4x+1 \right] \\ & = & 8u^7 \cdot (6x-4) \\ & = & 8 (6x-4)\left( 3x^{2} - 4x + 1 \right)^{7}. \end{eqnarray*}  \begin{eqnarray*} f(x) & = & x^8 \\ g(x) & = & 3x^{2} - 4x + 1 \\ f(g(x)) & = & \left( 3x^{2} - 4x + 1 \right)^{8} \end{eqnarray*}

• To differentiate $e^{-x^{2}}$, we identify $u=-x^{2}$. Then
\begin{eqnarray*} \frac{d}{dx} \left[ e^{-x^{2}} \right] & = & \frac{d}{du}\left[ e^u \right] \cdot \frac{d}{dx}\left[ -x^2 \right] \\ & = & e^u \cdot (-2x) \\ & = & -2xe^{-x^2}. \end{eqnarray*}  \begin{eqnarray*} f(x) & = & e^x \\ g(x) & = & -x^2 \\ f(g(x)) & = & e^{-x^{2}} \end{eqnarray*}

Sometimes you will need to apply the Chain Rule several times in order to differentiate a function.

#### Example

We will differentiate $\sqrt{\sin^{2} (3x) + x}$. $$\begin{array}{rclc} \frac{d}{dx}\left[ \sqrt{\sin^{2} (3x) + x}\right] & = & \frac{1}{2\sqrt{\sin^{2} (3x) + x}} \cdot \frac{d}{dx}\left[ \sin^{2} (3x) + x \right] & f(u) = \sqrt{u}\\ & = & \frac{1}{2\sqrt{\sin^{2} (3x) + x}} \cdot \left( 2 \sin (3x) \frac{d}{dx} \left[ \sin (3x) \right] + 1 \right) & \begin{array}{rcl} f(u) & = & u^2 \\ \frac{d}{dx} [x] & = & 1 \end{array} \\ & = & \frac{1}{2\sqrt{\sin^{2} (3x) + x}} \cdot \left( 2 \sin (3x) \cos (3x) \frac{d}{dx} [3x] + 1 \right) & f(u) = \sin (u) \\ & = & \frac{1}{2\sqrt{\sin^{2} (3x) + x}} \cdot \left( 2 \sin (3x) \cos (3x) \cdot 3 + 1 \right) \\ & = & \displaystyle\frac{6 \sin (3x) \cos (3x) + 1}{2\sqrt{\sin^{2} (3x) + x}} \end{array}$$

### Key Concepts

Let $g(x)$ be differentiable at $x$ and $f(x)$ be differentiable at $f(g(x))$. Then, if $y=f(g(x))$ and $u=g(x)$, $$\frac{dy}{dx} = \frac{dy}{du}\cdot\frac{du}{dx}.$$