The Multivariable Chain Rule

⚡ Key Takeaways

One-line statement: The multivariable chain rule computes the derivative of a composition of functions when intermediate quantities depend on several variables, summing contributions through every dependency path. Key result in words: The total rate of change equals the sum, over all intermediate variables, of (rate of change of the output w.r.t. that intermediate) × (rate of change of that intermediate w.r.t. the input). Where it applies: Functions Rn→Rm\mathbb{R}^n \to \mathbb{R}^m composed with other multivariable functions; physics, optimization, machine learning (backpropagation), thermodynamics, differential geometry. Who/when: Rooted in Leibniz's and Newton's calculus (1670s); generalized to multiple variables through the 18th–19th century (Euler, Cauchy); formalized via the Jacobian by the late 1800s.

💡 The Core Insight

A change in an input variable propagates to the output through every chain of dependencies. To find the total derivative, you trace each path from input to output, multiply the local derivatives along that path, and add up all the paths. The "sum over paths" is the heart of the matter; the matrix-product formulation is just this sum written compactly.

Formal Statement

DefinitionPartial and Total Derivatives

Let z=f(x1,…,xn)z = f(x_1, \dots, x_n) be a differentiable function. The partial derivative ∂f∂xi\frac{\partial f}{\partial x_i} measures the rate of change of ff as xix_i varies while all other xjx_j (j≠ij\neq i) are held fixed. If each xi=xi(t)x_i = x_i(t) is a function of a single parameter tt, then zz becomes a function of tt alone, and its total derivative dzdt\frac{dz}{dt} accounts for all the ways tt influences zz. The Jacobian matrix of a map f:Rn→Rm\mathbf{f}: \mathbb{R}^n \to \mathbb{R}^m, f=(f1,…,fm)\mathbf{f} = (f_1, \dots, f_m), is the m×nm \times n matrix

1
Df=(∂fi∂xj)1≤i≤m1≤j≤n.\quad D\mathbf{f} = \left(\frac{\partial f_i}{\partial x_j}\right)_{\substack{1 \le i \le m \\ 1 \le j \le n}}.

Derivation hint: stack the gradients ∇fi\nabla f_i as rows; entry (i,j)(i,j) is the sensitivity of output fif_i to input xjx_j.

TheoremMultivariable Chain Rule — Scalar Output, Curve Input

Let z=f(x1,…,xn)z = f(x_1, \dots, x_n) be differentiable at a point, and let each xi=xi(t)x_i = x_i(t) be differentiable. Then the composition z(t)=f(x1(t),…,xn(t))z(t) = f(x_1(t), \dots, x_n(t)) is differentiable and

2
dzdt=∑i=1n∂f∂xi dxidt=∇f⋅dxdt.\quad \frac{dz}{dt} = \sum_{i=1}^{n} \frac{\partial f}{\partial x_i}\,\frac{dx_i}{dt} = \nabla f \cdot \frac{d\mathbf{x}}{dt}.

Derivation hint: take the total differential dz=∑i∂f∂xi dxidz = \sum_i \frac{\partial f}{\partial x_i}\,dx_i and divide by dtdt; the dot product is gradient times velocity.

TheoremMultivariable Chain Rule — Several Independent Variables

Let z=f(x1,…,xn)z = f(x_1, \dots, x_n) where each xi=xi(t1,…,tk)x_i = x_i(t_1, \dots, t_k). Then for each j=1,…,kj = 1, \dots, k,

3
∂z∂tj=∑i=1n∂f∂xi ∂xi∂tj.\quad \frac{\partial z}{\partial t_j} = \sum_{i=1}^{n} \frac{\partial f}{\partial x_i}\,\frac{\partial x_i}{\partial t_j}.

Derivation hint: hold all tℓt_\ell (ℓ≠j\ell \neq j) fixed and apply equation [2] with tjt_j playing the role of tt.

TheoremGeneral Form — Jacobian Composition

