Skip to main content

Section 7.2 The Gradient Vector

Note that we can write the equation of the line through the point \(P_0(x_0,y_0)\) with the direction \(\mathbf u = u_1\mathbf i + u_2\mathbf j\) as
\begin{equation} x(s) = x_0 + su_1, \qquad y(s) = y_0 + su_2.\tag{7.3} \end{equation}
We can use the above relation between \(x\text{,}\) \(y\text{,}\) and \(s\) and the chain rule, whose dependency diagram is shown in FigureΒ 7.10, to compute the directional derivative as follows:
\begin{align*} \left(D_{\mathbf u} f\right)_{P_0} = \left(\frac{df}{ds}\right)_{\mathbf u,P_0} \amp= \left(\frac{\partial f}{\partial x}\right)_{P_0}\frac{dx}{ds}\\ \amp\quad + \left(\frac{\partial f}{\partial y}\right)_{P_0}\frac{dy}{ds}\\ \amp= \left(\frac{\partial f}{\partial x}\right)_{P_0}\cdot u_1\\ \amp\quad + \left(\frac{\partial f}{\partial y}\right)_{P_0}\cdot u_2\\ \amp= \left[\left(\frac{\partial f}{\partial x}\right)_{P_0}\mathbf i + \left(\frac{\partial f}{\partial y}\right)_{P_0}\mathbf j\right] \cdot \left(u_1\mathbf i + u_2\mathbf j\right). \end{align*}
The vector in the first set of parentheses is known as the gradient vector.

Definition 7.9 Gradient Vector.

The gradient vector of the function \(f(x,y)\) at \(P_0(x_0,y_0)\) is the vector
\begin{equation} \left(\nabla f\right)_{P_0} = \left(\frac{\partial f}{\partial x}\right)_{P_0}\mathbf i + \left(\frac{\partial f}{\partial y}\right)_{P_0}\mathbf j.\tag{7.4} \end{equation}
The gradient vector and the directional derivative of \(f(x,y)\) at \(P_0(x_0,y_0)\) in the direction \(\mathbf u = u_1\mathbf i + u_2\mathbf j\) are related via the following dot product:
\begin{equation} \left(\frac{df}{ds}\right)_{\mathbf u,\,P_0} = \left(\nabla f\right)_{P_0}\cdot\mathbf u.\tag{7.5} \end{equation}
Diagram Exploration Keyboard Controls
Key Action
Enter, A Activate keyboard driven exploration
B Activate menu driven exploration
Escape Leave exploration mode
Cursor down Explore next lower level
Cursor up Explore next upper level
Cursor right Explore next element on level
Cursor left Explore previous element on level
X Toggle expert mode
W Extra details if available
Space Repeat speech
M Activate step magnification
Comma Activate direct magnification
N Deactivate magnification
Z Toggle subtitles
C Cycle contrast settings
T Monochrome colours
L Toggle language (if available)
K Kill current sound
Y Stop sound output
O Start and stop sonification
P Repeat sonification output
Figure 7.10. The chain rule dependency diagram: multiplying down each branch and adding the two products gives \(\frac{df}{ds} = \frac{\partial f}{\partial x}\frac{dx}{ds} + \frac{\partial f}{\partial y}\frac{dy}{ds}\text{.}\)
A fundamental geometric property of the gradient is that, at every point, it is perpendicular to the level curve of \(f\) passing through that point, as the interactive figure below lets you verify. We state and prove this fact now.

Proof.

