- Home
- >
- Directional Derivative – Definition, Properties, and Examples

# Directional Derivative – Definition, Properties, and Examples

The **directional derivative** can help us in determining the steepness of the surface with respect to a given direction. The directional derivative allows us to expand our understanding of partial derivatives and the rates of change of $z$ with respect to any point’s direction.

*A directional derivative is a generalized form of partial derivative – this time, we can calculate the derivative of functions with two or more variables in any direction. *

Our article will cover the fundamentals of directional derivatives. We’ll also show you how the directional derivative’s formulas were established. We’ll also cover the concept of gradients and how we can use them to define directional derivatives.

**What Is a Directional Derivative?**

**The directional derivative** is another type of derivative that allows us to calculate the rate of change of a multivariable function in any direction. By the end of this section, you’ll be able to understand how these definitions for directional derivatives were established.

\begin{aligned} D_\textbf{u} f(x, y) &= \lim_{h \rightarrow 0} \dfrac{f(x + ha, y + hb) – f(x, y)}{h}\\&= f_x(x, y)a + f_y(x, y)b \end{aligned}

In the past, we’ve learned how to find the partial derivatives of the surface as it moves along the $x$ or $y$ directions. We’ve observed how the function behaves with respect to $x$ or $y$ by keeping the remaining variable fixed. Now, let’s extend our understanding of the multivariable function’s derivatives by observing how it behaves in any direction.

**Directional Derivative Definition**

Suppose that we have a function, $z = f(x, y)$, the directional derivative in the direction of the unit vector, $\textbf{u} = <a, b>$, can be defined in terms of limits as shown below.

\begin{aligned} D_\textbf{u} f(x, y) &= \lim_{h \rightarrow 0} \dfrac{f(x + ha, y + hb) – f(x, y)}{h} \end{aligned} |

The limit-based definition of partial derivatives is similar to the one shown above- the difference with directional derivatives, however, is that we have weighted values – we add $a \cdot h$ and $b \cdot h$ for the $x$ and $y$ components.

We can simplify the definition of directional derivatives by utilizing the partial derivatives of the function. Why don’t we derive the formula starting with the function in the single variable shown below? In case you want to try out examples first, feel free to head over to the next section to see how we can apply the definitions of directional derivatives.

We begin by using the function, $g(z)$, defined by a single variable, $z$:

\begin{aligned}g(z) &= f(x_o + az, y_o + az),\end{aligned}

where $x_o$, $y_o$, $a$, and $b$ are constants. This means that we can write $g\prime(z)$ and $g\prime(0)$ as shown below.

\begin{aligned}g\prime(z) &= \lim_{h \rightarrow 0} \dfrac{g(z + h) – g(z)}{h}\\g\prime(0) &= \lim_{h \rightarrow 0} \dfrac{g(h) – g(0)}{h}\end{aligned}

Now, let’s rewrite $g(h)$ and $g(0)$ using the fact that $g(z) = f(x_o + az, y_o + az)$ .

\begin{aligned}g\prime(0) &= \lim_{h \rightarrow 0} \dfrac{f(x_o + ah, y_o + ah) – f(x_o, y_o)}{h}\\&= D_\textbf{u} f(x_o, y_o) \end{aligned}

Let’s leave this relationship for now and rewrite $g(z)$ as $f(x, y)$, where $x = x_o + az$ and $y= y_o + bz$. Through this, we can write $g\prime(z)$ as shown below.

\begin{aligned}g\prime(z) &= \dfrac{d}{dz} f(x, y) \\&= \dfrac{\partial f}{\partial x} \dfrac{dx}{dz} + \dfrac{\partial f}{\partial y} \dfrac{dy}{dz}\\ &= af_x(x, y) + b f_y(x, y)\end{aligned}

What happens if we evaluate $g\prime(0)$ where $(x, y) =(x_o, y_o)$?

\begin{aligned}g\prime(0) &= af_x(x_o, y_o) + b f_y(x_o, y_o)\end{aligned}

Remember that we’ve established the fact that $g\prime(0) = D_\textbf{u} f(x_o, y_o)$? We can equation this with our second expression for $g\prime(0)$ and have the following relationship:

\begin{aligned} g\prime(0) &= D_\textbf{u} f(x_o, y_o)\\g\prime(0) &= af_x(x_o, y_o) + b f_y(x_o, y_o)\\D\textbf{u} &= af_x(x_o, y_o) + b f_y(x_o, y_o)\end{aligned}

This establishes our definition of directional derivatives in terms of the function’s partial derivatives.

Suppose that we have a function with two variables, $z = f(x, y)$, and $\textbf{u}$ be the unit vector, $\textbf{u} = <a, b>$, we can define the directional derivative, $D_{\textbf{u}} f(x, y)$, as shown below. \begin{aligned}D_\textbf{u} f(x, y) &= f_x(x, y)a + f_y(x, y)b\end{aligned} We can extend this definition for functions with three variables in the direction of unit vector, $\textbf{u} = <a, b, c>$. \begin{aligned}D_\textbf{u} f(x, y, z) &= f_x(x, y)a + f_y(x, y)b + f_z(x, y)c \end{aligned} |

