Gradient vector in 3D

A translucent blue paraboloid with level rings and teal gradient arrows pointing uphill, drawn on the surface and flat on the floor.Drag to turn

The gradient of a differentiable function of several variables is the vector of its partial derivatives. It points in the direction of steepest increase of the function, and its length is the rate of increase in that direction.

What the gradient vector is

For a function f(x, y), the gradient is written grad f or ∇f. It is the vector (∂f/∂x, ∂f/∂y). A partial derivative is the rate of change of f when one variable moves and the others are held fixed.

For three variables the gradient has three components, and in general it has one component per input. At each point in the domain, the gradient is a single vector, so it forms a vector field.

Why it points uphill

The directional derivative of f in the direction of a unit vector u is D_u f = ∇f · u. This holds when f is differentiable at the point. The dot product equals |∇f| cos θ, where θ is the angle between ∇f and u.

The value cos θ is largest, equal to 1, when θ = 0. So the steepest increase is along ∇f, and the rate there is |∇f|. The steepest decrease is along -∇f, and the rate is -|∇f|. Along directions perpendicular to ∇f, the rate is zero.

Worked example with f(x, y) = x² + y²

Here ∂f/∂x = 2x and ∂f/∂y = 2y, so ∇f = (2x, 2y). At the point (1, 2), ∇f = (2, 4). Its length is the square root of 2² + 4² = 4 + 16 = 20, which is about 4.47.

Take the unit direction u = (1, 0). Then D_u f = (2, 4) · (1, 0) = 2·1 + 4·0 = 2. This is smaller than 4.47, as expected, because u is not along the gradient.

The level curve through (1, 2) is x² + y² = 5, a circle. The tangent to this circle at (1, 2) has direction (2, -1). Check: (2, 4) · (2, -1) = 4 - 4 = 0. The gradient is perpendicular to the level curve.

Common misconceptions

The gradient is a vector in the input space, not a number and not a point on the graph. It lives in the plane of x and y, not in the third dimension of the surface.

The gradient does not point toward the global maximum. It gives only the local direction of fastest increase. Also, the gradient is perpendicular to level curves only where it is nonzero.

Where the gradient shows up

Optimization uses the gradient because critical points occur where ∇f = 0 for a differentiable function. Gradient descent algorithms repeatedly step along -∇f to lower a function's value.

In physics, a force can be written as the negative gradient of a potential energy function. In geometry, the gradient gives the normal vector to a level curve or level surface, which is used to build tangent lines and tangent planes.

Key terms

Gradient
The vector of all first partial derivatives of a function, written ∇f.
Partial derivative
The derivative of a multivariable function with respect to one variable, with the others held fixed.
Directional derivative
The rate of change of a function at a point in a chosen unit-vector direction, equal to ∇f · u.
Level curve
The set of points where a two-variable function takes one constant value.
Unit vector
A vector of length 1, used to specify a direction.
Critical point
A point where the gradient is zero or does not exist.

Common questions

What does it mean when the gradient is the zero vector?

The function has no first-order change in any direction at that point. Such a point is a critical point, and it may be a maximum, a minimum or a saddle point.

Why is the gradient perpendicular to level curves?

Along a level curve the function stays constant, so the directional derivative along its tangent is zero. Since ∇f · u = 0 for that tangent direction, the gradient is perpendicular to it.

Is the gradient the same as the derivative from single-variable calculus?

For a function of one variable, the gradient reduces to the ordinary derivative f'(x). For several variables it extends that idea into a vector of partial derivatives.

Learn this with a tutor

Sidechair's AI tutor will teach this topic in 3D. Join the waitlist for early access.

We'll only email you about Sidechair. Read our privacy policy.