Mathematics.

multivariable calculus

The Multivariable Chain Rule

Calculus III40 minDifficulty6 out of 10

You should know: partial derivatives, chain rule

Overview

The single-variable chain rule computes d/dt[f(g(t))] = f'(g(t))·g'(t) — the rate of change of a composed function is the product of the rates of change along the way. The multivariable chain rule generalizes this when a function z = f(x,y) depends on x and y, and x and y in turn depend on other variables (like time t, or two other parameters u and v). Instead of a single product, every path from the output back to the input variable contributes a term, and the total rate of change is the SUM over all such paths. This 'multivariable chain rule' underlies related rates problems in several variables, implicit differentiation of multivariable equations, and backpropagation in neural networks (where a loss depends on outputs, which depend on weights, through many layered compositions).

Intuition

Imagine f(x,y) is the temperature at position (x,y), and a bug walks along a path so that x=x(t) and y=y(t) trace out its position over time. As the bug moves, temperature changes for two independent reasons: because x is changing (contributing ∂f/∂x times how fast x changes) AND because y is changing (contributing ∂f/∂y times how fast y changes). Since both effects act simultaneously and independently, the total rate of temperature change the bug feels is the SUM of both contributions — this is exactly the multivariable chain rule. When x and y each depend on two new variables (a 'tree' of dependencies), you sum over every branch of that tree that reaches back to the variable you're differentiating with respect to.

Formal Definition

Definition

If z = f(x,y) is differentiable and x = x(t), y = y(t) are differentiable functions of t, then z is differentiable in t with:

dzdt=fxdxdt+fydydt\frac{dz}{dt} = \frac{\partial f}{\partial x}\frac{dx}{dt} + \frac{\partial f}{\partial y}\frac{dy}{dt}
Chain rule, single parameter t
zu=fxxu+fyyu,zv=fxxv+fyyv\frac{\partial z}{\partial u} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial u} + \frac{\partial f}{\partial y}\frac{\partial y}{\partial u}, \qquad \frac{\partial z}{\partial v} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial v} + \frac{\partial f}{\partial y}\frac{\partial y}{\partial v}

When x=x(u,v) and y=y(u,v) each depend on two new variables

Chain rule, two parameters u, v
dzdt=f(dxdt,dydt)\frac{dz}{dt} = \nabla f \cdot \left(\frac{dx}{dt}, \frac{dy}{dt}\right)

The chain rule as a dot product of the gradient with the velocity vector of the path

Vector form

Notation

NotationMeaning
zu=paths xifxixiu\frac{\partial z}{\partial u} = \sum_{\text{paths } x_i} \frac{\partial f}{\partial x_i}\frac{\partial x_i}{\partial u}Sum over every intermediate variable that connects z to u along the dependency tree

Derivation

The single-parameter case follows from a linear approximation (total differential) of f, divided by a small change in t and taking the limit:

ΔzfxΔx+fyΔy+ε1Δx+ε2Δy\Delta z \approx \frac{\partial f}{\partial x}\Delta x + \frac{\partial f}{\partial y}\Delta y + \varepsilon_1 \Delta x + \varepsilon_2 \Delta y

Linear approximation of f near a point, with error terms ε₁, ε₂ → 0 as Δx, Δy → 0

ΔzΔtfxΔxΔt+fyΔyΔt+ε1ΔxΔt+ε2ΔyΔt\frac{\Delta z}{\Delta t} \approx \frac{\partial f}{\partial x}\frac{\Delta x}{\Delta t} + \frac{\partial f}{\partial y}\frac{\Delta y}{\Delta t} + \varepsilon_1\frac{\Delta x}{\Delta t} + \varepsilon_2\frac{\Delta y}{\Delta t}

Divide through by Δt

Δt0    dzdt=fxdxdt+fydydt\Delta t \to 0 \implies \frac{dz}{dt} = \frac{\partial f}{\partial x}\frac{dx}{dt} + \frac{\partial f}{\partial y}\frac{dy}{dt}

As Δt→0, Δx,Δy→0 too (by continuity), so ε₁,ε₂→0 and the error terms vanish

Properties

Additivity over paths

Each intermediate variable contributes its own product term; total derivative is the sum over all paths in the dependency graph\text{Each intermediate variable contributes its own product term; total derivative is the sum over all paths in the dependency graph}

