Why the gradient points uphill
6 min read
Short answer
The rate of change of in a unit direction is . This is largest when , so the steepest ascent is along with rate , and it is zero along level curves, so is perpendicular to them.
The dot-product argument
If is differentiable, the rate of change along a unit vector is the dot product (this follows from the linear approximation ). Writing the dot product with the angle between the two vectors gives .
Cosine is at most , reached at . So no direction beats the gradient's own direction, and the maximum rate is exactly . The most negative rate, , is in the opposite direction, which is why gradient descent follows .
Why it is perpendicular to level curves
Along a level curve , the function does not change, so the rate of change along its tangent direction is zero: . Hence is perpendicular to the tangent, that is, to the curve itself. In three variables the same argument shows is normal to level surfaces, which is how the tangent plane to a surface is built.
What the gradient does not tell you
The gradient points toward the locally steepest increase. It does not point toward the global maximum; on a ridge-shaped landscape it can point sideways across the ridge. Its length measures steepness: where contour lines bunch together, is large; where they are far apart the function is nearly flat. At a critical point and no direction is preferred.
Worked example
For at , find the direction and rate of steepest ascent, and a direction in which does not change to first order.
at .
Steepest ascent: direction , with rate .
A level direction must be perpendicular to , such as since . Along it stays constant to first order.
Try it yourself
For at , what is the direction of steepest ascent and the maximum rate of change?
Show the answer
. The direction is and the maximum rate is .
Keep going with practice
Vidi's gradient lessons connect this dot-product argument to contour plots.