Suppose the level curve \(C\) is parametrized by a differentiable vector function
\begin{equation} \mathbf r(t) = \langle x(t),\, y(t)\rangle,\tag{7.6} \end{equation}
and let \(\mathbf v(t) = \langle x'(t),\, y'(t)\rangle\) denote its velocity vector. Because every point of \(C\) lies on the level curve, its coordinates satisfy
\begin{equation} f\bigl(x(t),\, y(t)\bigr) = c \qquad \text{for all } t.\tag{7.7} \end{equation}
The left-hand side is constant in \(t\text{,}\) so its derivative is zero. Differentiating both sides with respect to \(t\) and applying the chain rule gives
\begin{align} \frac{d}{dt}\, f\bigl(x(t), y(t)\bigr) \amp= \frac{\partial f}{\partial x}\,\frac{dx}{dt} + \frac{\partial f}{\partial y}\,\frac{dy}{dt}\notag\\ \amp= 0.\tag{7.8} \end{align}
We recognize the middle expression as the dot product of the gradient vector with the velocity vector:
\begin{align} \left\langle \frac{\partial f}{\partial x},\, \frac{\partial f}{\partial y} \right\rangle \cdot \left\langle \frac{dx}{dt},\, \frac{dy}{dt} \right\rangle \amp= \nabla f \cdot \mathbf v(t)\notag\\ \amp= 0.\tag{7.9} \end{align}
Therefore, at each point of \(C\text{,}\) the gradient \(\nabla f\) is orthogonal to the velocity vector \(\mathbf v(t)\text{,}\) as shown in FigureΒ 7.12. Since the velocity vector points in the direction of motion along the curve, it is tangent to \(C\text{;}\) hence \(\nabla f\) being orthogonal to \(\mathbf v(t)\) means precisely that \(\nabla f\) is perpendicular to the level curve \(C\text{.}\) This holds at every point where \(\nabla f \neq \mathbf 0\text{.}\)
Diagram Exploration Keyboard Controls
Key Action
Enter, A Activate keyboard driven exploration
B Activate menu driven exploration
Escape Leave exploration mode
Cursor down Explore next lower level
Cursor up Explore next upper level
Cursor right Explore next element on level
Cursor left Explore previous element on level
X Toggle expert mode
W Extra details if available
Space Repeat speech
M Activate step magnification
Comma Activate direct magnification
N Deactivate magnification
Z Toggle subtitles
C Cycle contrast settings
T Monochrome colours
L Toggle language (if available)
K Kill current sound
Y Stop sound output
O Start and stop sonification
P Repeat sonification output
Figure 7.12. The gradient \(\nabla f\) meets the level curve \(C\colon f = c\) at a right angle: it is perpendicular to the velocity vector \(\mathbf v(t)\text{,}\) which is tangent to \(C\text{.}\)

Activity 7.13 Checking that the Gradient Meets Level Curves at Right Angles.

TheoremΒ 7.11 claims that \(\nabla f\) is perpendicular to the level curve through a point. This activity asks you to verify that claim by hand at one point, and then to test it at many points using the interactive figure that follows.

(a)

Let \(f(x,y) = 1 + x^2 + y^2\text{.}\) Find the level curve of \(f\) through \(P_0(1,1)\text{,}\) and give a vector tangent to that curve at \(P_0\text{.}\)

(b)

Compute \(\left(\nabla f\right)_{(1,1)}\) and then the dot product of that gradient with your tangent vector. What does the result say?

(c)

Repeat the argument at an arbitrary point \((a,b) \ne (0,0)\) to show the right angle is not a coincidence of the point \((1,1)\text{.}\)

(d)

Now drag the red point in FigureΒ 7.14 to several locations, including points on the axes and points far from the origin. Confirm that the gradient arrow always meets the level curve at a right angle, and describe how the length of the arrow changes as the point moves away from the origin. Can you place the point where the gradient vanishes?

Instructions.

Drag the red point anywhere in the plane. The gradient vector \(\nabla f = 2x\,\mathbf i + 2y\,\mathbf j\) of \(f(x,y) = 1 + x^2 + y^2\) is drawn at the point, together with the level curve of \(f\) through the point. Observe that the gradient is always perpendicular to the level curve and points in the direction in which \(f\) increases.
Figure 7.14. The gradient \(\nabla f\) of \(f(x,y)=1+x^2+y^2\) at a movable point, shown with the level curve through that point, illustrating that \(\nabla f\) is perpendicular to the level curves.
With (7.5) in hand, the limit that defined the directional derivative can be set aside: the gradient and a dot product do the same work in a couple of lines. To see the difference, we rework ExampleΒ 7.6 β€” the same function, point, and direction β€” and then read the answer geometrically off the surface.

Example 7.15 Example II.

