- Calculate directional derivatives in two dimensions
- Find and interpret the gradient vector
- Use the gradient to find the tangent to a level curve of a given function
- Calculate directional derivatives in three dimensions
When you studied partial derivatives, you learned that a function [latex]z=f(x,y)[/latex] has two partial derivatives: [latex]\partial{z}/\partial{x}[/latex] and [latex]\partial{z}/\partial{y}[/latex]. These derivatives correspond to each independent variable and represent instantaneous rates of change—slopes of tangent lines. For example, [latex]\partial{z}/\partial{x}[/latex] gives the slope of a tangent line parallel to the [latex]x[/latex]-axis, and [latex]\partial{z}/\partial{y}[/latex] gives the slope of a tangent line parallel to the [latex]y[/latex]-axis.
But what if you want to find the slope of a tangent line that’s not parallel to either axis? That’s where directional derivatives come in.
Directional Derivatives
Let’s start with a surface defined by [latex]z=f(x, y)[/latex]. Given a point [latex](a, b)[/latex] in the domain of [latex]f[/latex], we choose a direction to travel from that point. We measure this direction using an angle [latex]\theta[/latex], measured counterclockwise in the [latex]xy[/latex]-plane, starting from the positive [latex]x[/latex]-axis (Figure 1).
We travel a distance [latex]h[/latex] in the direction given by the unit vector [latex]{\bf{u}}=(\cos\theta){\bf{i}}+(\sin\theta){\bf{j}}[/latex]. The [latex]z[/latex]-coordinate of our destination point on the graph is [latex]z=f(a+h\cos\theta, b+h\sin\theta)[/latex].

To find the slope of the secant line, we divide the difference in [latex]z[/latex]-values by the length of the line segment connecting the two points in the domain. Since the length is [latex]h[/latex], the slope of the secant line is:
[latex]m_{\text{sec}}=\dfrac{f(a+h\cos\theta, b+h\sin\theta)-f(a, b)}{h}[/latex]
To find the slope of the tangent line in this direction, we take the limit as [latex]h[/latex] approaches zero.
directional derivative
Suppose [latex]z=f(x, y)[/latex] is a function of two variables with a domain of [latex]D[/latex]. Let [latex](a,b)\in{D}[/latex] and define [latex]{\bf{u}}=(\cos\theta){\bf{i}}+(\sin\theta)\bf{j}[/latex]. Then the directional derivative of [latex]f[/latex] in the direction of [latex]\bf{u}[/latex] is given by
[latex]D_{\bf{u}}f(a,b)=\displaystyle\lim_{h\to0}\dfrac{f(a+h\cos\theta,b+h\sin\theta)-f(a,b)}{h},[/latex]
provided the limit exists.
This definition provides a formal way to calculate directional derivatives in many cases.
Computing Directional Derivatives Using Partial Derivatives
There’s another approach to calculating directional derivatives that uses partial derivatives directly. This method is often more efficient than using the limit definition.
directional derivative of a function of two variables
Let [latex]z=f(x, y)[/latex] be a function of two variables [latex]x[/latex] and [latex]y[/latex], and assume that [latex]f_x[/latex] and [latex]f_y[/latex] exist. Then the directional derivative of [latex]f[/latex] in the direction of [latex]{\bf{u}}=\cos\theta{\bf{i}}+\sin\theta\bf{j}[/latex] is given by:
[latex]\large{D_{\bf{u}}f(x,y)=f_x(x,y)\cos\theta+f_y(x,y)\sin\theta}.[/latex]
Proof
The directional derivative of [latex]f[/latex] in the direction of [latex]\bf{u}[/latex] states that the directional derivative of [latex]f[/latex] in the direction of [latex]{\bf{u}}=\cos\theta{\bf{i}}+\sin\theta\bf{j}[/latex] is given by
[latex]D_{\bf{u}}f(a,b)=\displaystyle\lim_{h\to0}\frac{f(a+h\cos\theta,b+h\sin\theta)-f(a,b)}{h}[/latex]
Let [latex]x=a+t\cos\theta[/latex] and [latex]y=b+t\sin\theta[/latex], and define [latex]g(t)=f(x, y)[/latex]. Since [latex]f_x[/latex] and [latex]f_y[/latex] both exist, and therefore [latex]f[/latex] is differentiable, we can use the chain rule for functions of two variables to calculate [latex]{g}'(t)[/latex]:
[latex]\hspace{8.5cm}\begin{align} g'(t)&=\frac{\partial f}{\partial x}\frac{dx}{dt}+\frac{\partial f}{\partial y}\frac{dy}{dt} \\ &=f_x(x,y)\cos\theta+f_y(x,y)\sin\theta. \end{align}[/latex]
If [latex]t=0[/latex], then [latex]x=x_0(=a)[/latex] and [latex]y=y_0(=b)[/latex], so
[latex]g'(0)=f_x(x_0,y_0)\cos\theta+f_y(x_0,y_0)\sin\theta[/latex]
By the definition of [latex]{g}'(t)[/latex], it is also true that
[latex]\hspace{8.5cm}\begin{align} g'(0)&=\displaystyle\lim_{t\to0}\frac{g(t)-g(0)}t \\ &=\displaystyle\lim_{t\to0}\frac{f(x_0+t\cos\theta,y_0+t\sin\theta)-f(x_0,y_0)}t. \end{align}[/latex]
Therefore, [latex]D_{\bf{u}}f(x_0,y_0)=f_x(x,y)\cos\theta+f_y(x,y)\sin\theta[/latex].
[latex]_\blacksquare[/latex]
Working with Non-Unit Vectors
If the direction vector you’re given is not a unit vector, divide it by its magnitude first to get [latex]{\bf{u}}[/latex]. For example, if you want the directional derivative in the direction of [latex]\langle-5,12\rangle[/latex], first find its magnitude: [latex]\sqrt{(-5)^2+12^2}=\sqrt{169}=13[/latex]. Then [latex]{\bf{u}}=\langle-5/13, 12/13\rangle[/latex].
Then you can calculate:
[latex]\begin{array}{ccc} D_{\bf{u}}f(x,y)&=&\nabla{f}(x,y)\cdot{\bf{u}} \\ &=&-\frac5{13}(2x-y)+\frac{12}{13}(-x+6y) \\ &=&-\frac{22}{13}x+\frac{17}{13}y \end{array}[/latex]
