The chain rule for compositions and the intuition that rates multiply along a chain, the power form for a function raised to a power, chains of three or more functions, combining the chain rule with the product and quotient rules, the Leibniz form and why it resembles cancellation, and the proof.
Subject: Calculus I · 67 slides · symbolic lesson
Open the interactive version of this deck
Title
Calculus I · Section 3.6
Differentiating a function of a function
Objectives
You can differentiate powers, sines, sums, products and quotients. You cannot yet differentiate sin of x cubed, or the square root of 3x squared plus 1, because each is one function fed into another. This lesson supplies the missing rule, and with it every function built from Chapter 1's families becomes differentiable.
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, pp. 250-258 — learning objectives 3.6.1 to 3.6.5
So far every derivative rule has handled one way of combining functions: adding them, multiplying them, dividing them. The most important way of combining functions has been missing, and it is the one used constantly in science and engineering: feeding the output of one function into another. A pendulum's position is a cosine of a multiple of time; a population model raises an expression to a power; a physics formula takes a square root of a sum of squares.
The chain rule handles every one of these with one idea: rates multiply along a chain. Once you have it, there is no function built from the families of Chapter 1 that you cannot differentiate.
The lesson follows the book's order. You will see where the rule comes from, use its most common special case, the power form, combine it with the rules you already know, stack it three layers deep, and finish with the proof and with Leibniz notation, the form physicists use.
Warm-up
Discussion prompt
You have the sum, product and quotient rules and the derivatives of sine and x cubed. Is sin(x³) a sum, a product or a quotient of those two functions? If not, describe precisely how it is built from them.
Write down your answer before revealing. The point of the question is to notice that sin of x cubed is not built from sine and x cubed by any operation you have a rule for.
It is tempting to see two functions and reach for the product rule, but sine times x cubed is a completely different function: at x equal to 2 it is about 7.27, while sin of 8 is about 0.99. Composition means one function is applied to the output of the other, and the order matters: the cube is computed first, then the sine is taken of the result.
Naming the inner function and the outer function like this is step one of every chain-rule problem in this lesson. If you can say which operation is applied last, you already know which rule to use first.
Section
Part 1
Concept
Figure (svg): Two boxes in a row: x goes into the first box, g, which cubes it, giving u equal to x cubed; u goes into the second box, f, which takes the sine, giving y equal to sin u. Underneath, the input 1.2 is traced through to 1.728 and then to 0.988.
\[ h(x) = (f \circ g)(x) = f\big(g(x)\big) \]
The book's two opening examples are both compositions: sin of x cubed, and the square root of 3x squared plus 1. In each, an inner function acts first and an outer function acts on its output.
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 250 — introduction
Picture a composition as two machines in a row. The input x goes into the first machine, which cubes it. Whatever comes out, call it u, goes into the second machine, which takes its sine. The final output is y.
Follow the yellow numbers underneath: 1.2 cubed is 1.728, and the sine of 1.728 is about 0.988. The outer machine never sees 1.2; it only sees 1.728. That is the fact behind the most important detail of the chain rule: the outer derivative will be evaluated at the inner output, not at x.
Get used to naming the layers out loud: inner function, the one applied first; outer function, the one applied last. The book writes the composite as f of g of x, with a small circle between f and g when it wants to name the composite function itself.
Intuition
Figure (svg): Three number lines drawn to the same scale. On the top line, x moves through an interval of length 1. Dashed lines carry it to the middle line, where u equal to 3x moves through length 3, and then to the bottom line, where y equal to 5u moves through length 15.
\[ \frac{dy}{dx} = \frac{dy}{du}\cdot\frac{du}{dx} = 5 \cdot 3 = 15 \]
If u moves three times as fast as x, and y moves five times as fast as u, then y moves fifteen times as fast as x. For straight lines this is plain arithmetic; the chain rule says the same holds for the instantaneous rates of curved functions.
Before any limits, look at the simplest possible chain: two straight lines. The top number line shows x moving through an interval of length one. The middle line shows u, equal to 3x, which moves through length three. The bottom line shows y, equal to 5u, which moves through length fifteen.
Each stage stretches whatever the previous stage hands it. The first stage stretches by three, and the second stage stretches that already-stretched interval by five, so the total stretch is fifteen. Stretches compound by multiplying, never by adding.
A derivative is exactly a local stretch factor: near a point, a differentiable function behaves like a straight line with slope equal to its derivative. So for curved functions the same thing happens locally, and the derivative of the composite is the product of the two local stretch factors. That is the whole chain rule, before any formula.
Prediction
A gearbox: the middle shaft turns 4 times for every turn of the input, and the output turns 2.5 times for every turn of the middle shaft.
Predict first
How many times does the output shaft turn for one turn of the input?
Correct: 10 times
Why: One input turn gives 4 middle turns, and each of those gives 2.5 output turns, so 4 lots of 2.5, which is 10. The second rate acts on everything the first one produced, which is why the rates multiply rather than add.
Commit to an answer before revealing. If you chose 6.5, you added the two rates, which is the natural first instinct and the one this slide is designed to catch.
Follow a single turn of the input shaft. It makes the middle shaft turn four times. Each of those four turns makes the output turn two and a half times. So the output turns four lots of two and a half, which is ten.
The second gear ratio does not act on the input; it acts on the middle shaft, which is already turning four times as fast. That is the same structure as a composition, where the outer function acts on the inner output. Keep this picture in mind whenever you are unsure whether the inner derivative should multiply or be added: along a chain, it multiplies.
Concept
Go back to the definition of the derivative at a point a.
\[ h'(a) = \lim_{x\to a}\frac{\sin(x^3) - \sin(a^3)}{x - a} \]
Multiply and divide by the change in the inner function, x cubed minus a cubed:
\[ h'(a) = \lim_{x\to a}\frac{\sin(x^3) - \sin(a^3)}{x^3 - a^3}\cdot\frac{x^3 - a^3}{x - a} \]
Nothing has changed in value; the fraction has been split into a change in the outer function over a change in the inner one, times the inner change over the change in x.
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 250 — the derivation for sin of x cubed
Now the book derives the rule for one specific function, sin of x cubed, straight from the definition of the derivative. The first line is just that definition at a point a: the change in the function over the change in x.
The trick is to multiply and divide by the change in the inner function, x cubed minus a cubed. That leaves the value unchanged, but it splits the fraction into two pieces with a clear meaning. The first piece is a change in the sine over a change in its input. The second is the change in x cubed over the change in x.
This is the gear picture written as a limit: the first fraction is the outer stage's stretch factor and the second is the inner stage's. Watch what each one becomes as x approaches a.
Concept
The second factor
Why: It is the definition of the derivative of x cubed at a.
\[ \lim_{x\to a}\frac{x^3 - a^3}{x - a} = \frac{d}{dx}\left(x^3\right)\Big|_{x=a} = 3a^2 \]
Rename the first factor
Why: Let u equal x cubed; as x approaches a, u approaches a cubed.
\[ \lim_{x\to a}\frac{\sin(x^3) - \sin(a^3)}{x^3 - a^3} = \lim_{u\to a^3}\frac{\sin u - \sin(a^3)}{u - a^3} \]
Recognise the first factor
Why: It is the derivative of sine, taken at u equal to a cubed.
\[ \lim_{u\to a^3}\frac{\sin u - \sin(a^3)}{u - a^3} = \cos(a^3) \]
Multiply
Why: The product of the two limits.
\[ h'(a) = \cos(a^3)\cdot 3a^2 \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, pp. 250-251 — the derivation for sin of x cubed
The second factor is easy to recognise: it is the definition of the derivative of x cubed at a, which you know is 3a squared.
The first factor needs a renaming. Call the inner output u, so u is x cubed. As x approaches a, u approaches a cubed, because x cubed is continuous. In terms of u, the first factor is the change in sin u over the change in u, which is exactly the definition of the derivative of sine, taken at the point a cubed. The derivative of sine is cosine, so the limit is cos of a cubed.
Multiplying gives cos of a cubed times 3a squared. Look at where the cosine is evaluated: at a cubed, the inner output, not at a. The outer machine's rate is measured at the input that machine actually receives.
Picture it
Figure (svg): The curve y equals sin of x cubed from x equals minus 0.3 to 1.9, flat near the origin and then rising and falling steeply. A tangent line touches it at x equal to 1, where the height is 0.841, with slope 3 cos 1, about 1.62.
\[ h'(1) = \cos(1)\cdot 3(1)^2 \approx 1.621 \]
The line through the point at x equal to 1 with that slope is tangent to the curve: it touches, and it does not cut across. The formula has passed its first test.
A formula derived from a limit deserves an independent test. At x equal to 1 the formula predicts a slope of cos 1 times 3, about 1.621. The yellow line is drawn through the point on the curve with exactly that slope.
Look at how it meets the curve: it touches and runs alongside for a short stretch, without cutting across. That is what a tangent line looks like, so the slope is right.
Notice also the shape of the curve. Near the origin it is almost flat, because x cubed barely changes there, so the sine barely changes either; the inner factor 3x squared is nearly zero. Further out it swings up and down faster and faster, because x cubed is now changing quickly and dragging the sine through its cycle. The inner derivative controls how fast the outer function is driven.
Concept
The chain rule (3.17) — If g is differentiable at x and f is differentiable at g(x), then the composite f of g is differentiable at x, and its derivative is the derivative of the outer function evaluated at the inner output, times the derivative of the inner function.
\[ h(x) = f\big(g(x)\big) \quad\Longrightarrow\quad h'(x) = f'\big(g(x)\big)\,g'(x) \]
In Leibniz notation, with y a function of u and u a function of x:
\[ \frac{dy}{dx} = \frac{dy}{du}\cdot\frac{du}{dx} \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 251 — Rule: The Chain Rule, equation 3.17
This is the general statement, equation 3.17. It needs two hypotheses: the inner function must be differentiable at x, and the outer function must be differentiable at the inner output g of x. Then the composite is differentiable, and its derivative is the outer derivative evaluated at the inner output, times the inner derivative.
Read it once more with sin of x cubed in mind: f is sine, g is x cubed, f prime of g of x is cos of x cubed, and g prime of x is 3x squared. Their product is the answer from the previous slides.
The second line is the same rule in Leibniz notation, where y depends on u and u depends on x. It looks like fractions cancelling, which is a helpful way to remember it, and you will see at the end of the lesson why it is not literally cancellation.
Notation
Annotate
On: \( \frac{d}{dx}f\big(g(x)\big) = f'\big(g(x)\big)\cdot g'(x) \)
Step through the annotations. The first one asks you to name the layers before doing anything else. Nearly every chain-rule mistake begins with not being clear about which function is outside.
The second and third annotations belong together. You differentiate the outer function as though its input were a plain variable, getting a formula such as cosine, and then you feed it the same input the original outer function had. The inside is copied unchanged.
The fourth annotation is the factor that gets forgotten. Without it you have only the outer stage's stretch factor, as if the inner function were a bare x. A quick defence: if the inside is not a bare x, there must be one extra factor at the end of your answer.
Concept
Two parts for two layers, three parts for three layers, and so on. And never evaluate a derivative at a derivative: the outer derivative is evaluated at g of x, never at g prime of x.
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 251 — Problem-Solving Strategy: Applying the Chain Rule
The book's problem-solving strategy has four steps, and they are worth following literally for the first dozen problems until they become automatic. Identify the two layers; differentiate the outer one and evaluate it at the inner output; differentiate the inner one; multiply.
The note underneath matters just as much. You always work from the outside in: the outermost layer is handled first, and whatever is inside it is treated as a single block until its turn comes. The number of layers equals the number of factors in the answer, which gives you a way to check that nothing was skipped.
Finally, never evaluate a derivative at a derivative. The outer derivative takes the inner function as its input, never the inner derivative. Cos of 3x squared, in place of cos of x cubed, is the error this warns against.
Step zero
\[ k(x) = \sqrt{3x^2 + 1} \]
Discussion prompt
This is the book's second opening example. Before any calculus: name the outer function and the inner function, and say what each derivative will be. Then assemble k′(x).
Write your decomposition before revealing. This is the book's other opening example, and step zero is simply naming the layers.
The square root is applied last, so it is the outer function, and it is easiest to handle as the one-half power. Its derivative is one half times the minus one-half power. The inner function is the quadratic 3x squared plus 1, whose derivative is 6x.
Multiplying and simplifying gives 3x over the square root of 3x squared plus 1. The check at x equal to 1 gives 1.5, which a numerical slope confirms. Notice that the square root in the denominator still contains the whole inside: the outer derivative was evaluated at the inner output.
Sorting
Sort into buckets
Look at what each outer function is applied to. Sort each function.
Sort each function by asking one question: what is each outer function applied to? If the answer is a bare x, the rules you already have are enough. If it is anything else, the chain rule is needed.
Two items are designed to mislead. The product x squared cos x and the quotient cos x over x look complicated, but each piece is applied directly to x, so the product and quotient rules alone handle them. On the other side, tan squared x looks simple, but it means the tangent, squared: a power applied to a function, so it needs the chain rule.
Asking the question out loud is more reliable than recognising shapes. With practice you will do it instantly, but a rushed glance is exactly how the inner derivative gets forgotten.
Trap
A tempting first attempt:
\[ \frac{d}{dx}\sin(x^3) = \cos x \cdot 3x^2 \]
Wrong. The inside was dropped from the outer derivative.
The cosine must be evaluated at the same input the sine had. Test at x equal to 2: the wrong line gives about minus 4.99, the right one about minus 1.75, and the graph's slope is minus 1.75.
\[ \frac{d}{dx}\sin(x^3) = \cos(x^3)\cdot 3x^2 \]
This mistake comes from learning that the derivative of sine is cosine and applying it too literally. The derivative of sine is cosine of the same input. Here the input is x cubed, so the cosine must be of x cubed.
Numbers settle it. At x equal to 2 the wrong line predicts a slope of about minus 4.99, and the correct line predicts about minus 1.75. A difference quotient on the actual function gives minus 1.75, so the wrong formula is not just differently written; it gives different numbers.
Notice that at x equal to 1 the two formulas happen to agree, because 1 cubed is 1. That is why checking at x equal to 1 is sometimes not enough: pick a test point where the inside differs from x.
Section
Part 2
Concept
Take the outer function to be the nth power. Its derivative is the power rule, and the chain rule then multiplies by the inside's derivative.
\[ h(x) = \big(g(x)\big)^n, \quad f(x) = x^n, \quad f'(x) = nx^{n-1} \]
\[ f'\big(g(x)\big) = n\big(g(x)\big)^{n-1} \]
Power rule for compositions (3.18) — The derivative of g of x to the n is n times g of x to the n minus 1, times g prime of x.
\[ h'(x) = n\big(g(x)\big)^{n-1}g'(x) \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, pp. 251-252 — Rule: Power Rule for Composition of Functions, equation 3.18
The most common chain-rule problem by far is an expression raised to a power, so it gets its own formula. Take the outer function to be the nth power. Its derivative is n times the n minus first power, and evaluating that at the inside gives n times the inside to the n minus 1.
Then the chain rule multiplies by the derivative of the inside. That is equation 3.18: bring the power down, lower it by one, leave the inside alone, and multiply by the inside's derivative.
This covers far more than it seems, because roots and reciprocals are powers. A square root is the one-half power; one over something squared is the minus second power. Rewriting in power form first is almost always the fastest route.
Picture it
Figure (svg): A square of side u with area u squared. Thin strips of width du are added along the right side and the top, each of area u times du, plus a tiny corner square. Beside it: the new area is about 2u du, and du is 2 dx when u is 2x plus 1.
\[ \frac{d}{dx}(2x+1)^2 = 2(2x+1)\cdot 2 = 8x + 4 \]
Expanding first gives the same answer: the square is 4x squared plus 4x plus 1, whose derivative is 8x plus 4. Without the inner factor you would get only half of it.
Here is a picture of the power form for the simplest case, a square. Think of a square whose side is u. When the side grows by a small amount du, the area grows by two thin strips, each u long and du wide, plus a tiny corner square so small it can be ignored. So the area grows by about 2u times du: that is the power rule, the outer rate.
Now make the side itself depend on x, with u equal to 2x plus 1. When x grows by dx, the side grows by twice as much. Substitute and the area grows by about 2u times 2 times dx: the outer rate times the inner rate.
You can confirm the answer by expanding the square first, which gives 8x plus 4 either way. Dropping the inner factor would give 4x plus 2, exactly half, which is a useful sanity check whenever you can expand.
Worked example
\[ h(x) = \frac{1}{(3x^2+1)^2} \]
Rewrite as a power
Why: A reciprocal is a negative power, so the power form applies.
\[ h(x) = (3x^2+1)^{-2} \]
Name the inside and differentiate it
Why: The inner function is the quadratic.
\[ g(x) = 3x^2 + 1, \quad g'(x) = 6x \]
Apply the power form
Why: Bring down minus 2, lower the exponent to minus 3, keep the inside, multiply by g prime.
\[ h'(x) = -2(3x^2+1)^{-3}(6x) \]
Rewrite as a fraction
Why: Multiply the constants and move the negative power to the denominator.
\[ h'(x) = \frac{-12x}{(3x^2+1)^3} \]
Check with a value
Why: At x equal to 1 the formula gives minus 12 over 64; a symmetric difference quotient with step one millionth gives minus 0.187500.
\[ h'(1) = \frac{-12}{4^3} = -0.1875 \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 252 — Example 3.48
The first move is the one that makes everything easy: rewrite the reciprocal as a negative power. Now the function is an expression raised to the minus second power, and the power form applies directly.
Bring down the minus 2, lower the exponent to minus 3, leave the quadratic inside untouched, and multiply by its derivative 6x. Multiplying the constants gives minus 12x, and moving the negative power back to the denominator gives a fraction with the cube of the quadratic below.
Check the sign before the value. For positive x the function is shrinking, since its denominator is growing, so the derivative should be negative there, and it is. The value at x equal to 1, minus 0.1875, matches a numerical slope exactly.
Fill the middle
\[ h(x) = (2x^3 + 2x - 1)^4 \]
Fill in the blanks
h'(x) = 4(2x^3+2x-1)^3\left(6x^2+2\right)
Why: The inside is 2x cubed plus 2x minus 1, whose derivative is 6x squared plus 2. At x equal to 0 the answer gives 4 times minus 1 times 2, which is minus 8, and a numerical slope at 0 is minus 8 too.
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 252 — Checkpoint 3.34
Everything but the inner factor has been written for you: the power 4 has come down and the exponent has dropped to 3, with the cubic copied inside. Type the derivative of the inside.
The inside is 2x cubed plus 2x minus 1, and its derivative, term by term, is 6x squared plus 2. The constant minus 1 contributes nothing.
A degree count confirms the structure. The original is a cubic to the fourth power, degree twelve, so its derivative must have degree eleven. The answer is a cubic cubed, degree nine, times a quadratic, degree two: eleven. Without the inner factor it would be degree nine and the count would expose the error.
Worked example
\[ h(x) = \sin^3 x \]
Read the notation
Why: Sine cubed means the sine, then cubed: the power is the outer layer.
\[ \sin^3 x = (\sin x)^3 \]
Apply the power form with g equal to sin x
Why: The derivative of the inside is cos x.
\[ h'(x) = 3(\sin x)^2\cos x \]
Write it the usual way
Why: Same expression, compact notation.
\[ h'(x) = 3\sin^2 x\cos x \]
Check at pi over 4
Why: Sine and cosine are both root 2 over 2 there; a difference quotient gives 1.060660.
\[ h'\left(\tfrac{\pi}{4}\right) = 3\cdot\tfrac12\cdot\tfrac{\sqrt2}{2} = \tfrac{3\sqrt2}{4} \approx 1.060660 \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 252 — Example 3.49
The notation sine cubed of x is a convention that trips people up. It means the sine of x, then cubed, so the cube is the outer layer and the sine is the inside. It does not mean the sine of x cubed, which is a different function with the layers in the other order.
Once rewritten, it is a power of a function: bring down the 3, lower the exponent to 2, keep the sine inside, and multiply by the derivative of sine, which is cosine.
The check at pi over 4 uses exact values. Sine and cosine are both root 2 over 2 there, so sine squared is one half, and the derivative is three times one half times root 2 over 2, about 1.0607. A numerical slope agrees to six decimal places.
Worked example
Find the equation of the line tangent to the graph at x equal to 2.
\[ h(x) = \frac{1}{(3x-5)^2}, \quad x = 2 \]
Find the point
Why: Substitute x equal to 2.
\[ h(2) = \frac{1}{(6-5)^2} = 1 \;\Longrightarrow\; (2, 1) \]
Rewrite as a power
Why: The power form needs a power.
\[ h(x) = (3x-5)^{-2} \]
Differentiate
Why: Minus 2 down, exponent minus 3, times the inner derivative 3.
\[ h'(x) = -2(3x-5)^{-3}(3) = -6(3x-5)^{-3} \]
Evaluate the slope
Why: At x equal to 2 the inside is 1.
\[ h'(2) = -6(1)^{-3} = -6 \]
Write the line
Why: Point-slope form, then solve for y.
\[ y - 1 = -6(x - 2) \;\Longrightarrow\; y = -6x + 13 \]
Figure (svg): The graph of h of x equals one over 3x minus 5 squared, with a vertical asymptote at x equals five thirds, and the tangent line y equals minus 6x plus 13 touching the right branch at the point 2, 1.
Check the point and the slope
Why: The line passes through the point, and a numerical slope at 2 is minus 6.000.
\[ -6(2) + 13 = 1 = h(2) \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 252 — Example 3.50
A tangent line needs two things, a point and a slope, and it is worth collecting them in that order. Substituting x equal to 2 gives a height of 1, so the point is 2, 1.
For the slope, rewrite as the minus second power and apply the power form: minus 2 comes down, the exponent drops to minus 3, and the inner derivative 3 multiplies on. At x equal to 2 the inside is 1, so the slope is simply minus 6.
Point-slope form then gives y equals minus 6x plus 13. The picture confirms it: the line touches the right-hand branch at the point 2, 1 and falls steeply, matching the curve's descent away from the vertical asymptote at five thirds. The check substitutes the point into the line, and a numerical slope confirms minus 6.
Worked example
\[ f(x) = (x^2 - 2)^3, \quad x = -2 \]
Find the point
Why: Substitute x equal to minus 2.
\[ f(-2) = (4 - 2)^3 = 8 \;\Longrightarrow\; (-2, 8) \]
Differentiate
Why: Power form: 3 down, exponent 2, times the inner derivative 2x.
\[ f'(x) = 3(x^2-2)^2(2x) = 6x(x^2-2)^2 \]
Evaluate the slope
Why: Substitute x equal to minus 2.
\[ f'(-2) = 6(-2)(2)^2 = -48 \]
Write the line
Why: Point-slope form, then solve for y.
\[ y - 8 = -48(x + 2) \;\Longrightarrow\; y = -48x - 88 \]
Figure (svg): The graph of f of x equals x squared minus 2, cubed, for x between minus 2.4 and minus 1.4, falling steeply, with the tangent line y equals minus 48x minus 88 touching it at the point minus 2, 8.
Check the point
Why: The line passes through the point; a numerical slope at minus 2 is minus 48.000.
\[ -48(-2) - 88 = 96 - 88 = 8 = f(-2) \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 252 — Checkpoint 3.35
Same procedure: point, then slope, then line. At x equal to minus 2 the inside is 4 minus 2, which is 2, so the height is 8.
The power form gives 3 times the inside squared times 2x, which tidies to 6x times the inside squared. At x equal to minus 2 that is minus 12 times 4, which is minus 48.
A slope of minus 48 may look suspicious, so look at the graph: the curve drops from about 36 at x equal to minus 2.3 to 8 at minus 2, a fall of 28 over three tenths of a unit. Steep slopes are normal for a cube of something that is itself changing quickly. The check confirms the line passes through the point.
Error analysis
Annotate
On: \( \frac{d}{dx}(x^2+1)^5 = 5(2x)^4 \)
Read the line and find the problem before you step through the notes. The exponent handling is right; the mistake is what happened to the inside.
The inside was replaced by its own derivative. That treats the chain rule as if it meant differentiate the outside and differentiate the inside, all in one expression. But the outer derivative must be evaluated at the original inside, and the inner derivative then multiplies on the outside.
The degree check is the fastest detector. The original is a quadratic to the fifth power, degree ten, so the derivative has degree nine. The wrong answer, 5 times 2x to the fourth, has degree four. The correct answer, 10x times the inside to the fourth, has degree one plus eight, which is nine.
Tweak it
Parameter explorer
The curve is the derivative of sin(kx). Slide k. How does the height of the derivative's wave depend on k, and which part of the chain rule produces that?
\[ \frac{d}{dx}\sin({k}x) = {k}\cos({k}x) \]
Start with k equal to 1: the curve is cos x, the derivative of sin x, with height 1. Now slide k up to 2. Two things happen: the wave squeezes horizontally, and it doubles in height.
The squeezing comes from the inside of the cosine: sin of kx runs through its cycle k times as fast, and so does its derivative. The doubling in height is the chain rule's extra factor, the inner derivative k. A sine wave that oscillates twice as fast must climb and fall twice as steeply, so its slopes double.
Try k equal to one half as well: the wave stretches out and its slopes halve. Whatever you choose, the peak height of the derivative equals k. That peak is the inner rate, made visible.
Section
Part 3
Worked example
First the general rule for a cosine of a function, then a use of it.
\[ h(x) = \cos\big(g(x)\big) \]
Name the outer function and its derivative
Why: The outer function is cosine.
\[ f(x) = \cos x, \quad f'(x) = -\sin x \]
Evaluate the outer derivative at the inside
Why: Copy g of x into it.
\[ f'\big(g(x)\big) = -\sin\big(g(x)\big) \]
Multiply by the inner derivative
Why: The chain rule.
\[ h'(x) = -\sin\big(g(x)\big)\,g'(x) \]
Example 3.52: take g equal to 5x squared
Why: Its derivative is 10x.
\[ \frac{d}{dx}\cos(5x^2) = -\sin(5x^2)\cdot 10x = -10x\sin(5x^2) \]
Figure (svg): Left: the graph of cos of 5x squared for x from 0 to 2, oscillating faster and faster. Right: its derivative, minus 10x times sin of 5x squared, oscillating between the dashed lines 10x and minus 10x, so its swings grow as x grows.
Check both
Why: With g equal to x the rule gives minus sin x, the known derivative of cosine; and at x equal to 1 the answer, minus 10 sin 5, is 9.589243, matching a numerical slope.
\[ -10(1)\sin 5 \approx 9.589243 \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 253 — Examples 3.51 and 3.52
Example 3.51 derives a rule for cosine of any inner function g. The outer derivative is minus sine, evaluated at g of x, and the chain rule multiplies by g prime. The result says: the derivative of cos of anything is minus sin of the same anything, times the derivative of that anything.
Example 3.52 uses it with g equal to 5x squared, whose derivative is 10x. The two panels show that factor at work. On the left, cos of 5x squared oscillates faster and faster as x grows, because the inside is growing faster and faster. On the right, the derivative's swings grow inside the dashed lines 10x and minus 10x.
The check is two-fold. With g equal to x, the general rule collapses to the familiar derivative of cosine, minus sine. And at x equal to 1 the specific answer matches a numerical slope, 9.589, positive because sin 5 is negative.
Worked example
\[ h(x) = \sec(4x^5 + 2x) \]
Apply the chain rule with the secant rule outside
Why: The derivative of secant is secant times tangent, both at the inside.
\[ h'(x) = \sec\big(g(x)\big)\tan\big(g(x)\big)\,g'(x) \]
Differentiate the inside
Why: Power rule, term by term.
\[ g(x) = 4x^5 + 2x, \quad g'(x) = 20x^4 + 2 \]
Substitute
Why: Copy the inside into both trig factors.
\[ h'(x) = \sec(4x^5+2x)\tan(4x^5+2x)(20x^4+2) \]
Tidy
Why: Put the polynomial factor in front.
\[ h'(x) = (20x^4+2)\sec(4x^5+2x)\tan(4x^5+2x) \]
Check at x equal to 0.3
Why: There the inside is 0.60972 and its derivative 2.162; the formula gives 1.842091, and so does a numerical slope.
\[ h'(0.3) = 2.162\,\sec(0.60972)\tan(0.60972) \approx 1.842091 \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 253 — Example 3.53
Here the outer function is secant, whose derivative from Section 3.5 is secant times tangent. The chain rule evaluates both of those at the inside, then multiplies by the derivative of the inside.
The inside is 4x to the fifth plus 2x, and its derivative is 20x to the fourth plus 2. The book moves that polynomial to the front, which is the usual convention because it keeps the trig factors together and avoids the misreading that the polynomial is inside the tangent.
The check uses x equal to 0.3, a deliberately awkward point. The inside there is 0.60972 and its derivative 2.162; the formula gives 1.842091, and a symmetric difference quotient on the original function gives the same six decimals. When the check matches that closely, you can trust every piece of the formula.
Prediction
\[ h(x) = \sin(7x + 2) \]
Predict first
What is h′(x)?
Correct: 7 cos(7x + 2)
Why: The outer derivative is cosine, evaluated at the same inside, 7x plus 2; then multiply by the inside's derivative, 7. Leaving off the 7 forgets the inner rate; 7 cos x evaluates the outer derivative at x; cos 7 evaluates it at the inner DERIVATIVE, which the book warns never to do.
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 253 — Checkpoint 3.36
Commit to an answer before revealing. Each wrong option is a specific, common error, and it is worth knowing which one you would have made.
The outer derivative of sine is cosine, and it keeps the same inside, 7x plus 2. The inner derivative is 7. So the answer is 7 cos of 7x plus 2.
The option without the 7 forgets the inner factor. The option 7 cos x differentiates correctly but drops the inside from the cosine. The option cos 7 is the error the book names explicitly: it evaluates the outer derivative at the inner derivative instead of the inner function. For a linear inside like this one, the inner factor is just the coefficient of x, which makes these the quickest chain-rule problems of all.
Concept
\[ \begin{aligned} \tfrac{d}{dx}\sin(g(x)) &= \cos(g(x))\,g'(x) \\ \tfrac{d}{dx}\cos(g(x)) &= -\sin(g(x))\,g'(x) \\ \tfrac{d}{dx}\tan(g(x)) &= \sec^2(g(x))\,g'(x) \end{aligned} \]
\[ \begin{aligned} \tfrac{d}{dx}\cot(g(x)) &= -\csc^2(g(x))\,g'(x) \\ \tfrac{d}{dx}\sec(g(x)) &= \sec(g(x))\tan(g(x))\,g'(x) \\ \tfrac{d}{dx}\csc(g(x)) &= -\csc(g(x))\cot(g(x))\,g'(x) \end{aligned} \]
There is nothing new to memorise: each line is the derivative you learned in Section 3.5, evaluated at the inside, times the derivative of the inside. The book also writes them with u in place of g of x and du by dx in place of g prime.
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 254 — Theorem 3.10
This table is Theorem 3.10. Each row is a derivative from Section 3.5 with the chain rule applied: the same formula, evaluated at g of x instead of x, times g prime of x.
The book states explicitly that you do not need to memorise these as separate formulas. If you know the six basic trigonometric derivatives and the chain rule, you can produce any row in one line, exactly as Examples 3.51 and 3.53 did.
Two patterns are worth noticing because they carry over. The three cofunctions, cosine, cotangent and cosecant, have the minus signs, just as before. And every single row ends with g prime of x. If the inside is not a bare x, that factor must be there.
Matching
Match the pairs
Why: Each derivative is the Section 3.5 formula with the inside copied in, times the inside's derivative: 2x for x², 3 for 3x, 2 for 2x. The minus signs belong to the cofunctions, cot and csc, exactly as before.
Pair each function with its derivative. Do the matching by producing each derivative yourself first, rather than scanning the right-hand column for something that looks similar.
Each answer has three ingredients: the basic derivative from Section 3.5, the inside copied into it, and the inner factor. For tan of x squared the inner factor is 2x; for cot of 3x it is 3, and the cotangent brings a minus sign; for sec of 2x it is 2; and for csc of x squared it is 2x, with the cosecant's minus sign.
If you found yourself hesitating on the signs, that is a Section 3.5 memory issue, not a chain-rule one. The chain rule never changes a sign; it only multiplies by the inner derivative.
Step zero
\[ h(x) = (2x+1)^5(3x-2)^7 \]
Discussion prompt
Before differentiating: what is the LAST operation applied in building h? Which rule must therefore be used first, and where will the chain rule appear?
Write your answer before revealing. The skill here is reading the structure of an expression, and it is the skill that decides whether a long calculation goes smoothly.
Think about how you would compute this function on a calculator for a given x. You would compute 2x plus 1, raise it to the fifth, compute 3x minus 2, raise it to the seventh, and finally multiply the two results. The last operation is the multiplication, so the product rule is the outermost rule.
Inside the product rule you need the derivative of each factor, and each factor is a power of a linear expression. That is where the chain rule appears, once in each term. The underbraces show exactly where.
Worked example
\[ h(x) = (2x+1)^5(3x-2)^7 \]
Apply the product rule
Why: Multiplication is the outermost operation.
\[ h'(x) = \tfrac{d}{dx}\left[(2x+1)^5\right](3x-2)^7 + \tfrac{d}{dx}\left[(3x-2)^7\right](2x+1)^5 \]
Apply the chain rule to each power
Why: Inner derivatives 2 and 3.
\[ h'(x) = 5(2x+1)^4\cdot 2\cdot(3x-2)^7 + 7(3x-2)^6\cdot 3\cdot(2x+1)^5 \]
Multiply the constants
Why: 5 times 2 and 7 times 3.
\[ h'(x) = 10(2x+1)^4(3x-2)^7 + 21(3x-2)^6(2x+1)^5 \]
Factor out the common powers
Why: Both terms contain the fourth power of the first and the sixth power of the second.
\[ h'(x) = (2x+1)^4(3x-2)^6\big[10(3x-2) + 21(2x+1)\big] \]
Simplify the bracket
Why: 30x minus 20 plus 42x plus 21.
\[ h'(x) = (2x+1)^4(3x-2)^6(72x+1) \]
Check at x equal to 0
Why: The unfactored line gives minus 1280 plus 1344; the factored form gives 1 times 64 times 1; a numerical slope gives 64.
\[ 10(1)(-2)^7 + 21(-2)^6(1) = -1280 + 1344 = 64 = (1)^4(-2)^6(1) \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 254 — Example 3.54
Follow the order: product rule first, because the last operation is multiplication; then the power form of the chain rule on each factor, with inner derivatives 2 and 3.
The algebra after that is where most of the work lies, and the book factors out the common powers to get a clean final form. Both terms contain the fourth power of 2x plus 1 and the sixth power of 3x minus 2, so pull those out and simplify what is left in the bracket to 72x plus 1.
The check at x equal to 0 compares the unfactored and factored forms: minus 1280 plus 1344 gives 64, and the factored form gives 1 times 64 times 1, which is also 64. When factoring by hand, this kind of spot check catches most algebra slips. The factored form also tells you at once where the derivative is zero.
Trap
Differentiating each factor and multiplying:
\[ \big[(2x+1)^5(3x-2)^7\big]' \]
\[ = 10(2x+1)^4\cdot 21(3x-2)^6 \]
Wrong. A product is not a composition.
The last operation is multiplication, so the product rule comes first and the chain rule lives inside each term. At x equal to 0 the wrong line gives 13440; the true slope is 64.
\[ h' = 10(2x+1)^4(3x-2)^7 \]
\[ \quad + 21(3x-2)^6(2x+1)^5 \]
This error treats a product as if it were a composition: differentiate each factor with the chain rule and multiply the results. It feels plausible because each factor does need the chain rule, but the factors are multiplied together, not nested.
The numbers expose it immediately. At x equal to 0 the wrong line gives 13440, while the true slope is 64. The product rule exists because the derivative of a product is not the product of the derivatives, and that is still true when the factors are themselves compositions.
Always decide the outermost operation first. Here it is multiplication, so the product rule's two-term structure must appear in your answer.
Worked example
\[ h(x) = \frac{x}{(2x+3)^3} \]
Apply the quotient rule
Why: Division is the outermost operation.
\[ h'(x) = \frac{1\cdot(2x+3)^3 - x\cdot\frac{d}{dx}(2x+3)^3}{(2x+3)^6} \]
Differentiate the denominator by the chain rule
Why: Inner derivative 2.
\[ \frac{d}{dx}(2x+3)^3 = 3(2x+3)^2\cdot 2 = 6(2x+3)^2 \]
Substitute
Why: Put that into the numerator.
\[ h'(x) = \frac{(2x+3)^3 - 6x(2x+3)^2}{(2x+3)^6} \]
Factor the numerator
Why: Both terms contain the square of 2x plus 3.
\[ h'(x) = \frac{(2x+3)^2\big[(2x+3) - 6x\big]}{(2x+3)^6} \]
Cancel and simplify
Why: Two powers cancel; the bracket is 3 minus 4x.
\[ h'(x) = \frac{3 - 4x}{(2x+3)^4} \]
Check at x equal to 0 and 1
Why: The formula gives 3 over 81 and minus 1 over 625; numerical slopes give 0.037037 and minus 0.001600.
\[ h'(0) = \tfrac{3}{81} \approx 0.037037, \qquad h'(1) = \tfrac{-1}{625} = -0.0016 \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 254 — Checkpoint 3.37
The outermost operation is division, so start with the quotient rule. The numerator's derivative is 1; the denominator's derivative needs the chain rule, giving 6 times the square of 2x plus 3.
The simplification is the important skill here. Both terms in the numerator contain the square of 2x plus 3, so factor it out. It then cancels against two of the six powers in the denominator, and the bracket simplifies to 3 minus 4x. The final answer, 3 minus 4x over the fourth power of 2x plus 3, is much tidier than the first line.
You could instead write the function as x times the minus third power of 2x plus 3 and use the product rule; you should get the same answer. The check at two points, 0 and 1, matches numerical slopes, and the sign change at x equal to three quarters tells you the function has a turning point there.
Worked example
\[ y = x^2\cos^4 x \]
Apply the product rule
Why: The last operation is multiplication.
\[ y' = 2x\cos^4 x + x^2\cdot\tfrac{d}{dx}(\cos x)^4 \]
Apply the power form to the second factor
Why: The inside is cos x, with derivative minus sin x.
\[ \tfrac{d}{dx}(\cos x)^4 = 4\cos^3 x\cdot(-\sin x) \]
Substitute
Why: Put it back into the product rule.
\[ y' = 2x\cos^4 x - 4x^2\cos^3 x\sin x \]
Factor
Why: Both terms share 2x cos cubed x.
\[ y' = 2x\cos^3 x\,(\cos x - 2x\sin x) \]
Check at x equal to 1
Why: The formula gives minus 0.360454, and so does a numerical slope.
\[ 2\cos^4 1 - 4\cos^3 1\sin 1 \approx -0.360454 \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 258 — Exercise 234
This exercise from the section combines the product rule with a power of a trig function. The last operation is multiplication, so the product rule comes first.
The derivative of x squared is 2x, with no chain rule needed. The derivative of cosine to the fourth is a power of a function: 4 cosine cubed, times the derivative of cosine, which is minus sine. That minus sign is easy to lose, so write the inner derivative in brackets before simplifying.
Factoring out 2x cosine cubed gives a compact answer. The check at x equal to 1 matches a numerical slope to six decimals, which confirms both the minus sign and the factor of 4.
Comparison
Comparison matrix
| function | last operation applied | rule to use first |
|---|---|---|
| (2x + 1)⁵(3x − 2)⁷ | multiplication | product rule |
| x/(2x + 3)³ | division | quotient rule |
| (x/(3x + 2))⁵ | fifth power | power form |
| tan(4x² − 3x + 1) | tangent | chain rule with tan |
| x² cos⁴x | multiplication | product rule |
Fill each blank before checking. For every function, imagine evaluating it on a calculator and ask which operation you would perform last. That operation names the first rule.
Two rows are worth a second look. The fifth power of a quotient looks like a quotient problem, but the last operation is raising to the fifth power, so the power form comes first and the quotient rule appears only inside it, when you differentiate the quotient. And the tangent of a quadratic is a chain-rule problem with tangent as the outer function.
Getting this first decision right is most of the battle. If you apply the rules in the wrong order you can still reach a correct answer sometimes, but the algebra gets much longer and the chance of an error grows.
Section
Part 4
Concept
\[ k(x) = h\Big(f\big(g(x)\big)\Big) \]
Once, with h outermost
Why: Treat everything inside h as one inner function.
\[ k'(x) = h'\Big(f\big(g(x)\big)\Big)\cdot\frac{d}{dx}f\big(g(x)\big) \]
Again, on the inner composite
Why: f of g of x is itself a two-layer chain.
\[ k'(x) = h'\Big(f\big(g(x)\big)\Big)\,f'\big(g(x)\big)\,g'(x) \]
Three layers give three factors, each layer differentiated at whatever sits inside it. You never need to memorise this: peel one layer at a time.
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, pp. 254-255 — Rule: Chain Rule for a Composition of Three Functions
When there are three layers, you do not need a new rule. Treat everything inside the outermost function as a single block and apply the chain rule once. That leaves you needing the derivative of the block, which is itself a two-layer composition, so apply the chain rule again.
The result has three factors: the outermost derivative at everything inside it, the middle derivative at the innermost function, and the innermost derivative. Each layer is differentiated at whatever sits inside that layer.
The book states the general formula but tells you not to memorise it. Four layers give four factors, and so on. The only procedure you need is peeling one layer at a time from the outside in.
Picture it
Figure (svg): Three nested boxes: the outermost labelled the fourth power, inside it a box labelled cosine, inside that a box holding 7x squared plus 1. Arrows run from each layer to one factor below: 4 cos cubed of 7x squared plus 1, minus sin of 7x squared plus 1, and 14x.
The layers of cosine to the fourth of 7x squared plus 1, from the outside in: a fourth power, a cosine, and a quadratic. Each contributes exactly one factor to the derivative.
The nested boxes show the three layers of cosine to the fourth of 7x squared plus 1. The outermost box is the fourth power, inside it is a cosine, and at the core is the quadratic.
Each arrow runs from a layer to the single factor it contributes. The fourth power gives 4 times the cosine cubed, with everything inside left alone. The cosine gives minus sine of the quadratic, again with its inside left alone. The quadratic gives 14x.
Multiplying the three factors gives the derivative at the bottom. When you do three-layer problems, it helps to draw this picture quickly, or at least to list the layers, before writing any derivative. Most errors in long chains are a skipped layer, and a list makes a skipped layer obvious.
Worked example
\[ k(x) = \cos^4(7x^2 + 1) \]
Rewrite to show the layers
Why: The fourth power is outermost.
\[ k(x) = \big(\cos(7x^2+1)\big)^4 \]
Peel the power
Why: Power form, with the cosine as the inside.
\[ k'(x) = 4\big(\cos(7x^2+1)\big)^3\cdot\tfrac{d}{dx}\cos(7x^2+1) \]
Peel the cosine
Why: Its derivative is minus sine, at the same inside.
\[ k'(x) = 4\big(\cos(7x^2+1)\big)^3\big(-\sin(7x^2+1)\big)\tfrac{d}{dx}(7x^2+1) \]
Differentiate the core
Why: The quadratic's derivative is 14x.
\[ k'(x) = 4\big(\cos(7x^2+1)\big)^3\big(-\sin(7x^2+1)\big)(14x) \]
Simplify
Why: Multiply 4, minus 1 and 14x.
\[ k'(x) = -56x\sin(7x^2+1)\cos^3(7x^2+1) \]
Check at x equal to one half
Why: There the inside is 2.75; the formula gives 8.438748, matching a numerical slope.
\[ -56(0.5)\sin(2.75)\cos^3(2.75) \approx 8.438748 \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 255 — Example 3.55
The first move rewrites the function so the layers are visible: the cosine of the quadratic, all raised to the fourth power. Now peel.
The power comes off first, with the cosine block left intact, and a derivative of the block is left to find. The cosine comes off next, becoming minus sine of the same quadratic, and a derivative of the quadratic is left. Finally the quadratic's derivative is 14x. Each line of the solution removes exactly one layer, and the pending derivative always moves one level inward.
Multiplying 4, minus 1 and 14x gives minus 56x. The check at x equal to one half matches a numerical slope, 8.4387, which tests all three factors at once: a missing layer would change that number.
Ranking
\[ h(x) = \sin^6(x^3) \]
Put in order
Put the steps of the derivative in the order you would carry them out.
Why: Outside in, one layer at a time, each layer's derivative evaluated at whatever sits inside it; the factors are multiplied at the end.
Put the steps in order before checking. The order is the procedure you will use on every multi-layer function.
Naming the layers comes first, because the rest depends on it. Then peel from the outside: the sixth power becomes 6 times the sine to the fifth, the sine becomes cosine of the same inside, and the core x cubed becomes 3x squared. The factors are multiplied at the end.
Notice that in each step the inside stays exactly as it was: x cubed appears unchanged in both the sine and the cosine factors. The only place x cubed is actually differentiated is the last factor.
Worked example
\[ h(x) = \sin^6(x^3) \]
Rewrite to show the layers
Why: The sixth power is outermost.
\[ h(x) = \big(\sin(x^3)\big)^6 \]
Peel the power
Why: Power form, keeping the sine inside.
\[ h'(x) = 6\big(\sin(x^3)\big)^5\cdot\tfrac{d}{dx}\sin(x^3) \]
Peel the sine
Why: Cosine of the same inside.
\[ h'(x) = 6\sin^5(x^3)\cos(x^3)\cdot\tfrac{d}{dx}(x^3) \]
Differentiate the core and multiply
Why: 3x squared, times 6.
\[ h'(x) = 18x^2\sin^5(x^3)\cos(x^3) \]
Check at x equal to 1
Why: The formula gives 18 sin to the fifth of 1 times cos 1, 4.103033, matching a numerical slope.
\[ 18\sin^5(1)\cos(1) \approx 4.103033 \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 255 — Checkpoint 3.38
This is the same peeling you just ordered. Rewrite to see the sixth power outside, then take off one layer per line.
The factors are 6 sine to the fifth of x cubed, cosine of x cubed, and 3x squared. Multiply the constants, 6 times 3, to get 18, and collect the x squared in front.
The check at x equal to 1 gives 18 times sine to the fifth of 1 times cosine of 1, about 4.103, which matches a numerical slope. A quick structural check also works: three layers should give three factors, and there are three.
Worked example
A particle's position at time t is given below. Find its velocity at t equal to pi over 6.
\[ s(t) = \sin(2t) + \cos(3t) \]
Velocity is the derivative of position
Why: Differentiate term by term, each with the chain rule.
\[ v(t) = s'(t) = 2\cos(2t) - 3\sin(3t) \]
Substitute t equal to pi over 6
Why: The insides become pi over 3 and pi over 2.
\[ v\left(\tfrac{\pi}{6}\right) = 2\cos\left(\tfrac{\pi}{3}\right) - 3\sin\left(\tfrac{\pi}{2}\right) \]
Evaluate
Why: Cos of pi over 3 is one half, sin of pi over 2 is 1.
\[ v\left(\tfrac{\pi}{6}\right) = 2\cdot\tfrac12 - 3\cdot 1 = -2 \]
Figure (svg): The position s of t equals sin 2t plus cos 3t for t from 0 to 2.2, with a tangent line of slope minus 2 touching the curve at t equals pi over 6, where the position is about 0.866.
Check on the graph
Why: The position curve is falling at t equal to pi over 6, and a numerical slope there is minus 2.000.
\[ \frac{s(0.5246) - s(0.5226)}{0.002} \approx -2.000 \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 255 — Example 3.56
Velocity is the derivative of position, so this is a differentiation problem with a physical meaning. Each term is a trig function of a multiple of t, so each needs the chain rule with a linear inside: the inner factors are 2 and 3.
Differentiating gives 2 cos 2t minus 3 sin 3t. At t equal to pi over 6 the insides become pi over 3 and pi over 2, whose cosine and sine are one half and one. So the velocity is 1 minus 3, which is minus 2.
The negative sign means the particle is moving in the negative direction at that moment. The graph shows the position curve falling there, and the yellow tangent with slope minus 2 matches it. A numerical slope between two nearby times gives minus 2.000, completing the check.
Prediction
\[ s(t) = \sin(4t) \]
Predict first
What is the acceleration a(t), the second derivative of position?
Correct: −16 sin(4t)
Why: Each differentiation brings out a factor 4 from the inside: v(t) = 4 cos(4t), then a(t) = 4 times minus 4 sin(4t), which is minus 16 sin(4t). Minus 4 sin(4t) collects the factor only once. Notice that a(t) is minus 16 times s(t).
\[ v(t) = 4\cos(4t), \quad a(t) = -16\sin(4t) = -16\,s(t) \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 255 — Checkpoint 3.39
Commit to an answer before revealing. Acceleration is the derivative of velocity, so you must differentiate twice, and the question is whether you apply the chain rule both times.
The first derivative brings out a factor of 4: the velocity is 4 cos 4t. The second derivative brings out another factor of 4 and a minus sign: the acceleration is minus 16 sin 4t. If you chose minus 4 sin 4t, you collected the inner factor only once.
Look at the last line: the acceleration is minus 16 times the position. That relationship, acceleration proportional to minus position, is the signature of simple harmonic motion, such as a mass on a spring. The 16 is the square of the inner rate 4, which is why faster oscillations need stronger restoring forces.
Section
Part 5
Concept
Start from the definition of the derivative of h, the composite, at a.
\[ h'(a) = \lim_{x\to a}\frac{f\big(g(x)\big) - f\big(g(a)\big)}{x - a} \]
Multiply and divide by the change in the inner function, assuming it is not zero for x near a:
\[ h'(a) = \lim_{x\to a}\frac{f\big(g(x)\big) - f\big(g(a)\big)}{g(x) - g(a)}\cdot\frac{g(x) - g(a)}{x - a} \]
Figure (svg): Left: a curve g with a secant line through the points at a and at x. Right: a curve f with a secant line through the points at g of a and g of x. Below, the two secant slopes multiply to give the secant slope of f of g.
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 255 — Proof
The general proof follows exactly the same idea as the derivation for sin of x cubed. Start from the definition of the derivative of the composite at a, and multiply and divide by the change in the inner function.
The picture shows what that split means. On the left is the inner function g with a secant line between a and x. On the right is the outer function f with a secant line between g of a and g of x. The product of the two secant slopes is exactly the secant slope of the composite, as the numbers at the bottom confirm.
As x approaches a, each secant slope turns into a tangent slope. The only assumption so far is that g of x is different from g of a near a, so that the division is allowed. Keep an eye on that assumption.
Concept
The second factor
Why: It is the definition of g prime at a.
\[ \lim_{x\to a}\frac{g(x) - g(a)}{x - a} = g'(a) \]
Continuity of g
Why: A differentiable function is continuous, so the inner output approaches g of a.
\[ \lim_{x\to a}g(x) = g(a) \]
Change variables
Why: Let y equal g of x and b equal g of a; y approaches b.
\[ \lim_{x\to a}\frac{f\big(g(x)\big) - f\big(g(a)\big)}{g(x) - g(a)} = \lim_{y\to b}\frac{f(y) - f(b)}{y - b} = f'\big(g(a)\big) \]
Multiply the limits
Why: Both limits exist, so the product's limit is the product.
\[ h'(a) = f'\big(g(a)\big)\,g'(a) \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 256 — Proof
The second factor is the definition of g prime at a, with no work needed. The first factor is the subtle one, and the argument has two moves.
First, g is differentiable at a, so it is continuous there, and g of x approaches g of a as x approaches a. Second, rename the inner output y and its target b. The first factor becomes the change in f over the change in its input, as that input approaches b, which is the definition of f prime at b, that is, f prime of g of a.
Both limits exist, so the limit of the product is the product of the limits, and the chain rule follows. Notice that continuity of g is what makes the renaming legitimate: it guarantees that as x closes in on a, the inner output closes in on g of a.
Counterexample
Discussion prompt
The proof assumed that g(x) never equals g(a) for x near a (other than at a itself). Give a function g for which this fails, say which line of the proof breaks, and say whether the chain rule itself still holds.
Write your example before revealing. The book calls this proof very informal precisely because of this assumption, and finding where it fails is the best way to understand the proof.
The simplest example is a constant inner function. Then the change in g is always zero, and multiplying and dividing by it divides by zero. The rule itself survives: the composite is a constant, with derivative zero, and the rule also gives zero because g prime is zero.
A more interesting example is x squared times sin of one over x near zero, which returns to zero infinitely often as x approaches zero, so there is no interval around zero where the assumption holds. Rigorous proofs repair the gap by defining the first quotient to equal f prime of g of a at any point where the change in g is zero; you will see that version in an analysis course.
Worked example
No formulas are given: only values of the functions and their derivatives.
\[ h(x) = f\big(g(x)\big), \quad g(1) = 4, \quad g'(1) = 3, \quad f'(4) = 7 \]
Apply the chain rule at x equal to 1
Why: The outer derivative is evaluated at the inner output g of 1.
\[ h'(1) = f'\big(g(1)\big)\,g'(1) \]
Substitute the inner values
Why: g of 1 is 4 and g prime of 1 is 3.
\[ h'(1) = f'(4)\cdot 3 \]
Substitute the outer value
Why: f prime of 4 is 7.
\[ h'(1) = 7\cdot 3 = 21 \]
Check with a model
Why: Any functions with these values must give the same answer; take g equal to 3x plus 1 and f equal to 7u, so h is 21x plus 7.
\[ g(x) = 3x+1,\; f(u) = 7u \;\Longrightarrow\; h(x) = 21x + 7, \quad h'(1) = 21 \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 256 — Example 3.57
Sometimes you are not given formulas at all, only values of functions and their derivatives at particular points. The chain rule works perfectly well with that information, provided you evaluate each piece at the right place.
Write the chain rule at x equal to 1 first, symbolically. Then substitute in stages: the inner function's value and derivative at 1, then the outer derivative at the inner output, which is 4. The answer is 7 times 3, which is 21.
The check builds simple functions that have exactly the given values: g equal to 3x plus 1, and f equal to 7u. Their composite is 21x plus 7, whose derivative is 21. Any functions with the same values at those points must give the same answer, because the chain rule uses nothing else. The common error is to use f prime of 1 instead of f prime of 4.
Concept
Name the layers with letters: u for the inner output, y for the final output.
\[ u = g(x), \quad y = f(u) = f\big(g(x)\big) \]
\[ h'(x) = \frac{dy}{dx}, \quad f'\big(g(x)\big) = f'(u) = \frac{dy}{du}, \quad g'(x) = \frac{du}{dx} \]
\[ \frac{dy}{dx} = \frac{dy}{du}\cdot\frac{du}{dx} \]
Written this way, the chain rule looks like fractions cancelling a du. That makes it easy to remember and to extend: three layers give three factors, with each intermediate variable appearing once on top and once below.
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 256 — Rule: Chain Rule Using Leibniz's Notation
Leibniz notation names every quantity with a letter and writes each derivative as a ratio of small changes. With u for the inner output and y for the final output, the three derivatives in the chain rule become dy by dx, dy by du, and du by dx.
In that notation the chain rule reads as if the du cancels, and this is why physicists love it. It makes the rule hard to forget, and it extends immediately to longer chains: a chain through u and then v gives three factors, and each intermediate variable appears once on top and once underneath.
The notation also reminds you what each factor measures, which the prime notation hides. In the balloon problem later, dV by dr and dr by dt say exactly which rate is which.
Notation
Annotate
On: \( \frac{dy}{dx} = \frac{dy}{du}\cdot\frac{du}{dx} \)
Step through the annotations. The first is the rate you are after, the final output against the original input.
The second is the outer rate, and it comes out naturally in terms of u, because you differentiate with u as the variable. That is convenient while you work, but u is not the original variable, so the answer is not finished until you substitute the formula for u in terms of x.
The last annotation matters for understanding. The symbols dy, du and dx here are not numbers, and dy by du is a limit, not a fraction. The cancellation is a reliable memory aid because the rule is true, but the rule is true because of the limit argument, not because of the cancellation.
Worked example
\[ y = \left(\frac{x}{3x+2}\right)^5 \]
Name the inner variable
Why: Let u be the quotient; then y is a fifth power of u.
\[ u = \frac{x}{3x+2}, \quad y = u^5 \]
Find du by dx with the quotient rule
Why: The numerator is 3x plus 2 minus 3x.
\[ \frac{du}{dx} = \frac{1\cdot(3x+2) - x\cdot 3}{(3x+2)^2} = \frac{2}{(3x+2)^2} \]
Find dy by du
Why: Power rule in u.
\[ \frac{dy}{du} = 5u^4 \]
Multiply
Why: The Leibniz chain rule.
\[ \frac{dy}{dx} = 5u^4\cdot\frac{2}{(3x+2)^2} \]
Replace u by its formula in x
Why: The answer must be in the original variable.
\[ \frac{dy}{dx} = 5\left(\frac{x}{3x+2}\right)^4\cdot\frac{2}{(3x+2)^2} \]
Simplify
Why: The powers of 3x plus 2 combine to the sixth.
\[ \frac{dy}{dx} = \frac{10x^4}{(3x+2)^6} \]
Check at x equal to 1
Why: The formula gives 10 over 5 to the sixth, 0.00064, and a numerical slope gives 0.000640.
\[ \frac{10(1)^4}{5^6} = \frac{10}{15625} = 0.00064 \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 257 — Example 3.58
The Leibniz method is a clean way to organise a problem like this one, where the inside is itself a quotient. Name the quotient u, so the function is simply u to the fifth.
Compute the two rates separately. The quotient rule gives du by dx: the numerator is 3x plus 2 minus 3x, which is just 2, over the square of 3x plus 2. The power rule gives dy by du, 5u to the fourth.
Multiply, then replace u by its formula in x, as the book insists. The powers of 3x plus 2 combine: four from the substituted u and two from du by dx give the sixth power. The check at x equal to 1 gives 0.00064, a tiny slope, which makes sense: the quotient is one fifth there, and its fourth power, which multiplies everything, is less than two thousandths.
Worked example
\[ y = \tan(4x^2 - 3x + 1) \]
Name the inner variable
Why: The quadratic inside the tangent.
\[ u = 4x^2 - 3x + 1, \quad y = \tan u \]
Find both rates
Why: One in x, one in u.
\[ \frac{du}{dx} = 8x - 3, \quad \frac{dy}{du} = \sec^2 u \]
Multiply
Why: The Leibniz chain rule.
\[ \frac{dy}{dx} = \sec^2 u\cdot(8x - 3) \]
Replace u
Why: Back to x.
\[ \frac{dy}{dx} = \sec^2(4x^2 - 3x + 1)\cdot(8x - 3) \]
Check at x equal to 0
Why: The inside is 1, so the formula gives minus 3 times sec squared of 1, minus 10.276556, matching a numerical slope.
\[ -3\sec^2(1) \approx -10.276556 \]
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 257 — Example 3.59
Name the quadratic u, so the function is tan u. The two rates are 8x minus 3 and secant squared of u.
Multiply them and substitute the quadratic back in for u. The final answer is secant squared of the quadratic, times 8x minus 3.
The check at x equal to 0 is a good one because the inside is simply 1 there, so the formula gives minus 3 times secant squared of 1, about minus 10.28, and a numerical slope agrees. Compare this with the Leibniz trap later: the line just before the substitution is correct but not yet an answer.
Fill the middle
\[ y = \cos(x^3), \quad u = x^3, \quad \frac{dy}{du} = -\sin u, \quad \frac{du}{dx} = 3x^2 \]
Fill in the blanks
\fracx^33x^2 = -\sin\left(___\right)\cdot ___
Why: Multiply the two rates, then replace u by x cubed so the answer is entirely in x: minus sin of x cubed times 3x squared. At x equal to 1 that is minus 3 sin 1, about minus 2.524, matching a numerical slope. Writing sin u and stopping leaves the answer in the wrong variable.
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 257 — Checkpoint 3.41
The two rates are given above the blanks: dy by du is minus sin u, and du by dx is 3x squared. Your job is to multiply them and express the result in x alone.
The first blank is the inside of the sine, which must be x cubed, not u, because the answer has to be in the original variable. The second blank is the inner rate, 3x squared.
This is the same function as the chain rule's opening example with cosine in place of sine, and the structure of the answer is identical: the outer derivative at the inner output, times the inner derivative. At x equal to 1 it gives about minus 2.524, matching a numerical slope.
Trap
Example 3.59, stopped one line early:
\[ \frac{dy}{dx} = \sec^2 u\cdot(8x - 3) \]
Incomplete. This mixes two variables.
The question was asked in x, so the answer must be a function of x alone. Replace u by the inner function before stopping; otherwise nobody can evaluate the derivative at a given x.
\[ \frac{dy}{dx} = \sec^2(4x^2-3x+1)(8x-3) \]
This is the characteristic error of the Leibniz method. The line on the left is correct as far as it goes, but it contains both u and x, and a derivative with respect to x should be a function of x alone.
The problem is practical, not just a matter of style. If someone asks for the slope at x equal to 0, the incomplete answer cannot be evaluated until u is worked out again. Substitute the inner formula as the last step, every time.
The book's remark after Example 3.58 says exactly this: when using the Leibniz form, the final answer must be expressed entirely in terms of the original variable.
Intuition
Before the limit, the changes are genuine numbers, and the fractions really do cancel:
\[ \frac{\Delta y}{\Delta x} = \frac{\Delta y}{\Delta u}\cdot\frac{\Delta u}{\Delta x} \quad (\Delta u \ne 0) \]
The catch is the condition in brackets. If the inner change is zero for x arbitrarily close to a, the middle fraction is undefined, which is exactly the gap in the informal proof. The Leibniz form hides that step; the limit argument has to deal with it.
Before any limit is taken, the small changes are genuine numbers, and the change in y over the change in x really does equal the product of the two fractions, just by cancelling the change in u. That is why the Leibniz form feels so natural.
The catch is the condition in brackets: the change in u must not be zero. For some inner functions it is zero for inputs arbitrarily close to the point, and then the middle fraction is undefined no matter how small the step. This is exactly the gap you met in the informal proof.
So use the cancellation freely as a way to remember and organise the chain rule, and remember that the rule is guaranteed by the limit argument, which handles the awkward case separately.
Real world
Figure (svg): A circle of radius r, 5 centimetres, representing a balloon, surrounded by a thin shaded shell out to a dashed circle of radius r plus dr. Beside it: the volume formula, its derivative, the radius rate 2 centimetres per second, and the resulting volume rate, 200 pi, about 628 cubic centimetres per second.
Discussion prompt
A spherical balloon's radius grows at 2 cm per second. How fast is its volume growing when the radius is 5 cm? Name the inner and outer functions.
Work out the answer before revealing, and name the layers first. The input is time. The radius is a function of time, so it is the inner function. The volume is a function of the radius, the outer function.
The chain rule in Leibniz form says the volume's rate is dV by dr times dr by dt. The first factor, 4 pi r squared, is the surface area of the sphere, and the picture shows why: the new volume is a thin shell whose volume is roughly the surface area times the added thickness. At a radius of 5, with the radius growing 2 centimetres per second, the volume grows at 200 pi, about 628 cubic centimetres per second.
Notice that the same inflation rate adds more and more volume as the balloon grows, because the surface area grows. This kind of problem, where two rates are linked through a formula, is the whole subject of related rates in Chapter 4.
Section
Part 6
Pattern
Figure (svg): A flow diagram. A box asks which operation is applied last. Four arrows lead to: a power, a trigonometric function, a product or quotient, and a bare x. Each leads to its move: the power rule times the inside's derivative; the trig rule at the inside times the inside's derivative; the product or quotient rule, then the chain rule on each piece; and stop. A note says: repeat on every inside until only a bare x remains.
This is the procedure for any function you are asked to differentiate from now on. The single question that drives it is: which operation is applied last? That operation's rule goes outermost.
The four branches of the diagram cover every case. A power uses the power form; a trigonometric function uses its Section 3.5 derivative evaluated at the same inside; a product or quotient uses its own rule first, with the chain rule applied inside the pieces that need it; and a bare x ends the process.
Every branch except the last ends by multiplying by the derivative of the inside, and then the question is asked again of that inside. Keep going until only a bare x remains, then check the answer with a value, a sign, or a degree count.
Check
Check your understanding
What is the derivative of cos(x²)?
Answer: A
Why: The outer derivative is minus sine, evaluated at the same inside x², and it is multiplied by the inner derivative 2x. That gives minus 2x sin(x²).
Choose an answer, then read the rationale for every option, not only the one you picked. Each distractor is a specific error you have seen in this lesson.
The correct derivative has the outer derivative, minus sine, at the same inside, x squared, times the inner derivative 2x. Option B evaluates the outer derivative at the inner derivative, which the book warns against; option C forgets the inner factor; option D uses the wrong outer derivative.
Check
Check your understanding
What is the derivative of sin²(3x)?
Answer: B
Why: Three layers: the square gives 2 sin(3x), the sine gives cos(3x), and the core 3x gives 3. Multiplying the three factors gives 6 sin(3x) cos(3x).
List the layers before choosing: a square outside, a sine in the middle, and 3x at the core. Three layers mean three factors.
The factors are 2 sin 3x, cos 3x, and 3, giving 6 sin 3x cos 3x. Each wrong option drops or garbles exactly one layer, which is the typical failure in multi-layer problems. Counting factors against layers is the quickest way to catch it.
Check
Check your understanding
h(x) = f(g(x)), with g(2) = −3, g′(2) = 4 and f′(−3) = 7. What is h′(2)?
Answer: A
Why: The chain rule gives h′(2) = f′(g(2)) · g′(2) = f′(−3) · 4 = 7 · 4 = 28. The outer derivative is taken at the inner output, −3, and multiplied by the inner rate at 2.
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 256 — Checkpoint 3.40
Write the chain rule at x equal to 2 before substituting anything. It needs the outer derivative at the inner output, g of 2, which is minus 3, and the inner derivative at 2.
So the answer is f prime of minus 3 times g prime of 2, which is 7 times 4, or 28. The distractors use the inner value instead of the inner rate, add the rates instead of multiplying, or forget the inner rate altogether.
Explain it to yourself
Discussion prompt
Using a chain of two unit conversions (for example, metres to feet, then feet to inches), explain in two or three sentences why the chain rule multiplies the two derivatives instead of adding them.
Write your two or three sentences before revealing. Being able to explain the multiplication in everyday terms is the best evidence that the chain rule is more than a formula to you.
A unit conversion is a rate: feet per metre, inches per foot. Converting in two stages multiplies the factors, because the second conversion acts on every unit produced by the first. Nobody would add 3.281 and 12.
A derivative is a local conversion factor between a small change in the input and the resulting change in the output. Chain two functions and the small change passes through two conversions, so the factors multiply. That is the chain rule in one sentence.
Exit ticket
\[ y = \left(x - \frac{6}{x}\right)^8 \]
Discussion prompt
Exercise 243: find the x-coordinates at which the tangent line to this curve is horizontal.
OpenStax Calculus Volume 1, §3.6 The Chain Rule §3.6, p. 258 — Exercise 243
This exercise pulls together the power form, a quotient inside, and a use of the derivative. Find the derivative first, then decide where it is zero.
The power form gives 8 times the inside to the seventh, times the derivative of the inside, which is 1 plus 6 over x squared. That second factor is always positive, so the derivative can only be zero where the inside itself is zero: x equals 6 over x, which means x squared is 6, so x is plus or minus root 6, about 2.449.
At those points the whole function is zero, and since it is an eighth power it can never be negative, so these are the curve's lowest points. A horizontal tangent at a minimum is exactly what you should expect.
Recap
| form | derivative | remember |
|---|---|---|
| f(g(x)) | f′(g(x)) · g′(x) | outer derivative at the inner output, times the inner derivative |
| (g(x))ⁿ | n(g(x))ⁿ⁻¹ · g′(x) | roots and reciprocals are powers too |
| sin, cos, tan … of g(x) | the Section 3.5 formula at g(x), times g′(x) | Theorem 3.10: nothing new to memorise |
| h(f(g(x))) | h′(f(g(x))) · f′(g(x)) · g′(x) | one factor per layer, outside in |
| y = f(u), u = g(x) | dy/dx = dy/du · du/dx | finish in terms of x |
\[ \frac{d}{dx}f\big(g(x)\big) = f'\big(g(x)\big)\,g'(x) \]
Next, Section 3.7 uses the chain rule to differentiate inverse functions, including the inverse trigonometric functions.
Stewart, Calculus: Early Transcendentals 8e, §3.4 The Chain Rule §3.4, pp. 197-207 — the same material in Stewart
One rule and its uses. The chain rule differentiates a composition: the outer derivative evaluated at the inner output, times the inner derivative. The power form and the six trigonometric forms of Theorem 3.10 are just this rule with a particular outer function.
With the other rules, decide the outermost operation first; with three or more layers, peel from the outside in, one factor per layer. In Leibniz form the rule looks like cancellation, which makes it easy to remember, but always finish in the original variable, and remember that the proof is a limit argument.
Section 3.7 uses the chain rule to find the derivatives of inverse functions, including the inverse trigonometric functions, and Chapter 4's related-rates problems are the chain rule applied to quantities that change in time.
Want this taught 1-on-1? Alexander tutors Calculus I — $55/session, free consultation.