Multivariable chain rule
For differentiable vector maps in output-row convention, the composition Jacobian is the outer Jacobian at the inner output times the inner Jacobian at the original input.
On this page 10 sections
01Follow a concrete composition#
A change in one input can reach an output through several intermediate coordinates. The multivariable chain rule accounts for all those paths. We will first follow actual values, then calculate the two local derivative maps.
Let the first function be . It adds and multiplies the original inputs. Let the second be . It squares the first intermediate coordinate and adds the two.
Start at . Here is simply a name for the input point. Apply to get the intermediate point :
Then apply to those coordinates: . The notation means this composition: first, then .
02Build each Jacobian where its function operates#
The diagram shows values, not derivatives. To describe small changes around them, build one Jacobian for each function. We use output rows and input columns.
For , the two rows are and . At the original point :
Read as “the Jacobian of , evaluated at .” The subscript names the function. The parentheses identify the point where its partial derivatives are evaluated. Neither symbol denotes an extra multiplication.
This matrix turns a small change in into a first-order change in near .
For , the first row of derivatives is and the second is . This function received , so its Jacobian is
The six comes from at . The zero records that has no dependence on .
You will often see instead of . They mean exactly the same thing because .
Evaluating the outer derivative at the original would put in its first entry instead of . That is the derivative at an input the outer function did not receive.
03Compose the local maps in order#
Write and for a moment. A small original input change first becomes approximately . The next map turns that into .
That is why the combined Jacobian is : the rightmost matrix acts first. In full notation, for differentiable maps,
Multiply the outer Jacobian by the inner one:
The first row comes from and . The second comes from and . Each entry adds contributions through both intermediate coordinates.
rows: . rows: . Return the ordered rows of .
Show answer and explanation
: .
04Check the result and the evaluation point#
We can verify the composition without using the matrix rule. Substitute directly into :
The first output has partial derivatives and . The second has partial derivatives and . At , these give the same rows and .
The original and intermediate points are both pairs, so either would fit into the outer formulas. Their equal dimensions do not make them interchangeable.
For a nonlinear outer function, moving its evaluation point can change the derivative. Always compute the forward intermediate values before substituting into the local Jacobians.
, . At , give as ordered rows.
Show answer and explanation
Outer entry: .
05Check dimensions and account for every path#
Reversing our two square matrices is possible arithmetically, but gives the wrong map:
Matching dimensions alone cannot establish the order. Follow the input change: inner derivative first, outer derivative second.
Rectangular maps make the dimensions more visible. If takes 2 inputs to 3 outputs, its Jacobian is . If takes those 3 coordinates to 2 outputs, its Jacobian is .
The product has shape , matching two original inputs and two final outputs. Reversing these factors instead describes a array, the wrong shape for this composition.
rows: . rows: . Repair reversed factors: give as ordered rows.
Show answer and explanation
: .
The same rule includes a scalar output reached through two paths. Let , , and . At , we have and .
The outer derivative row is . The inner derivative column is . Their product is : one contribution through , plus another through .
Direct substitution gives , whose derivative at is also . Dropping either path would miss part of that change.
This is the connection to backpropagation: forward values determine where local derivatives are evaluated, multiplication carries effects through operations, and addition collects contributions that meet at the same variable.
Evaluate the intermediate input, then multiply outer by inner.
- Compute the derivative of a composed vector map using Jacobians.
Further questions
Why does the inner factor sit on the right?
Sources & further reading
- [1]MIT 18.S096, Lecture 1–2: Derivatives as Linear Operators ↗MIT OpenCourseWare · Course