2.1 Partial derivatives and the gradient
Once a quantity depends on more than one variable — pressure , velocity , temperature in a metal bar — we need partial derivatives. The single-variable derivative from Foundations 1.1 generalises naturally: differentiate with respect to one variable while holding the others fixed. The vector of all such partial derivatives is the gradient, the first vector operator we need.
This lesson develops partial derivatives, the total differential, the gradient, and the directional derivative that ties the gradient to a geometric “steepest ascent” interpretation.
Partial derivatives
A partial derivative measures the rate of change of a multivariate function with respect to one variable while holding the others fixed:
The notation (instead of ) is a reminder that other variables are sitting still — the partial derivative differs from the total derivative when those other variables themselves depend on through some implicit relation. For most of physics the distinction is mainly bookkeeping; you write when there’s any possibility of confusion.
Mixed partials commute for smooth :
(Strictly: this holds for with continuous second derivatives. Almost every physical field satisfies the condition, and we will use the identity without worrying.) Commutativity matters: it is the algebraic fact that drives the identity in the next lesson, and it underlies the existence of energy and entropy as state functions in thermodynamics.
Visualising vector fields
Before getting to the gradient, an interactive that lets you build intuition for the four canonical 2-D vector fields we’ll see throughout this chapter.
at probe (0.60, 0.30):
| F | (0.60, 0.30) |
|---|---|
| ∇·F | 2.00 |
| (∇×F)z | 0.00 |
Every point flows outward from the origin. Divergence = 2 everywhere (source). Curl = 0 (irrotational).
The interactive demonstrates the three first-order vector operators on four canonical 2-D fields. Pick a field, slide the probe to any point, and read off the values of , , and there. The visual signature of each operator is worth absorbing:
- Divergence ≠ 0 → arrows point outward (positive) or inward (negative) at that point.
- Curl ≠ 0 → arrows tend to circulate around that point.
- A pure gradient field has zero curl (look at the radial and gradient-of-scalar presets).
We develop divergence and curl properly in 2.2; for now, focus on the gradient arrow, which is the topic of this lesson.
Small increments: the total differential
A first-order Taylor expansion (Foundations 1.3) of a multivariate function around a base point reads
This is the total differential — the linear approximation to how changes when all its inputs change by infinitesimal amounts. It is the multivariate analogue of from single-variable calculus.
This identity is doing real work throughout the Sound book whenever we linearise an equation around equilibrium. For instance, the speed of sound emerges from — a one-line Taylor expansion of pressure-as-a-function-of-density at constant entropy. The wave equation’s adiabatic equation of state (Sound 4.4) is exactly this small-increment statement.
The gradient
∇φ = (1.60, 0.80), |∇φ| = 1.79 — the gradient arrow is *perpendicular to the local contour* and points in the direction of steepest ascent.
The interactive shows a scalar field as a contour plot, with the gradient drawn as a red arrow at a movable probe point. Two things to absorb:
- The gradient points perpendicular to the contour line through the probe — the direction of steepest ascent.
- The magnitude measures how steeply the field rises in that direction; long arrows where contours are close, short arrows where they’re far apart.
For a scalar field , the gradient is the vector of partial derivatives:
It points in the direction of steepest increase of ; its magnitude is the rate of increase in that direction. Physically: the gradient of pressure points from high to low pressure (with a minus sign supplied by the dynamics), and that gradient is the force per unit volume on a fluid element.
The operator on its own is called del or nabla. Acting on a scalar field it produces a vector (the gradient). Acting on a vector field via the dot product, it produces a scalar (the divergence — next lesson). Acting via the cross product, it produces a vector (the curl — next lesson). The same operator, three different operations.
Directional derivative
The gradient encodes more than just “steepest ascent.” It also tells you the rate of change in any chosen direction.
The directional derivative of at a point in direction (a unit vector) is
where is the angle between and . Three things follow:
- The maximum directional derivative is , achieved when aligns with . (This is the “gradient points in the steepest ascent” statement, made quantitative.)
- The minimum is , achieved when is anti-parallel to — the direction of steepest descent.
- The directional derivative is zero perpendicular to — i.e. along the level set (contour) through the probe point. Moving along a contour, does not change, so its directional derivative there is zero.
The directional derivative of f at a point r in direction û is Dûf = ∇f · û = |∇f| cos φ, where φ is the angle between ∇f and û. Drag the black probe to choose a point; slide θ to rotate the blue direction arrow. The right panel plots ∇f · û as a function of θ — a cosine of amplitude |∇f|, peaked at the gradient direction (red dashed line) and zero perpendicular. This is what "the gradient points in the direction of steepest ascent" means quantitatively: among all unit directions, the gradient gives the largest directional derivative.
Pick a scalar field, drag the probe to a point, and slide the angle . The blue arrow is the unit direction ; the red arrow is the gradient at that point. The right panel plots as a function of — a cosine of amplitude , peaked at the gradient direction (red dashed) and zero perpendicular. The whole “gradient is steepest ascent” claim is exactly this cosine.
What’s next
The next lesson, 2.2 — Divergence and curl, develops the two operators that act on vector fields (rather than scalar). Divergence measures outflow per unit volume; curl measures local rotation. Both are essential to fluid dynamics and electromagnetism — and to the wave equation that comes out of them.