Mục lục bài viết

## Chain Rule

We’ve taken a lot of derivatives over the course of the last few sections. However, if you look back they have all been functions similar to the following kinds of functions.

R(z)=√z

f(t)=t^{50}

y=tan(x)

h(w)=e^{w}

g(x)=lnx

These are all fairly simple functions in that wherever the variable appears it is by itself. What about functions like the following,

None of our rules will work on these functions and yet some of these functions are closer to the derivatives that we’re liable to run into than the functions in the first set.

Let’s take the first one for example. Back in the section on the definition of the derivative we actually used the definition to compute this derivative. In that section we found that,

If we were to just use the power rule on this we would get,

which is not the derivative that we computed using the definition. It is close, but it’s not the same. So, the power rule alone simply won’t work to get the derivative here.

Let’s keep looking at this function and note that if we define,

then we can write the function as a composition.

and it turns out that it’s actually fairly simple to differentiate a function composition using the **Chain Rule**. There are two forms of the chain rule. Here they are.

**Chain Rule**

Suppose that we have two functions f(x) and g(x) and they are both differentiable.

If we define F(x)=(f∘g)(x) then the derivative of F(x) is,

F′(x)=f′(g(x)) g′(x)

If we have y=f(u) and u=g(x) then the derivative of y is,

Each of these forms have their uses, however we will work mostly with the first form in this class. To see the proof of the Chain Rule see the Proof of Various Derivative Formulas section of the Extras chapter.

Now, let’s go back and use the Chain Rule on the function that we used when we opened this section.

** Example 1** Use the Chain Rule to differentiate

*Solution*

We’ve already identified the two functions that we needed for the composition, but let’s write them back down anyway and take their derivatives.

So, using the chain rule we get,

And this is what we got using the definition of the derivative.

In general, we don’t really do all the composition stuff in using the Chain Rule. That can get a little complicated and in fact obscures the fact that there is a quick and easy way of remembering the chain rule that doesn’t require us to think in terms of function composition.

Let’s take the function from the previous example and rewrite it slightly.

This function has an “inside function” and an “outside function”. The outside function is the square root or the exponent of 1212 depending on how you want to think of it and the inside function is the stuff that we’re taking the square root of or raising to the 1212, again depending on how you want to look at it.

The derivative is then,

In general, this is how we think of the chain rule. We identify the “inside function” and the “outside function”. We then differentiate the outside function leaving the inside function alone and multiply all of this by the derivative of the inside function. In its general form this is,

We can always identify the “outside function” in the examples below by asking ourselves how we would evaluate the function. For instance in the R(z) case if we were to ask ourselves what R(2) is we would first evaluate the stuff under the radical and then finally take the square root of this result. The square root is the last operation that we perform in the evaluation and this is also the outside function. The outside function will always be the last operation you would perform if you were going to evaluate the function.

Let’s take a look at some examples of the Chain Rule.

** Example 2** Differentiate each of the following.

**Solutions**

There are a couple of general formulas that we can get for some special cases of the chain rule. Let’s take a quick look at those.

** Example 3** Differentiate each of the following.

**a** The outside function is the exponent and the inside is g(x).

**b** The outside function is the exponential function and the inside is g(x).

**c** The outside function is the logarithm and the inside is g(x).

The formulas in this example are really just special cases of the Chain Rule but may be useful to remember in order to quickly do some of these derivatives.

Now, let’s also not forget the other rules that we’ve got for doing derivatives. For the most part we’ll not be explicitly identifying the inside and outside functions for the remainder of the problems in this section. We will be assuming that you can see our choices based on the previous examples and the work that we have shown.

** Example 4** Differentiate each of the following.

**Solutions**

There were several points in the last example. First is to not forget that we’ve still got other derivatives rules that are still needed on occasion. Just because we now have the chain rule does not mean that the product and quotient rule will no longer be needed.

In addition, as the last example illustrated, the order in which they are done will vary as well. Some problems will be product or quotient rule problems that involve the chain rule. Other problems however, will first require the use the chain rule and in the process of doing that we’ll need to use the product and/or quotient rule.

Most of the examples in this section won’t involve the product or quotient rule to make the problems a little shorter. However, in practice they will often be in the same problem so you need to be prepared for these kinds of problems.

Now, let’s take a look at some more complicated examples.

** Example 5** Differentiate each of the following.

**Solutions**

Sometimes these can get quite unpleasant and require many applications of the chain rule. Initially, in these cases it’s usually best to be careful as we did in this previous set of examples and write out a couple of extra steps rather than trying to do it all in one step in your head. Once you get better at the chain rule you’ll find that you can do these fairly quickly in your head.

Finally, before we move onto the next section there is one more issue that we need to address. In the Derivatives of Exponential and Logarithm Functions section we claimed that,

