Partial derivatives give us an understanding of how a surface changes when we move in the $x$ and $y$ directions. We made the comparison to standing in a rolling meadow and heading due east: the amount of rise/fall in doing so is comparable to $f_x\text{.}$ Likewise, the rise/fall in moving due north is comparable to $f_y\text{.}$ The steeper the slope, the greater in magnitude $f_y\text{.}$

But what if we didn't move due north or east? What if we needed to move northeast and wanted to measure the amount of rise/fall? Partial derivatives alone cannot measure this. This section investigates directional derivatives, which do measure this rate of change.

We begin with a definition.

##### Definition12.6.1Directional Derivatives

Let $z=f(x,y)$ be continuous on an open set $S$ and let $\vec u = \la u_1,u_2\ra$ be a unit vector. For all points $(x,y)\text{,}$ the directional derivative of $f$ at $(x,y)$ in the direction of $\vec u$ is \begin{equation*} D_{\vec u\,}f(x,y) = \lim_{h\to 0} \frac{f(x+hu_1,y+hu_2) - f(x,y)}h. \end{equation*}

The partial derivatives $f_x$ and $f_y$ are defined with similar limits, but only $x$ or $y$ varies with $h\text{,}$ not both. Here both $x$ and $y$ vary with a weighted $h\text{,}$ determined by a particular unit vector $\vec u\text{.}$ This may look a bit intimidating but in reality it is not too difficult to deal with; it often just requires extra algebra. However, the following theorem reduces this algebraic load.

##### Example12.6.3Computing directional derivatives

Let $z= 14-x^2-y^2$ and let $P=(1,2)\text{.}$ Find the directional derivative of $f\text{,}$ at $P\text{,}$ in the following directions:

1. toward the point $Q=(3,4)\text{,}$

2. in the direction of $\la 2,-1\ra\text{,}$ and

3. toward the origin.

Solution

As we study directional derivatives, it will help to make an important connection between the unit vector $\vec u = \la u_1,u_2\ra$ that describes the direction and the partial derivatives $f_x$ and $f_y\text{.}$ We start with a definition and follow this with a Key Idea.

Let $z=f(x,y)$ be differentiable on an open set $S$ that contains the point $(x_0,y_0)\text{.}$

1. The gradient of $f$ is $\nabla f(x,y) = \la f_x(x,y),f_y(x,y)\ra\text{.}$

2. The gradient of $f$ at $(x_0,y_0)$ is $\nabla f(x_0,y_0) = \la f_x(x_0,y_0),f_y(x_0,y_0)\ra\text{.}$

The symbol “$\nabla$” is named “nabla,” derived from the Greek name of a Jewish harp. Oddly enough, in mathematics the expression $\nabla f$ is pronounced “del $f\text{.}$”

To simplify notation, we often express the gradient as $\nabla f = \la f_x, f_y\ra\text{.}$ The gradient allows us to compute directional derivatives in terms of a dot product.

##### Key Idea12.6.6The Gradient and Directional Derivatives

The directional derivative of $z=f(x,y)$ in the direction of $\vec u$ is \begin{equation*} D_{\vec u\,}f = \nabla f\cdot \vec u. \end{equation*}

The properties of the dot product previously studied allow us to investigate the properties of the directional derivative. Given that the directional derivative gives the instantaneous rate of change of $z$ when moving in the direction of $\vec u\text{,}$ three questions naturally arise:

1. In what direction(s) is the change in $z$ the greatest (i.e., the “steepest uphill”)?

2. In what direction(s) is the change in $z$ the least (i.e., the “steepest downhill”)?

3. In what direction(s) is there no change in $z\text{?}$

Using the key property of the dot product, we have $$\nabla f\cdot \vec u = \norm{\nabla f}\,\vnorm u \cos(\theta) = \norm{\nabla f}\cos(\theta) , \label{eq_gradient}\tag{12.6.1}$$ where $\theta$ is the angle between the gradient and $\vec u\text{.}$ (Since $\vec u$ is a unit vector, $\vnorm{u} = 1\text{.}$) This equation allows us to answer the three questions stated previously.

1. Equation (12.6.1) is maximized when $\cos(\theta) =1\text{,}$ i.e., when the gradient and $\vec u$ have the same direction. We conclude the gradient points in the direction of greatest $z$ change.

2. Equation (12.6.1) is minimized when $\cos(\theta) = -1\text{,}$ i.e., when the gradient and $\vec u$ have opposite directions. We conclude the gradient points in the opposite direction of the least $z$ change.

3. Equation (12.6.1) is 0 when $\cos(\theta) = 0\text{,}$ i.e., when the gradient and $\vec u$ are orthogonal to each other. We conclude the gradient is orthogonal to directions of no $z$ change.

This result is rather amazing. Once again imagine standing in a rolling meadow and face the direction that leads you steepest uphill. Then the direction that leads steepest downhill is directly behind you, and side–stepping either left or right (i.e., moving perpendicularly to the direction you face) does not change your elevation at all.

