Skip to main content

Section 6.1 Directional Derivatives

Firstly, note that \(2D\) vectors are a convenient way to specify directions in the \(xy\)-plane. For example, we could say the slope of the function in the direction of the vector \(\mathbf{i} = \langle 1, 0 \rangle\) is \(f_x(x_0,y_0)\) while in the direction of the vector \(\mathbf{j} = \langle 0,1 \rangle\) it is \(f_y(x_0,y_0)\text{.}\) Thus the problem we are looking at is that of finding the slope of the function at the point \((x,y) = (x_0,y_0)\) in the direction given by some vector \(\mathbf{u} = \langle u_1, u_2 \rangle\text{.}\) Mathematically, we would say that we are trying to find the directional derivative of the function \(f(x,y)\) at the point \((x_0,y_0)\) in the direction \(\mathbf{u}\text{.}\) The notation that we use to denote this directional derivative is

\begin{equation*} D_{\mathbf{u}}f(x_0,y_0)\text{.} \end{equation*}

One way to approach the problem of finding the directional derivative \(D_{\mathbf{u}}f(x_0,y_0)\) is to use the tangent plane to the function at the point \((x_0,y_0)\text{,}\) i.e.

\begin{equation*} L(x,y) = f(x_0,y_0) + f_x (x_0,y_0)(x - x_0) + f_y(x_0,y_0) (y-y_0)\text{.} \end{equation*}

Then the slope of the function \(f(x,y)\) in the direction of \(\mathbf{u}\) is the slope of \(L(x,y)\) in that direction. If \(\hat{\mathbf{u}} = \langle u_1, u_2 \rangle\) is a unit vector in the direction of \(\mathbf{u}\) then the required slope is the amount by which the value of \(L\) changes as the independent variables change from \((x_0,y_0)\) to \((x_0+u_1,y_0+u_2)\text{,}\) i.e.

\begin{align*} D_u f(x_0,y_0) \amp = L(x_0+u_1, y_0+u_2) - L(x_0,y_0)\\ \amp = \bigg[ f(x_0,y_0) + f_x(x_0,y_0)(x_0+u_1 - x_0) + f_y(x_0,y_0)(y_0+u_2-y_0) \bigg] - f(x_0,y_0)\\ \amp = f_x(x_0,y_0)u_1 + f_y(x_0,y_0)u_2 \end{align*}

Consider the function \(z(x,y) = 5 - \dfrac{x^2+y^2}{2}\text{.}\) Figure 6.1.2 shows the graph of this function along with its the tangent plane at \((x,y) = (2,1)\text{.}\) Also shown on the diagram are the vectors \(\mathbf{u} = \langle 2,2 \rangle\) and \(\mathbf{v} = \langle 2,-1 \rangle\) drawn in the \(xy\)-plane with their tails at the point \((x,y) = (2,1)\text{.}\) Then the directional derivative \(D_{\mathbf{u}}(f(2,1))\) will be the slope of the line joining the points \((2,1,z(2,1))\) and \((4,3,L(4,3))\) while the directional derivative \(D_{\mathbf{v}}(f(2,1))\) will be the slope of the line joining the points \((2,1,z(2,1))\) and \((4,0,L(4,0))\text{.}\)

Figure 6.1.2.

To summarise:

Definition 6.1.3. Directional Derivative.

The directional derivative of the differentiable function \(f(x,y)\) at the point \((x_0,y_0)\) in the direction of the unit vector \(\hat{\mathbf{u}} = \langle u_1, u_2 \rangle\) is given by

\begin{equation*} D_{\hat{\mathbf{u}}} f(x_0,y_0) = f_x(x_0,y_0)u_1 + f_y (x_0,y_0)u_2\text{.} \end{equation*}

Find the directional derivative of \(f(x,y) = y\ln(x)\) at \((1,-3)\) in the direction \(\mathbf{u} = \langle -4, 3 \rangle\text{.}\)

Answer.

\(D_\hat{\mathbf{u}} f(1,-3)=\dfrac{12}{5}\text{.}\)

Solution.

For the given function

\begin{equation*} f_x = \dfrac{y}{x} \: \text{ and } \: f_y = \ln(x)\text{.} \end{equation*}