but at the time we didn’t have the knowledge to do this. We now do. What we needed was the chain rule.

First, notice that using a property of logarithms we can write a as,

This may seem kind of silly, but it is needed to compute the derivative. Now, using this we can write the function as,

Okay, now that we’ve gotten that taken care of all we need to remember is that a is a constant and so lnaln is also a constant. Now, differentiating the final version of this function is a (hopefully) fairly simple Chain Rule problem.

Now, all we need to do is rewrite the first term back as a^{x} to get,

So, not too bad if you can see the trick to rewriting the a and with using the Chain Rule.

## Chain Rule And Composite Functions

In differential calculus, the **chain rule** is a formula used to find the derivative of a composite function. If y = f(g(x)), then as per chain rule the instantaneous rate of change of function ‘f’ relative to ‘g’ and ‘g’ relative to x results in an instantaneous rate of change of ‘f’ with respect to ‘x’. Hence, the derivative of y will be given as, y’ = f'(g(x)).g'(x). Chain rule is one of the important rules in differentiation. In this article, we will learn the chain rule formula with solved examples.

## What is Chain Rule?

The rule applied for finding the derivative of the composite function (e.g. cos 2x, log 2x, etc.) is basically known as the chain rule. It is also called the composite function rule. The chain rule is applicable only for composite functions. So before starting the formula of the chain rule, let us understand the meaning of composite function and how it can be differentiated.

## Chain Rule Formula

The formula of chain rule for the function y = f(x), where f(x) is a composite function such that x = g(t), is given as:

This is the standard form of **chain rule of differentiation** formula.

Another formula of chain rule is represented by:

y’ = d/dx ( f(g(x) ) = f’ (g(x)) · g’ (x)

### Composite Function For Chain Rule

A composite function is denoted as:

(fog)(x) = f(g(x))

Suppose f(x) and g(x) are two differentiable functions such that the derivative of a composite function f(g(x)) can be expressed as

(fog)′ = (f′o g) × g′

This can be understood in a better way from the example given below:

Consider f(x) = e^{x2 + 4} and g(x) = x^{2} + 4

Therefore, f'(x) = 2x e^{x2} and g'(x) = 2x

Now, the derivative of composite function of f(x) and g(x) can be written as:

(fog)′ = (f′o g) × g′

Let g(x) = k then f(x) = e^{k} {where k = x^{2} + 4}

⇒ (f′o g) = e^{k} and g′ = 2x

⇒(fog)′ = e^{k} × 2x = e^{x2 + 4} × 2x

### Chain Rule in Differentiation

Let f represent a real valued function which is a composition of two functions u and v such that:

f = v(u(x))

Let us assume u(x) = t

Now if the functions u and v are differentiable and dt/dx and dv/dt exist, then the composite function f(x) is also differentiable. This can be done as given below.

Using Leibnitz notation, we can express the differentiation of the above function as

df/dx = (dv/dt) × (dt/dx)

As the name suggests, chain rule means differentiating the terms one by one in a chain form, starting from the outermost function to the innermost function. In layman terms, to differentiate a composite function at any point in its domain, first differentiate the outer part (i.e. the function enclosing some other function) and then multiply it with the inner function’s derivative function. This will provide us with the desired differentiation.

## Chain Rule for Partial Derivatives

The chain rule for total derivatives implies a chain rule for partial derivatives. We know that the partial derivative in the ith coordinate direction can be evaluated by multiplying the ith basis vector’s Jacobian matrix when the total derivative exists. Hence, the chain rule for the function y = f(u) = (f_{1}(u), …, f_{k}(u)) and u = g(x) = (g_{1}(x), …, g_{m}(x)) can be written for partial derivatives as:

## Chain Rule Solved Examples

**Example 1: **

Find the derivative of the function f(x) = sin(2x^{2} – 6x).

**Solution: **

The given can be expressed as a composite function as given below:

f(x) = sin(2x^{2} – 6x)

u(x) =2x^{2} – 6x

v(t) = sin t

Thus, t = u(x) = 2x^{2} – 6x

⇒f(x) = v(u(x))

According to the chain rule,

df(x)/dx = (dv/dt) × (dt/dx)

Where,

dv/dt = d/dt (sin t) = cos t

dt/dx = d/dx [u(x)] = d/dx (2x^{2} – 6x) = 4x – 6

Therefore, df/dx = cos t × (4x – 6)

= cos(2x^{2} – 6x) × (4x – 6)

= (4x – 6) cos(2x^{2} – 6x)

**Example 2:**

**Solution:**

Given,

It is a composition of three functions such as:

p(s) = sin s, q(t) = e^{t} and r(x) = x^{3}

Thus, f(x) = p(q(r(x)))

That means, t = x^{3} and s = e^{x3}

Using chain rule formula,

df/dx = (dp/ds) × (ds/dt) × (dt/dx)

= [d/ds (sin s)] × [d/dt (e^{t})] × [d/dx (x^{3})]

= cos s × e^{t} × 3x^{2}

**Example 3:**

**Solution:**

Given,

The given function represents a composition of functions where

## Chain Rule Practice Problems

Practice the question given below:

- Find the derivative of the function y = cos
^{2}(x^{4}) - Using chain rule, find the derivative of y = sin
^{4}x + sin x^{4} - Find the derivative of y = 2 ln[ln(ln sec x)]

### Chain Rule Steps

- Step 1: Identify The Chain Rule: The function must be a composite function, which means one function is nested over the other.
- Step 2: Identify the inner function and the outer function.
- Step 3: Find the derivative of the outer function, leaving the inner function.
- Step 4: Find the derivative of the inner function.
- Step 5: Multiply the results from step 4 and step 5.
- Step 6: Simplify the chain rule derivative.

For example: Consider a function: g(x) = ln(sin x)

- g is a composite function. So apply the chain rule.
- sin x is the inner function and ln(x) is the outer function.
- The derivative of the outer function is 1/sin x.
- The derivative of the inner function is cos x.
- Finally g'(x) = derivative of the outside function, leaving the inside alone × the derivative of the inside function = 1/sin x × cos x
- On simplifying we get, cos x/sin x = cot x

## Chain Rule Formula and Proof

There are two forms of chain rule formula as shown below.

### Chain Rule Formula 1:

d/dx ( f(g(x) ) = f’ (g(x)) · g’ (x)

**Example :** To find the derivative of d/dx (sin 2x), express sin 2x = f(g(x)), where f(x) = sin x and g(x) = 2x.

Then by the chain rule formula,

d/dx (sin 2x) = cos 2x · 2 = 2 cos 2x

### Chain Rule Formula 2:

We can assume the expression that is replacing “x” with “u” and applying the chain rule formula.

dy/dx = dy/du · du/dx

**Example : **To find d/dx (sin 2x), assume that y = sin 2x and 2x = u. Then y = sin u.

By the chain rule formula,

d/dx (sin 2x) = d/du (sin u) · d/dx(2x) = cos u · 2 = 2 cos u = 2 cos 2x

### Chain Rule formula Proof

If y = f(g(x)) = (fog)x, then d/dx ((f(g(x)) = f'(g(x))g'(x)

Proof: Now Δu = g(x+Δx) -g(x)

Therefore Δy/Δx = Δy/ Δu × Δu/Δx

As Δx → 0, Δu → 0

Thus lim_{Δx→0} Δy/Δx

= lim_{Δx→0 }(Δy/Δu × Δy/Δux)

= f'(u) × u'(x)

= f'(g(x)) g'(x)

Thus lim_{Δx→0} Δy/Δx = f'(g(x)) g'(x)

## Double Chain Rule

There could be nested functions one over the other, where the functions depend on more than one variable. The chain of smaller derivatives is multiplied together to get the overall derivative. Let there be 3 functions: u, v, w. A function f is a composite of u, v, and w. The chain rule is extended here. If a function is a composition of 3 functions, we apply the chain rule twice. When f = (u o v) o w = df/dx = df/du. du/dv. dv/dw. dw/dx

**Example 1:** y = (1+ cos 2x)^{2}

y’ = 2( 1+ cos 2x) . (-sin 2x). (2)

= – 4(1+ cos 2x) . sin2x

**Example 2: **y **= **sin (cos (x^{2}))

y’ = cos(cos (x^{2})). -sin (x^{2})). 2x

= -2x sin (x^{2}) cos (cos x^{2})

**Note: **We do not need to remember the chain rule formula. Instead, we can just apply the derivative formulas (which are in terms of x) and then multiply the result by the derivative of the expression that is replacing x.

For example, d/dx ( (x^{2 }+ 1)^{3}) = 3 (x^{2} + 1)^{2} · d/dx (x^{2} + 1) = 3 (x^{2} + 1)^{2} · 2x = 6x (x^{2} + 1)^{2}.

## Applications of The Chain Rule

This chain rule has broad applications in the fields of physics, chemistry, and engineering. We apply the chain rule:

- To find the time rate of change of the pressure,
- To calculate the rate of change of distance between two moving objects,
- To find the position of an object that is moving to the right and left in a particular interval,
- To determine if a function is increasing or decreasing,
- To find the rate of change of the average molecular speed,

Let us apply the chain rule to find the equation of the tangent line to the given function y = (5 x^{4} – 2)^{3 }at x = 1.

We know that the derivative of the function gives the slope of the line at the given point.

y’ = 3 (5 x^{4} – 2) ^{2 }× 20 x^{3}

= 60 x^{3 }(5 x^{4} – 2) ^{2}

y’ at x =1 gives 60(3)^{2} = 540

We need to evaluate the function and the derivative at the given point

y = ((5 (1)^{4} – 2)^{3 }= 3^{3 }= 27

Therefore the equation of the tangent line in the slope-intercept form is y = mx+ b ⇒ 27 = 540x + b

We need to find the equation of the tangent line.

Hence substitute (1,27) in the equation of the tangent line, y = 540x + b, we get

27 = 540(1) + b ⇒ b = -513

Thus the equation of the tangent line to the given function y = (5 x^{4} – 2)^{3 }applying the chain rule formula is y = 540x – 513

## Examples Using Chain Rule

**Example 1: **Find the derivative of y= ln √x using the chain rule.

**Solution:**y = ln √x.f(x) = y is a composition of the functions ln(x) and √x, and therefore we can differentiate it using the chain rule.Assume that u = √x. Then y = ln u.By the chain rule formula,dy/dx = dy/du · du/dxdy/dx = d/du (ln u) · d/dx (√x)dy/dx = (1/u) · (1/(2√x))dy/dx = (1/√x) . (1/(2√x))dy/dx = 1/(2x) (because u = 1/(2√x)).y = cos (2x^{2} + 1).

**Answer**: dy/dx = 1/(2x)

**Example 2: **A point A is moving along the curve whose equation is y = √(x^{3 }+ 56). When A is at (2,8), y is increasing at the rate of 2 units per second. How fast is x changing? (Hint: Use the chain rule.)To find: dx/dtGiven y = √(x^{3 }+ 56) and dy/dt = 2 units / secdy/dx = (1/2)(x^{3 }+ 56)^{-1/2 }(3x^{2})=[(3/2) x^{2 }] / (x^{3 }+ 56)^{1/2}Applying the chain rule, dx/dt = dx/dy . dy/dtGiven dy/dx at x = 2dy/dx at x = 2is [3(4)]/2√64dy/dx =3/4dx/dy = 4/3Thus dx/dt = 4/3 × 2 = 8/3

**Answer: x is changing at the rate of 8/3 units per second.**

**Example 3: **Find the derivative of the function y = cos (2x^{2} + 1) using the chain rule.

**Solution:**Assume that u = 2x^{2} + 1. Then y = cos u.By the chain rule formula,dy/dx = dy/du · du/dxdy/dx = d/du (cos u) · d/dx (2x^{2} + 1)dy/dx = – sin u · 4xdy/dx = -4x sin (2x^{2} + 1) (because u = 2x^{2} + 1).

**Answer**: The derivative of the given function is, dy/dx = -4x sin (2x^{2} + 1).

## FAQs on Chain Rule

### What Is Chain Rule?

The chain rule is used to find the derivative of a composite function. If there exists a function f of g which in turn is a function of u(x), then the instantaneous change in f with respect to x is given as change in f/ change in x = change in g /change in u × change in u /change in x. If y = f(g(x)), then y’ = f'(g(x)). g'(x)

### What Is Chain Rule Formula?

The chain rule formula is used to find the derivative of a composite function (i.e, when one function is inside the other). There are two forms of the chain rule formula.

- d/dx ( f(g(x) ) = f’ (g(x)) · g’ (x)
- dy/dx = dy/du · du/dx

### When To Use Chain Rule Formula?

Usually, all the derivative formulas are in terms of x, for example, d/dx (sin x) = cos x. When x here is replaced with something else here, say, d/dx(sin 3x) =? In such cases, we apply the chain rule formula which says d/dx ( f(g(x) ) = f’ (g(x)) · g’ (x). Using this, d/dx (sin 3x) = cos 3x · d/dx(3x) = cos 3x (3) = 3 cos 3x.

### What Are the Applications of Chain Rule Formula?

The chain rule formula is mainly used to find the derivative of a composite function (a function that is the combination of two or more functions). This chain rule has broad applications in physics, chemistry, and engineering. To find the time rate of change of the pressure, to calculate the rate of change of distance between two moving objects, to find the rate of change of the average molecular speed, we apply the chain rule.

### What Is the Difference Between Chain Rule Formula and Product Rule?

The chain rule formula is used to differentiate a composite function (a function where one function is inside the other), for example, ln (x^{2} + 2), whereas the product rule is used to find the derivative of the product of two functions, for example, ln x · (x^{2} + 2).

The chain rule formula is d/dx ( f(g(x) ) = f’ (g(x))·g’ (x), whereas the product rule formula is d/dx[f(x). g(x)] = f(x) g'(x)+ f'(x) g(x).

### What is The Use of Chain Rule?

We use the chain rule in the situations where we require to find the rate of change of a function that is dependent on another function, which is dependent on another function. Here the functions seem to be nested. We use the chain rule formula d/dx ( f(g(x) ) = f’ (g(x)) · g’ (x) and find the derivative.