There are instances when we’re given the value of $\theta$ instead of the unit vector. This is why when given the value of $\theta$, keep in mind that $\textbf{u}$ is equal to %%EDITORCONTENT%%lt;\cos \theta, \sin \theta>$ or $\cos \theta \textbf{i} + \sin \theta \textbf{j}$. We can redefine directional derivatives as shown below.

Suppose that we have a function with two variables, $z = f(x, y)$, and $\textbf{u}$ be the unit vector, $\textbf{u} = <\cos \theta, \sin \theta>$, we can define the directional derivative, $D_{\textbf{u}} f(x, y)$, as shown below. \begin{aligned} D_\textbf{u} f(x, y) &= \lim_{h \rightarrow 0} \dfrac{f(x + h\cos \theta, y + h\sin \theta) – f(x, y)}{h}\\&= f_x(x, y) \cos \theta + f_y(x, y)\sin \theta \end{aligned} |

Now that we’ve covered all the fundamental definitions of directional derivative, it’s time that we break down the steps in evaluating a function’s directional derivative. We’ll also highlight key applications of directional derivatives in the next section.

**How To Find Directional Derivatives?**

Finding the directional derivative of a function is straightforward – we simply need to apply the formula or definition that represents the directional derivative of the function. Here are some key pointers to remember when finding the directional derivative of the function:

- Double-check if the given vector is a unit vector by checking if the magnitude is equal to $1$.
- If the vector, $\textbf{v} = <a, b>$ or $\textbf{v} = <a, b, c>$, is not a unit vector, normalize the vector by applying the formulas shown below.

\begin{aligned}\textbf{u}\end{aligned} |
\begin{aligned}\textbf{u}\end{aligned} |

\begin{aligned}\textbf{u} = \left<\dfrac{a}{\sqrt{a^2 + b^2}}, \dfrac{b}{\sqrt{a^2 + b^2}}\right>\end{aligned} |
\begin{aligned}\textbf{u} = \left<\dfrac{a}{\sqrt{a^2 + b^2}}, \dfrac{b}{\sqrt{a^2 + b^2}}, \dfrac{c}{\sqrt{a^2 + b^2}}\right>\end{aligned} |

- Take the partial derivatives of the function then multiply each expression by the corresponding constant from the unit vector.

\begin{aligned}\textbf{u} = <a, b>\end{aligned} |
\begin{aligned} f_x(x,y) \cdot a, f_y(x, y) \cdot b \end{aligned} |

\begin{aligned}\textbf{u} = <\cos \theta, \sin \theta>\end{aligned} |
\begin{aligned} f_x(x,y) \cdot \sin \theta, f_y(x, y) \cdot \cos \theta \end{aligned} |

\begin{aligned}\textbf{u} = <a, b, c>\end{aligned} |
\begin{aligned} f_x(x, y, z) \cdot a, f_y(x, y, z) \cdot b, f_z(x, y, z) \cdot \end{aligned} |

- Write down the directional derivative as the sum of the components from the previous step.

**Example of Applying the Directional Derivative Formula**

Of course, the best way to master this topic is by working on different directional derivatives. Let’s go ahead and find the directional derivative of $f(x, y) = x^2 – 4xy + 2y^2$ in the direction of the vector, $\textbf{v} = \left<3, -4 \right>$.

\begin{aligned}|\textbf{v}| &= \sqrt{(3)^2 + (-4)^2}\\&= 5\\&\neq 1\end{aligned}

Since the vector is still not a unit vector, let’s go ahead and normalize the vector by dividing each component by the magnitude of the vector.

\begin{aligned}\textbf{u} &= \dfrac{v}{|\textbf{v}|}\\&= \left<\dfrac{3}{5}, – \dfrac{4}{5}\right>\end{aligned}

Now that we have the unit vector, it’s time for us to find the partial derivatives of the function. We’ve summarized the calculation in the table shown below.

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial x} = f_x(x, y)}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial x} f(x, y) &= \dfrac{\partial f}{\partial {\color{Teal}x}}\left({\color{Teal} x^2} – 4{\color{Teal} x}y + 2y^2\right )\\&= ({\color{Teal}2x^{2 – 1}}) – 4({\color{Teal}1})y + 0\\&= 2x – 4y\end{aligned} |

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial y} = f_y(x, y)}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial y} f(x, y) &= \dfrac{\partial f}{\partial {\color{DarkOrange}y}}\left(x^2 – 4x{\color{DarkOrange} y} + 2{\color{DarkOrange}y^2}\right )\\&= 0 – 4x({\color{DarkOrange}1}) + 2({\color{DarkOrange}2y^{2 -1}})\\&= -4x + 4y\\&= 4y – 4x\end{aligned} |

Now, multiple the partial derivatives with their corresponding component from the unit vector, $\textbf{u} = \left<\dfrac{3}{5}, – \dfrac{4}{5}\right>$, to write the direction derivative of $f(x, y)$.

\begin{aligned}D_{\textbf{u}} f(x, y) &= f_x(x, y)a + f_y(x, y)b\\&= (2x – 4y)\left(\dfrac{3}{5}\right) + (4y – 4x)\left(-\dfrac{4}{5}\right)\\&= \dfrac{6}{5}x – \dfrac{12}{5}y – \dfrac{16}{5}y + \dfrac{16}{5}x\\&= \dfrac{22}{5}x – \dfrac{28}{5}y\end{aligned}

