Gradient — Definition, Formula & Examples
The gradient is a vector that collects all the partial derivatives of a multivariable function, pointing in the direction where the function increases most rapidly. Its magnitude tells you how steep that increase is.
For a scalar-valued function that is differentiable at a point , the gradient of at , denoted , is the vector in whose -th component is the partial derivative evaluated at . Geometrically, is orthogonal to the level set of passing through and points in the direction of greatest rate of increase of .
Key Formula
Where:
- = A differentiable scalar-valued function of n variables
- = The independent variables of the function
- = The gradient vector (read "del f" or "nabla f")
How It Works
To compute the gradient, take the partial derivative of the function with respect to each variable separately, then assemble those derivatives into a vector. At any given point, the gradient vector points "uphill" — the direction you would walk to increase the function value as quickly as possible. Moving in the opposite direction, , gives the steepest descent. The directional derivative of in any unit direction equals , so the gradient encodes the rate of change in every direction at once. If the gradient is the zero vector at a point, that point is a critical point where no single direction produces a first-order change.
Worked Example
Problem: Find the gradient of and evaluate it at the point .
Step 1: Partial derivative with respect to x: Differentiate with respect to , treating and as constants.
Step 2: Partial derivative with respect to y: Differentiate with respect to , treating and as constants.
Step 3: Partial derivative with respect to z: Differentiate with respect to , treating and as constants.
Step 4: Assemble and evaluate: Write the gradient vector and substitute .
Answer: . This vector points in the direction of steepest increase of at that point, and its magnitude gives the maximum rate of increase.
Another Example
Problem: Given , find the direction of steepest ascent at the point and the rate of increase in that direction.
Step 1: Compute the gradient: Take partial derivatives and form the vector.
Step 2: Find the direction (unit vector): Normalize the gradient to get a unit vector.
Step 3: State the maximum rate of increase: The magnitude of the gradient equals the maximum directional derivative.
Answer: At , the function increases fastest in the direction at a rate of 10 units per unit distance.
Why It Matters
The gradient is central to Multivariable Calculus (Calc III) and appears in nearly every topic that follows — directional derivatives, tangent planes, Lagrange multipliers, and the divergence theorem. In machine learning, gradient descent uses to iteratively minimize a loss function, making it the engine behind training neural networks. Physics and engineering rely on the gradient to describe electric fields (), heat flow, and fluid pressure changes.
Common Mistakes
Mistake: Writing the gradient as a scalar instead of a vector.
Correction: The gradient is always a vector. Each component is a partial derivative, and the result has the same number of components as the function has input variables.
Mistake: Confusing the gradient direction with the direction of the level curve.
Correction: The gradient is perpendicular to level curves (2D) or level surfaces (3D). It points away from the level set toward higher values, not along it.
