Directional Derivatives and the Gradient: Learn It 2

Gradient

Look back at the formula for the directional derivative: [latex]D_{\bf{u}}f(x,y)=f_x(x,y)\cos\theta+f_y(x,y)\sin\theta[/latex]. The right-hand side can be written as a dot product of two vectors. Define the first vector as [latex]\nabla{f}(x,y)=f_x(x,y){\bf{i}}+f_y(x,y){\bf{j}}[/latex] and the second as [latex]{\bf{u}}=(\cos\theta){\bf{i}}+(\sin\theta){\bf{j}}[/latex]. Then:

[latex]D_{\bf{u}}f(x,y)=\nabla{f}(x,y)\cdot{\bf{u}}[/latex]

The symbol [latex]\nabla[/latex] is called nabla, and the vector [latex]\nabla{f}[/latex] is read “del [latex]f[/latex]” or “gradient of [latex]f[/latex]“.

The first vector in this equation has a special name: the gradient of the function [latex]f[/latex].

gradient

Let [latex]z=f(x, y)[/latex] be a function of [latex]x[/latex] and [latex]x[/latex] such that [latex]f_x[/latex] and [latex]f_y[/latex] exist. The vector [latex]\nabla{f}(x,y)[/latex] is called the gradient of [latex]f[/latex] and is defined as:

[latex]\nabla{f}(x,y)=f_x(x,y){\bf{i}}+f_y(x,y){\bf{j}}.[/latex]

The vector [latex]\nabla{f}(x,y)[/latex] is also written as “grad [latex]f[/latex]“.

Find the gradient [latex]\nabla{f}(x,y)[/latex] of each of the following functions:

  1. [latex]f(x,y)=x^2-xy+3y^2[/latex]
  2. [latex]f(x,y)=\sin{3x}\cos{3y}[/latex]

Properties of the Gradient

The gradient has important properties that make it useful for understanding how functions behave. We’ve already seen one: the formula for the directional derivative. Let’s dig deeper.

Recall that if the angle between two vectors [latex]{\bf{a}}[/latex] and [latex]{\bf{b}}[/latex] is [latex]\varphi[/latex], then [latex]{\bf{a}}\cdot{\bf{b}}=|{\bf{a}}||{\bf{b}}|\cos\varphi[/latex]. If the angle between [latex]\nabla{f}(x_0,y_0)[/latex] and [latex]{\bf{u}}=(\cos\theta){\bf{i}}+(\sin\theta){\bf{j}}[/latex] is [latex]\varphi[/latex], then:

[latex]D_{\bf{u}}f(x_0,y_0)=\nabla{f}(x_0,y_0)\cdot{\bf{u}}=|\nabla{f}(x_0,y_0)||{\bf{u}}|\cos\varphi=|\nabla{f}(x_0,y_0)|\cos\varphi[/latex]

The [latex]|{\bf{u}}|[/latex] term disappears because [latex]{\bf{u}}[/latex] is a unit vector. The directional derivative equals the magnitude of the gradient at [latex](x_0, y_0)[/latex], multiplied by [latex]\cos\varphi[/latex].

Since [latex]\cos\varphi[/latex] ranges from [latex]-1[/latex] to [latex]1[/latex], we can determine when the directional derivative is maximized or minimized:

  • If [latex]\varphi=0[/latex], then [latex]\cos\varphi=1[/latex] and [latex]\nabla{f}(x_0,y_0)[/latex] and [latex]{\bf{u}}[/latex] point in the same direction. This maximizes [latex]D_{\bf{u}}f(x_0,y_0)[/latex].
  • If [latex]\varphi=\pi[/latex], then [latex]\cos\varphi=-1[/latex] and [latex]\nabla{f}(x_0,y_0)[/latex] and [latex]{\bf{u}}[/latex] point in opposite directions. This minimizes [latex]D_{\bf{u}}f(x_0,y_0)[/latex].
  • If [latex]\nabla{f}(x_0,y_0)={\bf{0}}[/latex], then [latex]D_{\bf{u}}f(x_0,y_0)=0[/latex] for any unit vector [latex]{\bf{u}}[/latex].

These cases are outlined in the following theorem.

properties of the gradient

Suppose the function [latex]z=f(x, y)[/latex] is differentiable at [latex](x_0, y_0)[/latex] (Figure 3).

  1. If [latex]\nabla{f}(x_0,y_0)=0[/latex], then [latex]D_{\bf{u}}f(x_0,y_0)=0[/latex] for any unit vector [latex]\bf{u}[/latex].
  2. If [latex]\nabla{f}(x_0,y_0)\ne 0[/latex], then [latex]D_{\bf{u}}f(x_0,y_0)[/latex] is maximized when [latex]\bf{u}[/latex] points in the same direction as [latex]\nabla{f}(x_0,y_0)[/latex]. The maximum value of [latex]D_{\bf{u}}f(x_0,y_0)[/latex] is [latex]\|\nabla{f}(x_0,y_0)\|[/latex].
  3. If [latex]\nabla{f}(x_0,y_0)\ne 0[/latex], then [latex]D_{\bf{u}}f(x_0,y_0)[/latex] is minimized when [latex]\bf{u}[/latex] points in the opposite direction from [latex]\nabla{f}(x_0,y_0)[/latex]. The minimum value of [latex]D_{\bf{u}}f(x_0,y_0)[/latex] is [latex]-\|\nabla{f}(x_0,y_0)\|[/latex].
An upward facing paraboloid in xyz space with point P0 (x0, y0, z0). From this point, there are arrows going up, down, and around the paraboloid. On the xy plane, the point (x0, y0) is marked, and the corresponding arrows are drawn onto the plane: the down arrow corresponds to −∇f (most rapid decrease in f), the up arrow corresponds to ∇f (most rapid increase in f), and the arrows around correspond to no change in f. The up/down arrows are perpendicular to the around arrows in their projection on the plane.
Figure 1. The gradient indicates the maximum and minimum values of the directional derivative at a point.
Find the direction for which the directional derivative of [latex]f(x, y)=3x^{2}-4xy+2y^{2}[/latex] at [latex](-2, 3)[/latex] is a maximum. What is the maximum value?

Interpreting the Gradient

Figure 3 shows part of the graph of [latex]f(x,y)=3+\sin x\sin y[/latex]. Given a point [latex](a, b)[/latex] in the domain of [latex]f[/latex], the maximum value of the gradient at that point is [latex]|\nabla{f}(a,b)|[/latex]. If the surface represented a topographical map, this would be the rate of greatest ascent. In the opposite direction, it would be the rate of greatest descent.

An surface in xyz space with point at f(a, b). There is an arrow in the direction of greatest descent.
Figure 3. A typical surface in [latex]\mathbb{R}^{3}[/latex]. Given a point on the surface, the directional derivative can be calculated using the gradient.

When using a topographical map, the steepest slope is always in the direction where the contour lines are closest together (see Figure 4). This is analogous to the contour map of a function, assuming the level curves are obtained for equally spaced values throughout the range of that function.

Two crossing dashed lines that pass through the origin and a series of curved lines approaching the crosses dashed lines as if they are asymptotes.
Figure 4. Contour map for the function [latex]\small{f(x,y)=x^{2}-y^{2}}[/latex] using level values between [latex]\small{-5}[/latex] and [latex]\small{5}[/latex].