This means that the directional derivative of $f(x, y)$ along the vector, %%EDITORCONTENT%%lt;3, -4>$, is $D_{\textbf{u}} f(x, y) = \dfrac{22}{5}x – \dfrac{28}{5}y$. Now, if we want to find the directional derivative of $f(x, y)$ at the point, $(-1, 2)$, we simply evaluate the resulting directional derivative at $x = -1$ and $y = 2$.

\begin{aligned} D_{\textbf{u}} f(-1, 2) &= \dfrac{22}{5}(-1) – \dfrac{28}{5}(2)\\&= -\dfrac{78}{5}\end{aligned}

Hence, the directional derivative of the function along the vector, %%EDITORCONTENT%%lt;3, -4>$, and at the point, $(-1, 2)$ is equal to $-\dfrac{78}{5}$ or $-15.6$. Now that we’ve learned how to calculate the directional derivative of the function, let’s explore other ways for us to define directional derivatives.

**How To Find Directional Derivatives Using Gradients?**

When we write the expression for the directional derivatives, we multiply the components of the unit vector with the corresponding partial derivatives.

\begin{aligned}D_\textbf{u} f(x, y) &= f_x(x, y)a + f_y(x, y)b \\D_\textbf{u} f(x, y, z) &= f_x(x, y, z)a + f_y(x, y, z)b + f_z(x, y, z)c \end{aligned}

There is a more compact way to describe the relationship between the partial derivatives of the function and the vectors using dot products.

\begin{aligned}D_\textbf{u} f(x, y) &= \left<f_x(x, y) , f_y(x, y)\right> \cdot \left<a, b\right>\\&= \left<\dfrac{\partial f}{\partial x}, \dfrac{\partial f}{\partial y}\right> \cdot \left<a, b\right>\\\\D_\textbf{u} f(x, y, z) &= \left<f_x(x, y, z) , f_y(x, y, z), f_z(x, y, z)\right> \cdot \left<a, b, c\right>\\&= \left<\dfrac{\partial f}{\partial x}, \dfrac{\partial f}{\partial y}, \dfrac{\partial f}{\partial z}\right> \cdot \left<a, b c\right> \end{aligned}

Through the use of dot products, we can now highlight the components of the unit vector that corresponds with the partial derivatives of the function. Now, the **vector function containing the partial derivatives of the function** has a name – we call it the **gradient**.

Suppose that $z = f(x, y)$ is function so that the partial derivatives, $f_x(x, y)$ and $f_y(x, y)$ exist, we call the vector, $\nabla f(x,y)$, the function’s gradient. We can define gradients by the equations shown below. \begin{aligned}\nabla f(x,y) &= f_x(x, y)\textbf{i} +f_y(x, y)\textbf{j}\\&= \left<\dfrac{\partial f}{\partial x}, \dfrac{\partial f}{\partial y}\right> \end{aligned} We can extend this definition to functions defined by three variables, so we can write the gradient as: \begin{aligned}\nabla f(x,y, z) &= f_x(x, y, z)\textbf{i} + f_y(x, y, z)\textbf{j} + f_z(x, y, z)\textbf{k}\\&= \left<\dfrac{\partial f}{\partial x}, \dfrac{\partial f}{\partial y},\dfrac{\partial f}{\partial z}\right> \end{aligned} |

This means that we can write the **directional derivative** as a **dot product of the function’s gradient and the** **vector**.

When $z = f(x, y)$ is a continuous and differentiable function moving along the unit vector, $\textbf{u}$, we can write the directional derivative using the function’s gradient. \begin{aligned}D_{\textbf{u}} f &= \nabla f \cdot \textbf{u}\end{aligned} |

We can use this definition to express the directional derivative in terms of $\theta$.

\begin{aligned} D_{\textbf{u}} f &= \nabla f \cdot <\cos \theta, \sin \theta>\end{aligned}

Through gradients, we can now write the directional derivative’s expressions in a more compact manner. Let’s now explore the other properties of gradients that we may use with directional derivatives.

**Properties of Directional Derivative and Gradients**

We begin by recalling the fact that the dot product of two vectors, $\textbf{a}$ and $\textbf{b}$, can be used to determine the angle between them using the equation below.

\begin{aligned}\textbf{a} \cdot \textbf{b} &= |\textbf{a}||\textbf{b}| \cos \varphi\\ \varphi &= \cos^{-1} \left(\dfrac{\textbf{a} \cdot \textbf{b}}{|\textbf{a}||\textbf{b}|} \right )\end{aligned}

This means that when we have the angle between$\nabla f(x, y)$ and the unit vector, $\textbf{u} = <\cos \theta, \sin \theta>$, is $\varphi$, we have the following relationships:

\begin{aligned}D_{\textbf{u}} f(x, y) &= \nabla f(x, y) \cdot \textbf{u}\\&= |\nabla f(x, y) |\cdot |\textbf{u}| \cos \varphi\\&=|\nabla f(x, y) |\cos \varphi \end{aligned}

Keep in mind that $\textbf{u}$ is a unit vector, so $|\textbf{u}| = 1$. That’s why the expression has reduced to $ |\nabla f(x, y) |\cos \varphi$. If we have a point, $(x_o, y_o)$, we can use the angles to predict the direction of $\nabla f(x_o, y_o)$ and $\textbf{u}$.

