Picture a hot air balloon rising into the sky. As it climbs, the air around it gets colder. So how fast is the temperature near the balloon dropping, second by second?
That question is hiding two separate rates. The balloon's height changes over time. The temperature changes with height. To answer the question, you need both rates, linked together.
This kind of linked dependency is everywhere. One quantity feeds into a second, and the second feeds into the thing you actually care about. The rule for finding the combined rate is called the chain rule, and once you see how it works, you'll notice it everywhere in calculus.
Composition is just two functions in a row
Before we talk about rates, let's get comfortable with the setup. When we write , we mean: take , run it through first, then take that result and run it through .
Say and . Plug in . First squares it: . Then takes the sine of that: .
That two-step process, input through , then through , is called composition. We write the combined function as , or sometimes . Nothing fancy is happening yet. It's just a pipeline: one function's output becomes the next function's input.
Hover a stage to see its own local rate. Drag the slider and watch both stages update together.
Drag the slider and watch both stages update together. Notice that is always positive, since we're squaring. That's a small preview of something useful: what happens at the first stage constrains what the second stage ever sees.
Why would the rates multiply, not add?
Now for the actual question. If is changing at some rate, and is changing at some rate, what's the rate of the combined function ?
The instinct a lot of people have is to add the two rates. That feels natural, since we're used to rates combining by addition almost everywhere else. But it's the wrong instinct here, and the reason is worth sitting with.
Think about what a "rate" really means for a moment: it's how much the output stretches or shrinks for a tiny nudge in the input. If stretches a tiny interval by a factor of 3, and then stretches that result by a factor of 4, the input interval doesn't end up 3 + 4 = 7 times bigger. It ends up times bigger, because the second stretch acts on the already-stretched interval, not on the original one.
Drag the handle to shrink the interval. The funnel shapes show it stretching through g, then again through f.
Drag the handle to shrink the little interval around . Watch the funnel shape: the interval widens or narrows on the way to , then widens or narrows again on the way to . As the interval shrinks, the measured stretch factors lock onto the exact derivative values, and the total stretch always equals the product of the two stage stretches. Never the sum.
Think of it as a gear train
Here's a physical picture that makes the multiplication obvious. Imagine three gears connected in a row. The first gear turns at some steady speed. It drives the second gear, which turns at a rate scaled by the gear ratio between them. That second gear drives a third, scaled again by its own ratio.
If the first gear turns at 1 rotation per second, and the second gear's ratio doubles that, the second gear turns at 2 rotations per second. If the third gear's ratio triples whatever comes in, the third gear turns at rotations per second. Each gear multiplies the rate it receives. It doesn't add its own speed on top.
The input gear turns at a steady rate. Each gear after it multiplies the rate by its own local derivative.
That's exactly the chain rule. The "input crank" is moving at a steady rate. The first gear is , scaling that rate by . The second gear is , scaling the result by . Hit play and slide around, including through zero, where hits 0 and the whole train stalls for an instant.
Let's check the guess with real numbers
A picture and an analogy are convincing, but numbers settle it. Take our running example, . We can estimate its derivative at any point two different ways: by nudging a tiny bit and measuring the actual change (a numerical estimate), or by using the chain rule formula directly.
If the chain rule is right, those two numbers should agree, and they should agree more closely the smaller the nudge gets.
Shrink h and watch the secant line rotate onto the dashed chain-rule tangent line.
Shrink toward zero and watch the secant line (the "measured" slope through two nearby points) rotate onto the dashed tangent line (the chain rule's predicted slope). The numeric estimate and the formula converge to the same number, because that's what a derivative is: the limit a secant line approaches as the two points it passes through merge into one.
Writing it in the language of calculus
Now that the idea is solid, the notation is just a shorthand for what we already believe. If and , we write the chain rule as:
Read it exactly like the gear train: is how fast changes as changes, and is how fast changes as changes. Multiply them and you get how fast changes as changes.
In function notation, the same rule looks like this:
For our running example, so , and so . Chaining them together:
That matches exactly what the numerical check above converges to. Let's try two more, quickly. For , the outer function is and the inner is :
And for , the outer function is and the inner is :
Same move every time: find the outer function, find the inner function, take each derivative on its own, then multiply.
The short version
Whenever one function is tucked inside another, a change to the input ripples through both stages before it reaches the output. Each stage scales that ripple by its own local rate. Since the second stage acts on the already-scaled result of the first, the two rates multiply instead of add.
That's the whole chain rule: . Find the outer function's derivative, find the inner function's derivative, and multiply them together. Everything else, gear trains, funnels, secant lines, is just a way of making that multiplication feel obvious instead of memorized.
All visualizations are interactive React components running entirely in your browser, built with inline SVG. No libraries beyond React.