Chain Rule

Related Calculator: Online Derivative Calculator with Steps

Now let's see how to differentiate composite functions.

Suppose that we are given function `h(x)=f(g(x))`. Remembering that `g'(x)` is rate of change of `g(x)` with respect to `x` and `f'(g(x))` is rate of change of `f` with respect to `g(x)` then it is reasonable to suggest that rate of change of `f` with respect to `x` is product of `f'(g(x))` and `g'(x)`.

Indeed, if `g` changes twice as fast as `x` and `f` changes three times as fast as `g`, then `f` changes six times as fast as `x`.

Chain Rule. If `f` and `g` are both differentiable and `h=f@g` is the composite function defined by `h(x)=f(g(x))`, then `h` is differentiable and `h'(x)=f'(g(x))g'(x)`.

Proof. Recall that if `y=f(x)` and `x` changes from `a` to `a+Delta x` then increment of `y` is `Delta y=f(a+Delta x)-f(a)` . According to the definition of derivative `lim_(Delta x->0)(Delta y)/(Delta x)=f'(a)`.

So if we denote by `epsi` the difference between the difference quotient and the derivative, we obtain `lim_(Delta x->0)epsi=lim_(Delta x->0)((Delta y)/(Delta x)-f'(a))=f'(a)-f'(a)=0`.

But `epsi=(Delta y)/(Delta x)-f'(a)` or `Delta y=f'(a)Delta x+epsi Delta x`.

Thus, for any differentiable function `f`, `Delta y=f'(a) Delta x+epsi Delta x` where `epsi->0` as `Delta x->0`.

Now, suppose `u=g(x)` is differentiable at `a` and `y=f(u)` is differentiable at `b=g(a)`. If `Delta x` is an increment in `x` and `Delta u` and `Delta y` are the corresponding increments in `u` and `y` then

`Delta u=g'(a)Delta x+epsi_1 Delta x=(g'(a)+epsi_1)Delta x` where `epsi_1->0` as `Delta x->0`

`Delta y=f'(b)Delta u+epsi_2 Delta u=(f'(b)+epsi_2)Delta u` where `epsi_2->0` as `Delta u->0`

Now substitute expression for `Delta u` in the last equation:

`Delta y=(f'(b)+epsi_2)(g'(a)+epsi_1)Delta x`


`(Delta y)/(Delta x)=(f'(b)+epsi_2)(g'(a)+epsi_1)`

As `Delta x->0` then`Delta u->0`. So, both `epsi_1->0` and `epsi_2->0` as `Delta x->0` .

Therefore, `(dy)/(dx)=lim_(Delta x->0)((f'(b)+epsi_2)(g'(a)+epsi_1))=f'(b)g'(a)=f'(g(a))g'(a)`.

In Leibniz notation, if `y=f(u)` and `u=g(x)` are both differentiable then `(dy)/(dx)=(dy)/(du)(du)/(dx)`.

In Leibniz notation it is especially easy to remember chain rule because if `(dy)/(du)` and `(du)/(dx)` were quotients, then we could cancel `du`. Remember, however, that `du` has not been defined and `(du)/(dx)` should not be thought of as an actual quotient.

Example 1. Find derivative of `h(x)=sqrt(x^2+1)`

Here `f(u)=sqrt(u)` and `g(x)=x^2+1` and `h(x)=f(g(x))`, therefore

`f'(u)=(sqrt(u))'=1/(2sqrt(u))` and `g'(x)=(x^2+1)'=2x`.

So, `h'(x)=f'(g(x))g'(x)=f'(sqrt(x^2+1))2x=1/(2sqrt(x^2+1))2x=x/(sqrt(x^2+1))`.

In using the Chain Rule we work from the outside to the inside. We differentiate the outer function [at the inner function g(x)] and then we
multiply by the derivative of the inner function.

Example 2. Differentiate `y=cos(x^3)` and `y=(cos(x))^3` .

If `y=cos(x^3)` then outer function is cosine and inner is cubic function, so `y'=-sin(x^3)*(x^3)'=-3x^2sin(x^3)` .

If `y=(cos(x))^3` then outer function is cubic and inner is cosine, so `y'=3(cos(x))^2*(cos(x))'=-3(cos(x))^2sin(x)`.

Example 3. Differentiate `y=(x^2+1)^7`


Example 4. Differentiate `y=((2t+3)/(t-5))^8`

Here we use chain rule and quotient rule.

`y'=8((2t+3)/(t-5))^(8-1)*((2t+3)/(t-5))'=8((2t+3)/(t-5))^7 ((2t+3)'(t-5)-(2t+3)(t-5)')/(t-5)^2=`

`=8((2t+3)/(t-5))^7 (2(t-5)-(2t+3))/(t-5)^2=8((2t+3)/(t-5))^7 (-13)/(t-5)^2=-104 ((2t+3)^7)/((t-5)^9)`.

Example 5. Find derivative of `f(x)=(3x^2+4x+1)^5(e^x+sin(x))^2`.

We need to use product rule together with chain rule.


`=5(3x^2+4x+1)^4*(3x^2+4x+1)'(e^x+sin(x))^2+(3x^2+4x+1)^5 2(e^x+sin(x))(e^x+sin(x))'=`

`=5(3x^2+4x+1)^4*(6x+4)(e^x+sin(x))^2+(3x^2+4x+1)^5 2(e^x+sin(x))(e^x+cos(x))=`


Now let's see how to use chain rule more than once.

Example 6. Differentiate `f(t)=e^(cos(2t))`.

We apply chain rule twice.


Example 7. Differentiate `f(x)=cos(sin(tan(x)))`

Here we again apply chain rule twice.



In general we can apply chain rule even more than two times. We need to use it as many times as we need.