\begin{aligned}\varphi = 0 &\Rightarrow \cos \varphi = 1\end{aligned} |
$\nabla f(x_o, y_o)$ and $\textbf{u}$ point in the same direction |
$D_{\textbf{u}}f(x_o, y_o)$ is maximized |

\begin{aligned}\varphi = \pi &\Rightarrow \cos \varphi = -1\end{aligned} |
$\nabla f(x_o, y_o)$ and $\textbf{u}$ point in opposite direction |
$D_{\textbf{u}}f(x_o, y_o)$ is minimized |

Let us summarize these observations by outlining the three properties shown below.

When we have a function, $z = f(x, y)$, that is differentiable at $(x_o, y_o)$, we have the following properties: 1) When $\nabla f(x_o, y_o) = 0$, the directional derivative, $D_{\textbf{u}} f(x_o, y_o) = 0$ for any given unit vector, $\textbf{u}$. 2) When $\nabla f(x_o, y_o) \neq 0$, the directional derivative, $D_{\textbf{u}} f(x_o, y_o) = \text{maximum}$ for when $(x_o, y_o)$ points in the same direction as $\textbf{u}$. Hence, the maximum value of $D_{\textbf{u}} f(x_o, y_o)$ is equal to $|\nabla f(x_o, y_o)|$. 3) When $\nabla f(x_o, y_o) \neq 0$, the directional derivative, $D_{\textbf{u}} f(x_o, y_o) = \text{minimum}$ for when $(x_o, y_o)$ points in the same direction as $\textbf{u}$. Hence, the minimum value of $D_{\textbf{u}} f(x_o, y_o)$ is equal to $-|\nabla f(x_o, y_o)|$. |

We’ve prepared a wide range of problems for you to work on to check your understanding and to master this topic. When you’re ready, head over to the section below!

*Example 1*

Calculate the gradient, $\nabla f(x, y)$, of each of the following functions:

a. $f(x,y) = 4x^2 – 3xy + 5y^2$

b. $f(x,y) = \cos 4y \sin 3x$

__Solution__

Recall that the gradient of a function is simply the vector with the partial derivatives of the function as its components.

\begin{aligned}\nabla f(x, y) &= \left<\dfrac{\partial x}{\partial y}\right>\end{aligned}

We’ll use this definition of gradients to find the $\nabla f(x, y)$ for both functions. Let’s begin by taking the partial derivatives of $f(x,y) = 4x^2 – 3xy + 5y^2$.

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial x}}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial x} f(x, y) &= \dfrac{\partial f}{\partial {\color{Teal}x}}\left(4{\color{Teal} x^2} – 3{\color{Teal} x}y +5y^2\right )\\&= 4({\color{Teal}2x^{2 – 1}}) – 3({\color{Teal}1})y + 0\\&= 4(2x) – 3y\\&= 8x – 3y\end{aligned} |

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial y}}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial y} f(x, y) &= \dfrac{\partial f}{\partial {\color{DarkOrange}y}}\left(4x^2 – 3x{\color{DarkOrange} y} + 5{\color{DarkOrange}y^2}\right )\\&= 0 – 3x({\color{DarkOrange}1}) + 5({\color{DarkOrange}2y^{2 -1}})\\&= -3x + 10y\\&= 10y – 3x\end{aligned} |

Now, let’s write these partial derivatives as components of $f(x, y)$’s gradient.

\begin{aligned}\nabla f(x, y) &= \left<\dfrac{\partial f}{\partial x}, \dfrac{\partial f}{\partial y}\right>\\&= \left<8x – 3y, 10y – 3x\right>\end{aligned}

a. This means that $\nabla f(x,y)$ is equal to $\left<8x – 3y, 10y – 3x\right>$.

We’ll apply a similar process to find the expression for the gradient of $f(x,y) = \cos 4y \sin 3x$. Begin by taking the partial derivatives of $f(x, y)$.

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial x}}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial x} f(x, y) &= \dfrac{\partial f}{\partial {\color{Teal}x}}\left(\cos 4y \phantom{x}{\color{Teal}\sin 3x}\right )\\&= (\cos 4y)({\color{Teal} 3 \cos 3x})\\&= 3 \cos 4y \cos 3x\end{aligned} |

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial y}}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial x} f(x, y) &= \dfrac{\partial f}{\partial {\color{DarkOrange}y}}\left({\color{DarkOrange}\cos 4y}\phantom{x}\sin 3x\right )\\&= ({\color{DarkOrange}- 4 \cdot\sin 4y })(\sin 3x)\\&= -4 \sin 4y \sin 3x\end{aligned} |

Use these partial derivatives to write the gradient of the function as shown below.

\begin{aligned}\nabla f(x, y) &= \left<\dfrac{\partial f}{\partial x}, \dfrac{\partial f}{\partial y}\right>\\&= \left<3 \cos 4y \cos 3x, -4 \sin 4y \sin 3x \right>\end{aligned}

b. Hence, the gradient of $f(x,y) = \cos 4y \sin 3x$ is equal to $\left<3 \cos 4y \cos 3x, -4 \sin 4y \sin 3x \right>$.

*Example 2*

Suppose that $\theta = \arccos (4/5)$ and the function, $f(x, y) = x^2 – 2xy + y^2$, points in the direction of $\textbf{u} =\left< \cos \theta, \sin \theta\right>$. Determine the directional derivative of $f(x, y)$ using the limit-based definition for $D_{\textbf{u}} f(x, y)$.