Recall that a level curve is defined as a curve in the $x$-$y$ plane along which the $z$-values of a function do not change. Let a surface $z=f(x,y)$ be given, and let's represent one such level curve as a vector–valued function, $\vrt = \la x(t), y(t)\ra\text{.}$ As the output of $f$ does not change along this curve, $f\big(x(t),y(t)\big) = c$ for all $t\text{,}$ for some constant $c\text{.}$

Since $f$ is constant for all $t\text{,}$ $\frac{df}{dt} = 0\text{.}$ By the Multivariable Chain Rule, we also know \begin{align*} \frac{df}{dt} \amp = f_x(x,y)x'(t) + f_y(x,y)y'(t)\\ \amp = \la f_x(x,y),f_y(x,y)\ra \cdot \la x'(t),y'(t)\ra\\ \amp = \nabla f \cdot \vrp(t)\\ \amp =0. \end{align*}

This last equality states $\nabla f \cdot \vrp(t) = 0\text{:}$ the gradient is orthogonal to the derivative of $\vec r\text{,}$ meaning the gradient is orthogonal to $\vec r$ itself. Our conclusion: at any point on a surface, the gradient at that point is orthogonal to the level curve that passes through that point.

We restate these ideas in a theorem, then use them in an example.

##### Example12.6.8Finding directions of maximal and minimal increase

Let $f(x,y) = \sin(x) \cos(y)$ and let $P=(\pi/3,\pi/3)\text{.}$ Find the directions of maximal/minimal increase, and find a direction where the instantaneous rate of $z$ change is 0.

Solution
##### Example12.6.12Understanding when $\nabla f = \vec 0$

Let $f(x,y) = -x^2+2x-y^2+2y+1\text{.}$ Find the directional derivative of $f$ in any direction at $P=(1,1)\text{.}$

Solution

The fact that the gradient of a surface always points in the direction of steepest increase/decrease is very useful, as illustrated in the following example.

##### Example12.6.14The flow of water downhill

Consider the surface given by $f(x,y)= 20-x^2-2y^2\text{.}$ Water is poured on the surface at $(1,1/4)\text{.}$ What path does it take as it flows downhill?

Solution

# Subsection12.6.1Functions of Three Variables

The concepts of directional derivatives and the gradient are easily extended to three (and more) variables. We combine the concepts behind Definitions 12.6.1 and 12.6.5 and Theorem 12.6.2 into one set of definitions.

##### Definition12.6.18Directional Derivatives and Gradient with Three Variables

Let $w=F(x,y,z)$ be differentiable on an open ball $B$ and let $\vec u$ be a unit vector in $\mathbb{R}^3\text{.}$

1. The gradient of $F$ is $\nabla F = \la F_x,F_y,F_z\ra\text{.}$

2. The directional derivative of $F$ in the direction of $\vec u$ is \begin{equation*} D_{\vec u\,}F=\nabla F\cdot \vec u. \end{equation*}

The same properties of the gradient given in Theorem 12.6.7, when $f$ is a function of two variables, hold for $F\text{,}$ a function of three variables.

We interpret the third statement of the theorem as “the gradient is orthogonal to level surfaces,” the three–variable analogue to level curves.

##### Example12.6.20Finding directional derivatives with functions of three variables

If a point source $S$ is radiating energy, the intensity $I$ at a given point $P$ in space is inversely proportional to the square of the distance between $S$ and $P\text{.}$ That is, when $S=(0,0,0)\text{,}$ $\ds I(x,y,z) = \frac{k}{x^2+y^2+z^2}$ for some constant $k\text{.}$

Let $k=1\text{,}$ let $\vec u = \la 2/3, 2/3, 1/3\ra$ be a unit vector, and let $P = (2,5,3)\text{.}$ Measure distances in inches. Find the directional derivative of $I$ at $P$ in the direction of $\vec u\text{,}$ and find the direction of greatest intensity increase at $P\text{.}$

Solution

The directional derivative allows us to find the instantaneous rate of $z$ change in any direction at a point. We can use these instantaneous rates of change to define lines and planes that are tangent to a surface at a point, which is the topic of the next section.

# Subsection12.6.2Exercises

Terms and Concepts

In the following exercises, a function $z=f(x,y)$ is given. Find $\nabla f\text{.}$

In the following exercises, a function $z=f(x,y)$ and a point $P$ are given. Find the directional derivative of $f$ in the indicated directions. Note: these are the same functions as in Exercises 12.6.2.712.6.2.12.

In the following exercises, a function $z=f(x,y)$ and a point $P$ are given.

1. Find the direction of maximal increase of $f$ at $P\text{.}$

2. What is the maximal value of $D_{\vec u}\,f$ at $P\text{?}$

3. Find the direction of maximal decrease in $f$ at $P\text{.}$

4. Give a direction $\vec u$ such that $D_{\vec u}\,f=0$ at $P\text{.}$

Note: these are the same functions and points as in Exercises 12.6.2.13 through 12.6.2.18.

In the following exercises, a function $w=F(x,y,z)\text{,}$ a vector $\vec v$ and a point $P$ are given.

1. Find $\nabla F(x,y,z)\text{.}$

2. Find $D_{\vec u}\,F$ at $P\text{.}$