Directional Derivatives and the Gradient: Learn It 4

Three-Dimensional Gradients and Directional Derivatives

The definition of a gradient extends naturally to functions of more than two variables.

gradient of a function of three variables

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]

The notation [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 follows the same process as in two variables. First, calculate the partial derivatives [latex]f_x[/latex], [latex]f_y[/latex], and [latex]f_z[/latex], then assemble them into the gradient vector.

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

  1. [latex]f(x,y,z)=5x^2-2xy+y^2-4yz+z^2+3xz[/latex]
  2. [latex]f(x,y,z)=e^{-2z}\sin 2x\cos 2y[/latex]

Directional Derivatives in Three Dimensions

The directional derivative also generalizes to functions of three variables. To specify a direction in three dimensions, we need a vector with three components. This vector must be a unit vector, and its components are called directional cosines.

Given a three-dimensional unit vector [latex]{\bf{u}}[/latex] in standard position (initial point at the origin), this vector forms three angles with the positive [latex]x[/latex]-, [latex]y[/latex]-, and [latex]z[/latex]-axes. Let’s call these angles [latex]\alpha[/latex], [latex]\beta[/latex], and [latex]\gamma[/latex]. The directional cosines are [latex]\cos\alpha[/latex], [latex]\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, we have [latex]\cos^2\alpha+\cos^2\beta+\cos^2\gamma=1[/latex].

directional derivative in three dimensions

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.

[latex]\\[/latex]

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.

Just as in two dimensions, we can calculate the directional derivative using the gradient. This leads to a formula analogous to the dot product definition we saw earlier.

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.

[latex]\\[/latex]

Then, the directional derivative of [latex]f[/latex] in the direction of [latex]{\bf{u}}[/latex] is given by

[latex]\begin{array}{ccl}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{array}[/latex]

The three angles [latex]\alpha[/latex], [latex]\beta[/latex], and [latex]\gamma[/latex] determine the unit vector [latex]{\bf{u}}[/latex]. In practice, you can use any (nonunit) vector, then divide by its magnitude to obtain a unit vector in the desired direction.
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].