Directional Derivatives and the Gradient
The partial derivatives measure slope along the two axes; the directional derivative measures slope along any chosen direction, and equals the gradient dotted with a unit vector. The gradient points in the direction of steepest increase, its length is the greatest rate, and it stands perpendicular to level curves and surfaces, which fixes the tangent plane to a level surface.
╌╌╌╌
The partials and report the rate of change of along the - and -axes. Standing on a hillside, those are the slopes due east and due north. The rate of change in an arbitrary compass direction is the directional derivative, and collecting the two partials into one vector (the gradient) gives every directional slope at once, including the steepest.
The directional derivative
Let be a unit vector. Stepping from a distance in the direction lands at . The rate of change of per unit distance along that direction is the limit of the difference quotient.
The two partials are the special cases along the axes: gives , and gives . Geometrically, is the slope of the surface in the vertical plane through carrying the direction , the slope of the tangent to the curve where that plane meets the surface.
Computing that limit directly is unnecessary. For a differentiable function it reduces to the partials.
The proof applies the chain rule to : . Writing by its angle, , the formula is .
The gradient vector
The formula is a dot product of with the vector of partials. That vector has a name.
With this, the directional derivative is a single dot product,
the scalar projection of the gradient onto . Every slope in every direction is read off the one vector .
Steepest ascent
Because , where is the angle between and , the directional derivative is largest when , that is when points along .
Three facts, one for each value of :
- Uphill fastest. increases most rapidly in the direction of , at rate .
- Downhill fastest. decreases most rapidly in the direction of , at rate .
- Level. is momentarily unchanging in the directions perpendicular to , the directions along the level curve.
Gradient perpendicular to level curves
The last bullet has a geometric consequence. Along a level curve the value of is constant, so its rate of change in the tangent direction of the curve is zero. But that rate is , so is orthogonal to the curve's tangent: the gradient meets every level curve at a right angle, pointing toward higher values.
Two objects follow from this.
Gradient field. Plotting as an arrow based at each point produces the gradient vector field, laid over the contour map. Every arrow crosses its contour perpendicularly and points uphill; arrows are long where contours crowd (steep ground) and short where they spread (flat ground).
Steepest-ascent path. A curve that follows the gradient at every point, always turning to head straight uphill, cuts across the contours at right angles everywhere. This is the path of steepest ascent, and the same idea run downhill, following , is the geometry behind gradient-descent optimization.
Level surfaces and tangent planes
For three variables the picture rises one dimension. If a surface is a level surface , take any curve lying on through . Then is constant, and differentiating by the chain rule,
Since is a tangent vector to an arbitrary curve on , the gradient is perpendicular to every tangent direction at : it is a normal vector to the surface.
This subsumes the earlier tangent plane. A graph is the level surface , whose gradient is ; the normal equation reduces to , the tangent-plane formula for a graph.
The perpendicularity of the gradient to level sets is what makes constrained optimization tractable: at a constrained optimum the gradient of the objective and the gradient of the constraint are parallel, because both are normal to the same tangent direction.
╌╌ END ╌╌