Thus

\begin{equation*} f_x(1,-3) = -3 \: \text{ and } \: f_y(1,-3) = 0\text{.} \end{equation*}

Now the unit vector in the direction of \(\langle -4,3 \rangle\) is

\begin{equation*} \hat{\mathbf{u}} = \left \langle -\dfrac{4}{5}, \dfrac{3}{5} \right \rangle\text{.} \end{equation*}

Thus the required directional derivative is

\begin{equation*} D_\hat{\mathbf{u}} f(1,-3) = (-3) \left( -\dfrac{4}{5} \right) + (0) \left( \dfrac{3}{5} \right) = \dfrac{12}{5}\text{.} \end{equation*}

Find the directional derivative of \(f(x,y) = \sin(x+2y)\) in the direction of the angle (from the positive \(x\)-axis) \(\theta = \dfrac{3 \pi}{4}\text{.}\)

Answer.

\(D_\hat{\mathbf{u}} f(x,y)=\dfrac{1}{\sqrt{2}} \cos(x+2y)\)

Solution.

For the given function

\begin{equation*} f_x = \cos(x+2y) \: \text{ and } \: f_y = 2\cos(x+2y)\text{.} \end{equation*}

Now, the unit vector in the direction of the angle \(\theta = \dfrac{3 \pi}{4}\) is

\begin{equation*} \hat{\mathbf{u}} = \left \langle - \dfrac{1}{\sqrt{2}}, \dfrac{1}{\sqrt{2}} \right \rangle\text{.} \end{equation*}

Thus the required directional derivative is

\begin{align*} D_\hat{\mathbf{u}} f(x,y) \amp = \cos(x+2y) \left( - \dfrac{1}{\sqrt{2}} \right) + 2\cos(x+2y) \left( \dfrac{1}{\sqrt{2}} \right)\\ \amp = \dfrac{1}{\sqrt{2}} \cos(x+2y) \end{align*}

Note that the directional derivative \(D_\mathbf{u} f(x_0,y_0)\) can be expressed in the terms of the scalar product if we use the following definition.

Definition 6.1.6. Gradient Vector.

The vector

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

is called the gradient vector of \(f(x,y)\) at \((x_0,y_0)\text{.}\)

With this definition the directional derivative can be written as:

\begin{align*} D_\mathbf{u} f(x_0,y_0) \amp = \langle f_x(x_0,y_0),f_y(x_0,y_0) \rangle \cdot \langle u_1, u_2 \rangle\\ \amp = \nabla f(x_0,y_0) \cdot \hat{\mathbf{u}} \end{align*}

Find the gradient vector for the function \(f(x,y) = e^{-x} \sin(y)\text{.}\) Hence find \(\nabla f(0,\pi/3)\) and the directional derivative in the direction of the origin.

Answer.

\(\nabla f = \left \langle -e^{-x}\sin(y), e^{-x}\cos(y) \right \rangle\)

\(\nabla f(0, \pi/3) = \left \langle - \dfrac{\sqrt{3}}{2} , \dfrac{1}{2} \right \rangle\)

\(D_{\hat{\mathbf{u}}} f \left( 0, \dfrac{\pi}{3} \right)=-\dfrac{1}{2}\text{.}\)

Solution.

For the given function

\begin{equation*} f_x = -e^{-x} \sin(y) \: \text{ and } \: f_y = e^{-x}\cos(y)\text{,} \end{equation*}

and so the gradient vector is

\begin{equation*} \nabla f = \left \langle -e^{-x}\sin(y), e^{-x}\cos(y) \right \rangle\text{.} \end{equation*}

Thus

\begin{equation*} \nabla f(0, \pi/3) = \left \langle -e^0 \sin \left( \dfrac{\pi}{3} \right), e^0 \cos \left( \dfrac{\pi}{3} \right) \right \rangle = \left \langle - \dfrac{\sqrt{3}}{2} , \dfrac{1}{2} \right \rangle\text{.} \end{equation*}

Now, the unit vector in the direction of the origin from the point \(\left( 0, \dfrac{\pi}{3} \right)\) is

