Skip to main content
\(\newcommand{\R}{\mathbb{R}} \newcommand{\va}{\mathbf{a}} \newcommand{\vb}{\mathbf{b}} \newcommand{\vc}{\mathbf{c}} \newcommand{\vC}{\mathbf{C}} \newcommand{\vd}{\mathbf{d}} \newcommand{\ve}{\mathbf{e}} \newcommand{\vi}{\mathbf{i}} \newcommand{\vj}{\mathbf{j}} \newcommand{\vk}{\mathbf{k}} \newcommand{\vn}{\mathbf{n}} \newcommand{\vm}{\mathbf{m}} \newcommand{\vr}{\mathbf{r}} \newcommand{\vs}{\mathbf{s}} \newcommand{\vu}{\mathbf{u}} \newcommand{\vv}{\mathbf{v}} \newcommand{\vw}{\mathbf{w}} \newcommand{\vx}{\mathbf{x}} \newcommand{\vy}{\mathbf{y}} \newcommand{\vz}{\mathbf{z}} \newcommand{\vzero}{\mathbf{0}} \newcommand{\vF}{\mathbf{F}} \newcommand{\vG}{\mathbf{G}} \newcommand{\vH}{\mathbf{H}} \newcommand{\vR}{\mathbf{R}} \newcommand{\vT}{\mathbf{T}} \newcommand{\vN}{\mathbf{N}} \newcommand{\vL}{\mathbf{L}} \newcommand{\vB}{\mathbf{B}} \newcommand{\vS}{\mathbf{S}} \newcommand{\proj}{\text{proj}} \newcommand{\comp}{\text{comp}} \newcommand{\nin}{} \newcommand{\vecmag}[1]{|#1|} \newcommand{\grad}{\nabla} \DeclareMathOperator{\curl}{curl} \DeclareMathOperator{\divg}{div} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \)

Section2.5Directional Derivatives and the Gradient

Objectives
  • The partial derivatives of a function \(f\) tell us the rate of change of \(f\) in the direction of the coordinate axes. How can we measure the rate of change of \(f\) in other directions?

  • What is the gradient of a function and what does it tell us?

The partial derivatives of a function tell us the instantaneous rate at which the function changes as we hold all but one independent variable constant and allow the remaining independent variable to change. It is natural to wonder how we can measure the rate at which a function changes in directions other than parallel to a coordinate axes. In what follows, we investigate this question, and see how the rate of change in any given direction is connected to the rates of change given by the standard partial derivatives.

Exploration2.5.1

Let's consider the function \(f\) defined by

\begin{equation*} f(x,y) = 30 - x^2 - \frac 12 y^2, \end{equation*}

and suppose that \(f\) measures the temperature, in degrees Celsius, at a given point in the plane, where \(x\) and \(y\) are measured in feet. Assume that the positive \(x\)-axis points due east, while the positive \(y\)-axis points due north. A contour plot of \(f\) is shown in Figure2.5.1

Figure2.5.1A contour plot of \(f(x,y) = 30-x^2-\frac12 y^2\text{.}\)
  1. Suppose that a person is walking due east, and thus parallel to the \(x\)-axis. At what instantaneous rate is the temperature changing with respect to \(x\) at the moment the walker passes the point \((2,1)\text{?}\) What are the units on this rate of change?

  2. Next, determine the instantaneous rate of change of temperature with respect to distance at the point \((2,1)\) if the person is instead walking due north. Again, include units on your result.

  3. Now, rather than walking due east or due north, let's suppose that the person is walking with velocity given by the vector \(\vv = \langle 3, 4 \rangle\text{,}\) where time is measured in seconds. Note that the person's speed is thus \(| \vv | = 5\) feet per second. Find parametric equations for the person's path; that is, parameterize the line through \((2,1)\) using the direction vector \(\vv = \langle 3, 4 \rangle\text{.}\) Let \(x(t)\) denote the \(x\)-coordinate of the line, and \(y(t)\) its \(y\)-coordinate. Make sure your parameterization places the walker at the point \((2,1)\) when \(t=0\text{.}\)

  4. With the parameterization in (c), we can now view the temperature \(f\) as not only a function of \(x\) and \(y\text{,}\) but also of time, \(t\text{.}\) Hence, use the chain rule to determine the value of \(\frac{df}{dt}\bigm|_{t=0}\text{.}\) What are the units on your answer? What is the practical meaning of this result?

Subsection2.5.1Directional Derivatives

Given a function \(z = f(x,y)\text{,}\) the partial derivative \(f_x(x_0,y_0)\) measures the instantaneous rate of change of \(f\) as only the \(x\) variable changes; likewise, \(f_y(x_0,y_0)\) measures the rate of change of \(f\) at \((x_0,y_0)\) as only \(y\) changes. Note particularly that \(f_x(x_0,y_0)\) is measured in units of \(f\) per unit of change in \(x\text{,}\) and that the units on \(f_y(x_0,y_0)\) are similar.

In Preview Activity2.5.1, we saw how we could measure the rate of change of \(f\) in a situation where both \(x\) and \(y\) were changing; in that activity, however, we found that this rate of change was measured in units of \(f\) per unit of time. In a given unit of time, we may move more than one unit of distance. In fact, in Preview Activity2.5.1, in each unit increase in time we move a distance of \(| \vv | = 5\) feet. To generalize the notion of partial derivatives to any direction of our choice, we instead want to have a rate of change whose units are units of \(f\) per unit of distance in the given direction.

In this light, in order to formally define the derivative in a particular direction of motion, we want to represent the change in \(f\) for a given unit change in the direction of motion. We can represent this unit change in direction with a unit vector, say \(\vu = \langle u_1, u_2 \rangle\text{.}\) If we move a distance \(h\) in the direction of \(\vu\) from a fixed point \((x_0,y_0)\text{,}\) we then arrive at the new point \((x_0+u_1h, y_0+u_2h)\text{.}\) It now follows that the slope of the secant line to the curve on the surface through \((x_0,y_0)\) in the direction of \(\vu\) through the points \((x_0,y_0)\) and \((x_0+u_1h, y_0+u_2h)\) is

\begin{equation} m_{\mbox{sec} } = \frac{f(x_0+u_1h, y_0+u_2h) - f(x_0,y_0)}{h}.\label{eq_10_6_diff_quot}\tag{2.5.1} \end{equation}

To get the instantaneous rate of change of \(f\) in the direction \(\vu = \langle u_1, u_2 \rangle\text{,}\) we must take the limit of the quantity in Equation(2.5.1) as \(h \to 0\text{.}\) Doing so results in the formal definition of the directional derivative.

Definition2.5.2

Let \(f = f(x,y)\) be given. The derivative of \(f\) at the point \((x,y)\) in the direction of the unit vector \(\vu = \langle u_1, u_2 \rangle\) is denoted \(D_{\vu}f(x,y)\) and is given by

\begin{equation} D_{\vu}f(x,y) = \lim_{h \to 0} \frac{f(x+u_1h, y+u_2h) - f(x,y)}{h}\label{E_DirDerDef}\tag{2.5.2} \end{equation}

for those values of \(x\) and \(y\) for which the limit exists.

The quantity \(D_{\vu} f(x,y)\) is called a directional derivative. When we evaluate the directional derivative \(D_{\vu} f(x,y)\) at a point \((x_0, y_0)\text{,}\) the result \(D_{\vu} f(x_0,y_0)\) tells us the instantaneous rate at which \(f\) changes at \((x_0, y_0)\) per unit increase in the direction of the vector \(\vu\text{.}\) In addition, the quantity \(D_{\vu} f(x_0,y_0)\) tells us the slope of the line tangent to the surface in the direction of \(\vu\) at the point \((x_0,y_0,f(x_0,y_0))\text{.}\)

Subsection2.5.2Computing the Directional Derivative

In a similar way to how we developed shortcut rules for standard derivatives in single variable calculus, and for partial derivatives in multivariable calculus, we can also find a way to evaluate directional derivatives without resorting to the limit definition found in Equation(2.5.2). We do so using a very similar approach to our work in Preview Activity2.5.1.

Suppose we consider the situation where we are interested in the instantaneous rate of change of \(f\) at a point \((x_0,y_0)\) in the direction \(\vu = \langle u_1, u_2 \rangle\text{,}\) where \(\vu\) is a unit vector. The variables \(x\) and \(y\) are therefore changing according to the parameterization

\begin{equation*} x = x_0 + u_1t \ \ \ \ \ \text{ and } \ \ \ \ \ y = y_0 + u_2t. \end{equation*}

Observe that \(\frac{dx}{dt} = u_1\) and \(\frac{dy}{dt} = u_2\) for all values of \(t\text{.}\) Since \(\vu\) is a unit vector, it follows that a point moving along this line moves one unit of distance per one unit of time; that is, each single unit of time corresponds to movement of a single unit of distance in that direction. This observation allows us to use the Chain Rule to calculate the directional derivative, which measures the instantaneous rate of change of \(f\) with respect to change in the direction \(\vu\text{.}\)

In particular, by the Chain Rule, it follows that

\begin{align*} D_{\vu}f(x_0,y_0) \amp = f_x(x_0,y_0)\frac{dx}{dt}\biggm|_{(x_0,y_0)} + f_y(x_0,y_0)\frac{dy}{dt}\biggm|_{(x_0,y_0)} \\ \amp = f_x(x_0,y_0)u_1 + f_y(x_0,y_0)u_2. \end{align*}

This now allows us to compute the directional derivative at an arbitrary point according to the following formula.

Calculating a directional derivative

Given a differentiable function \(f = f(x,y)\) and a unit vector \(\vu = \langle u_1, u_2 \rangle\text{,}\) we may compute \(D_{\vu}f(x,y)\) by

\begin{equation} D_{\vu}f(x,y) = f_x(x,y)u_1 + f_y(x,y)u_2.\label{eq_10_6_DD}\tag{2.5.3} \end{equation}

Note well: To use Equation (2.5.3), we must have a unit vector \(\vu = \langle u_1, u_2 \rangle\) in the direction of motion. In the event that we have a direction prescribed by a non-unit vector, we must first scale the vector to have length 1.

Activity2.5.2

Let \(f(x,y) = 3xy-x^2y^3\text{.}\)

  1. Determine \(f_x(x,y)\) and \(f_y(x,y)\text{.}\)

  2. Use Equation(2.5.3) to determine \(D_{\vi} f(x,y)\) and \(D_{\vj} f(x,y)\text{.}\) What familiar function is \(D_{\vi} f\text{?}\) What familiar function is \(D_{\vj} f\text{?}\) (Recall that \(\vi\) is the unit vector in the positive \(x\)-direction and \(\vj\) is the unit vector in the positive \(y\)-direction.)

  3. Use Equation(2.5.3) to find the derivative of \(f\) in the direction of the vector \(\vv = \langle 2, 3 \rangle\) at the point \((1,-1)\text{.}\) Remember that a unit direction vector is needed.

Answer
  1. The partial derivatives are \(f_x(x,y) = 3y-2xy^3\) and \(f_y(x,y) = 3x-3x^2y^2\text{.}\)

  2. Use Equation(2.5.3) to determine \(D_{\vi} f(x,y)\) and \(D_{\vj} f(x,y)\text{.}\) What familiar function is \(D_{\vi} f\text{?}\) What familiar function is \(D_{\vj} f\text{?}\) (Recall that \(\vi\) is the unit vector in the positive \(x\)-direction and \(\vj\) is the unit vector in the positive \(y\)-direction.) We get that

    \begin{align*} D_{\vi} f(x,y) \amp = f_x(x,y)\cdot 1 + f_y(x,y)\cdot 0\\ \amp = f_x(x,y) \end{align*}

    and

    \begin{align*} D_{\vj} f(x,y) \amp = f_x(x,y)\cdot 0 + f_y(x,y)\cdot 1\\ \amp = f_y(x,y). \end{align*}
  3. Computing the length of \(\vv\text{,}\) we get \(|\vv| = \sqrt{2^2+3^2}=\sqrt{13}\text{,}\) so a unit vector in the direction of \(\vv\) is \(\vu = \langle \frac{2}{\sqrt{13}}, \frac{3}{\sqrt{13}} \rangle\text{.}\) We also get \(f_x(1,-1) = 3(-1)-2(1)(-1)^3 = -1\) and \(f_y(1,-1) = 3(1)-3(1)^2(-1)^2=0\text{,}\) so the derivative of \(f\) in the direction of the vector \(\vv \) at the point \((1,-1)\) is

    \begin{equation*} D_{\vu}f(1,-1) = f_x(1,-1)\cdot \frac{2}{\sqrt{13}} + f_y(1,-1)\cdot\frac{3}{\sqrt{13}} = -\frac{2}{\sqrt{13}}. \end{equation*}

Subsection2.5.3The Gradient

Via the Chain Rule, we have seen that for a given function \(f = f(x,y)\text{,}\) its instantaneous rate of change in the direction of a unit vector \(\vu = \langle u_1, u_2 \rangle\) is given by

\begin{equation} D_{\vu}f(x_0,y_0) = f_x(x_0,y_0)u_1 + f_y(x_0,y_0)u_2.\label{E_DDrevisited}\tag{2.5.4} \end{equation}

Recalling that the dot product of two vectors \(\vv = \langle v_1, v_2 \rangle\) and \(\vu = \langle u_1, u_2 \rangle\) is computed by

\begin{equation*} \vv \cdot \vu = v_1 u_1 + v_2 u_2, \end{equation*}

we see that we may recast Equation(2.5.4) in a way that has geometric meaning. In particular, we see that \(D_{\vu}f(x_0,y_0)\) is the dot product of the vector \(\left\langle f_x(x_0,y_0), f_y(x_0,y_0) \right\rangle\) and the vector \(\vu\text{.}\)

We call this vector formed by the partial derivatives of \(f\) the gradient of \(f\) and denote it

\begin{equation*} \nabla f(x_0,y_0) = \left\langle f_x(x_0,y_0), f_y(x_0,y_0) \right\rangle. \end{equation*}

We read \(\nabla f\) as the gradient of \(f\text{,}\) grad \(f\) or del \(f\).1The symbol \(\nabla\) is called nabla, which comes from a Greek word for a certain type of harp that has a similar shape. Notice that \(\nabla f\) varies from point to point, and also provides an alternate formulation of the directional derivative.

The directional derivative and the gradient

Given a differentiable function \(f = f(x,y)\) and a unit vector \(\vu = \langle u_1, u_2 \rangle\text{,}\) we may compute \(D_{\vu}f(x,y)\) by

\begin{equation} D_{\vu}f(x,y) = \nabla f(x,y) \cdot \vu.\label{eq_10_6_DD_grad}\tag{2.5.5} \end{equation}
In the following activity, we investigate some of what the gradient tells us about the behavior of a function \(f\text{.}\)

Activity2.5.3

Let's consider the function \(f\) defined by \(f(x,y) = x^2 - y^2\text{.}\) Some contours for this function are shown in Figure2.5.3.

Figure2.5.3Contours of \(f(x,y) = x^2 - y^2\text{.}\)
  1. Find the gradient \(\nabla f (x,y)\text{.}\)

  2. For each of the following points \((x_0,y_0)\text{,}\) evaluate the gradient \(\nabla f(x_0,y_0)\) and sketch the gradient vector with its tail at \((x_0,y_0)\text{.}\) Some of the vectors are too long to fit onto the plot, but we'd like to draw them to scale; to do so, scale each vector by a factor of 1/4.

    • \((x_0,y_0) = (2,0)\)

    • \((x_0,y_0) = (0,2)\)

    • \((x_0,y_0) = (2,2)\)

    • \((x_0,y_0) = (2,1)\)

    • \((x_0,y_0) = (-3,2)\)

    • \((x_0,y_0) = (-2,-4)\)

    • \((x_0,y_0) = (0,0)\)

  3. What do you notice about the relationship between the gradient at \((x_0,y_0)\) and the contour passing through that point?

  4. Does \(f\) increase or decrease in the direction of \(\nabla f(x_0,y_0)\text{?}\) Provide a justification for your response.

Answer
  1. The gradient is \(\nabla f (x,y) = \langle 2x, -2y \rangle\text{.}\)

  2. For all the gradients you drew, you should notice that the gradient at \((x_0,y_0)\) is perpendicular to the contour passing through that point.

  3. All of the \(\nabla f(x_0,y_0)\) that you drew should be pointing to contour lines with higher values, so \(f\) is increasing in the direction of \(\nabla f(x_0,y_0)\text{.}\)

As a vector, \(\nabla f(x_0,y_0)\) defines a direction and a length. As we will soon see, both of these convey important information about the behavior of \(f\) near \((x_0,y_0)\text{.}\)

Subsection2.5.4The Direction of the Gradient

Remember that the dot product also conveys information about the angle between the two vectors. If \(\theta\) is the angle between \(\nabla f(x_0,y_0)\) and \(\vu\) (where \(\vu\) is a unit vector), then we also have that

\begin{equation*} D_{\vu}f(x_0,y_0) = \nabla f(x_0,y_0)\cdot\vu = |\nabla f(x_0,y_0)||\vu| \cos(\theta). \end{equation*}

In particular, when \(\theta\) is a right angle, as shown on the left of Figure2.5.4, then \(D_{\vu}f(x_0,y_0) = 0\text{,}\) because \(\cos(\theta) = 0\text{.}\) Since the value of the directional derivative is 0, this means that \(f\) is unchanging in this direction, and hence \(\vu\) must be tangent to the contour of \(f\) that passes through \((x_0,y_0)\text{.}\) In other words, \(\nabla f(x_0,y_0)\) is orthogonal to the contour through \((x_0,y_0)\text{.}\) This shows that the gradient vector at a given point is always perpendicular to the contour passing through the point, confirming that what we saw in part (c) of Activity2.5.3 holds in general.

Figure2.5.4The sign of \(D_{\vu} f(x_0,y_0)\) is determined by \(\theta\text{.}\)

Moreover, when \(\theta\) is an acute angle, it follows that \(\cos(\theta) > 0\) so since

\begin{equation*} D_{\vu}f(x_0,y_0) = |\nabla f(x_0,y_0)||\vu| \cos(\theta), \end{equation*}

and therefore \(D_{\vu}f(x_0,y_0) > 0\text{,}\) as shown in the middle image in Figure2.5.4. This means that \(f\) is increasing in any direction where \(\theta\) is acute. In a similar way, when \(\theta\) is an obtuse angle, then \(\cos(\theta) \lt 0\) so \(D_{\vu}f(x_0,y_0) \lt 0\text{,}\) as seen on the right in Figure2.5.4. This means that \(f\) is decreasing in any direction for which \(\theta\) is obtuse.

Finally, as we can see in the following activity, we may also use the gradient to determine the directions in which the function is increasing and decreasing most rapidly.

Activity2.5.4

In this activity we investigate how the gradient is related to the directions of greatest increase and decrease of a function. Let \(f\) be a differentiable function and \(\vu\) a unit vector.

  1. Let \(\theta\) be the angle between \(\nabla f(x_0,y_0)\) and \(\vu\text{.}\) Use the relationship between the dot product and the angle between two vectors to explain why

    \begin{equation} D_{\vu} f(x_0,y_0) = |\langle f_x(x_0,y_0), f_y(x_0,y_0) \rangle | \cos(\theta).\label{eq_10_6_DD_grad2}\tag{2.5.6} \end{equation}
  2. At the point \((x_0,y_0)\text{,}\) the only quantity in Equation(2.5.6) that can change is \(\theta\) (which determines the direction \(\vu\) of travel). Explain why \(\theta = 0\) makes the quantity

    \begin{equation*} |\langle f_x(x_0,y_0), f_y(x_0,y_0) \rangle| \cos(\theta) \end{equation*}

    as large as possible.

  3. When \(\theta = 0\text{,}\) in what direction does the unit vector \(\vu\) point relative to \(\nabla f(x_0,y_0)\text{?}\) Why? What does this tell us about the direction of greatest increase of \(f\) at the point \((x_0,y_0)\text{?}\)

  4. In what direction, relative to \(\nabla f(x_0,y_0)\text{,}\) does \(f\) decrease most rapidly at the point \((x_0,y_0)\text{?}\)

  5. State the unit vectors \(\vu\) and \(\vv\) (in terms of \(\nabla f(x_0,y_0)\)) that provide the directions of greatest increase and decrease for the function \(f\) at the point \((x_0,y_0)\text{.}\) What important assumption must we make regarding \(\nabla f(x_0,y_0)\) in order for these vectors to exist?

Answer
  1. By definition of unit vector, we know that \(|\vu|=1\text{.}\) Then

    \begin{align*} D_{\vu} f(x_0,y_0) \amp = |\langle f_x(x_0,y_0), f_y(x_0,y_0) \rangle | |vu| \cos(\theta)\\ \amp = |\langle f_x(x_0,y_0), f_y(x_0,y_0) \rangle | (1) \cos(\theta)\\ \amp = |\langle f_x(x_0,y_0), f_y(x_0,y_0) \rangle | \cos(\theta). \end{align*}
  2. The maximum output of the cos function is 1, which occurs when the input is \(\theta = 0\) (and again at every \(2\pi\)). The quantity

    \begin{equation*} |\langle f_x(x_0,y_0), f_y(x_0,y_0) \rangle| \cos(\theta) \end{equation*}

    is maximized when cos is maximized, and thus is as large as possible when \(\theta = 0\text{.}\)

  3. When \(\theta = 0\) the unit vector \(\vu\) points in the same direction as \(\nabla f(x_0,y_0)\) since \(\theta\) represents the angle between \(\vu\) and \(\nabla f(x_0,y_0)\text{.}\) The direction of greatest increase of \(f\) at the point \((x_0,y_0)\) is then the direction of the gradient.

  4. At the point \((x_0,y_0)\text{,}\) \(f\) decreases most rapidly in the direction opposite the gradient (that is, in the direction \(-\nabla f(x_0,y_0)\)).

  5. The unit vector \(\vu\) in the direction of greatest increase for the function \(f\) at the point \((x_0,y_0)\) is

    \begin{equation*} \vu = \frac{\nabla f(x_0,y_0)}{|\nabla f(x_0,y_0)|} \end{equation*}

    and the unit vector \(\vv\) in the direction of greatest decrease for the function \(f\) at the point \((x_0,y_0)\) is

    \begin{equation*} \vv = -\frac{\nabla f(x_0,y_0)}{|\nabla f(x_0,y_0)|}, \end{equation*}

    assuming \(f\) is differentiable at the point \((x_0,y_0)\text{.}\)

Subsection2.5.5The Length of the Gradient

Having established in Activity2.5.4 that the direction in which a function increases most rapidly at a point \((x_0,y_0)\) is the unit vector \(\vu\) in the direction of the gradient, (that is, \(\vu = \frac{1}{|\nabla f(x_0,y_0)|} \nabla f(x_0,y_0)\text{,}\) provided that \(\nabla f(x_0,y_0) \ne \vzero\)), it is also natural to ask, in the direction of greatest increase for \(f\) at \((x_0,y_0)\text{,}\) what is the value of the rate of increase? In this situation, we are asking for the value of \(D_{\vu} f(x_0,y_0)\) where \(\vu = \frac{1}{|\nabla f(x_0,y_0)|} \nabla f(x_0,y_0)\text{.}\)

Using the now familiar way to compute the directional derivative, we see that

\begin{equation*} D_{\vu} f(x_0,y_0) = \nabla f(x_0,y_0) \cdot \left(\frac{1}{|\nabla f(x_0,y_0)|} \nabla f(x_0,y_0) \right). \end{equation*}

Next, we recall two important facts about the dot product: (i) \(\vw\cdot (c \vv) = c (\vw \cdot \vv)\) for any scalar \(c\text{,}\) and (ii) \(\vw \cdot \vw = |\vw|^2\text{.}\) Applying these properties to the most recent equation involving the directional derivative, we find that

\begin{equation*} D_{\vu} f(x_0,y_0) = \frac{1}{|\nabla f(x_0,y_0)|} (\nabla f(x_0,y_0) \cdot \nabla f(x_0,y_0)) = \frac{1}{|\nabla f(x_0,y_0)|} |\nabla f(x_0,y_0)|^2. \end{equation*}

Finally, since \(\nabla f(x_0,y_0)\) is a nonzero vector, its length \(|\nabla f(x_0,y_0)|\) is a nonzero scalar, and thus we can simplify the preceding equation to establish that

\begin{equation*} D_{\vu} f(x_0,y_0) = |\nabla f(x_0,y_0)|. \end{equation*}

We summarize our most recent work by stating two important facts about the gradient.

Important facts about the gradient

Let \(f\) be a differentiable function and \((x_0,y_0)\) a point for which \(\nabla f(x_0,y_0) \ne \vzero\text{.}\) Then \(\nabla f(x_0,y_0)\) points in the direction of greatest increase of \(f\) at \((x_0,y_0)\text{,}\) and the instantaneous rate of change of \(f\) in that direction is the length of the gradient vector. That is, if \(\vu = \frac{1}{|\nabla f(x_0,y_0)|} \nabla f(x_0,y_0)\text{,}\) then \(\vu\) is a unit vector in the direction of greatest increase of \(f\) at \((x_0,y_0)\text{,}\) and \(D_{\vu} f(x_0,y_0) = |\nabla f(x_0,y_0)|\text{.}\)

Activity2.5.5

Consider the function \(f\) defined by \(f(x,y) = -x + 2xy - y\text{.}\)

  1. Find the gradient \(\nabla f(1,2)\) and sketch it on Figure2.5.5.

    Figure2.5.5A plot for the gradient \(\nabla f(1,2)\text{.}\)

  2. Sketch the unit vector \(\vz = \left\langle-\frac1{\sqrt{2}}, -\frac1{\sqrt{2}}\right\rangle\) on Figure2.5.5 with its tail at \((1,2)\text{.}\) Now find the directional derivative \(D_{\vz}f(1,2)\text{.}\)

  3. What is the slope of the graph of \(f\) in the direction \(\vz\text{?}\) What does the sign of the directional derivative tell you?

  4. Consider the vector \(\vv = \langle 2,-1\rangle\) and sketch \(\vv\) on Figure2.5.5 with its tail at \((1,2)\text{.}\) Find a unit vector \(\vw\) pointing in the same direction of \(\vv\text{.}\) Without computing \(D_{\vw}f(1,2)\text{,}\) what do you know about the sign of this directional derivative? Now verify your observation by computing \(D_{\vw}f(1,2)\text{.}\)

  5. In which direction (that is, for what unit vector \(\vu\)) is \(D_{\vu}f(1,2)\) the greatest? What is the slope of the graph in this direction?

  6. Corresponding, in which direction is \(D_{\vu}f(1,2)\) least? What is the slope of the graph in this direction?

  7. Sketch two unit vectors \(\vu\) for which \(D_{\vu}f(1,2) = 0\) and then find component representations of these vectors.

  8. Suppose you are standing at the point \((3,3)\text{.}\) In which direction should you move to cause \(f\) to increase as rapidly as possible? At what rate does \(f\) increase in this direction?

Answer
  1. The gradient is \(\nabla f(x,y)=\langle -1+2y, 2x-1\rangle\) in general, so at \((1,2)\) it is \(\nabla f(1,2)=\langle 3, 1\rangle\text{.}\)

  2. Since \(\vz\) is already a unit vector, we can directly compute the directional derivative with a dot product:

    \begin{align*} D_{\vz}f(1,2) \amp = \langle 3, 1\rangle\cdot\left\langle-\frac{1}{\sqrt{2}},-\frac{1}{\sqrt{2}}\right\rangle\\ \amp = -\frac{3}{\sqrt{2}}-\frac{1}{\sqrt{2}}\\ \amp = -\frac{4}{\sqrt{2}} =-2\sqrt{2}. \end{align*}
  3. The slope of the graph of \(f\) in the direction \(\vz\) is \(-2\sqrt{2}\text{,}\) and since the directional derivative has negative sign we know that \(f\) decreases as you move along \(\vz\text{.}\)

  4. The magnitude of \(\vv\) is \(|\vv|=\sqrt{5}\text{,}\) so the unit vector pointing in the same direction as \(\vv\) is \(\vw = \left\langle\frac{2}{\sqrt{5}}, -\frac{1}{\sqrt{5}}\right\rangle\text{.}\)

    After sketching \(\vv\) on Figure2.5.5 with its tail at \((1,2)\text{,}\) note that it makes an accute angle with \(\nabla f(1,2)\text{.}\) Combining this with Figure2.5.4, we can predict that \(D_{\vw}f(1,2)\) will have positive sign. Verifying, we get:

    \begin{align*} D_{\vw}f(1,2) \amp = \langle 3, 1\rangle\cdot\left\langle\frac{2}{\sqrt{5}}, -\frac{1}{\sqrt{5}}\right\rangle\\ \amp = \frac{6}{\sqrt{5}}-\frac{1}{\sqrt{5}}\\ \amp = \frac{5}{\sqrt{5}} =\sqrt{5}. \end{align*}
  5. The directional derivative \(D_{\vu}f(1,2)\) is greatest when \(\vu\) is the unit vector pointing in the same direction as \(\nabla f(1,2)=\langle 3, 1\rangle\text{:}\) \(\vu = \left\langle \frac{3}{\sqrt{10}}, \frac{1}{\sqrt{10}} \right\rangle\text{.}\) The slope in the direction of \(\vu\) is the magnitude of \(\nabla f(1,2)\text{:}\) \(\sqrt{10}\text{.}\)

  6. The directional derivative \(D_{\vu}f(1,2)\) is least when \(\vu\) is the unit vector pointing in the opposite direction as \(\nabla f(1,2)=\langle 3, 1\rangle\text{:}\) \(\vu = \left\langle -\frac{3}{\sqrt{10}}, -\frac{1}{\sqrt{10}} \right\rangle\text{.}\) The slope in the direction of \(\vu\) is negative of the magnitude of \(\nabla f(1,2)\text{:}\) \(-\sqrt{10}\text{.}\)

  7. The two unit vectors are the ones forming right angles with \(\nabla f(1,2)\text{,}\) which are \(\left\langle \frac{1}{\sqrt{10}}, -\frac{3}{\sqrt{10}} \right\rangle\) and \(\left\langle -\frac{1}{\sqrt{10}}, \frac{3}{\sqrt{10}} \right\rangle\text{.}\)

  8. You should move in the direction of \(\nabla f(3,3)=\langle 5, 5\rangle\text{,}\) and \(f\) increases with a slope of \(|\nabla f(3,3)|=\sqrt{50}=5\sqrt{2}\text{.}\)

Subsection2.5.6Applications

The gradient finds many natural applications. For example, situations often arise for instance, constructing a road through the mountains or planning the flow of water across a landscape where we are interested in knowing the direction in which a function is increasing or decreasing most rapidly.

For example, consider a two-dimensional version of how a heat-seeking missile might work. (This application is borrowed from United States Air Force Academy Department of Mathematical Sciences.) Suppose that the temperature surrounding a fighter jet can be modeled by the function \(T\) defined by

\begin{equation*} T(x,y) = \frac{100}{1+(x-5)^2 + 4(y-2.5)^2}, \end{equation*}

where \((x,y)\) is a point in the plane of the fighter jet and \(T(x,y)\) is measured in degrees Celsius. Some contours and gradients \(\nabla T\) are shown on the left in Figure2.5.6.

Figure2.5.6Contours and gradient for \(T(x,y)\) and the missile's path.

A heat-seeking missile will always travel in the direction in which the temperature increases most rapidly; that is, it will always travel in the direction of the gradient \(\nabla T\text{.}\) If a missile is fired from the point \((2,4)\text{,}\) then its path will be that shown on the right in Figure2.5.6.

In the final activity of this section, we consider several questions related to this context of a heat-seeking missile, and foreshadow some upcoming work in Section2.6.

Activity2.5.6
  1. The temperature \(T(x,y)\) has its maximum value at the fighter jet's location. State the fighter jet's location and explain how Figure2.5.6 tells you this.

  2. Determine \(\nabla T\) at the fighter jet's location and give a justification for your response.

  3. Suppose that a different function \(f\) has a local maximum value at \((x_0,y_0)\text{.}\) Sketch the behavior of some possible contours near this point. What is \(\nabla f(x_0,y_0)\text{?}\) (Hint: What is the direction of greatest increase in \(f\) at the local maximum?)

  4. Suppose that a function \(g\) has a local minimum value at \((x_0,y_0)\text{.}\) Sketch the behavior of some possible contours near this point. What is \(\nabla g(x_0,y_0)\text{?}\)

  5. If a function \(g\) has a local minimum at \((x_0,y_0)\text{,}\) what is the direction of greatest increase of \(g\) at \((x_0,y_0)\text{?}\)

Answer
  1. The maximum value of the temperature (and hence the fighter jet's location) is at \((5, 2.5)\text{.}\) We can see this in Figure2.5.6 since the contour lines have increasing values toward that point.

  2. The gradient \(\nabla T\) at the fighter jet's location will be \(\langle0,0\rangle\text{.}\) If the gradient had a nonzero magnitude then there would be a direction to move in which would increase the heat, which would contradict the jet being at the maximum heat.

  3. If there were a direction away from \((x_0,y_0)\) we could move in to increase \(g\text{,}\) we could move in the opposite direction to decrease \(g\text{,}\) but we've assumed that \(g\) has a local minimum at \((x_0,y_0)\text{.}\) Then the direction of greatest increase of \(g\) at \((x_0,y_0)\) is again \(\langle0,0\rangle\text{.}\)

Subsection2.5.7Summary

  • The directional derivative of \(f\) at the point \((x,y)\) in the direction of the unit vector \(\vu = \langle u_1, u_2 \rangle\) is

    \begin{equation*} D_{\vu}f(x,y) = \lim_{h \to 0} \frac{f(x+u_1h, y+u_2h) - f(x,y)}{h} \end{equation*}

    for those values of \(x\) and \(y\) for which the limit exists. In addition, \(D_{\vu}f(x,y)\) measures the slope of the graph of \(f\) when we move in the direction \(\vu\text{.}\) Alternatively, \(D_{\vu} f(x_0,y_0)\) measures the instantaneous rate of change of \(f\) in the direction \(\vu\) at \((x_0,y_0)\text{.}\)

  • The gradient of a function \(f=f(x,y)\) at a point \((x_0,y_0)\) is the vector

    \begin{equation*} \nabla f(x_0,y_0) = \left\langle f_x(x_0,y_0), f_y(x_0,y_0)\right\rangle. \end{equation*}
  • The directional derivative in the direction \(\vu\) may be computed by

    \begin{equation*} D_{\vu}f(x_0,y_0) = \nabla f(x_0,y_0)\cdot \vu. \end{equation*}
  • At any point where the gradient is nonzero, gradient is orthogonal to the contour through that point and points in the direction in which \(f\) increases most rapidly; moreover, the slope of \(f\) in this direction equals the length of the gradient \(|\nabla f(x_0,y_0)|\text{.}\) Similarly, the opposite of the gradient points in the direction of greatest decrease, and that rate of decrease is the opposite of the length of the gradient.

Subsection2.5.8Exercises

Let \(E(x,y) = \frac{100}{1+(x-5)^2 + 4(y-2.5)^2}\) represent the elevation on a land mass at location \((x,y)\text{.}\) Suppose that \(E\text{,}\) \(x\text{,}\) and \(y\) are all measured in meters.

  1. Find \(E_x(x,y)\) and \(E_y(x,y)\text{.}\)

  2. Let \(\vu\) be a unit vector in the direction of \(\langle -4,3 \rangle\text{.}\) Determine \(D_{\vu} E(3,4)\text{.}\) What is the practical meaning of \(D_{\vu} E(3,4)\) and what are its units?

  3. Find the direction of greatest increase in \(E\) at the point \((3,4)\text{.}\)

  4. Find the instantaneous rate of change of \(E\) in the direction of greatest decrease at the point \((3,4)\text{.}\) Include units on your answer.

  5. At the point \((3,4)\text{,}\) find a direction \(\vw\) in which the instantaneous rate of change of \(E\) is 0.

Find all directions in which the directional derivative of \(f(x,y) = ye^{-xy}\) is 1 at the point \((0,2)\text{.}\)

Find, if possible, a function \(f\) such that

\begin{equation*} \nabla f = \left\langle \sin(yz), xz\cos(yz)+2y, xy\cos(yz)+\frac{5}{z} \right\rangle\text{.} \end{equation*}

If not possible, explain why.

Let \(f(x,y) = x^2+3y^2\text{.}\)

  1. Find \(\nabla f(x,y)\) and \(\nabla f(1,2)\text{.}\)

  2. Find the direction of greatest increase in \(f\) at the point \((1,2)\text{.}\) Explain. A graph of the surface defined by \(f\) is shown at left in Figure2.5.7. Illustrate this direction on the surface.

  3. A contour diagram of \(f\) is shown at right in Figure2.5.7. Illustrate your calculation from (b) on this contour diagram.

    Figure2.5.7Left: Graph of \(f(x,y) = x^2+3y^2\text{.}\) Right: Contours.

  4. Find a direction \(\vw\) for which the derivative of \(f\) in the direction of \(\vw\) is zero.

The properties of the gradient that we have observed for functions of two variables also hold for functions of more variables. In this problem, we consider a situation where there are three independent variables. Suppose that the temperature in a region of space is described by

\begin{equation*} T(x,y,z) = 100e^{-x^2-y^2-z^2} \end{equation*}

and that you are standing at the point \((1,2,-1)\text{.}\)

  1. Find the instantaneous rate of change of the temperature in the direction of \(\vv=\langle 0, 1, 2\rangle\) at the point \((1,2,-1)\text{.}\) Remember that you should first find a unit vector in the direction of \(\vv\text{.}\)

  2. In what direction from the point \((1,2,-1)\) would you move to cause the temperature to decrease as quickly as possible?

  3. How fast does the temperature decrease in this direction?

  4. Find a direction in which the temperature does not change at \((1,2,-1)\text{.}\)

Figure2.5.8 shows a plot of the gradient \(\nabla f\) at several points for some function \(f=f(x,y)\text{.}\)

Figure2.5.8The gradient \(\nabla f\text{.}\)
  1. Consider each of the three indicated points, and draw, as best as you can, the contour through that point.

  2. Beginning at each point, draw a curve on which \(f\) is continually decreasing.