13 · Gradient and Directional Derivatives
Chapter 13

Gradient and Directional Derivatives

This set of notes dives deeper into the geometry of the first derivative. As a review, recall that the gradient packages the first partial derivatives:

𝑓=𝑓𝑥1,,𝑓𝑥𝑛.

Chapter 12 showed that this vector determines the differential

𝑑𝑓𝑝(𝑣)=𝑓(𝑝)𝑣.

We now use that linear derivative to measure slopes in every direction and to understand what the gradient means geometrically.

13.1Directional Derivatives

We have seen that 𝜕𝑥𝑓 and 𝜕𝑦𝑓 measure the slope of a multivariable function in the 𝑥 and 𝑦 directions, respectively. But what is its rate of change in the direction of an arbitrary unit vector 𝑢?

Definition 13.1 (Directional Derivative). The derivative of 𝑓 at 𝑝 in the direction of a unit vector 𝑢 is denoted 𝐷𝑢𝑓(𝑝) and is defined by the limit

𝐷𝑢𝑓(𝑝)=lim0𝑓(𝑝+𝑢)𝑓(𝑝).

Computing this seems difficult. But we can use the Fundamental Strategy of Calculus to save the day! If 𝑓 is differentiable at 𝑝, its linear approximation says

𝑓(𝑝+𝑢)𝑓(𝑝)=𝑓(𝑝)𝑢+𝐸(𝑢),

where the error is small compared with ||. Dividing by and taking the limit gives

𝐷𝑢𝑓(𝑝)=𝑑𝑓𝑝(𝑢)=𝑓(𝑝)𝑢.

That is, the directional derivative is just a linear combination of the basic slopes we already know!

Theorem 13.2 (Directional Derivative). If 𝑢 =𝑎,𝑏 is a unit vector, then

𝐷𝑢𝑓(𝑥,𝑦)=𝑎𝑓𝑥(𝑥,𝑦)+𝑏𝑓𝑦(𝑥,𝑦).

All of this carries over to three or higher dimensions: if 𝑢 =𝑎,𝑏,𝑐 is a unit vector and 𝑓(𝑥,𝑦,𝑧) is a three variable function then

𝐷𝑢𝑓=𝑎𝑓𝑥+𝑏𝑓𝑦+𝑐𝑓𝑧.

Any time we have a collection of sums of products of terms we should think, "Is this a dot product?" And in this case it is! If we factor the above equations into a dot product we see the directional derivative is related directly to the gradient.

Theorem 13.3 (Directional Derivatives and the Gradient). For a unit vector 𝑢,

𝐷𝑢𝑓(𝑝)=𝑓(𝑝)𝑢.
Figure 13.1 Chapter 11 held one variable fixed; nothing stops the glass from standing at any other angle. Aim the direction 𝑢—or let it sweep—and the sheet cuts its own slice through the point, drawn flat alongside with its tangent line. The slope of that line is the directional derivative, and it costs nothing new: 𝐷𝑢𝑓 =𝑓 𝑢 =𝑎𝑓𝑥 +𝑏𝑓𝑦, the two slopes already computed, recombined. When 𝑢 lines up with an axis, this is Chapter 11's figure exactly.

The unit-vector requirement matters. For example, suppose

𝑓(𝑥,𝑦)=𝑥2+𝑦2

and we want the directional derivative at (1,2) in the direction 𝑣 =3,4. First normalize the supplied direction:

𝑢=𝑣𝑣=35,45.

Since 𝑓(1,2) =2,4,

𝐷𝑢𝑓(1,2)=2,435,45=225.

We reserve 𝐷𝑢𝑓 for a unit direction. The differential can still be applied to any vector:

𝑑𝑓𝑝(𝑣)=𝑓(𝑝)𝑣,

but if 𝑣 1, this quantity includes both the direction and the length of the proposed step.

13.2Geometry of the Gradient

The gradient is not merely a list of derivatives. For a scalar field on the plane, it assigns a vector in the domain to every point of the domain.

Figure 13.2 The gradient, drawn where it lives. At every point of the domain, 𝑓 =𝑓𝑥,𝑓𝑦 is a vector in the domain—the floor under the graph, where every arrow in this picture lies flat. The derivative of a scalar field is a field of arrows. Read the surface above, read the arrows below, and form your own suspicions about where they point and where they grow long. The next figures turn those suspicions into theorems.

Since we know the interpretation of dot products in terms of angles, we can use the directional derivative formula above to help us understand the direction the gradient points in.

If a unit vector 𝑢 makes angle 𝜃 with the gradient, we see the directional derivative in direction 𝑢 is given by

𝐷𝑢𝑓=𝑓𝑢=𝑓𝑢cos𝜃=𝑓cos𝜃.

This tells us a lot!

Theorem 13.4 (Direction and Magnitude of the Gradient). At a point where 𝑓 0:

  • The gradient points in the direction of maximal directional derivative.

  • Its magnitude is the directional derivative in that direction.

  • The opposite direction gives the steepest decrease.

  • In every direction orthogonal to the gradient, the directional derivative is zero: the function is not changing to first order.

In formulas,

𝑢steepest increase=𝑓𝑓,𝐷𝑢𝑓=𝑓,

while