\begin{equation*} \hat{\mathbf{u}} = \langle 0, -1 \rangle\text{.} \end{equation*}

Thus the required directional derivative is

\begin{equation*} D_{\hat{\mathbf{u}}} f \left( 0, \dfrac{\pi}{3} \right) = \left \langle -\dfrac{\sqrt{3}}{2} , \dfrac{1}{2} \right \rangle \cdot \langle 0, -1 \rangle = - \dfrac{1}{2}\text{.} \end{equation*}

The gradient vector has some interesting facts associated with it. Note in the following we are assuming that \(\nabla f \neq \langle 0, 0 \rangle\text{.}\)

  1. \(\nabla f\) points in the direction in which the directional derivative takes on its largest value. To see this, note that

    \begin{align*} D_{\mathbf{u}} f(x,y) \amp = \nabla f(x,y) \cdot \hat{\mathbf{u}}\\ \amp = \| \nabla f \| \| \hat{\mathbf{u}} \| \cos(\theta)\\ \amp = \| \nabla f \| \cos(\theta) \end{align*}

    At a given point \(\| \nabla f \|\) is fixed and so the largest value of \(D_{\mathbf{u}} f(x,y)\) will occur when \(\cos(\theta) = 1\text{,}\) i.e. when \(\theta = 0\) or put another way, when \(\hat{\mathbf{u}}\) is parallel to \(\nabla f\text{.}\) We can also see from this that the largest value that the directional derivative can take is \(\| \nabla f \|\text{.}\)

    Similarly, the directional derivative takes on its smallest value in the direction of \(-\nabla f\) and has value \(- \| \nabla f \|\text{.}\)

  2. \(\nabla f(x_0,y_0)\) is orthogonal (i.e. at right angles) to the level curve passing through \((x_0,y_0)\text{.}\)

    For the function \(z = f(x,y)\) the level curve passing through the point \((x_0,y_0)\) is given by

    \begin{equation*} f(x,y) = f(x_0,y_0)\text{.} \end{equation*}

    Now, as shown in Figure 6.1.8, a vector parallel to the tangent to this curve at the point \((x_0,y_0)\) will be \(\left \langle 1, \dfrac{dy}{dx} \right \rangle\text{.}\)

    Figure 6.1.8.

    Thus a vector normal to the curve at the point \((x_0,y_0)\) will be \(\left\langle -\dfrac{dy}{dx},1\right\rangle\text{.}\) We will see subsequently, via implicit differentiation, that for the curve \(f(x,y)=k\text{,}\)

    \begin{equation*} \frac{dy}{dx}=-\frac{f_x}{f_y} \end{equation*}

    and so a vector normal to the curve at the point \((x_0,y_0)\) will be \(\left \langle \dfrac{f_x(x_0,y_0)}{f_y(x_0,y_0)}, 1 \right \rangle\text{,}\) which is parallel to \(\nabla f(x_0,y_0)\text{.}\)

    Notice that since \(\nabla f(x_0,y_0)\) is orthogonal to the level curve passing through the point \((x_0,y_0)\) and that \(\nabla f (x_0,y_0)\) is the direction in which the directional derivative takes on its largest value, the “path of steepest ascent” on any surface \(z=f(x,y)\) is always at right angles to its contours. See the following diagram for an attempt to show this.

    Figure 6.1.9.

For the function \(f(x,y) = x^2y^3-3x\) find the directions in which the directional derivative at the point \((-2,4)\) is maximised, minimised and \(0\text{.}\)

Answer.

Maximised in the direction \(\mathbf{u} = \langle -259, 192 \rangle\text{;}\) minimised in the direction \(\mathbf{u} = \langle 259, -192 \rangle\text{;}\) and \(0\) when \(\mathbf{u} = \langle 192, 259 \rangle\)

Solution.

For the given function

\begin{equation*} f_x = 2xy^3-3 \: \text{ and } \: f_y = 3x^2y^2\text{,} \end{equation*}

and so

\begin{equation*} \nabla f(-2,4) = \langle -259,192 \rangle\text{.} \end{equation*}

Thus the directional derivative, \(D_{\hat{\mathbf{u}}} f(-2,4)\text{,}\) will be maximised in the direction

