If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

# Chain rule

AP.CALC:
FUN‑3 (EU)
,
FUN‑3.C (LO)
,
FUN‑3.C.1 (EK)
The chain rule states that the derivative of f(g(x)) is f'(g(x))⋅g'(x). In other words, it helps us differentiate *composite functions*. For example, sin(x²) is a composite function because it can be constructed as f(g(x)) for f(x)=sin(x) and g(x)=x². Using the chain rule and the derivatives of sin(x) and x², we can then find the derivative of sin(x²). Created by Sal Khan.

## Want to join the conversation?

• What is the standard formula or the chain rule?
• sal says it at the start of the next video
• Can anyone please help me undrrstand how there are two functions in y=sin x^2 but one in y=2x^2+3x?....really getting confused..
thank you
• The function in the video is y = (sin x)² [more commonly written as y = sin² x]. I think of this as square(sin(x)), that is, a square function of a sine function of x.

Think of y = 2x² + 3x as y = f(x) + g(x) where f(x) is 2x² and g(x) is 3x. The functions of x are not being composed/chained as above (so the chain rule doesn't apply), and they are not being multiplied (so the product rule doesn't apply). They're simply being added. In this situation, the derivative of a sum is the sum of the derivatives, and each function of x is so simple that we can apply the power rule to each term.

* thanks to John Kollar for pointing out how my answer could be clarified.
• At , Sal says that we can't cancel d(sinx) . Why is that so ?
• Treating differentials as regular numbers is in some cases useful, but it is not entirely correct. In some cases, it can simply confuse you.
If it helps you to remember the chain rule, you can think of the canceling of the differentials. However, do not make the mistake of thinking that is actually what is happening.
• Why is it called the Chain rule ?
• When functions are composed, they operate as if they were in a chain: the input goes into the first function which spits out an output that becomes the input to the next function which spits out an output that may become the input of a third function and so on. We don't necessarily see this immediately from the way the function is written, but that's the way a compound function operates. So if our function is sin^2(x + pi), we feed the input (x) into the first function which increases it by pi and hands it over to the next function which finds the sine and hands that result over to the next function which squares it.
• Near , 2sin(x)cos(x) is equal to sin(2x). Is there any deeper meaning to this?
• can u give some sort of logic behind chain rule on a graph ?? we learnt about basic differentiation using graph, why is it that chain rule is stated here and in my textbook as a fact ?
• Hmm... very interesting question...

When you apply the chain rule, you're taking into account how the slope of the function is behaving by the influence of the internal variables... for example...

Say f(x) = (2x+1)^2
then, f'(x) = 2(2x+1)(2) = 4(2x+1) = 8x+4

If you graph (2x+1)^2 you will see that it is a parabola... then, if you graph 8x+4 on the same sheet of graphing paper... you will see something very interesting...

Towards the top of of the parabola on the left side, it almost looks like a straight line... and we know the derivative is decreasing... on the same x-value for the derivative... we see that the x-value produces an incredibly negative y-value, which is the slope of the function f(x) at the x-value of interest (sometimes called a)... Even when the slope of f(x) is 0 at x = -2, we see the graph of the derivative crosses the x-axis at x = -2...

A lot of this has to do with looking at a graphs of a function and their derivatives on the same graphing sheet. That's the only time you will make sense of it all.

In sum, basically, the chain rule takes into consideration of how the functions within a function determine the function's slope at some input.

Hope that helps... You may want to review some of Sal's videos on derivatives - especially the ones where he graphs the derivatives intuitively. They seem to get the point across very efficiently.

Happy learning =)
• Okay, so I sort of understand how we have to go through the function by layers. It's like we unzip it. But I don't understand why we multiply the different layers once we've taken it apart. In the video's example, at we get h'(x)=2sinx * cosx. Why isn't it h'(x)= 2cosx? When we solve for the inner function, why doesn't our answer replace the sinx in the final answer?
• Consider what is the derivative of 2sinx? The answer is 2cosx, and if that's the derivative of 2sinx we shouldn't expect it to also be the derivative of (sinx)^2.

