# The Chain Rule

### Summary

• Chain rule lets us differentiate a function of a function i.e  $f(g\left( x \right) )$
• Chain rule can be applied through two different equations:

$\frac { d }{ dx } \left[ f(g\left( x \right) ) \right] \quad =\quad f^{ ' }\left( g\left( x \right) \right) \quad \times \quad g^{ ' }\left( x \right)$

AND

$\frac { dy }{ dx } \quad =\quad \frac { dy }{ du } \quad \times \quad \frac { du }{ dx }$

#### What is the chain rule?

One of the rules of differentiation is the chain rule, which basically lets us differentiate a function of a function in other words differentiation of composite functions.

Let’s suppose we have a function y which is formed by two different functions f(x) and g(x) i.e  $f(g\left( x \right) )$f(x) is said to be the outer function and g(x) is the inside function.

You will be able to understand this better when we go through an example.

#### Example #1

Let   $y\quad =\quad { (2x\quad +\quad 3{ x }^{ 3 }) }^{ 8 }$

We can see that in this case the outer function f(x) is  ${ x }^{ 8 }$  and the inside function g(x) is  $2x\quad +\quad 3{ x }^{ 3 }$.

When we put g(x) inside the expression of f(x) , like  $f{ (2x\quad +\quad 3{ x }^{ 3 }) }$  we get:

$f(g\left( x \right) )\quad =\quad y\quad =\quad { (2x\quad +\quad 3{ x }^{ 3 }) }^{ 8 }$

#### Example #2

$y\quad =\quad { cos^{ 4 }(x) }$

As  ${ cos^{ 4 }(x) }$  is actually ${ (cos(x)) }^{ 4 }$

Therefore:

$f\left( x \right) \quad =\quad { x^{ 4 } }$

$g\left( x \right) \quad =\quad cos(x)$

Hence:

$f(g\left( x \right) )\quad =\quad f(cos(x))$

$=\quad { cos^{ 4 }(x) }$

Now that we have understood what it means by a ”function of a function” or composite function, we can move on to the chain rule technique.

If we are able to differentiate function g with respect to x and we are able to differentiate function f with respect to g(x), then the composite function  $f(g\left( x \right) )$  is differentiable and we can use the chain rule technique to find its derivative.

The chain rule formula is defined as:

$\frac { d }{ dx } \left[ f(g\left( x \right) ) \right] \quad =\quad f^{ ' }\left( g\left( x \right) \right) \quad \times \quad g^{ ' }\left( x \right) \quad \rightarrow \quad eq\quad 1$

Where g'(x) is the derivative of the function g(x),
and  $f^{ ' }\left( g\left( x \right) \right)$  is the derivative of the function  $f(g\left( x \right) )$.

The following three steps explains how the formula is applied:

i) Differentiate the outside function f(x)
ii) Leave the inside function g(x) alone
iii) Multiply by the derivative of the inside function g(x)

There is also another way to apply the chain rule:

to find the derivative of  $y\quad =\quad f(g\left( x \right) )$  we take g(x) and substitute it as u i.e:

Let u = g(x)

Therefore now y = f(u).

Hence, to find  $\frac { dy }{ dx }$  we can apply chain rule formula  $\frac { d }{ dx } \left[ f(g\left( x \right) ) \right] \quad =\quad f^{ ' }\left( g\left( x \right) \right) \quad \times \quad g^{ ' }\left( x \right)$  in a way that it becomes:

$\frac { dy }{ dx } \quad =\quad \frac { dy }{ du } \quad \times \quad \frac { du }{ dx } \quad \rightarrow \quad eq\quad 2$

After we go through a few examples using both the formulas, you can choose which one you find easy to apply.

#### Example #3

Q. Find the derivative of $y\quad =\quad cos{ (x) }^{ 2 }$

We know f(x) = cos(x)
$g\left( x \right) \quad =\quad { x^{ 2 } }$

Using equation 1 here:

$\frac { d }{ dx } \left[ f(g\left( x \right) ) \right] \quad =\quad f^{ ' }\left( g\left( x \right) \right) \quad \times \quad g^{ ' }\left( x \right)$

i) f'(x) = -sin(x)

ii) $g\left( x \right) \quad =\quad { x^{ 2 } }$

iii) g'(x) = 2x

Put the above values in the equation:

$\frac { d }{ dx } \left[ f(g\left( x \right) ) \right] \quad =\quad f^{ ' }\left( { x^{ 2 } } \right) \quad \times \quad g^{ ' }\left( x \right)$

$=\quad -sin({ x^{ 2 } })\quad \times \quad 2x$

Ans:      $=\quad -2xsin({ x^{ 2 } })$

#### Example #4

Q. Now solve the same question using equation 2

As  $y\quad =\quad cos{ (x) }^{ 2 }$

Let $u\quad =\quad x^{ 2 }$

Therefore:

y = cos u

Use equation 2:

$\frac { dy }{ dx } \quad =\quad \frac { dy }{ du } \quad \times \quad \frac { du }{ dx }$

To find  $\frac { dy }{ dx }$  we first find the following two:

$\frac { dy }{ du } \quad =\quad -sin\quad u$  and  $\frac { du }{ dx } \quad =\quad 2x$

Substitute the values in the equation:

$\frac { dy }{ dx } \quad =\quad -sin\quad u\quad \times \quad 2x$

$=\quad -2xsin\quad u$   substitute  $u\quad =\quad x^{ 2 }$

$=\quad -2xsin(x^{ 2 })\quad$

Hence, this shows we reach the same answer using both the equations, so now you can decide which one is easier for you.