Let g:Rk→Rn\mathbf{g}: \mathbb{R}^k \to \mathbb{R}^n be differentiable at t0\mathbf{t}_0 and f:Rn→Rm\mathbf{f}: \mathbb{R}^n \to \mathbb{R}^m be differentiable at g(t0)\mathbf{g}(\mathbf{t}_0). Then h=f∘g:Rk→Rm\mathbf{h} = \mathbf{f}\circ \mathbf{g}: \mathbb{R}^k \to \mathbb{R}^m is differentiable at t0\mathbf{t}_0 and its Jacobian factors as a matrix product:

4
Dh(t0)=Df(g(t0)) ⋅ Dg(t0).\quad D\mathbf{h}(\mathbf{t}_0) = D\mathbf{f}\big(\mathbf{g}(\mathbf{t}_0)\big)\,\cdot\,D\mathbf{g}(\mathbf{t}_0).

Derivation hint: the best linear approximation of a composition is the composition of best linear approximations; composing linear maps corresponds to multiplying their matrices.

The dimensions confirm consistency: (m×n)⋅(n×k)=(m×k)(m\times n)\cdot(n\times k) = (m\times k), exactly the Jacobian of h:Rk→Rm\mathbf{h}:\mathbb{R}^k\to\mathbb{R}^m.

Why It Holds / Derivation

ProofProof via Differentiability and Linear Approximation

We prove equation [2]; the general case [4] follows by applying it component-wise.

Step 1 — Differentiability hypothesis. Since ff is differentiable at a=x(t0)\mathbf{a} = \mathbf{x}(t_0), by definition there is a remainder function ε(h)\varepsilon(\mathbf{h}) with ε(h)→0\varepsilon(\mathbf{h})\to 0 as h→0\mathbf{h}\to 0 such that

5
f(a+h)−f(a)=∑i=1n∂f∂xi(a) hi+∥h∥ ε(h).\quad f(\mathbf{a}+\mathbf{h}) - f(\mathbf{a}) = \sum_{i=1}^n \frac{\partial f}{\partial x_i}(\mathbf{a})\,h_i + \|\mathbf{h}\|\,\varepsilon(\mathbf{h}).

Derivation hint: this is precisely the definition of (total) differentiability — linear part plus error vanishing faster than ∥h∥\|\mathbf{h}\|.

Step 2 — Increment from tt. Let h=x(t0+Δt)−x(t0)\mathbf{h} = \mathbf{x}(t_0 + \Delta t) - \mathbf{x}(t_0), so hi=xi(t0+Δt)−xi(t0)h_i = x_i(t_0+\Delta t) - x_i(t_0). Substituting into [5] and dividing by Δt\Delta t:

6
z(t0+Δt)−z(t0)Δt=∑i=1n∂f∂xi(a) hiΔt+∥h∥Δt ε(h).\quad \frac{z(t_0+\Delta t) - z(t_0)}{\Delta t} = \sum_{i=1}^n \frac{\partial f}{\partial x_i}(\mathbf{a})\,\frac{h_i}{\Delta t} + \frac{\|\mathbf{h}\|}{\Delta t}\,\varepsilon(\mathbf{h}).

Derivation hint: divide both sides of [5] by the scalar Δt\Delta t and identify z(t)=f(x(t))z(t)=f(\mathbf{x}(t)).

Step 3 — Take the limit. As Δt→0\Delta t \to 0: each hiΔt→xi′(t0)\frac{h_i}{\Delta t} \to x_i'(t_0) by differentiability of xix_i; the factor ∥h∥Δt\frac{\|\mathbf{h}\|}{\Delta t} stays bounded (it tends to ∥x′(t0)∥\|\mathbf{x}'(t_0)\|); and ε(h)→0\varepsilon(\mathbf{h})\to 0 since h→0\mathbf{h}\to 0. Hence the error term vanishes and

7
dzdt(t0)=∑i=1n∂f∂xi(a) xi′(t0).■\quad \frac{dz}{dt}(t_0) = \sum_{i=1}^n \frac{\partial f}{\partial x_i}(\mathbf{a})\,x_i'(t_0). \qquad \blacksquare

Derivation hint: product of (something bounded) and (something →0\to 0) is →0\to 0; the surviving sum is the claim.

∎
⚠️ Why differentiability — not just partial derivatives — is required