Why do we multiply when applying the chain rule? Derivatives are rates of change, which means they're essentially multipliers. For example, the derivative of x^2 is 2x, which means at any point on the curve, y is growing at a rate of two times x. If we apply another function to that function, we have another multiplier applied to the first one. That's the essence of why the chain rule works the way it does.
• what is the derivative of a complex number
• Since a complex number in itself is a constant, its derivative is zero. Did you mean to ask about the differentiation of complex-valued functions defined on subsets of the complex plane? Such functions may (sometimes) be differentiated. Let `C` denote the set of complex numbers, and suppose `U` is some subset of `C`. Suppose further that `ƒ: U → C` is a complex-valued function defined on `U`, and suppose `w` is an interior point of `U`. If the limit

`lim (z → w) [ƒ(z) - ƒ(w)] / [z - w]`

exists, we say that `ƒ` is (complex) differentiable at `w`, and we denote the value of this limit by `ƒ'(w)`. If `U` is open, and if `ƒ` is differentiable at every point of `U`, we say that `ƒ` is differentiable on `U`. If `ƒ` is differentiable on an open set `U`, one also says that `ƒ` is holomorphic on `U`, or sometimes that `ƒ` is analytic on `U`. Holomorphic functions are central in the theory of complex functions.

More specifically, to say that `ƒ: U → C` is differentiable at an interior point `w` in `U` means the following: there exists some complex number `L` such that for every real number `ε > 0` there exists a real number `δ > 0` with the property that for all complex numbers `z` in `U` with `0 < |z - w| < δ`, we have `|[ƒ(z) - ƒ(w)]/[z - w] - L| < ε`. If such a number `L` exists, we usually denote it by `ƒ'(w)`. This property may also be cast in terms of convergent sequences in `U`.

The process of differentiation of complex-valued functions defined on subsets of the complex plane shares many properties with differentiation of real-valued functions defined on subsets of the real numbers. For instance, the differentiation operator is linear. Furthermore, the product rule, the quotient rule, and the chain rule all hold for such complex functions.

As an example, consider the function `ƒ: C → C` defined by `ƒ(z) = (1 - 3𝑖)z - 2`. It can be shown that `ƒ` is holomorphic, and that `ƒ'(z) = 1 - 3𝑖` for every complex number `z`.
• Hello.... I have a question that I am unable to solve.....
the question is to differentiate cos x^3 . sin^2*(x^5) w.r.t x
• Did you mean d/dx{cos(x³) * sin²(x⁵)}?
If so, this is a bit of a tricky one. Here's how to do it:
Step 1: Use the power rule.
d/dx{cos(x³) * sin²(x⁵)}
= cos(x³)d/dx{sin²(x⁵)} + sin²(x⁵)d/dx{cos(x³)}

Step 2: Now we have the sum of two derivatives. So, we will find d/dx{sin²(x⁵)} and d/dx{cos(x³)} separately and then plug in the results to cos(x³)d/dx{sin²(x⁵)} + sin²(x⁵)d/dx{cos(x³)}

Step 2a:First, let us do d/dx{sin²(x⁵)}
We need to use the chain rule twice:
d/dx{sin²(x⁵)}
= 2sin(x⁵) d/dx(sin(x⁵))
= 2 sin(x⁵)cos(x⁵) d/dx(x⁵)
= 2 cos(x⁵) sin(x⁵)[5x⁴]
Simplify:
= 10 x⁴ cos(x⁵) sin(x⁵)

Step 2b: Now let us do d/dx{cos(x³)}
We use the chain rule:
d/dx{cos(x³)}
=- sin(x³) d/dx(x³)
=- sin(x³)[3x²]
= -3x²sin(x³)

Step 3: Now let us plug the derivatives we found in steps 2a and 2b into
cos(x³)d/dx{sin²(x⁵)} + sin²(x⁵)d/dx{cos(x³)}
=cos(x³)[10 x⁴ cos(x⁵) sin(x⁵)] + sin²(x⁵)d/dx{cos(x³)}
=cos(x³)[10 x⁴ cos(x⁵) sin(x⁵)] + sin²(x⁵)[-3x²sin(x³)]
Simplify.
=10 x⁴ cos(x³) cos(x⁵) sin(x⁵) -3x²sin²(x⁵) sin(x³)