§ 01The Intuition — From Slope to Direction
In single-variable calculus, f′(x) gives you a single number: the slope at a point. In multivariable calculus, the "slope" depends on which direction you move, so the derivative becomes a vector.
Think of a mountainous landscape described by a height function f(x, y). At any point on the mountain, you could walk north, east, northeast, or in any of infinitely many compass directions. Each direction gives a different rate of ascent or descent. The question "how steep is it here?" has no single answer: unless you also specify a direction.
The gradient resolves this by packaging the rate-of-change information from every direction into a single vector. Once you have it, you can instantly compute the rate of change in any specific direction with a dot product. The gradient also has a beautiful geometric property: it always points directly uphill: in the direction of steepest ascent.
Prerequisites for This Page
This topic builds directly on partial derivatives. You should be comfortable computing ∂f/∂x and ∂f/∂y for polynomial, exponential, and trigonometric functions before continuing. You will also need a basic understanding of vectors, specifically the dot product: since the directional derivative formula uses it explicitly. The chain rule also appears in the derivation.
§ 02The Gradient Vector ∇f
For a differentiable function f(x, y), the gradient of f (written ∇f (read "del f" or "nabla f")) is the vector formed by collecting both partial derivatives:
The symbol ∇ (nabla) is a vector differential operator. Applying it to a scalar function f gives a vector field, at each point (x, y), the gradient is a vector in ℝ².
Notice what this means concretely. The first component ∂f/∂x measures how fast f changes as you move in the x-direction (while y stays fixed). The second component ∂f/∂y measures how fast f changes in the y-direction. The gradient vector combines these two rates into a single arrow at each point in the domain.
Component Form vs. Notation
You will encounter several equivalent ways to write the gradient. All of the following mean the same thing:
Computing the Gradient — Step by Step
The process is exactly the same as computing partial derivatives, organised into a vector:
Find ∇f for f(x, y) = x³y + 2x − y².
Differentiate with respect to x (treat y as constant):
∂f/∂x = 3x²y + 2Differentiate with respect to y (treat x as constant):
∂f/∂y = x³ − 2yAt the specific point (1, 2): ∇f(1, 2) = ⟨ 3(1)(2) + 2, 1 − 4 ⟩ = ⟨ 8, −3 ⟩
Find ∇f for f(x, y) = exsin(y) + x²y.
The term exsin(y) differentiates as ex·sin(y) (sin(y) is a constant w.r.t. x). The term x²y differentiates as 2xy.
The term exsin(y) differentiates as ex·cos(y) (ex is a constant w.r.t. y). The term x²y differentiates as x².
§ 03The Directional Derivative Dûf
The partial derivatives ∂f/∂x and ∂f/∂y only tell you the rate of change in the coordinate axis directions. The directional derivative generalises this to any direction in the plane.
Let û = ⟨ a, b ⟩ be a unit vector (meaning |û| = √(a² + b²) = 1) that specifies the direction you want to move. The directional derivative of f at a point P in the direction û is:
where û = ⟨ a, b ⟩ is a unit vector and ∇f is evaluated at the point of interest.
The dot product projects the gradient onto the direction û. The result is a scalar: the rate of change of f in the direction û.
Why Must û Be a Unit Vector?
The directional derivative measures rate of change per unit distance in a given direction. If you used a non-unit vector, the magnitude would affect the result, conflating the direction with the speed of travel. Normalising to a unit vector ensures that Dûf is purely about direction, not about how far you walk per step.
Formal Definition via Limits
Before we had the gradient formula, the directional derivative was defined as a limit. Understanding this definition clarifies why the formula works:
This is the standard difference quotient, but instead of moving along the x-axis, you move in the direction û = ⟨ a, b ⟩ by a small amount h. The partial derivative ∂f/∂x is the special case û = ⟨1, 0⟩, and ∂f/∂y is the case û = ⟨0, 1⟩.
Using the chain rule and the definition of differentiability, one can prove that this limit equals ∇f · û whenever f is differentiable: giving us the convenient formula we use in practice.
Let f(x, y) = x² + xy. Find the directional derivative at (1, 2) in the direction of the vector v = ⟨ 3, 4 ⟩.
First find the unit vector: |v| = √(9 + 16) = 5
û = ⟨ 3/5, 4/5 ⟩At (1, 2): ∇f(1, 2) = ⟨ 2(1) + 2, 1 ⟩ = ⟨ 4, 1 ⟩
Moving from (1, 2) in the direction of ⟨3, 4⟩, the function f increases at a rate of 3.2 per unit distance.
Let f(x, y) = x²y − y³. Find the rate of change of f at the point (2, 1) in the direction making angle θ = π/3 with the positive x-axis.
∂f/∂x = 2xy, ∂f/∂y = x² − 3y²
At (2,1): ∇f = ⟨4, 4 − 3⟩ = ⟨4, 1⟩
§ 04Maximum Rate of Change and Steepest Ascent
The directional derivative Dûf = ∇f · û depends on the angle between the gradient vector and the direction û. Using the geometric definition of the dot product:
Here θ is the angle between ∇f and û. Since |û| = 1 (unit vector), the formula simplifies to |∇f|cos θ.
This immediately gives us three fundamental results:
| Angle θ | Direction | Dûf | Meaning |
|---|---|---|---|
| θ = 0° | Parallel to ∇f (same direction) | +|∇f| (maximum) | Steepest ascent |
| θ = 90° | Perpendicular to ∇f | 0 | No change — along a level curve |
| θ = 180° | Anti-parallel to ∇f | −|∇f| (minimum) | Steepest descent |
The maximum rate of change of f at a point P is the magnitude of the gradient at P. The direction that achieves this maximum is the unit vector pointing in the same direction as ∇f.
Similarly, the minimum rate of change (most negative) is −|∇f|, in the direction −∇f / |∇f|.
Let f(x, y) = 4x² − y². Find: (a) the direction of steepest ascent at (1, 2), (b) the maximum rate of change, and (c) the direction along which f does not change.
At (1, 2): ∇f(1, 2) = ⟨8, −4⟩
Direction of steepest ascent: û = ∇f / |∇f|
|∇f| = √(64 + 16) = √80 = 4√5 û = ⟨8/(4√5), −4/(4√5)⟩ = ⟨2/√5, −1/√5⟩f does not change when moving perpendicular to ∇f = ⟨8, −4⟩. A vector perpendicular to ⟨8, −4⟩ is ⟨4, 8⟩ (swap components, negate one), or its unit version ⟨1/√5, 2/√5⟩.
Steepest ascent direction: ⟨2/√5, −1/√5⟩
Maximum rate of change: 4√5 ≈ 8.94
Level-curve direction: ⟨1/√5, 2/√5⟩
§ 05Level Curves and Gradient Perpendicularity
A level curve of f(x, y) is the set of all points where f equals a fixed constant k:
On a topographic map, level curves are the contour lines, curves of constant elevation. Moving along a level curve keeps you at the same height, so f is not changing at all in that direction.
This connects directly to the gradient: since Dûf = 0 when û is tangent to a level curve, and since Dûf = ∇f · û = 0 means ∇f ⊥ û, we get the key theorem:
Application: Finding Tangent Lines to Implicit Curves
The perpendicularity of ∇f to level curves gives an elegant method for finding tangent lines to implicitly defined curves. If a curve is defined by F(x, y) = k, then at any point (x₀, y₀) on the curve, the tangent line is perpendicular to ∇F(x₀, y₀). Since ∇F is the normal vector to the tangent line, the tangent line equation is:
This is the equation of the line through (x₀, y₀) with normal vector ∇F(x₀, y₀).
Find the tangent line to the ellipse x² + 4y² = 20 at the point (2, 2).
Let F(x, y) = x² + 4y². The ellipse is the level curve F = 20.
At (2, 2): ∇F = ⟨4, 16⟩
§ 06The Gradient in Three Dimensions
Everything extends naturally to functions of three variables f(x, y, z). The gradient becomes a vector in ℝ³:
The directional derivative formula remains the same: Dûf = ∇f · û, where û = ⟨a, b, c⟩ is now a unit vector in ℝ³ (satisfying a² + b² + c² = 1).
In three dimensions, the analogue of a level curve is a level surface: the set of all points (x, y, z) where f equals a constant k. The gradient ∇f at a point P is perpendicular to the level surface through P. This is the key fact used in many applications:
Let f(x, y, z) = xyz². Find the gradient and the directional derivative at (1, 2, 3) in the direction of v = ⟨ 1, 1, −1 ⟩.
∂f/∂x = yz², ∂f/∂y = xz², ∂f/∂z = 2xyz
At (1, 2, 3): ∇f = ⟨2·9, 1·9, 2·1·2·3⟩ = ⟨18, 9, 12⟩
Find the equation of the tangent plane to the surface x² + y² + z² = 14 at the point (1, 2, 3).
Let F(x,y,z) = x² + y² + z². The surface is F = 14 (a level surface).
∇F = ⟨2x, 2y, 2z⟩At (1,2,3): ∇F = ⟨2, 4, 6⟩: this is normal to the tangent plane.
§ 07Further Worked Examples
The following examples cover a broader range of function types and question styles. Work through them yourself before reading the solutions, each one highlights a different aspect of the gradient or directional derivative.
Let f(x,y) = x² − 2xy + y². Verify that the directional derivative in the direction û = ⟨1/√2, 1/√2⟩ at any point (a, a) (on the line y = x) is zero. Interpret this geometrically.
At (a, a): ∇f = ⟨2a − 2a, −2a + 2a⟩ = ⟨0, 0⟩
The rate of change is zero in every direction at these points.
Notice that f(x,y) = (x−y)² ≥ 0, and f = 0 precisely on the line y = x. Every point on y = x is a global minimum, so f has zero rate of change there, the gradient is the zero vector at all these points, confirming that (a, a) lies at the bottom of a valley.
Let f(x,y) = ln(x² + y²). At the point (1, 0), find all unit vectors û such that Dûf = 1.
∂f/∂x = 2x/(x²+y²), ∂f/∂y = 2y/(x²+y²)
At (1,0): ∇f = ⟨2/1, 0/1⟩ = ⟨2, 0⟩
Let û = ⟨cosθ, sinθ⟩. Then:
Dûf = ⟨2,0⟩ · ⟨cosθ, sinθ⟩ = 2cosθ = 1 cosθ = 1/2 → θ = ±π/3Two directions (symmetric about the x-axis) give a rate of change of exactly 1. This makes geometric sense: the set of directions achieving a given rate D = ∇f · û = c is a pair of vectors at equal angles from ∇f.
§ 08Common Mistakes
§ 09Test Your Understanding
Ten questions covering every concept from this page: gradient computation, directional derivatives, steepest ascent, level curves, and 3D gradients. Try each question before revealing the explanation.