Multivariable calculus
Use gradients and Jacobians as local linear models, then check the approximation numerically.
On this page
The question for today
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 , the partial derivative with respect to varies while holding 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.
The gradient predicts every unit direction
To find the rate along a unit direction , take the dot product . The Cauchy–Schwarz inequality shows that this is largest when 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.
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.
Work it through
Check a tangent prediction against the exact change
Let . Predict its value at using the derivative at .
Evaluate the starting value: . Differentiate while holding the other variable fixed: .
At the gradient is . The displacement is , giving the first-order change .
Predict . Direct substitution gives , so the prediction misses by only .
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.
The living notebook
Explore the model
Interactive lab · function
Treat the curve as a local slice
Inspect , its tangent slope , and area from zero to x. Hold coefficient a fixed while moving x, then change a. The family's gradient in coordinates is ; this slice lab does not render a general surface or Hessian.
- y at chosen x
- 0.608
- Tangent slope · 2ax
- 1.35
- Signed area · ax³/3
- 0.182
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.
Pause & reason
Check your understanding
Your turn
Try it yourself
For , predict the first-order change at for displacement , 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 . The exact value changes from to , an increase of . A direction tangent to a level set at one point need not follow that curved level set for a finite straight step.
Keep the idea
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.