core20 min studyLesson 15 in Mathematics

Multivariable calculus

Use gradients and Jacobians as local linear models, then check the approximation numerically.

On this page

What you’ll understand

  • Distinguish a partial derivative from a directional derivative.
  • Use the gradient to predict a small scalar change.
  • Compose Jacobians in the correct order and recognize a local approximation.

A temperature field depends on several coordinates; a loss depends on many parameters. A derivative must describe how these possible input changes influence an output. The gradient handles scalar outputs, the Jacobian handles vector outputs, and the chain rule connects stages. Specify what changes, what stays fixed, and where each local approximation is evaluated.

Partial derivatives inspect one coordinate at a time

For a function f(x,y)f(x,y), the partial derivative with respect to xx varies xx while holding yy fixed. It answers a controlled question rather than describing every possible path through the input plane. Collecting the partial derivatives gives the gradient. If the function is differentiable, its first-order change is the dot product of this gradient with a small displacement. The neglected remainder becomes small relative to the displacement length.

Differentiability is stronger than merely having partial derivatives at one point. The local linear model must work consistently for approaches from all directions. Continuous partial derivatives in a neighborhood are a useful sufficient condition. In physical calculations, track units: a temperature derivative per meter differs from one per centimeter. In optimization, rescaling a feature changes gradient coordinates and can change a naive algorithm's steps.

f(x+h)=f(x)+∇f(x)Th+o(∥h∥),∇f=(∂f/∂x1⋮∂f/∂xn)f(x+h)=f(x)+\nabla f(x)^Th+o(\|h\|),\qquad \nabla f=\begin{pmatrix}\partial f/\partial x_1\\\vdots\\\partial f/\partial x_n\end{pmatrix}
For a differentiable real scalar function on an open region of Euclidean space, this is a local statement as h tends to zero, not an exact formula for arbitrary steps.↔ Scroll wide equations horizontally.

The gradient predicts every unit direction

To find the rate along a unit direction uu, take the dot product ∇f⋅u\nabla f\cdot u. The Cauchy–Schwarz inequality shows that this is largest when uu points along the gradient, provided the gradient is nonzero and ordinary Euclidean distance defines a unit step. The opposite direction is steepest descent locally. A direction perpendicular to the gradient has no first-order change, although a curved function can still change at second order.

The matrix of second partial derivatives is the Hessian. For a twice continuously differentiable scalar function, it describes the leading change in the gradient and the curvature of the local quadratic approximation. A positive-definite Hessian at a stationary point establishes a strict local minimum. A zero gradient alone does not: a saddle can be stationary while increasing along one direction and decreasing along another.

Duf(x)=∇f(x)Tu,∥u∥=1;f(x+h)≈f(x)+∇f(x)Th+12hTH(x)hD_u f(x)=\nabla f(x)^Tu,\quad \|u\|=1;\qquad f(x+h)\approx f(x)+\nabla f(x)^Th+\tfrac12h^TH(x)h
The directional formula assumes differentiability. The quadratic expression is a local second-order approximation under sufficient smoothness, with a remainder omitted explicitly by the approximation sign.↔ Scroll wide equations horizontally.

A Jacobian is the derivative as a matrix

For a vector-valued function, arrange output partial derivatives in rows and input coordinates in columns. The resulting Jacobian maps a small input displacement into a predicted output displacement. Its dimensions reveal whether a proposed calculation makes sense. A function from three inputs to two outputs has a two-by-three Jacobian; multiplying it by a three-component displacement produces the required two-component prediction.

The chain rule composes these local maps: the Jacobian of an outer function multiplies the Jacobian of the inner function. This order is the same as matrix composition. Backpropagation later exploits this structure efficiently, but automatic differentiation does not establish that a model is smooth everywhere or that optimization will succeed. Here, differentiate a concrete expression, predict a small change, and compare against the exact value to learn what the derivative is promising.

Check a tangent prediction against the exact change

Let f(x,y)=x2+xy+2y2f(x,y)=x^2+xy+2y^2. Predict its value at (1.02,1.99)(1.02,1.99) using the derivative at (1,2)(1,2).

  1. Evaluate the starting value: f(1,2)=1+2+8=11f(1,2)=1+2+8=11. Differentiate while holding the other variable fixed: ∇f=(2x+y,x+4y)\nabla f=(2x+y,x+4y).

  2. At (1,2)(1,2) the gradient is (4,9)(4,9). The displacement is (0.02,−0.01)(0.02,-0.01), giving the first-order change 4(0.02)+9(−0.01)=−0.014(0.02)+9(-0.01)=-0.01.

  3. Predict f≈10.99f\approx10.99. Direct substitution gives 1.0404+2.0298+7.9202=10.99041.0404+2.0298+7.9202=10.9904, so the prediction misses by only 0.00040.0004.

The result

The exact change is −0.0096 and the linear prediction is −0.01. Their difference is a second-order correction, not a failure of the derivative's local claim.

Explore the model

Interactive lab

Interactive lab · function

Treat the curve as a local slice

Inspect y=ax2y=ax^2, its tangent slope 2ax2ax, and area from zero to x. Hold coefficient a fixed while moving x, then change a. The family's gradient in coordinates (a,x)(a,x) is (x2,2ax)(x^2,2ax); this slice lab does not render a general surface or Hessian.

Treat the curve as a local sliceThis lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Current readings: y at chosen x: 0.608; Tangent slope · 2ax: 1.35; Signed area · ax³/3: 0.182. All parameters are adjustable with the labeled controls below.−2.4−1.201.22.4−9−4.504.59xy(x, ax²)
y = ax²TangentSigned integral
y at chosen x
0.608
Tangent slope · 2ax
1.35
Signed area · ax³/3
0.182
t = 0 s

This lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forA derivative describes nearby change; a long move needs the full function or an error estimate.

Check your understanding

If a differentiable function has gradient (3,4), what is its directional derivative along the unit vector (1,0)?

Try it yourself

For f(x,y)=x2+y2f(x,y)=x^2+y^2, predict the first-order change at (1,2)(1,2) for displacement (0.1,−0.05)(0.1,-0.05), then compute the exact change.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

The gradient is (2,4). Keep the second-order squared displacements when checking the exact answer.

Compare with the solution

The linear change is 2(0.1)+4(−0.05)=02(0.1)+4(-0.05)=0. The exact value changes from 55 to 1.12+1.952=5.01251.1^2+1.95^2=5.0125, an increase of 0.01250.0125. A direction tangent to a level set at one point need not follow that curved level set for a finite straight step.

Take it with you

  • A differentiable function has one local linear model for all small directions.
  • The gradient gives scalar rates; the Jacobian gives vector-output changes.
  • Zero first-order change does not imply zero finite change or a minimum.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.