__Solution__

We know that $\theta = \arccos (4/5)$, so $\cos \theta = \dfrac{4}{5}$, where $\theta$ is an acute angle. We can use the Pythagorean identity, $\sin^2 \theta + \cos^2 \theta = 1$, to find the expression for $\sin \theta$.

\begin{aligned}\sin \theta &= \sqrt{1 – \left(\dfrac{4}{5}\right)^2} \\&= \sqrt{\dfrac{9}{25}}\\ &= \dfrac{3}{5}\end{aligned}

We can use the limit-based definition of directional derivative, $D_{\textbf{u}} f(x, y)$, given the unit vector, $\textbf{u} = \left<\cos \theta, \sin \theta\right>$.

\begin{aligned} D_\textbf{u} f(x, y) &= \lim_{h \rightarrow 0} \dfrac{f(x + h\cos \theta, y + h\sin \theta) – f(x, y)}{h} \end{aligned}

Let’s first simplify the numerator, $ f(x + h\cos \theta, y + h\sin \theta) – f(x, y)$ using

$f(x, y) = x^2 – 2xy + y^2$. Begin by evaluating $ f(x + h\cos \theta, y + h\sin \theta)$:

\begin{aligned} f(x + h\cos \theta, y + h\sin \theta) &= (x + h\cos \theta)^2 – 2(x + h\cos \theta) (y + h\sin \theta) + (y + h\sin \theta) ^2\\&= x^2 + 2xh\cos \theta + h^2\cos^2\theta – 2(xy + xh\sin \theta + yh\cos \theta + h^2 \sin \theta \cos \theta)\\ &\phantom{x}+ y^2 + 2yh\sin \theta + h^2 \sin^2 \theta\\&= x^2 + h^2( \cos^2 \theta + \sin^2 \theta) + 2xh(\cos \theta – \sin \theta) – 2yh(\cos\theta – \sin\theta)+ y^2 – 2xy – 2h^2\sin \theta \cos \theta\\&= x^2 + h^2 + y^2 -2xy – 2h^2\sin \theta \cos \theta + (2xh – 2yh)(\cos \theta – \sin \theta)\end{aligned}

Substitute $\cos \theta = \dfrac{4}{5}$ and $\sin \theta = \dfrac{3}{5}$ to further simplify the expression.

\begin{aligned} f(x + h\cos \theta, y + h\sin \theta) &= x^2 + h^2 + y^2 -2xy – 2h^2\left(\dfrac{3}{5} \right )\left(\dfrac{4}{5}\right ) + (2xh – 2yh)\left(\dfrac{4}{5} – \dfrac{3}{5}\right)\\&= x^2 + h^2 + y^2 – 2xy – \dfrac{24}{25}h^2 + \dfrac{1}{5}(2xh – 2yh)\end{aligned}

Let’s go back to our limit-based equation for $D_{\textbf{u}} f(x, y)$ and evaluate the limit of our expression.

\begin{aligned} D_\textbf{u} f(x, y) &= \lim_{h \rightarrow 0} \dfrac{\left[x^2 + h^2 + y^2 – 2xy – \dfrac{24}{25}h^2 + \dfrac{1}{5}(2xh – 2yh) \right ] – (x^2 – 2xy + y^2)}{h}\\&=\lim_{h \rightarrow 0} \dfrac{x^2 + h^2 + y^2 – 2xy – \dfrac{24}{25}h^2 + \dfrac{2}{5}xh – \dfrac{2}{5}yh – x^2 + 2xy- y^2}{h} \\&= \lim_{h \rightarrow 0} \dfrac{h^2 – \dfrac{24}{25}h^2 + \dfrac{2}{5}xh – \dfrac{2}{5}yh}{h}\\&= \lim_{h \rightarrow 0} \dfrac{\dfrac{1}{25}h^2 + \dfrac{2}{5}xh – \dfrac{2}{5}yh}{h}\\&= \lim_{h \rightarrow 0} \dfrac{1}{25}h + \dfrac{2}{5}x – \dfrac{2}{5}\\&= \dfrac{2}{5}x – \dfrac{2}{5}y\end{aligned}

Hence, through the limit-based definition of directional derivatives, we’ve shown that $D_{\textbf{u}} f(x, y) = \dfrac{2}{5}x – \dfrac{2}{5}y$.

*Example 3*

Now, use the partial derivatives of $f(x, y)$ to confirm that the directional derivative of $f(x, y) = x^2 – 2xy + y^2$ along the unit vector, $\textbf{u} = \left<\dfrac{4}{5}, \dfrac{3}{5}\right>$, is equal to $D_{\textbf{u}} f(x, y) = \dfrac{2}{5}x – \dfrac{2}{5}y$.

__Solution__

Let’s show that our answer from the second example is correct by using the partial derivatives of $f(x, y)$ and the unit vector, %%EDITORCONTENT%%lt;a, b>$.

\begin{aligned}D_{\textbf{u}} f(x, y) &= af_x(x, y) + bf_y(x, y) \end{aligned}

