Three-Dimensional Gradients and Directional Derivatives

Learning Objectives

  • Calculate directional derivatives and gradients in three dimensions.

The definition of a gradient can be extended to functions of more than two variables.

Definition


Let [latex]w=f(x, y ,z)[/latex] be a function of three variables such that [latex]f_x[/latex], [latex]f_y[/latex], and [latex]f_z[/latex] exist. The vector [latex]\nabla{f}(x,y,z)[/latex] is called the gradient of [latex]f[/latex] and is defined as

[latex]\nabla{f}(x,y,z)=f_x(x,y,z){\bf{i}}+f_y(x,y,z){\bf{j}}+f_z(x,y,z){\bf{k}}.[/latex]

[latex]\nabla{f}(x,y,z)[/latex] can also be written as [latex]\text{grad }f(x,y,z)[/latex].

Calculating the gradient of a function in three variables is very similar to calculating the gradient of a function in two variables. First, we calculate the partial derivatives [latex]f_x[/latex], [latex]f_y[/latex], and [latex]f_z[/latex], and then we use the Equation for [latex]\nabla{f}(x,y,z)[/latex].

Example: finding gradients in three dimensions

Find the gradient [latex]\nabla{f}(x,y,z)[/latex] of each of the following functions:

a. [latex]f(x,y,z)=5x^2-2xy+y^2-4yz+z^2+3xz[/latex]

b. [latex]f(x,y,z)=e^{-2z}\sin 2x\cos 2y[/latex]

Try it

Find the gradient [latex]\nabla{f}(x,y,z)[/latex] of [latex]f(x,y,z)=\frac{x^2-3y^2+z^2}{2x+y-4z}[/latex].

Watch the following video to see the worked solution to the above Try It

You can view the transcript for “CP 4.32” here (opens in new window).
>The directional derivative can also be generalized to functions of three variables. To determine a direction in three dimensions, a vector with three components is needed. This vector is a unit vector, and the components of the unit vector are called directional cosines. Given a three-dimensional unit vector [latex]\bf{u}[/latex] in standard form (i.e., the initial point is at the origin), this vector forms three different angles with the positive [latex]x-,y-[/latex] and [latex]z-[/latex]axes. Let’s call these angles [latex]\alpha,\beta[/latex] and [latex]\gamma[/latex]. Then the directional cosines are given by [latex]\cos\alpha,\cos\beta[/latex] and [latex]\cos\gamma[/latex]. These are the components of the unit vector [latex]\bf{u}[/latex]; since [latex]\bf{u}[/latex] is a unit vector, it is true that [latex]\cos^2\alpha+\cos^2\beta+\cos^2\gamma=1[/latex].

Definition


Suppose [latex]w=f(x,y,z)[/latex] is a function of three variables with a domain of [latex]D[/latex], Let [latex](x_0,y_0,z_0)\in{D}[/latex] and let [latex]{\bf{u}}=cos\alpha{\bf{i}}+\cos\beta{\bf{j}}+\cos\gamma{\bf{k}}[/latex] be a unit vector. Then, the directional derivative of [latex]f[/latex] in the direction of [latex]u[/latex] is given by

[latex]D_{\bf{u}}f(x_0,y_0,z_0)=\displaystyle{\lim_{t\to0}}\frac{f(x_0+t\cos\alpha,y_0+t\cos\beta,z_0+t\cos\gamma)-f(x_0,y_0,z_0)}t,[/latex]

providing the limit exists.

We can calculate the directional derivative of a function of three variables by using the gradient, leading to a formula that is analogous to the dot product definition of the Directional Derivative of a Function of Two Variables.

Theorem: Directional derivative of a function of three variables


Let [latex]f(x,y,z)[/latex] be a differentiable function of three variables and let [latex]{\bf{u}}=\cos\alpha{\bf{i}}+\cos\beta{\bf{j}}+\cos\gamma{\bf{k}}[/latex] be a unit vector. Then, the directional derivative of [latex]f[/latex] in the direction of [latex]{\bf{u}}[/latex] is given by

[latex]\hspace{6cm}\begin{align} D_{\bf{u}}f(x,y,z)&=\nabla{f}(x,y,z)\cdot{\bf{u}} \\ &=f_x(x,y,z)\cos\alpha+f_y(x,y,z)\cos\beta+f_z(x,y,z)\cos\gamma. \end{align}[/latex]

The three angles [latex]\alpha,\beta[/latex], and [latex]\gamma[/latex] determine the unit vector [latex]\bf{u}[/latex]. In practice, we can use an arbitrary (nonunit) vector, then divide by its magnitude to obtain a unit vector in the desired direction.

Example: finding a directional derivative in three dimensions

Calculate [latex]D_{\bf{u}}f(1,-2,3)[/latex] in the direction of [latex]v=-{\bf{i}}+2{\bf{j}}+2{\bf{k}}[/latex] for the function

[latex]f(x,y,z)=5x^2-2xy+y^2-4yz+z^2+3xz[/latex].

Try it

Calculate [latex]D_{\bf{u}}f(x,y,z)[/latex] and [latex]D_{\bf{u}}f(0,-2,5)[/latex] in the direction of [latex]{\bf{v}}=-3{\bf{i}}+12{\bf{j}}-4{\bf{k}}[/latex] for the function [latex]f(x,y,z)=3x^2+xy-2y^2+4yz-z^2+2xz[/latex].

Watch the following video to see the worked solution to the above Try It

You can view the transcript for “CP 4.33” here (opens in new window).