Reduces to single-variable chain rule

If z=f(x) depends on a single intermediate variable, the rule collapses to dzdt=f(x)dxdt\text{If } z=f(x) \text{ depends on a single intermediate variable, the rule collapses to } \frac{dz}{dt}=f'(x)\frac{dx}{dt}

Theorems

Theorem 1: Multivariable Chain Rule
If f is differentiable and x,y are differentiable functions of t, then dzdt=fxx(t)+fyy(t)\text{If } f \text{ is differentiable and } x,y \text{ are differentiable functions of } t \text{, then } \frac{dz}{dt} = f_x\, x'(t) + f_y\, y'(t)
Theorem 2: Implicit Function Theorem (chain-rule corollary)
If F(x,y)=0 defines y implicitly as a function of x, then dydx=FxFy (when Fy0)\text{If } F(x,y)=0 \text{ defines } y \text{ implicitly as a function of } x \text{, then } \frac{dy}{dx} = -\frac{F_x}{F_y} \text{ (when } F_y\neq 0\text{)}

Applications

Backpropagation in neural networks is a repeated application of the multivariable chain rule: the loss depends on the output, which depends on each layer's weights through a long composition, and gradients are summed along every path in the computational graph.

Worked Examples

  1. Compute the partial derivatives of z with respect to x and y.

    zx=2xy,zy=x2\frac{\partial z}{\partial x} = 2xy, \qquad \frac{\partial z}{\partial y} = x^2
  2. Compute the derivatives of x and y with respect to t.

    dxdt=2t,dydt=3t2\frac{dx}{dt} = 2t, \qquad \frac{dy}{dt} = 3t^2
  3. Combine via the chain rule formula.

    dzdt=(2xy)(2t)+(x2)(3t2)\frac{dz}{dt} = (2xy)(2t) + (x^2)(3t^2)
  4. Substitute x=t², y=t³ and evaluate at t=1: x=1, y=1.

    dzdtt=1=(211)(2)+(1)(3)=4+3=7\frac{dz}{dt}\Big|_{t=1} = (2\cdot1\cdot1)(2) + (1)(3) = 4+3 = 7

Answer: dz/dt at t=1 is 7.

Practice Problems

Difficulty 5/10

Let z = xy, with x = t and y = t². Find dz/dt at t=2 using the chain rule.

Difficulty 6/10

Let z = x² − y², where x = 2u+v and y = u−3v. Find ∂z/∂v.

Difficulty 7/10

The area of a rectangle is A = xy where x is growing at 3 cm/s and y is shrinking at 2 cm/s. At the instant x=10 cm, y=5 cm, find dA/dt.

Common Mistakes

Common Mistake

Forgetting a term in the sum when an intermediate variable has multiple paths back to the differentiation variable.

Draw the dependency tree first: if both x and y depend on u, ∂z/∂u needs BOTH terms (∂f/∂x)(∂x/∂u) + (∂f/∂y)(∂y/∂u) — dropping either term is the most common chain-rule mistake.

Common Mistake

Using ordinary derivative notation (d/du) when partial derivatives are required because other variables (like v) are held fixed.

When x and y depend on TWO OR MORE parameters (u and v), use ∂x/∂u (partial), not dx/du, since x also depends on v which must stay fixed while differentiating with respect to u.

Quiz

If z=f(x,y), x=x(t), y=y(t), the chain rule gives dz/dt equal to:
The multivariable chain rule can be written compactly as a dot product of which two vectors?

Flashcards

1 / 3

Summary

  • The multivariable chain rule sums a product term for EACH intermediate variable connecting the output to the differentiation variable.
  • One parameter: dz/dt = f_x x'(t) + f_y y'(t). Two parameters: analogous sums for ∂z/∂u and ∂z/∂v.
  • Compactly, dz/dt = ∇f · (velocity vector of the path) — a dot product form linking the chain rule to the gradient.
  • Drawing the dependency tree prevents the most common error: dropping a term when a variable has multiple paths.
  • Backpropagation in neural networks and related-rates problems are direct applications of this rule.

References

  1. BookStewart, J. Calculus: Early Transcendentals, 8th ed. Ch. 14.5.