We have $f(x, y) = x^2 – 2xy + y^2$ moving along the unit vector, $\textbf{u} = \left<\dfrac{4}{5}, \dfrac{3}{5}\right>$. Take the partial derivatives of the function first:

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial x}}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial x} f(x, y) &= \dfrac{\partial f}{\partial {\color{Teal}x}}\left({\color{Teal} x^2} – 2{\color{Teal} x}y + y^2\right )\\&= ({\color{Teal}2x^{2 – 1}}) – 2({\color{Teal}1})y + 0\\&= 2x – 2y\end{aligned} |

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial y}}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial y} f(x, y) &= \dfrac{\partial f}{\partial {\color{DarkOrange}y}}\left(x^2 – 2x{\color{DarkOrange} y} + {\color{DarkOrange}y^2}\right )\\&= 0 – 2x({\color{DarkOrange}1}) + ({\color{DarkOrange}2y^{2 -1}})\\&= -2x + 2y\\&= 2y – 2x\end{aligned} |

Let’s now use these expressions and the fact that %%EDITORCONTENT%%lt;a, b> = \left<\dfrac{4}{5}, \dfrac{3}{5}\right>$ to define the directional derivative of $f(x, y)$.

\begin{aligned}D_{\textbf{u}} f(x, y) &= \dfrac{4}{5}(2x – 2y) + \dfrac{3}{5}(2y – 2x)\\&= \dfrac{2}{5}x -\dfrac{2}{5}y \end{aligned}

Hence, we’ve proven that $D_{\textbf{u}} f(x, y) = \dfrac{2}{5}x – \dfrac{2}{5}y$. This confirms that the directional derivative returned using the limit-based definition and the directional derivative evaluated using the function’s partial derivatives will return the same expression.

*Example 4*

Find the partial derivatives of the function, $f(x, y) = \sin \left(\dfrac{x}{y}\right)$. Use the result to determine the directional derivative in the direction of $\textbf{v} = \left<-6, 8\right>$.

__Solution__

To find the partial derivatives of $f(x, y) = \sin \left(\dfrac{x}{y}\right)$, differentiate the function with respect to $x$ and with respect to $y$ while keeping the other variable constant.

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial x}}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial x} f(x, y) &= \dfrac{\partial f}{\partial {\color{Teal}x}}\left(\sin \dfrac{\color{Teal}x}{y}\right )\\&= \cos \dfrac{x}{y} \cdot \dfrac{\partial f}{\partial {\color{Teal}x}} \phantom{x}\dfrac{\color{Teal}x}{y}\\&= \cos \dfrac{x}{y} \cdot\dfrac{\color{Teal}1}{y}\\&= \dfrac{1}{y} \cos \dfrac{x}{y} \end{aligned} |

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial y}}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial y} f(x, y) &= \dfrac{\partial f}{\partial {\color{DarkOrange}y}}\left(\sin \dfrac{x}{{\color{DarkOrange}y}}\right )\\&= \cos \dfrac{x}{y} \cdot \dfrac{\partial f}{\partial {\color{DarkOrange}y}} \phantom{x}\dfrac{x}{{\color{DarkOrange}y}}\\&= \cos \dfrac{x}{y} \cdot x({\color{DarkOrange}-y^{-2}})\\&= -\dfrac{x}{y^2} \cos \dfrac{x}{y} \end{aligned} |

We have the following partial derivatives of the function, $f(x, y) = \sin \left(\dfrac{x}{y}\right)$:

- $f_x(x, y) = \dfrac{1}{y} \cos \dfrac{x}{y}$
- $f_y(x, y) = -\dfrac{x}{y^2} \cos \dfrac{x}{y}$

Before we set up the equation for the directional derivative, let’s look into our given vector to see if we still need to normalize it to a unit vector.

\begin{aligned}\textbf{v} &=\left<-6, 8\right> \\ |\textbf{v}| &= \sqrt{(-6)^2 + (8)^2}\\&= 10\\&\neq 1\end{aligned}

Since the magnitude of $\textbf{v}$ is still not equal to $1$, we’ll need to normalize the vector by dividing each component by the magnitude.

\begin{aligned}\textbf{u} &= \dfrac{\textbf{v}}{|\textbf{v}|} \\&= \left<-\dfrac{6}{10}, \dfrac{8}{10} \right>\\ &= \left<-\dfrac{3}{5}, \dfrac{4}{5} \right>\end{aligned}

Now that we have a unit vector, $\textbf{u} = \left<-\dfrac{3}{5}, \dfrac{4}{5} \right>$, use this and the partial derivatives of $f(x, y)$ to write the directional derivative’s expression.

\begin{aligned}D_{\textbf{u}} f(x, y) &= af_x(x, y) + bf_y(x, y)\\&= -\dfrac{3}{5} \left(\dfrac{1}{y} \cos \dfrac{x}{y}\right) + \dfrac{4}{5}\left(-\dfrac{x}{y^2} \cos \dfrac{x}{y}\right)\\&= -\dfrac{3}{5y}\cos \dfrac{x}{y} – \dfrac{4x}{5y^2} \cos \dfrac{x}{y}\\&= \left(-\dfrac{1}{5y}\cos \dfrac{x}{y} \right )\left(3 – \dfrac{4}{y} \right ) \end{aligned}

Hence, the directional derivative of the function is equal to $D_{\textbf{u}} f(x, y) = \left(-\dfrac{1}{5y}\cos \dfrac{x}{y} \right )\left(3 – \dfrac{4}{y} \right )$.