\begin{equation*} \mathbf{u} = \nabla f(-2,4) = \langle -259, 192 \rangle \end{equation*}

and minimised in the direction

\begin{equation*} \mathbf{u} = -\nabla f(-2,4) = \langle 259, -192 \rangle\text{.} \end{equation*}

Finally \(D_{\hat{\mathbf{u}}} f(-2,4)\) will be \(0\) when

\begin{align*} \nabla f(-2,4) \cdot \mathbf{u} \amp = 0\\ -259u_1 + 192u_2 \amp = 0 \end{align*}

i.e. when

\begin{equation*} \mathbf{u} = \langle 192, 259 \rangle \end{equation*}

or some scalar multiple of this.

For the function \(f(x,y) = x^2-y\) find the level curve, the tangent line and the gradient vector at the point \((-3,1)\text{.}\)

Answer.

The level curve is \(y=x^2-8\text{.}\)

The tangent line is \(y=-6x-17\text{.}\)

The gradient vector is \(\nabla f(-3,1) = \langle -6, -1 \rangle\)

Solution.

Since \(f(-3,1)=8\) the level curve through the point \((-3,1)\) is \(x^2-y=8\) or \(y=x^2-8\text{.}\) We can find the equation of the tangent by standard calculus to obtain

\begin{equation*} y=-6x-17\text{.} \end{equation*}

Next, the gradient vector is

\begin{equation*} \nabla f(-3,1) = \langle f_x(-3,1), f_y(-3,1) \rangle = \langle -6, -1 \rangle\text{.} \end{equation*}

As can be seen in the diagram below, the gradient vector is orthogonal to the level curve.

Figure 6.1.12.

Suppose you are climbing a hill whose shape is given by the equation

\begin{equation*} z = 1000-0.01x^2 - 0.02y^2 \end{equation*}

and you are standing at the point with coordinates \((60,100,764)\text{.}\)

  1. In which direction should you proceed initially in order to be ascending most rapidly?

  2. If you climb in that direction, at what angle to the horizontal will you be climbing initially?

Answer.
  1. Head in the direction of \(\nabla f (60,100) = \langle-1.2,-4 \rangle\text{.}\)

  2. The angle to the horizontal will be \(\theta = \tan^{-1} (4.17) \simeq 1.33^{c}\text{.}\)

Solution.
  1. Since we want to travel on the path of steepest ascent we will want to head in the direction of \(\nabla f(60,100)\text{.}\) Now

    \begin{equation*} \nabla f(x,y) = \langle -0.02x, -0.04y \rangle \end{equation*}
    and hence
    \begin{equation*} \nabla f (60,100) = \langle-1.2,-4 \rangle\text{.} \end{equation*}

  2. In this direction we know that

    \begin{equation*} D_{\hat{\mathbf{u}}} f(60,100) = \| \nabla f(60,100) \| \simeq 4.17\text{.} \end{equation*}
    Thus the angle, \(\theta\text{,}\) to the horizontal will be
    \begin{equation*} \theta = \tan^{-1} (4.17) \simeq 1.33^{c}\text{.} \end{equation*}

Exercises Example Tasks

1.

Find the directional derivative for \(f(x,y) = (x-2y)^2 + 5x^2\) at the point \((-3,1)\) in the direction of the point \((1,4)\text{.}\)

2.

Find the maximum value of the rate of change of \(h(s,t) = \dfrac{1}{\sqrt{s^2+t^2}}\) at \((3,4)\text{.}\)

3.

For the curve \(e^x \ln (y) - xy = 0\) use the gradient vector of a two variable function to find the tangent line and the normal line at the point \((2,e^2)\text{.}\)

4.

For the following contour plot for some unspecified function of two variables estimate the sign of the directional derivatives at:

Figure 6.1.14.
  1. The point \(A\) and in the direction of \(\mathbf{u} = \langle 1,2 \rangle\text{.}\)

  2. The point \(B\) and in the direction of \(\mathbf{w} = \langle -1,-1 \rangle\text{.}\)

  3. The point \(A\) and in the direction of the origin.

  4. The point \(B\) and in the direction of the origin.