Image Source

 

This post will be about the chain rule. The chain rule was one of those topics that took a bit of time for me to understand when I was a younger math student. It is assumed that the reader knows about the product rule.

 

A Motivating Example

 

Consider a simple function such as \(f(x) = x^3\). The derivative would be simply \(f'(x) = 3x^2\).

But what if was expressed as \(f'(x) = 3x^2 * 1\)? Where did this 1 come from? Let’s try this:

 

\[f'(x) = 3x^2 \dfrac{d}{dx} x\]

 

The 1came from the derivative of x with respect to x.

So what did we do above? We took the derivative of \(x^3\) and then multiplied it by the derivative of \(x\).

 

The Chain Rule

 

Given a (continuous) function \(h(x) = f(g(x))\) where and \(f(x)\) and \(g(x)\) are different (continuous) functions. Then

 

\[\displaystyle h'(x) = f'( g(x) ) g'(x)\].

 

This means we take the derivative of the outside function \(f(g(x)\) and then take the derivative of the inside function \(g(x)\). It can be possible that the function inside \(g(x)\) can be a different function such as \(k(x)\) which is different from \(x\).

 

Examples

 

Example 1

 

The function \(x^3\) from earlier has \(g(x) = x\), \(f(x) = x^3\), \(f'(x) = 3x^2\) and \(g'(x) = 1\). The derivative of \(x^3\) is simply \(3x^2\).

 

Example 2

 

Consider the function \(h(x) = \sin(2x)\). The outside function is \(f(x) = \sin(x)\) with \(f'(x) = \cos(x)\). The inside function is \(g(x) = 2x\) with \(g'(x) = 2\).

By Chain Rule, the derivative \(h'(x)\) is \(2 \cos(2x)\).

 

Example 3 (Combining with Product Rule)

 

Suppose that we have \(h(x) = x e^{x^2}\). Through product rule and chain rule on the derivative of \(e^{x^2}\) gives:

 

\[\begin{array}{lcl} h'(x) & = & e^{x^2} + x \times e^{x^2} \times 2x \\ & = & e^{x^2} (1 + 2x^2) \\ \end{array}\]

 

Example 4 (Multiple Chain Rule)

 

There are cases when you may have to use multiple chain rules along with product rules, quotient rules and so on.

Consider \(h(x) = \cos((2x + 1)^2)\). The derivative \(h'(x)\) is:

 

\[\begin{array}{lcl} h'(x) & = & - \sin(x^2) \dfrac{d}{dx} (2x + 1)^{2} \\ & = & - \sin(x^2) \times 2(2x + 1) \times \dfrac{d}{dx} (2x + 1) \\ & = & -2 \sin(x^2) (2x + 1) \times 2\\ & = & -4 \sin(x^2) (2x + 1) \end{array}\]  

Tips for Learning Chain Rule

 

Take it one step at a time.

Identify the outside function(s) and inside function(s). Start from the outside to the inside.

Practice with the simple functions such as \(x\), \(\cos(x)\), \(\dfrac{1}{x}\) and so on.