*Example 5*

For this problem, we’ll be working with the function, $f(x, y, z) = x^2y – 2x^2z$.

a. What is the value of $\nabla f(2, -1, 4)$?

b. Determine the directional derivative of $f(x, y, z)$ in the direction of $\textbf{v} = \left<-1, 1, 2 \right>$ and at the point, $(2, -1, 4)$.

__Solution__

First, let’s find the gradient of $f(x, y, z)$ by writing down the vector that contains the function’s derivatives as components. This means that we now need three partial derivatives: $\dfrac{\partial f}{\partial x}$, $\dfrac{\partial f}{\partial y}$, and $\dfrac{\partial f}{\partial z}$.

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial x}}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial x} f(x, y) &= \dfrac{\partial f}{\partial {\color{Teal}x}} ({\color{Teal}x^2}y – 2{\color{Teal}x^2}z)\\&= ({\color{Teal} 2x^{2- 1}})y – 2({\color{Teal} 2x^{2- 1}})z\\&= 2xy – 4xz \end{aligned} |

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial y}}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial x} f(x, y) &= \dfrac{\partial f}{\partial {\color{DarkOrange}y}} (x^2{\color{DarkOrange}y} – 2x^2z)\\&= x^2({\color{DarkOrange}1}) – 0\\&= x^2 \end{aligned} |

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial z}}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial x} f(x, y) &= \dfrac{\partial f}{\partial {\color{Purple}z}} (x^2y – 2x^2{\color{Purple}z})\\&= 0 – 2x^2({\color{Purple}1})\\&= -2x^2 \end{aligned} |

This means that the gradient of the function is equal to vector shown below.

\begin{aligned}\nabla f(x,y, z) &= \left< \dfrac{\partial f}{\partial x}, \dfrac{\partial f}{\partial y}, \dfrac{\partial f}{\partial z}\right>\\&= \left<2xy – 4xz, x^2, -2x^2 \right>\end{aligned}

Now, use $x = 2$, $y = -1$, and $z = 4$ to find the value of $\nabla f(2, -1, 4)$.

\begin{aligned}\nabla f(2, -1, 4) &= \left<2xy – 4xz, x^2, -2x^2 \right>\\&= \left<2(2)(-1) – 4(2)(4), (2)^2, -2(2)^2\right>\\&= \left<-36, 4, -8\right>\end{aligned}

a. Hence, $\nabla f(2, -1, 4)$ is equal to $\left<-36, 4, -8\right>$.

To find the directional derivative of our function, we need to check if the given vector is a unit vector. If the magnitude is not equal to zero, let’s find the unit vector by dividing $\textbf{v}$ by its magnitude.

\begin{aligned}\textbf{v} &=\left<-1,1, 2\right> \\ |\textbf{v}| &= \sqrt{(-1)^2 + (1)^2 + (2)^2}\\&= 4\\&\neq 1\end{aligned}

Let’s normalize this vector by dividing each of the three components by $4$.

\begin{aligned}\textbf{u} &= \dfrac{\textbf{v}}{|\textbf{v}|} \\&= \left<-\dfrac{1}{4}, \dfrac{1}{4}, \dfrac{2}{4} \right>\\ &= \left<-\dfrac{1}{4}, \dfrac{1}{4}, \dfrac{1}{2} \right>\end{aligned}

Now that we have the gradient of $f(x, y, z)$ evaluated at the point, $(2, -1, 4)$ and the unit vector, we can their product to calculate the function’s directional derivative.

\begin{aligned}D_{\textbf{u}} f(x, y, z) &= \nabla f(x,y, z) \cdot \textbf{u}\\&= \nabla f(-2, 1, 4) \cdot \left<-\dfrac{1}{4}, \dfrac{1}{4}, \dfrac{1}{2} \right>\\&= \left<-36, 4, -8\right> \cdot \left<-\dfrac{1}{4}, \dfrac{1}{4}, \dfrac{1}{2} \right>\\&= -36 \cdot -\dfrac{1}{4} + 4 \cdot \dfrac{1}{4} + -8 \cdot \dfrac{1}{2}\\&= 9 + 1 – 4\\&= 6\end{aligned}

b. This means that the directional derivative of $f(-2, 1, 4)$ in the direction of $\textbf{v}$ is equal to $6$.

*Example 5*

For this problem, we’ll be working with the function, $f(x, y, z) = x^2y – 2x^2z$.

a. What is the value of $\nabla f(2, -1, 4)$?

b. Determine the directional derivative of $f(x, y, z)$ in the direction of $\textbf{v} = \left<-1, 1, 2 \right>$ and at the point, $(2, -1, 4)$.

__Solution__

First, let’s find the gradient of $f(x, y, z)$ by writing down the vector that contains the function’s derivatives as components. This means that we now need three partial derivatives: $\dfrac{\partial f}{\partial x}$, $\dfrac{\partial f}{\partial y}$, and $\dfrac{\partial f}{\partial z}$.

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial x}}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial x} f(x, y) &= \dfrac{\partial f}{\partial {\color{Teal}x}} ({\color{Teal}x^2}y – 2{\color{Teal}x^2}z)\\&= ({\color{Teal} 2x^{2- 1}})y – 2({\color{Teal} 2x^{2- 1}})z\\&= 2xy – 4xz \end{aligned} |

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial y}}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial x} f(x, y) &= \dfrac{\partial f}{\partial {\color{DarkOrange}y}} (x^2{\color{DarkOrange}y} – 2x^2z)\\&= x^2({\color{DarkOrange}1}) – 0\\&= x^2 \end{aligned} |