Consider the function \(f(x,y) = 1 + x^2 + y^2\text{,}\) the point \(P_0(1,1)\text{,}\) and the unit vector \(\mathbf u = \dfrac{1}{\sqrt 2}\mathbf i + \dfrac{1}{\sqrt 2}\mathbf j\text{.}\) Evaluate the directional derivative \(\left(D_{\mathbf u} f\right)_{P_0}\) and interpret your result.
Solution.
We use \(\left(\dfrac{df}{ds}\right)_{\mathbf u,P_0} = \left(\nabla f\right)_{P_0}\cdot\mathbf u\text{.}\) First we compute the gradient vector:
\begin{align*} \nabla f \amp= \frac{\partial f}{\partial x}\,\mathbf i + \frac{\partial f}{\partial y}\,\mathbf j\\ \amp= (2x)\,\mathbf i + (2y)\,\mathbf j,\\ \left(\nabla f\right)_{(1,1)} \amp= \left(\frac{\partial f}{\partial x}\right)_{(1,1)}\mathbf i + \left(\frac{\partial f}{\partial y}\right)_{(1,1)}\mathbf j\\ \amp= 2\,\mathbf i + 2\,\mathbf j. \end{align*}
Then we take the dot product with \(\mathbf u\text{:}\)
\begin{align} \left(\frac{df}{ds}\right)_{\mathbf u,P_0} \amp= \left(\nabla f\right)_{P_0}\cdot\mathbf u\notag\\ \amp= \left(2\,\mathbf i + 2\,\mathbf j\right)\cdot \left(\tfrac{1}{\sqrt 2}\,\mathbf i + \tfrac{1}{\sqrt 2}\,\mathbf j\right)\notag\\ \amp= \frac{4}{\sqrt 2}\notag\\ \amp= 2\sqrt 2,\tag{7.10} \end{align}
which agrees with the limit computation in ExampleΒ 7.6. See FigureΒ 7.16 for a geometrical interpretation of the directional derivative. Note that the unit vector \(\mathbf u = \frac{1}{\sqrt 2}\mathbf i + \frac{1}{\sqrt 2}\mathbf j\) is the direction vector of the line \(y = x\) located in the \(xy\)-plane. The plane \(x - y = 0\) contains this line and is orthogonal to the \(xy\)-plane. The intersection of the surface \(z = 1 + x^2 + y^2\) and the plane \(x - y = 0\) is the parabola shown in the figure. Finally, the directional derivative of \(f(x,y) = 1 + x^2 + y^2\) at the point \((1,1)\) corresponds to the slope of the tangent line to the surface \(z = 1 + x^2 + y^2\) at \((1,1,3)\) that is located in the plane \(x - y = 0\text{.}\)
A paraboloid cut by a vertical plane, with the trace parabola and its tangent line at the point one comma one comma three.
The surface \(z = 1 + x^2 + y^2\text{,}\) an upward-opening paraboloid, drawn as a translucent blue surface. A translucent yellow vertical plane \(x - y = 0\) passes through the surface above the line \(y = x\) in the \(xy\)-plane, where the unit vector \(\mathbf u\) is drawn as a blue arrow starting at \((1,1,0)\text{.}\) The plane meets the surface in a parabola, drawn in solid vermillion, and a green tangent line touches this parabola at the marked point \((1,1,3)\text{.}\) The slope of this tangent line, measured within the vertical plane, is the directional derivative \(2\sqrt 2\text{.}\) A reddish-purple circle on the surface at height \(z = 3\) marks the level curve \(f = 3\text{,}\) and its dashed projection in the \(xy\)-plane is the circle \(x^2 + y^2 = 2\) through the point \((1,1)\text{.}\)
Figure 7.16. The surface \(z = 1 + x^2 + y^2\) cut by the vertical plane \(x - y = 0\text{,}\) which contains the direction \(\mathbf u\text{.}\) The intersection is a parabola, and the directional derivative \(\left(D_{\mathbf u} f\right)_{(1,1)} = 2\sqrt 2\) is the slope of its tangent line at the point \((1,1,3)\text{.}\) The level curve \(f = 3\) through \((1,1)\text{,}\) the circle \(x^2 + y^2 = 2\text{,}\) is drawn on the surface at height \(z = 3\text{,}\) with its dashed projection in the \(xy\)-plane.

Instructions.

Press β€œPlay” to watch the vertical plane through \(P_0(1,1)\) turn once around. The gold curve is where the plane cuts the surface \(z = 1 + x^2 + y^2\text{,}\) and the straight line through \((1,1,3)\) is the tangent to that curve; its slope is \(D_{\mathbf u} f = \left(\nabla f\right)_{(1,1)}\cdot\mathbf u\text{,}\) read off at the lower left. The tangent is green and steepest upwards when \(\mathbf u\) points along \(\nabla f\text{,}\) red and steepest downwards along \(-\nabla f\text{,}\) and yellow and level in the two directions tangent to the pink level curve. Stop the animation at any time and drag the \(\varphi\) slider, drag the figure to change the viewpoint, or press β€œSpin”.
Figure 7.17. The same slice, animated: the tangent to the sliced surface at \((1,1,3)\) tipping from steepest ascent through level to steepest descent as the direction \(\mathbf u\) turns around \(P_0(1,1)\text{.}\)
You have attempted of activities on this page.