Why the Multivariate Chain Rule Is a Sum
As t moves, x and y move at once. The rate of change of f is the directional derivative along the velocity (x'(t), y'(t)), and a dot product is a sum — so each intermediate variable contributes its own term.
The question
Let , where and are themselves functions of a single variable :
The single-variable chain rule says: differentiate the outside, times the derivative of the inside. But here there are two insides, and , and both are moving at once. Which one do you multiply by? The answer is: both — and you add the results:
This note explains why the plus sign is there, and why it could not be anything else. The short version: is a directional derivative, taken in the direction the point is actually moving. A directional derivative is a dot product, and a dot product is a sum.
Directional derivatives: how fast does f change in a given direction?
Stand at a point and walk in a direction given by a unit vector . The directional derivative is the rate at which changes per unit distance walked in that direction:
If is differentiable, this limit has a closed form in terms of the gradient
namely
Read that dot product as a sentence: the -component of the direction, , is weighted by how sensitive is to ; the -component, , is weighted by how sensitive is to ; then add. Each coordinate contributes its own term, because moving in direction means moving in and in at the same time.
Two facts about this formula do most of the work below:
- The gradient points in the direction of steepest increase of , and its length is the slope in that direction.
- The dot product is the component of the gradient along : it measures how much of ’s steepness is aligned with the direction you are actually walking.
If is not a unit vector but a general vector , the same dot product still gives a rate of change — now per unit of whatever parameter is a velocity with respect to, rather than per unit distance. That distinction matters in the next section: our velocity is a velocity with respect to , and is a rate per unit .
The motion picks the direction
Now let the point move. As increases by a small amount , the point moves by approximately
So the point is travelling, at this instant, in the direction of the velocity vector
The rate at which changes as the point sweeps along is therefore the directional derivative of in the direction — the rate per unit along this motion:
That is the whole argument in one line. Everything after this is just expanding the dot product.
The diagram shows the motion at one instant: the point , its velocity (red), and the velocity split into its horizontal part and its vertical part (blue). The motion is one arrow, but it has two components — and each component will contribute one term.
Expanding the dot product gives the sum
Write out component by component:
That is Eq. 2. Each term has the same shape — sensitivity times speed — and the two terms are added because the dot product adds them:
- : how much changes because is moving, holding fixed. The partial derivative is the sensitivity to ; is how fast is moving.
- : how much changes because is moving, holding fixed.
If only moved (), the second term would vanish and you would recover the single-variable chain rule. If only moved, the first term would vanish. In general both move, so both terms are present.
Why a sum, not a product?
The linear approximation makes the addition unavoidable. For small displacements,
Small changes in add: a nudge in changes by roughly , a nudge in changes it by roughly , and to first order the two nudges do not interfere with each other. Divide by and let :
A product would come from a term like , but that is second order — it shrinks like , so it disappears in the limit. The derivative only sees first-order effects, and first-order effects add. This is the same reason the total differential is a sum:
and dividing by gives Eq. 2 again.
Worked example: check it both ways
Take
Directly. Substitute first, then differentiate:
By the chain rule. The partials are and , and , , so
The two routes agree, as they must. At the contributions are easy to read off:
| Channel | Sensitivity | Speed | Contribution | | — | — | — | — | | through | | | | | through | | | | | total | | | |
The -channel contributes twice as much as the -channel here, even though is “more sensitive” to in isolation at some points — what matters is sensitivity times speed along the actual motion.
A second example: contributions can cancel
Suppose that at some instant
Then
Moving in alone would push up at rate ; moving in alone would pull it down at rate . Moving in both at once, the net rate is . The sum is doing real work here: it lets the two channels partly cancel. A product could never produce that — it could not even get the sign right in general, since a product of a positive and a negative contribution is negative, while the sum can be either.
Geometrically, , where is the angle between the gradient and the velocity. The rate is largest when the motion aligns with the gradient, zero when the motion is perpendicular to it (you are walking along a level curve), and negative when the motion opposes the gradient. All of that is the dot product talking — and the dot product is a sum over coordinates.
The general form, and backprop
With intermediate variables and , the same argument gives one term per variable:
where . In matrix form this is a Jacobian times an Jacobian — and matrix multiplication is itself a sum over the shared index. The plus sign in the chain rule and the plus sign in matrix multiplication are the same plus sign.
This is also why backpropagation sums over paths. If a loss depends on a weight through several activations , then
each path from to contributes its own sensitivity-times-speed term, and the total gradient is the sum over paths. A node that feeds the loss through two routes contributes twice — once per route — for exactly the reason above: the point is moving in two coordinates at once, and first-order changes add.
Checklist and pitfalls
- Partial vs total. In Eq. 2, holds fixed, while is the total rate along the motion. Do not swap them: would be meaningless here, since has no argument of its own.
- Differentiability matters. The argument needs differentiable at and differentiable at . Mere existence of the partials is not quite enough in pathological cases; continuous partials are a safe sufficient condition.
- If also depends on directly, say , there is one more channel — time itself — and one more term: .
- Units check. Each term is (change in per unit ) times (change in per unit ), i.e. change in per unit — as it must be, since all terms are added to give .