Gradient of a Scalar Field: Explained with Examples
Stand on a hillside in thick fog. You cannot see the summit, but you can feel which way the ground slopes most steeply under your feet. That “steepest uphill direction” — together with how steep it is — is exactly what the gradient captures. For any smooth quantity that varies through space, like temperature, pressure, or elevation, the gradient is a vector pointing in the direction of fastest increase.
If f(x, y, z) is a scalar field (one number at every point), its gradient is the vector field ∇f = (fx, fy, fz), where ∇ (called “del” or “nabla”) is the vector of partial-derivative operators (∂/∂x, ∂/∂y, ∂/∂z). The gradient’s direction is the direction of steepest ascent, its length is the slope in that direction, and it is always perpendicular to the level surfaces f = constant.
Key Concepts
- Scalar field: one number at each point (temperature, height, pressure). Vector field: one vector at each point (wind velocity).
- Gradient: ∇f = (∂f/∂x, ∂f/∂y, ∂f/∂z) — differentiate once per variable and assemble the vector.
- Directional derivative: the rate of change of f in the direction of a unit vector û is Dûf = ∇f · û.
- Steepest ascent: the maximum rate of increase is |∇f|, attained in the direction ∇f/|∇f|; the maximum decrease is in the opposite direction.
- Geometry: ∇f is perpendicular to level curves and surfaces; ∇f = 0 at local maxima, minima, and saddle points.
Formulas
- ∇f = (fx, fy, fz)
- Dû f = ∇f · û, where û is a unit vector
- Maximum increase rate = |∇f| = √(fx² + fy² + fz²)
Worked Example
For f(x, y, z) = x² + 2y² − 3z, find ∇f at (1, 1, 1) and the fastest rate of increase there.
- Differentiate. fx = 2x, fy = 4y, fz = −3, so ∇f(x, y, z) = (2x, 4y, −3).
- Evaluate at (1, 1, 1): ∇f = (2, 4, −3).
- Steepest increase rate: |∇f| = √(2² + 4² + (−3)²) = √(4 + 16 + 9) = √29 ≈ 5.39 per unit distance.
- Direction of steepest increase: (2, 4, −3)/√29.
- Sanity check along the x-axis û = (1, 0, 0): Dûf = ∇f · û = 2, which is smaller than 5.39 — as expected, the x-axis is not the steepest path.
Common Misconceptions
- “The gradient points downhill.” It points uphill, toward the fastest increase; −∇f points downhill.
- “The gradient is just a list of derivatives.” Direction matters — it is a vector with geometric meaning: steepest ascent and normal to level sets.
- “A bigger gradient means a bigger function value.” The gradient measures the slope, not the height — a flat high plateau has ∇f = 0.
Real-World Applications
- Machine learning: gradient descent follows −∇f of the loss function to train models.
- Physics: force is the negative gradient of potential energy (F = −∇U); heat flows along −∇T.
- Topography: steepest-ascent paths and contour maps are drawn from gradients.
- Optimization: the gradient drives most numerical minimization algorithms.
The gradient turns a scalar field into a compass: at every point it points to the fastest way up, and its length says how steep that way is. Compute it by differentiating once per variable, use the dot product with a direction for the slope that way, and remember that walking opposite the gradient is the fastest way down — the idea behind gradient descent.
Related blogs
- Functions of Several Variables: Explained with Examples
- Partial Derivatives: Rules and Examples Fully Explained
- Higher-Order Partial Derivatives Explained Simply
- Total Differential: Definition, Approximation, Chain Rule
- Chain Rule for Several Variables: Explained with Examples
- Jacobians in Calculus: Definition, Formula and Examples