Skip to main content
Logo image

Section 3.4 Gradients and Potentials

In this section we review the concept of the gradient of a scalar function and its relationship to potential functions. The gradient is one of our key notions of derivatives in higher dimensions, and potentials are analogous to antiderivatives in this setting.

Subsection Gradients

Recall that a function of several variables, say \(f(x,y,z)\text{,}\) has partial derivatives corresponding to its variables. These partial derivatives are computed by treating the other variables as constants. The gradient of \(f\) is then the vector of partial derivatives.

Definition 3.4.1. Gradient of a Scalar Field.

Let \(f(x,y,z)\) be a differentiable function (so its partial derivatives exist and are continuous). The gradient of \(f(x,y,z)\) is the vector field \(\grad f(x,y,z)\) defined by the equation
\begin{equation*} \grad f(x,y,z) = \mqty[\pdv{f}{x} & \pdv{f}{y} & \pdv{f}{z}]\text{.} \end{equation*}
The gradient can also be written in terms of the del operator \(\grad\text{,}\) which is defined to be
\begin{equation*} \grad = \mqty[\pdv{x} & \pdv{y} & \pdv{z}] \end{equation*}
in the case of scalar fields on \(\RR^3\text{.}\) The gradient vector \(\grad f\) is then obtained as the scalar product of the “vector” \(\grad\) with the scalar field \(f\text{.}\)

Example 3.4.2. Computing a Gradient in \(\RR^3\).

Let \(f(x,y,z) = xze^{x-y^2}\text{.}\) Find \(\grad f\text{.}\)
Solution.
The gradient is the vector of partial derivatives:
\begin{equation*} \grad f = \mqty[z(1+x)e^{x-y^2} & -2xyze^{x-y^2} & xe^{x-y^2}]\text{.} \end{equation*}
Sage can also compute gradients of scalar fields using the .gradient() method. When using Sage, be careful to define any relevant variables. Remember that Sage will default to recognizing x as a variable if its value hasn't been otherwise assigned.
The gradient is a useful tool for finding directional derivatives.

Example 3.4.4. Computing a Directional Derivative.

Determine if \(f(x, y, z) = z^2 - xy\) is increasing or decreasing at the point \((0, 2, 0)\) and in the direction of \(\vv = \smqty[-1 & 1 & 0]\text{.}\)
Solution.
Since \(\grad f = \smqty[-y & -x & 2z]\text{,}\) it follows that
\begin{align*} D_{\vv}f(0,2,0) & = \grad f(0, 2, 0) \cdot \frac{\vv}{\norm{\vv}} \\ & = \mqty[-2 & 0 & 0] \cdot \mqty[-\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} & 0] \\ & = \frac{2}{\sqrt{2}} \end{align*}
Since this is positive, the function \(f\) is increasing at \((0, 2, 0)\) in the direction of \(\vv\text{.}\)
The relationship between gradients and directional derivatives gives the following very important property of the gradient.

Example 3.4.6. Finding a Heat Flow.

Let \(T(x,y) = 3x^2 - 2y^2\text{.}\) Find the direction and magnitude of the heat flow at the point \((3, 4)\text{.}\)

Subsection Potential Functions

Given a continuous one-dimensional force \(f(x)\) defined on some interval \([a, b]\text{,}\) we can define a corresponding potential function \(U(x)\) by
\begin{equation*} U(x) = -\int_{x_0}^x f(t)\dd{t}\text{,} \end{equation*}
where \(x_0\in[a,b]\) is some previously chosen initial value. With this definition, the work done by \(f\) in moving a particle from \(x = x_1\) to \(x = x_2\) can be written
\begin{equation*} -\Delta U = -(U(x_2) - U(x_1))\text{.} \end{equation*}
In particular, the work done by \(f\) depends only on the initial point \(x_1\) and the terminal point \(x_2\) and the work done is path independent.
Now let's move to a higher dimensional setting. Say we have the force \(\ff(x,y) = \mqty[0 & x]\) and we wish to find the work done as a particle moves from \((0, 0)\) to \((1,0)\text{.}\) If we plot this force field we see that the vectors increase in magnitude as we move to the right.
A plot of \(\ff(x,y) = \mqty[0 & x]\text{.}\)
Figure 3.4.7. A plot of \(\ff(x,y) = \mqty[0 & x]\text{.}\)
In the force field above, the work done is now path dependent. To see why, consider two paths from \((0,0)\) to \((1,0)\text{:}\) \(C_1\) given by the top half of the circle \((x-\frac{1}{2})^2 + y^2 = \frac{1}{4}\) traversed clockwise and \(C_2\) given by the bottom half of the same circle traversed counterclockwise. On \(C_1\) the work done will be negative since the path tends to go against \(\ff\) more than with \(\ff\text{.}\) Likewise, the work will be positive on \(C_2\) since this path flows with \(\ff\) more than it flows against it. Since the work depends on the path taken between \((0,0)\) and \((1,0)\text{,}\) the work is path dependent.
The issue here is that the force field \(\ff(x,y) = \mqty[0 & x]\) has no corresponding potential function. This is made more precise in the following definition.

Definition 3.4.8. Conservative Vector Fields and Potentials.

Let \(\vb{F}\) denote a vector field. If there exists a scalar field \(f\) such that \(\grad f = \vb{F}\text{,}\) then we say that \(\vb{F}\) is a conservative vector field and that \(f\) is a potential function for \(\vb{F}\text{.}\)
The vector field \(\ff\) seen in Figure 3.4.7 above is not conservative. If it were, then it would have a potential function \(\varphi(x,y)\) such that \(\grad\varphi = \ff\text{,}\) which would then imply that \(\varphi_x = 0\) and \(\varphi_y = x\text{.}\) Then
\begin{equation*} \varphi(x, y) = \int\varphi_y\dd{y} = xy + g(x) \implies \varphi_x = y + \dv{g}{x}\text{.} \end{equation*}
This contradicts the condition \(\varphi_x = 0\text{,}\) so \(\ff\) cannot have a potential.
A necessary condition for a vector field \(\ff = \mqty[P & Q]\) to be conservative is for \(Q_x - P_y\) to be \(0\text{.}\) Equivalently, \(P_y = Q_x\) in a conservative vector field. The quantity \(Q_x - P_y\) is also known as the two-dimensional curl of the vector field \(\ff\) and represents the tendency of \(\ff\) to rotate counterclockwise. Therefore two-dimensional conservative vector fields are also irrotational.

Example 3.4.9. Finding a Potential Function.

Let \(\ff = \mqty[x & y]\text{.}\) Is \(\ff\) conservative?