𝑢steepest decrease=𝑓𝑓,𝐷𝑢𝑓=𝑓.
Figure 13.3 The rotating slice again, now with the gradient's whole line lit up on the floor. The pane beside it drops the slice and keeps only slopes: every direction through the point contributes one line to the faint fan, the current direction sweeps through it in orange, and the gradient's own line stays put in its own color at the top of the fan. The sweeping line climbs, reaches the gradient's exactly when the glass lands on the lit line—and never passes it: 𝐷𝑢𝑓 =𝑓cos𝜃, so no direction beats 𝑓, and downhill is steepest against it.

At a point where 𝑓 =0, the gradient has no direction and all first directional derivatives are zero. Such a point is called a critical point; Chapter 14 studies what the function can do there.

One consequence of zero change in perpendicular directions is so useful that it gets its own theorem box.

Theorem 13.5 (The Gradient and Level Sets). At a regular point 𝑝 of a level set, where 𝑓(𝑝) 0, the gradient vector is orthogonal to the level set and points in the direction of increase.

This is very helpful for understanding a function from its gradient, as it lets us convert between level-set understanding and gradient understanding!

When level sets are close to each other, that means the function is steeply increasing or decreasing, so the gradient is long. When level sets are far apart, that means the function is only slowly changing, so the gradient is short.

More precisely, suppose neighboring contours differ by the same value |Δ𝑐|. Locally, their spacing in the normal direction is approximately

|Δ𝑐|𝑓.

Thus, for equally spaced contour values, crowded contours indicate a long gradient and widely separated contours indicate a short gradient. Without equal contour intervals, visual density alone does not determine the gradient's magnitude.

Figure 13.4 The gradient on the map. It crosses the level curve through its point at a right angle—uphill has no reason to lean along the coastline—and its length answers to the crowding: with contours drawn every Δ𝑐, the next one lies about |Δ𝑐|/𝑓 away, so crowded contours mean a strong gradient and sparse ones a weak one. Drag the point across the island and watch both facts hold everywhere.
Figure 13.5 The two portraits of one function, laid on top of each other: every level set, and the whole gradient field crossing them. Each arrow stands perpendicular to the curve it sits on, and one linear scale draws them all, so their lengths can be compared: the arrows are long exactly where contours drawn at equal value increments crowd and short where they spread out. That trade is the thing to take away—crowded curves, strong gradient; sparse curves, weak one—and the graph alongside shows why: crowding is steepness. Swap the function and the pattern survives every swap.

Because the gradient is a normal vector to level sets we can use the gradient to derive the equation for a tangent plane to a surface!

If 𝑝 is a point on a plane and 𝑛 is a normal vector to the plane, the equation

𝑛(𝑥𝑝)=0

describes the plane because it says 𝑥 lies in the plane so long as the vector connecting it to 𝑝 is orthogonal to 𝑛.

Now consider a regular point 𝑝 on the level surface

𝐹(𝑥,𝑦,𝑧)=𝑘.

The gradient 𝐹(𝑝) is the normal vector to the surface, so we can directly write down the tangent plane:

𝐹(𝑝)(𝑥𝑝)=0.

Chapter 12 found tangent planes to graphs 𝑧 =𝑓(𝑥,𝑦) using linearization. Here we obtain tangent planes to implicit surfaces 𝐹(𝑥,𝑦,𝑧) =𝑘 using the geometry of the gradient. These are two descriptions of the same local linear idea.

But knowing the normal vector also allows us to compute other geometric quantities of interest: such as the normal line: the parametric line which intersects a level set orthogonally.

This is also immediate: if we know a point 𝑝 and a direction vector 𝑣, the associated line is (𝑡) =𝑝 +𝑡𝑣. Here, the direction vector is 𝐹(𝑝), so the normal line is

(𝑡)=𝑝+𝑡𝐹(𝑝).
Figure 13.6 One dimension up, the same fact writes equations for you. For a level surface 𝐹(𝑥,𝑦,𝑧) =𝑘, the gradient 𝐹 stands normal to the surface—watch it ride along, carrying the tangent plane 𝐹(𝑝) (𝑥 𝑝) =0 with it, while the dashed normal line (𝑡) =𝑝 +𝑡𝐹(𝑝) runs straight through. Plane and line both fall out of a single gradient evaluation, with no new machinery at all.

Example 13.6 (A Tangent Plane and Normal Line). Compute the tangent plane and the normal line to 𝑥 =𝑦2 +𝑧2 +1 at (3,1, 1).

First, we rearrange so that the surface equation is written as a level set: 𝑥 𝑦2 𝑧2 =1 with all the variables on one side. Now we can compute the gradient:

𝐹=1,2𝑦,2𝑧𝐹(3,1,1)=1,2,2

This vector and the original point (3,1, 1) immediately determine the plane and line:

1,2,2𝑥3,𝑦1,𝑧+1=0
𝑥2𝑦+2𝑧=1
(𝑡)=(3,1,1)+𝑡1,2,2=(3+𝑡,12𝑡,1+2𝑡)

The gradient now gives us a complete first-order picture: it computes every directional derivative, points uphill, measures the steepest rate, and stands normal to level sets. In the next chapter, we investigate the points where this first-order picture goes silent because 𝑓 =0.