The proof crucially uses the differentiability of ff (Step 1), which is stronger than mere existence of partial derivatives. A function can have all partials at a point yet fail to be differentiable, and the chain rule can then break. Always verify differentiability (e.g., continuous partials suffice — class C1C^1).

mathematician · Augustin-Louis Cauchy | 1789–1857

While Leibniz and Newton wielded chain-rule reasoning informally, Cauchy is central to the rigorous ε\varepsilon–δ\delta foundation that makes the proof above legitimate. His insistence on precise definitions of limit and derivative transformed the chain rule from a symbolic manipulation of differentials into a theorem with hypotheses (differentiability) and a remainder analysis. The Jacobian matrix formulation that crowns the modern statement is named for Carl Gustav Jacob Jacobi (1804–1851), whose 1841 treatise De determinantibus functionalibus systematized functional determinants.

Building Intuition

🧠 Sum Over Dependency Paths

Draw a dependency graph: arrows from each input to each intermediate variable, then from each intermediate to the output. To find ∂(output)∂(input)\frac{\partial(\text{output})}{\partial(\text{input})}: 1. Find every directed path from the input node to the output node. 2. Along each path, multiply the local derivatives on its edges. 3. Sum over all paths. If zz depends on u,vu,v, and both u,vu,v depend on s,ts,t, there are two paths from ss to zz (through uu, and through vv), giving ∂z∂s=∂z∂u∂u∂s+∂z∂v∂v∂s\frac{\partial z}{\partial s} = \frac{\partial z}{\partial u}\frac{\partial u}{\partial s} + \frac{\partial z}{\partial v}\frac{\partial v}{\partial s}. The single-variable rule is the degenerate case of exactly one path.

Figure
Dependency graph for z=f(u,v)z=f(u,v) with u=u(s,t), v=v(s,t)u=u(s,t),\,v=v(s,t). Two paths carry ss to zz.
s t u v z ∂u/∂s ∂v/∂s ∂z/∂u ∂z/∂v Gold paths: the two routes from s to z that are summed.

Worked Examples

ExampleA particle's temperature along a path

Given: Temperature field T(x,y)=x2y+3yT(x,y) = x^2 y + 3y (°C, with x,yx,y in metres). A particle moves along x(t)=cos⁡tx(t) = \cos t, y(t)=sin⁡ty(t) = \sin t (metres), with tt in seconds. Find dTdt\frac{dT}{dt} at t=π/2t = \pi/2 s.

Step 1 — Partials.

8
∂T∂x=2xy,∂T∂y=x2+3.\quad \frac{\partial T}{\partial x} = 2xy, \qquad \frac{\partial T}{\partial y} = x^2 + 3.

Derivation hint: differentiate x2y+3yx^2y+3y treating the other variable as constant.

Step 2 — Velocities. dxdt=−sin⁡t\dfrac{dx}{dt} = -\sin t, dydt=cos⁡t\dfrac{dy}{dt} = \cos t.

Step 3 — Chain rule [2].

9
dTdt=(2xy)(−sin⁡t)+(x2+3)(cos⁡t).\quad \frac{dT}{dt} = (2xy)(-\sin t) + (x^2+3)(\cos t).

Derivation hint: substitute the partials and velocities into dTdt=Txx′+Tyy′\frac{dT}{dt}=T_x x' + T_y y'.

Step 4 — Evaluate at t=π/2t=\pi/2: x=cos⁡(π/2)=0x=\cos(\pi/2)=0, y=sin⁡(π/2)=1y=\sin(\pi/2)=1, sin⁡t=1\sin t = 1, cos⁡t=0\cos t = 0.

10
dTdt=(2⋅0⋅1)(−1)+(02+3)(0)=0.\quad \frac{dT}{dt} = (2\cdot0\cdot1)(-1) + (0^2+3)(0) = 0.

Derivation hint: plug numbers; both terms vanish.

dTdt∣t=π/2=0 °C/s\boxed{\dfrac{dT}{dt}\Big|_{t=\pi/2} = 0\ \text{°C/s}}
ExamplePolar-coordinate partial derivatives

