Why does the chain rule multiply by the derivative of the inside function?
Differentiate a composite function with the chain rule, one layer at a time, and use it for slopes and tangent lines.
Is just ? runs the same wave twice as fast: at the slopes are and . The inside moves times as fast as , so .
A composite : is the inside, the outside. E.g. has derivative : outside, times inside.
The chain rule: , or . In words: outside(inside kept) inside.
The common shapes: , , , .
Any base : , so ; and , so . With an inside : times .
More layers, one link at a time: : outside , middle , inside .
Times the inside's derivative
Common mistake .
Correction Times the inside's derivative : .
Same wave, twice as fast
Let's test it. Put sine x and sine two x side by side. Sine two x runs the exact same wave, just on fast-forward: twice as fast. Watch them both leave zero. At zero, sine x climbs out with slope one. Sine two x shoots out twice as steep, with slope two.
So every slope along the wave gets multiplied by two. So cosine two x isn't the whole story. Our new guess: the derivative of sine two x is two cosine two x. Let's see why.
Inside and outside
Look at three x plus one, squared. That's two jobs, one right after the other. First job, the inside: take x, triple it, add one. Call that u. u equals three x plus one.
y equals u squared. In general, y equals f of g of x. g works first, on the inside. f works last, on the outside. Can't tell which part is the inside?
Pretend you're putting a number, like five, into a calculator. Whatever you'd compute first is the inside. Try it on sine squared x. That's sine x, squared: you take the sine first, so sine x is the inside. But sine of x squared: you square first, so x squared is the inside.
And if the inside is just x? Its derivative is one. Times one changes nothing, so you never even noticed it. Back to three x plus one, squared. We can also go the long way.
Expand: nine x squared, plus six x, plus one. Take the derivative, term by term: eighteen x, plus six. Now factor it a sneaky way: two, times three x plus one, times three. Look at the pieces. Two times three x plus one: that's the outside's derivative, with the inside left alone.
And the extra three tagging along? The inside's slope. Maybe that's a fluke, you might say. So try a curved inside: x squared plus one, squared. Expand: x to the fourth, plus two x squared, plus one.
Take the derivative: four x cubed, plus four x. Factor it the same way: two, times x squared plus one, times two x. Look at the tag-along this time. It isn't a number anymore... It's two x: the inside's derivative.
Bet you can beat the algebra now. Call the shot on the cube before you expand it: three, times x squared plus one, squared, times two x. Check it once the long way. Expand: x to the sixth, plus three x to the fourth, plus three x squared, plus one. Its derivative: six x to the fifth, plus twelve x cubed, plus six x.
And the guess multiplies out to six x to the fifth, plus twelve x cubed, plus six x. An exact match.
Why multiply? From the definition
We've seen that it works. But why do the slopes multiply, instead of add? Let's prove it, straight from the definition. By definition, the derivative of f of g of x is the limit, as h goes to zero, of f of g of x plus h, minus f of g of x, all over h. That's crowded. So give the two insides names.
The triangle is g of x plus h. The square is g of x. So it's the limit of f of triangle, minus f of square, over h. Now multiply and divide by triangle minus square: g of x plus h, minus g of x. As long as the inside really moves, that's not zero, so we're allowed.
That splits into a product of fractions: f of triangle minus f of square, over triangle minus square... times g of x plus h, minus g of x, over h.
As h goes to zero, where does the triangle go? The triangle slides right into the square, because g is differentiable, so it's continuous. No jumps. The first fraction: the change in f over the change in its input, with the triangle heading to the square. It has the same form as the derivative at a point: f of t minus f of a, over t minus a, as t goes to a. Here the triangle plays t, and the square plays a.
Since f is differentiable at the square, that's f prime of the square: f prime of g of x. And the second fraction is just the definition of g prime of x. So the derivative of f of g of x is f prime of g of x, times g prime of x.
Name the inside: the chain rule
Letters make this easier to carry around. Call the square u. u is g of x, and y is f of u. Then f prime of g of x is dy du: how fast y changes with u. And g prime of x is du dx: how fast u changes with x.
The du's look like they cancel, but dy du and du dx aren't plain fractions: the rates multiply. On our example: u is three x plus one, and y is u squared. dy du is two u, du dx is three. Two u times three is six u. Put u back: six times three x plus one, eighteen x plus six, the same as the long way.
And officially, this has a name: the chain rule. For g differentiable at x and f differentiable at g of x, the derivative of f of g of x is f prime of g of x, times g prime of x. Say it like this: the outside's derivative, with the inside kept just as it is, times the inside's derivative. Outside first, then inside. So, our opening bet.
The outside is sine, so cosine two x, with the two x kept inside, times the inside's derivative, two... Two cosine two x, just what the graph showed at zero.
Box shapes and layers
Some shapes show up all the time. Put the inside in a box. A power of the box gives n times the box to the n minus one... times the box's derivative. e to the box gives e to the box, unchanged... times the box's derivative. The natural log of the box, with the box positive, gives one over the box, times the box's derivative... the box's derivative over the box.
Sine of the box gives cosine of the box, times the box's derivative.
Cosine and tangent go the same way: negative sine of the box, and secant squared of the box wherever tangent of the box is defined, each times the box's derivative. Watch that minus sign. And a square root, with the box positive: the power rule again, the box's derivative, over two root the box. These aren't new rules to cram. It's one move in different outfits: the outside's derivative, the box kept, times the box's derivative.
Three functions stacked inside each other? Peel them one at a time, from the outside in. Take e to the sine of four x. An e on the outside, a sine in the middle, and four x deep inside. Peel the e first.
It stays e to the sine of four x, unchanged. Step in and peel the sine. That gives cosine of four x, with four x kept inside. The core, four x, gives four. Now multiply all three links: e to the sine four x, times cosine four x, times four.
So y prime is four cosine four x, times e to the sine four x. Link times link times link: that's why it's called a chain.
Any base a
The chain rule also shows where the a to the x rule comes from, for any positive base a. Rewrite it with base e. e and natural log undo each other, so a to the x is e to the natural log of a to the x. In the log of a power, the exponent hops to the front. So a to the x is e to the x natural log a.
Now it's e to an inside. The outside stays, e to the x natural log a... times the inside's derivative, natural log a, because the inside is just x times that number. Put a to the x back: the derivative of a to the x is a to the x, times natural log a.
For example, two to the x gives two to the x, times natural log two. Quick check: what if a is e? Natural log e is one, so e to the x stays e to the x. It fits. New today: logs of any base. Log base a of x is natural log x over natural log a, for a positive base other than one.
That's the change-of-base formula, so its derivative is one over x natural log a. So log base two of x gives one over x natural log two.
Example 1: a square root
Example one. f of x is the square root of x squared plus five. Find f prime of x, then the tangent line at x equals two. The plan: this is a composite. The outside is a square root. The inside is x squared plus five, because you'd compute that first.
Part a. Calculus likes powers better than roots, so write it as a power: x squared plus five, to the one half. The outside's derivative: one half, times x squared plus five, to the negative one half. The inside stays as it is. And don't stop writing yet: times the inside's derivative, two x. On a free response, write the whole line, times two x included.
The negative one half power sends the root downstairs: two x over two root x squared plus five. The twos cancel... x over root x squared plus five. You've got f prime now. Try part b, the tangent line at x equals two, before I do. Part b. A tangent line needs two things: a point, f of two, and a slope, f prime of two.
First the point. Plug two into f: root of two squared plus five... root nine, three. Then the slope. Plug two into f prime: two over root nine... two thirds. Put the point and the slope together. So here is our line: y equals three, plus two thirds, times x minus two.
No need to simplify it. In the picture, the line touches the curve at two, three. There's one just like it in your workbook: catch the inside's derivative before you check the solution.
Common mistake: the inside's derivative
Back to part a for a moment, because this is where people lose points. On the 2025 AP exam, free-response question five began with the derivative of e to an inside, and the first point was for that derivative itself: an answer alone could not earn it. Now our part a. Here's where it goes wrong: f prime of x equals one half, x squared plus five, to the negative one half... and it stops. Then f prime of two comes out one sixth.
Every time you finish an outside, ask: times what? Times the inside's derivative, two x. So f prime of x is x over root x squared plus five, and f prime of two is two thirds.
Example 2: product and chain
Example two. h of x is x squared, times e to the negative three x. Where does its graph have a horizontal tangent line? The plan: a horizontal tangent means slope zero, so we solve h prime of x equals zero. Looks busy? It's just a product, x squared times e to the negative three x, with a chain inside, e to the negative three x. The two rules sit right under the problem.
Knock out the chain first: e to the negative three x stays, times the inside's derivative, negative three.
Now the product rule: two x, times e to the negative three x... plus x squared, times negative three e to the negative three x. To set it equal to zero, factor. Don't divide by x: that throws away the solution x equals zero. Pull out x, e to the negative three x. What's left: two minus three x.
Can e to the negative three x ever be zero? No. e to any power is positive. So x is zero, or two minus three x is zero: x equals two thirds. So x is zero or two thirds. That's C. Choice D, zero and negative two, is what you get when the negative three goes missing: two plus x instead of two minus three x.
Classic trap: the inside's derivative, dropped. Your turn: there's one like this in your workbook, a product with a chain inside. Write every factor out.
Example 3: three layers
Example three. f of x is sine squared of three x. Find f prime of pi over twelve. The chain rule and its shapes are under the problem. First, rewrite that floating two: sine squared of three x means sine of three x, all squared.
Looks scary? It's three short links: the square, the sine, and three x.
Peel them. The square gives two sine three x, the sine gives cosine three x, and the inside gives three. Two times three: six sine three x cosine three x. Now x is pi over twelve. Multiply by three first: three x is pi over four. Everybody's favorite angle.
Sine of pi over four is root two over two. Cosine, the same. Six, times root two over two, times root two over two... six times two fourths. Three. So the answer is C. One more like this in your workbook.
Peel it one link at a time.
Worked examples
Example 1
Let . (a) Find . (b) Write an equation of the tangent line to the graph of at .
Hint
Outside , inside .
Answer and solution
Tangent line: y = 3 + (2/3)(x - 2).
Example 2
Let . At which -values does the graph of have a horizontal tangent line?
Hint
Horizontal means .
Answer and solution
Answer C.
e^(-3x) > 0, never 0. So x = 0 or 2 - 3x = 0, x = 2/3. Answer C.