\begin{aligned}\boldsymbol{\dfrac{\partial f}{\partial z}}\end{aligned} |
\begin{aligned}\dfrac{\partial }{\partial x} f(x, y) &= \dfrac{\partial f}{\partial {\color{Purple}z}} (x^2y – 2x^2{\color{Purple}z})\\&= 0 – 2x^2({\color{Purple}1})\\&= -2x^2 \end{aligned} |

This means that the gradient of the function is equal to vector shown below.

\begin{aligned}\nabla f(x,y, z) &= \left< \dfrac{\partial f}{\partial x}, \dfrac{\partial f}{\partial y}, \dfrac{\partial f}{\partial z}\right>\\&= \left<2xy – 4xz, x^2, -2x^2 \right>\end{aligned}

Now, use $x = 2$, $y = -1$, and $z = 4$ to find the value of $\nabla f(2, -1, 4)$.

\begin{aligned}\nabla f(2, -1, 4) &= \left<2xy – 4xz, x^2, -2x^2 \right>\\&= \left<2(2)(-1) – 4(2)(4), (2)^2, -2(2)^2\right>\\&= \left<-36, 4, -8\right>\end{aligned}

a. Hence, $\nabla f(2, -1, 4)$ is equal to $\left<-36, 4, -8\right>$.

To find the directional derivative of our function, we need to check if the given vector is a unit vector. If the magnitude is not equal to zero, let’s find the unit vector by dividing $\textbf{v}$ by its magnitude.

\begin{aligned}\textbf{v} &=\left<-1,1, 2\right> \\ |\textbf{v}| &= \sqrt{(-1)^2 + (1)^2 + (2)^2}\\&= 4\\&\neq 1\end{aligned}

Let’s normalize this vector by dividing each of the three components by $4$.

\begin{aligned}\textbf{u} &= \dfrac{\textbf{v}}{|\textbf{v}|} \\&= \left<-\dfrac{1}{4}, \dfrac{1}{4}, \dfrac{2}{4} \right>\\ &= \left<-\dfrac{1}{4}, \dfrac{1}{4}, \dfrac{1}{2} \right>\end{aligned}

Now that we have the gradient of $f(x, y, z)$ evaluated at the point, $(2, -1, 4)$ and the unit vector, we can their product to calculate the function’s directional derivative.

\begin{aligned}D_{\textbf{u}} f(x, y, z) &= \nabla f(x,y, z) \cdot \textbf{u}\\&= \nabla f(-2, 1, 4) \cdot \left<-\dfrac{1}{4}, \dfrac{1}{4}, \dfrac{1}{2} \right>\\&= \left<-36, 4, -8\right> \cdot \left<-\dfrac{1}{4}, \dfrac{1}{4}, \dfrac{1}{2} \right>\\&= -36 \cdot -\dfrac{1}{4} + 4 \cdot \dfrac{1}{4} + -8 \cdot \dfrac{1}{2}\\&= 9 + 1 – 4\\&= 6\end{aligned}

b. This means that the directional derivative of $f(-2, 1, 4)$ in the direction of $\textbf{v}$ is equal to $6$.

### Practice Questions

1. Calculate the gradient, $\nabla f(x, y)$, of each of the following functions:

a. $f(x,y) = -3x^2 + 6xy + 4y^2$

b. $f(x,y) = \tan 4x \sec 4y$

c. $f(x,y) = \ln(3x – 4y) + \ln(4x -3y)$

2. Find the partial derivatives of the function, $f(x, y) = \cos \left(\dfrac{x}{y}\right)$. Use the result to determine the directional derivative in the direction of $\textbf{v} = \left<3, -4\right>$.

3. For this problem, we’ll be working with the function, $f(x, y) = x^2y$.

a. What is the value of $\nabla f(3,1)$?

b. Determine the directional derivative of $f(x, y, z)$ in the direction of $\textbf{v} = \left<-1, 2 \right>$ and at the point, $(3, 2)$.

### Answer Key

1.

a. $\nabla f(x,y) = \left<6y – 6x, 6x + 8y\right>$

b. $\nabla f(x,y) = \left<4\sec 4y \sec^2 4x, 4\tan 4x \sec 4y \tan 4y\right>$

c. $\nabla f(x,y) = \left<\dfrac{24x – 25y}{\left(3x – 4y\right)\left(4x – 3y\right)}, \dfrac{24y-25x}{\left(3x – 4y\right)\left(4x – 3y\right)}\right>$

2. Partial derivatives: $f_x(x, y) = -\dfrac{1}{y}\sin \dfrac{x}{y}$ and $f_y(x, y) = \dfrac{x}{y^2} \sin \dfrac{x}{y}$

Directional derivative: $D_{texbf{u}} (x, y) = \left(-\dfrac{1}{5y}\sin \dfrac{x}{y}\right)\left(3 + \dfrac{4x}{y}\right)$

3.

a. $\nabla f(3, 2) = <12, 9>$

b. $D_u f(3, 2) = 6\sqrt{5}$