Given: f(x,y)=x2+y2f(x,y) = x^2 + y^2 with x=rcos⁡θx = r\cos\theta, y=rsin⁡θy = r\sin\theta. Find ∂f∂r\frac{\partial f}{\partial r} and ∂f∂θ\frac{\partial f}{\partial \theta} at r=2r=2, θ=π/4\theta = \pi/4.

Step 1 — Partials of ff. ∂f∂x=2x\dfrac{\partial f}{\partial x} = 2x, ∂f∂y=2y\dfrac{\partial f}{\partial y} = 2y.

Step 2 — Partials of x,yx,y.

11
∂x∂r=cos⁡θ, ∂y∂r=sin⁡θ, ∂x∂θ=−rsin⁡θ, ∂y∂θ=rcos⁡θ.\quad \frac{\partial x}{\partial r}=\cos\theta,\ \frac{\partial y}{\partial r}=\sin\theta,\ \frac{\partial x}{\partial\theta}=-r\sin\theta,\ \frac{\partial y}{\partial\theta}=r\cos\theta.

Derivation hint: differentiate rcos⁡θr\cos\theta and rsin⁡θr\sin\theta w.r.t. rr and θ\theta.

Step 3 — Chain rule [3].

12
∂f∂r=2xcos⁡θ+2ysin⁡θ=2rcos⁡2θ+2rsin⁡2θ=2r.\quad \frac{\partial f}{\partial r} = 2x\cos\theta + 2y\sin\theta = 2r\cos^2\theta + 2r\sin^2\theta = 2r.

Derivation hint: substitute x=rcos⁡θ, y=rsin⁡θx=r\cos\theta,\ y=r\sin\theta and use cos⁡2+sin⁡2=1\cos^2+\sin^2=1.

13
∂f∂θ=2x(−rsin⁡θ)+2y(rcos⁡θ)=−2r2cos⁡θsin⁡θ+2r2sin⁡θcos⁡θ=0.\quad \frac{\partial f}{\partial \theta} = 2x(-r\sin\theta) + 2y(r\cos\theta) = -2r^2\cos\theta\sin\theta + 2r^2\sin\theta\cos\theta = 0.

Derivation hint: the two terms cancel — consistent with f=r2f=r^2 being independent of θ\theta.

Step 4 — Evaluate at r=2r=2: ∂f∂r=4\frac{\partial f}{\partial r} = 4, ∂f∂θ=0\frac{\partial f}{\partial\theta}=0.

∂f∂r∣r=2=4,∂f∂θ=0\boxed{\dfrac{\partial f}{\partial r}\Big|_{r=2} = 4,\qquad \dfrac{\partial f}{\partial\theta} = 0}

(Check: f=r2⇒∂f/∂r=2r=4f = r^2 \Rightarrow \partial f/\partial r = 2r = 4. ✓)

Common Misconceptions

⚠️ Distinguish ∂z∂t\frac{\partial z}{\partial t} from dzdt\frac{dz}{dt}

When z=f(x,t)z = f(x,t) has an explicit tt and also x=x(t)x = x(t), the total derivative includes both the direct and indirect dependence:

14
dzdt=∂f∂t+∂f∂xdxdt.\quad \frac{dz}{dt} = \frac{\partial f}{\partial t} + \frac{\partial f}{\partial x}\frac{dx}{dt}.

Derivation hint: tt reaches zz directly (through the explicit slot) and indirectly (through xx); sum both paths. Forgetting the ∂f/∂t\partial f/\partial t term is the single most common error in physics and economics. The notation DfDt\frac{Df}{Dt} (material derivative) in fluid dynamics is precisely this distinction made explicit.

CounterexamplePartials exist but the chain rule fails

Let

