Source scope: §4.5.1, PDF pages 28. Numerical examples, experiments, added derivations, and practice are teaching supplements unless identified as source results.
Track one input through two functions
Let g(x)=(x,x2)T and f(z1,z2)=z1+3z2. Direct substitution gives (f∘g)(x)=x+3x2 and derivative 1+6x. We can get the same answer by multiplying local derivatives rather than expanding the composition.
The single-variable chain rule is
(f∘g)′(x)=f′(g(x))g′(x).
The outer derivative is evaluated at the inner output, not at the original input.
Proposition 12. For differentiable g:Rn→Rm and f:Rm→Rk,
Jf∘g(x)=Jf(g(x))Jg(x).
The dimensions are (k×m)(m×n)=k×n. The rightmost matrix acts first on an input increment. Differentiability at the relevant points is an explicit prerequisite of the rule; the source leaves it implicit in the statement.
In our example Jg(x)=(1,2x)T is 2×1 and Jf=(1,3) is 1×2. Their product is 1+6x. At x=2, the two pathways contribute 1 and 12, giving 13 in total.
Turn the Jacobian row into a gradient column
Corollary 1. When k=1, f:Rm→R and g:Rn→Rm give
∇(f∘g)(x)=Jg(x)T∇f(g(x)).
The shape is (n×m)(m×1)=n×1. Transposing the Jacobian product reverses factor order: (JfJg)T=JgTJfT. This explains both the transpose and the backward direction of scalar derivative propagation. The source states the Jacobian rule without proof and obtains the corollary from ∇f=JfT.
Added explanation of the rule. A small input change h produces Jgh in the intermediate space and then Jf(Jgh) in the output space. Differentiability makes omitted errors small relative to ∥h∥. This composition is the product JfJg, with derivatives evaluated at their respective base points.
Transfer
Let g(x)=Bx−b for B∈Rm×n, and f(z)=∥z∥22. Then Jg=B and ∇f(z)=2z, so ∇(f∘g)(x)=2BT(Bx−b). Its n entries describe how the loss changes with each input parameter, not with each of the m residuals.
Explore the relationship
Explore it yourself
Follow both derivative paths
How do the two paths from x to the scalar output combine?
Preparing interactive controls…
Check your reasoning
Make a prediction
If g maps R\u00b3 to R\u00b2 and f maps R\u00b2 to R, what is the shape of the composite gradient?