Skip to content

Why the gradient points uphill

6 min read

Short answer

The rate of change of ff in a unit direction u\mathbf{u} is Duf=∇f⋅u=∥∇f∥cos⁡θD_{\mathbf{u}}f=\nabla f\cdot\mathbf{u}=\|\nabla f\|\cos\theta. This is largest when θ=0\theta=0, so the steepest ascent is along ∇f\nabla f with rate ∥∇f∥\|\nabla f\|, and it is zero along level curves, so ∇f\nabla f is perpendicular to them.

Diagram∇f
For f = x² + y², the level curves are circles. At a point, the gradient points straight outward, perpendicular to the circle (and to its tangent, dashed).

The dot-product argument

If ff is differentiable, the rate of change along a unit vector u\mathbf{u} is the dot product ∇f⋅u\nabla f\cdot\mathbf{u} (this follows from the linear approximation f(a+tu)≈f(a)+t ∇f⋅uf(\mathbf{a}+t\mathbf{u})\approx f(\mathbf{a})+t\,\nabla f\cdot\mathbf{u}). Writing the dot product with the angle θ\theta between the two vectors gives ∥∇f∥ ∥u∥cos⁡θ=∥∇f∥cos⁡θ\|\nabla f\|\,\|\mathbf{u}\|\cos\theta=\|\nabla f\|\cos\theta.

Cosine is at most 11, reached at θ=0\theta=0. So no direction beats the gradient's own direction, and the maximum rate is exactly ∥∇f∥\|\nabla f\|. The most negative rate, −∥∇f∥-\|\nabla f\|, is in the opposite direction, which is why gradient descent follows −∇f-\nabla f.

Why it is perpendicular to level curves

Along a level curve f=cf=c, the function does not change, so the rate of change along its tangent direction T\mathbf{T} is zero: ∇f⋅T=0\nabla f\cdot\mathbf{T}=0. Hence ∇f\nabla f is perpendicular to the tangent, that is, to the curve itself. In three variables the same argument shows ∇f\nabla f is normal to level surfaces, which is how the tangent plane to a surface F(x,y,z)=cF(x,y,z)=c 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, ∥∇f∥\|\nabla f\| is large; where they are far apart the function is nearly flat. At a critical point ∇f=0\nabla f=\mathbf{0} and no direction is preferred.

Worked example

For f(x,y)=x2+2y2f(x,y)=x^2+2y^2 at (1,1)(1,1), find the direction and rate of steepest ascent, and a direction in which ff does not change to first order.

∇f=(2x, 4y)=(2,4)\nabla f=(2x,\,4y)=(2,4) at (1,1)(1,1).

Steepest ascent: direction 120(2,4)=15(1,2)\tfrac{1}{\sqrt{20}}(2,4)=\tfrac1{\sqrt5}(1,2), with rate ∥∇f∥=20≈4.47\|\nabla f\|=\sqrt{20}\approx4.47.

A level direction must be perpendicular to (2,4)(2,4), such as (2,−1)(2,-1) since (2,4)⋅(2,−1)=0(2,4)\cdot(2,-1)=0. Along it ff stays constant to first order.

Try it yourself

For f(x,y)=xyf(x,y)=xy at (2,3)(2,3), what is the direction of steepest ascent and the maximum rate of change?

Show the answer

∇f=(y, x)=(3,2)\nabla f=(y,\,x)=(3,2). The direction is 113(3,2)\tfrac1{\sqrt{13}}(3,2) and the maximum rate is 13≈3.61\sqrt{13}\approx3.61.

Keep going with practice

Vidi's gradient lessons connect this dot-product argument to contour plots.