15
f(x,y)={xyx2+y2(x,y)≠(0,0)0(x,y)=(0,0).\quad f(x,y) = \begin{cases} \dfrac{xy}{x^2+y^2} & (x,y)\neq(0,0)\\[4pt] 0 & (x,y)=(0,0).\end{cases}

Derivation hint: a classic homogeneous-degree-zero example. Both partials exist at the origin: fx(0,0)=fy(0,0)=0f_x(0,0)=f_y(0,0)=0 (since f≡0f\equiv0 on both axes). Now take the path x(t)=tx(t)=t, y(t)=ty(t)=t. Then f(t,t)=t22t2=12f(t,t) = \frac{t^2}{2t^2}=\frac12 for t≠0t\neq0, so z(t)=12z(t)=\frac12 (constant), giving dzdt=0\frac{dz}{dt}=0. The naive formula fxx′+fyy′=0⋅1+0⋅1=0f_x x' + f_y y' = 0\cdot1 + 0\cdot1 = 0 happens to agree here — but ff is not even continuous at the origin (limit along y=xy=x is 12\tfrac12, along axes is 00), so it is not differentiable, and the chain rule has no theorem to stand on. The agreement is a coincidence, and along other constructions the naive formula misfires. Moral: existence of partials does not license the chain rule.

Connections

connection · Where the chain rule plugs into the wider theory

The multivariable chain rule is the computational engine behind several neighbouring results. The Gradient Vector appears as the row-vector factor ∇f\nabla f in equation [2], and the rule shows dzdt=∇f⋅v\frac{dz}{dt}=\nabla f\cdot \mathbf{v}, directly yielding the Directional Derivative. The general Jacobian form [4] is the multivariable face of the Single-Variable Chain Rule, with matrix multiplication replacing scalar multiplication. It underlies the Implicit Function Theorem (differentiate a constraint F(x,y)=0F(x,y)=0 along a curve), the change-of-variables formula in Multiple Integrals (through det⁡Dg\det D\mathbf{g}), and the transformation of vector fields in Differential Geometry. In its iterated, layered form it is exactly the Backpropagation Algorithm.

Real-World Applications

🔬 Concrete uses across science and engineering

Historical Development

⏳ History
- 1676 — Gottfried Wilhelm Leibniz develops differential notation dydy, dxdx and manipulates differentials of composite quantities, implicitly using chain-rule reasoning.
- 1690s — Johann and Jakob Bernoulli apply chain-rule techniques to curves and the brachistochrone, treating differentials of functions of functions.
- 1755 — Leonhard Euler, in Institutiones calculi differentialis, systematizes partial differentiation and differentials of functions of several variables.
- 1797 — Joseph-Louis Lagrange introduces functional/prime notation, recasting the chain rule symbolically.
- 1821 — Augustin-Louis Cauchy's Cours d'analyse supplies rigorous limit definitions, enabling a proper proof with error terms.
- 1841 — Carl Gustav Jacob Jacobi publishes De determinantibus functionalibus, establishing the Jacobian determinant and matrix as the organizing object for transformations.
- late 1800s — The matrix-product form of the chain rule [4] becomes standard as linear algebra and vector analysis mature (Gibbs, Heaviside).
- 1960s–1986 — Reverse-mode automatic differentiation is developed (Linnainmaa, 1970) and popularized as backpropagation (Rumelhart, Hinton, Williams, 1986), recognizing the chain rule as the foundation of neural-network training.

Subtleties & Limits

open-problem · Edge cases and ongoing care

The clean theorem [4] requires differentiability at the relevant points; weakening to mere directional or partial differentiability invalidates it (see the counterexample). Subtle questions persist in: (a) non-smooth analysis — chain rules for subdifferentials and Clarke generalized gradients of nonsmooth functions require careful constraint qualifications, and a single clean equation does not always hold; (b) infinite dimensions — in Banach/Fréchet spaces the chain rule for Fréchet derivatives holds, but Gâteaux differentiability is too weak, mirroring the finite-dimensional cautions; (c) automatic differentiation correctness — efficiently and exactly differentiating programs with control flow, recursion, and nondifferentiable kinks (ReLU, max⁡\max) is an active engineering and theoretical area, where the naive chain rule can yield wrong or undefined values at kinks. The conceptual rule is settled; its rigorous reach into nonsmooth and infinite-dimensional settings remains a refined subject.

See Also

Partial Derivatives · The Gradient Vector · Jacobian Matrix · Single-Variable Chain Rule · Implicit Function Theorem · Directional Derivatives · Backpropagation Algorithm · Material Derivative · Change of Variables in Multiple Integrals