Back to the on-screen lesson ·
The rate of change of a function in any direction as a dot product with the gradient, and the three things the gradient then tells you at once: which way is steepest, how steep it is, and which way is level.
Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.
By the end of this lesson you will be able to compute the gradient of a function of two or three variables, use it to find the rate of change in any given direction after normalising that direction, name the direction of steepest increase and the rate along it, and use the fact that the gradient is perpendicular to a level curve or level surface to write down a tangent plane.
Partial derivatives, which give the rate of change along the two coordinate axes, and the dot product, which turns two vectors into a length times a cosine. This lesson is those two facts multiplied together: the rate of change in any direction turns out to be a dot product of the partials with that direction, and everything else follows from reading that dot product carefully.
The directional derivative $D_{\mathbf{u}}f$ is the rate of change of $f$ in the direction of a unit vector $\mathbf{u}$. The gradient $\nabla f$ is the vector of partial derivatives, $\langle f_x, f_y \rangle$ in two variables and $\langle f_x, f_y, f_z \rangle$ in three. A level curve is a set where $f$ is constant — a contour on a map — and a level surface is the same idea one dimension up. The symbol $\nabla$ is read del or nabla.
Fix a point and a unit vector $\mathbf{u} = \langle u_1, u_2 \rangle$. The rate of change of $f$ as you set off in that direction is
$$D_{\mathbf{u}}f = \lim_{h \to 0} \frac{f(a + hu_1,\, b + hu_2) - f(a, b)}{h} = f_x(a,b)\,u_1 + f_y(a,b)\,u_2.$$
The right-hand side is a dot product. Collecting the partials into one vector, the gradient
$$\nabla f = \langle f_x,\, f_y \rangle, \qquad D_{\mathbf{u}}f = \nabla f \cdot \mathbf{u}.$$
Taking $\mathbf{u} = \mathbf{i}$ recovers $f_x$ and taking $\mathbf{u} = \mathbf{j}$ recovers $f_y$, so the two partials were never special: they are two of infinitely many directional derivatives, and the gradient holds all of them.
The three readings of the gradient. Write $D_{\mathbf{u}}f = |\nabla f|\,|\mathbf{u}|\cos\theta = |\nabla f|\cos\theta$. Then:
The third is the geometric one: the gradient is perpendicular to the level curve through the point, because moving along a level curve changes nothing.
Level surfaces and tangent planes. In three variables the same argument gives that $\nabla F$ is perpendicular to the level surface $F(x, y, z) = k$. So the tangent plane to that surface at $P = (a, b, c)$ has $\nabla F(P)$ as its normal:
$$F_x(P)(x - a) + F_y(P)(y - b) + F_z(P)(z - c) = 0.$$
This is the general form of the tangent plane from the last lesson, and it works on surfaces like $x^2 + y^2 + z^2 = 9$ that no single $z = f(x, y)$ describes.
Another way: picture
Lay a contour map flat. At any point the gradient is an arrow drawn on the map — not on the hill — pointing straight across the contour lines towards higher ground, and long where the contours are crowded together. Walking along a contour is walking at right angles to it, which is why a path that stays level always crosses the gradient arrow squarely.
Another way: steps
To find a rate of change in a stated direction:
Suppose a curve $\mathbf{r}(t)$ stays on the level curve $f = k$, so that $f(\mathbf{r}(t)) = k$ for every $t$. Differentiate both sides. The left-hand side is handled by the chain rule of lesson 17, which gives $\nabla f \cdot \mathbf{r}'(t)$; the right-hand side is constant, so its derivative is zero. Hence
$$\nabla f \cdot \mathbf{r}'(t) = 0.$$
But $\mathbf{r}'(t)$ is tangent to the level curve. So the gradient is perpendicular to every tangent of every curve lying in the level set — which is what perpendicular to the level curve means.
Two things are worth noticing. First, the argument never used two variables: run it with $\mathbf{r}(t)$ in space and $F$ a function of three variables and it says the gradient is normal to the level surface, which is where the tangent-plane formula above comes from. Second, it explains why the gradient grows where contours crowd: a short step across a narrow gap between contours changes $f$ by the same amount as a long step across a wide one, so the rate — and the arrow — is larger.
Forgetting to normalise the direction. $D_{\mathbf{u}}f$ is defined for a unit vector. Dotting the gradient with $\langle 3, 4 \rangle$ instead of $\langle 3/5, 4/5 \rangle$ gives five times the truth, and nothing in the arithmetic complains.
Thinking the gradient points along the surface. It lives in the domain — the $xy$ plane for a function of two variables — and gives a compass bearing, not an uphill direction in space. The vector that points up the hill has a third component; the gradient does not.
Reading $|\nabla f|$ as a value of $f$. It is a rate: units of $f$ per unit of distance.
Using the formula at a point where the partials do not exist or $f$ is not differentiable. The identity $D_{\mathbf{u}}f = \nabla f \cdot \mathbf{u}$ is a theorem with a hypothesis, and at a corner of a surface it can fail while both partials exist perfectly well.
It is a vector in the domain: two components for a function of two variables, three for a function of three. It says which way to walk on the map, and its length says how fast the value then changes. The uphill direction in three-dimensional space is a different vector with a vertical component, and the two are easy to conflate because both are called steepest ascent.
The same confusion, one dimension up, causes real trouble: for $F(x, y, z)$ the gradient $\nabla F$ is a vector in space and it is normal to the level surface, not tangent to it. Learners who have absorbed the gradient points uphill often expect it to lie along the surface. It does not — it is the one direction that leaves the surface as fast as possible, and that is precisely why it serves as the normal in the tangent plane formula.
For $f(x, y) = x^2y$ at $(3, 2)$: $f_x = 2xy = 12$ and $f_y = x^2 = 9$, so $\nabla f = \langle 12, 9 \rangle$.
The gradient is the partials evaluated at the point.
In the direction of $\langle 4, -3 \rangle$, whose length is $5$, the unit vector is $\langle 4/5, -3/5 \rangle$.
Divide the given direction by its length.
So $D_{\mathbf{u}}f = 12 \cdot \tfrac45 + 9 \cdot \left(-\tfrac35\right) = \tfrac{48}{5} - \tfrac{27}{5} = \tfrac{21}{5}$, and the steepest rate available at that point is $|\nabla f| = 15$.
This direction climbs, but at well under the best rate on offer.
The sphere $x^2 + y^2 + z^2 = 14$ is a level surface of $F(x, y, z) = x^2 + y^2 + z^2$, and $(1, 2, 3)$ lies on it.
No formula $z = f(x, y)$ is needed.
$\nabla F = \langle 2x, 2y, 2z \rangle$, which at the point is $\langle 2, 4, 6 \rangle$.
The gradient is normal to the level surface.
So the tangent plane is $2(x - 1) + 4(y - 2) + 6(z - 3) = 0$, or $x + 2y + 3z = 14$. The normal came out parallel to the position vector of the point, which is the sphere telling you something true about itself.
A normal and a point are all a plane ever needs.
A hill has height $h(x, y) = 100 - 2x^2 - 3y^2$. At $(2, 1)$, $h_x = -4x = -8$ and $h_y = -6y = -6$.
Compute the two partials and substitute the point.
So $\nabla h = \langle -8, -6 \rangle$, of length $10$. The walker climbs fastest heading in the direction $\langle -8, -6 \rangle$, that is towards the summit at the origin.
And the steepest rate is $10$ metres of height per metre travelled on the map. That is a very steep hill — worth noticing, because the number is a rate rather than a height, and a reader who mistakes it for one has the walker $10$ metres up rather than on a one-in-ten-thousand slope.
Write $\nabla f$ at $(4, 3)$ as a row, for $f(x, y) = x^2 + 2xy + 5y^2$.
This task has no paper form; do it on a device.
At a point the gradient of $f$ has length $5$. Match each question to its answer.
| Along the gradient | At the rate $5$ | At right angles to the gradient | Straight against the gradient | |
|---|---|---|---|---|
| Which way does $f$ increase fastest? | ||||
| How fast does it increase that way? | ||||
| Which way does $f$ not change at all? | ||||
| Which way does $f$ decrease fastest? |
For $f(x, y) = 15x + 25y$, find the rate of change of $f$ in the direction of $\langle 3, 4 \rangle$.
Answer:
At a point $|\nabla f| = 16$, and a unit vector $\mathbf{u}$ makes an angle of $60^\circ$ with $\nabla f$. What is $D_{\mathbf{u}}f$ there?
Answer:
Write $\nabla f$ at $(1, 3)$ as a row, for $f(x, y) = 3x^2 + 4xy + 5y^2$.
This task has no paper form; do it on a device.
A walker stands on a hillside where the gradient of the height function has length $8$ metres per metre. They want to walk without gaining or losing height. Which way should they set off?
Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.
At a point the gradient of $f$ has length $9$. Match each question to its answer.
| Along the gradient | At the rate $9$ | At right angles to the gradient | Straight against the gradient | |
|---|---|---|---|---|
| Which way does $f$ increase fastest? | ||||
| How fast does it increase that way? | ||||
| Which way does $f$ not change at all? | ||||
| Which way does $f$ decrease fastest? |
You can turn a function and a direction into a rate of change, and you can say what the gradient's direction, its length and its perpendicular all mean on a contour map. Next: the points where the gradient is zero, and how to tell a summit from a pass.
10. Your turn: the steepest climb on a hill, step 3