$$\def\ans#1{\bbox[border:1px solid green,6pt]{#1}}$$

# Conservative Vector Fields

## Introduction

Remember, we can generate a vector field by taking the gradient of a scalar potential function: $\begin{array}{c c c} \phi (x,y) & \longrightarrow & \vec{F} (x,y) = \nabla \phi (x,y)\\ \textrm{potential function} & & \textrm{gradient field} \end{array}$ Now, start with a vector field; in some cases, we can work backwards and find that it is the gradient of some scalar function. This leads to the following definition: if a vector field can be written as the gradient of some potential function (i.e. if some function $$\phi (x,y)$$ exists such that $$\vec{F} (x,y) = \nabla \phi (x,y)$$) then this field is conservative.

#### Terminology

The term "conservative" is related to the concept of conservation of energy. Some forces are conservative (like gravity and magnetism), meaning that if you travel along a closed path through a gravitational or magnetic field, the initial and final energy will be equal (conserved). Some forces, however, are not conservative (the notable example being friction).

### Testing to see if a field is conservative

In 2-D: a vector field $$\vec{F} = \langle f(x,y), g(x,y) \rangle$$ is conservative if and only if $$f_y = g_x$$.

In 3-D: a vector field $\vec{F} = \langle f(x,y,z), g(x,y,z), h(x,y,z) \rangle$ is conservative if and only if $$f_y=g_x$$, $$f_z=h_x$$, and $$g_z=h_y$$.

Determine whether or not $$\vec{F} = \langle -y,x+y \rangle$$ is conservative.

#### Solution

Since $$f(x,y) = -y$$ and $$g(x,y) = x+y$$, $$f_y=-1$$ and $$g_x=1$$. Then, since $$f_y \neq g_x$$, this field is not conservative.

Determine whether or not $$\vec{F} = \langle 2xy-z^2,x^2+2z,2y-2xz \rangle$$ is conservative.

#### Solution

\begin{align} f(x,y,z) = 2xy-z^2 &\longrightarrow f_y = 2x,\ f_z=-2z\\ g(x,y,z) = x^2+2z &\longrightarrow g_x = 2x,\ g_z = 2\\ h(x,y,z) = 2y-2xz &\longrightarrow h_x = -2z,\ h_y = 2\\ \\ &\longrightarrow f_y=g_x, f_z=h_x, \textrm{ and } g_z=h_y\\ \\ &\implies \ans{\textrm{Conservative}} \end{align}

#### Try it yourself:

(click on a problem to show/hide its answer)

## Finding the Potential Function

Suppose we start with a conservative vector field, and we want to know what its potential function is. We can work backward by integrating the component functions of the vector field.

For instance, suppose $$\vec{F} = \langle 4x+y, x+2y \rangle$$. Then we want to find the potential function $$\phi (x,y)$$ where $$\vec{F} = \nabla \phi (x,y)$$, meaning that $$\phi_x = 4x+y$$ and $$\phi_y = x+2y$$. Start by integrating $$\phi_x$$ with respect to x: $\phi = \int 4x+y\ dx = 2x^2 + xy + c(y)$ Notice that the constant of integration is a function of y (constant with respect to x).

Similarly, we can integrate $$\phi_y$$ with respect to y: $\phi = \int x+2y\ dy = xy + y^2 + c(x)$

Matching up the two expressions for $$\phi$$, we can tell that $$c(x) = 2x^2$$ and $$c(y)=y^2$$, so $\phi(x,y) = 2x^2+xy+y^2.$

Find the potential function $$\phi (x,y,z)$$ if $$\vec{F} = \langle 2xy-z^2,x^2+2z,2y-2xz \rangle$$.

#### Solution

Start by integrating $$\phi_x$$ with respect to x, noting that the constant of integration will be a function of y and z:

\begin{align} \phi_x &= 2xy-z^2\\ \phi &= \int 2xy-z^2\ dx\\ &= x^2y-z^2x+c(y,z) \end{align}

Here's where things get a bit tricky: to find $$c(y,z)$$, differentiate this expression with respect to y and match it up with $$\phi_y$$:

\begin{align} \phi &= x^2y-z^2x+c(y,z)\\ \phi_y &= x^2 + c_y(y,z) = x^2+2z\\ &\implies c_y (y,z) = 2z\\ &\implies c(y,z) = \int 2z\ dy = 2yz+d(z) \end{align}

Now we're closer (we know that $$\phi (x,y) = x^2y-z^2x+2yz+d(z)$$), but we still need to find $$d(z)$$. Here, differentiate $$\phi$$ with respect to z:

\begin{align} \phi &= x^2y-z^2x+2yz+d(z)\\ \phi_z &= -2zx+2y+d_z(z) = 2y-2xz\\ &\implies d_z (z) = 0\\ &\implies d(z) = C \textrm{ (let } C=0 \textrm{)}\\ \\ &\implies \ans{\phi(x,y,z) = x^2y-z^2x+2yz} \end{align}

## Fundamental Theorem for Line Integrals

For a line integral in a vector field, there is a fundamental theorem analogous to the well-known fundamental theorem of calculus:

A vector field $$\vec{F}$$ is conservative (i.e. $$\vec{F}=\nabla \phi(x,y)$$) if and only if $\int_C \vec{F} \cdot \vec{T} \ ds = \int_C \vec{F} \cdot \vec{r}\ '(t)\ dt = \phi (B) - \phi (A),$ where $$A$$ and $$B$$ are the starting and ending points of the path $$C$$, respectively.

In physical terms, this means that the line integral is independent of path; this will come into play when we calculate work done by a conservative force.

Suppose $$\phi (x,y)=\dfrac{1}{2}(x^2-y^2)$$, so $$\vec{F} (x,y) = \nabla \phi (x,y) = \langle x,-y \rangle$$. If $$A=(1,0)$$ and $$B=(0,1)$$, consider the following two paths from $$A$$ to $$B$$: \begin{align} C_1 &= \vec{r}_1(t) = \langle \cos t, \sin t \rangle \ \textrm{ for } \ 0 \leq t \leq \dfrac{\pi}{2} \ \textrm{ (quarter circle)}\\ C_2 &= \vec{r}_2(t) = \langle 1-t,t \rangle \ \textrm{ for } \ 0 \leq t \leq 1 \ \textrm{ (straight line)} \end{align} Show that $$\int_{C_1} \vec{F} \cdot \vec{r}\ '(t)\ dt = \int_{C_2} \vec{F} \cdot \vec{r}\ '(t)\ dt$$ (the line integral is independent of path).

#### Solution

\begin{align} \int_{C_1} \vec{F} \cdot \vec{r}_1\ '(t)\ dt &= \int_0^{\pi/2} -2\sin t \cos t \ dt\\ &= \int_0^{\pi/2} -\sin (2t)\ dt\\ &= \dfrac{1}{2} \cos (2t) \bigg|_0^{\pi/2} = -1\\ \\ \int_{C_2} \vec{F} \cdot \vec{r}_2\ '(t)\ dt &= \int_0^1 t-1-t\ dt\\ &= \int_0^1 -1\ dt = -1\\ \\ &\implies \ans{\int_{C_1} \vec{F} \cdot \vec{r}\ '(t)\ dt = \int_{C_2} \vec{F} \cdot \vec{r}\ '(t)\ dt} \end{align}

## Application: Work

The work done on an object by moving through a conservative force field (like a magnetic field or a gravitational field) depends only on the starting and ending points, not on the path taken (based on the fundamental theorem). Basically, the positive and negative changes in energy cancel each other out along different paths (and if the object returns to its starting point, the net work will be zero, since the initial and final energies will be the same).

$W = \int_C \vec{F} \cdot \vec{r}\ '(t)\ dt = \phi(B) - \phi(A)$

Suppose $$\phi (x,y)=3x+x^2y-y^3$$, so $$\vec{F} (x,y) = \nabla \phi (x,y) = \langle 3+2xy,x^2-3y^2 \rangle$$. Find the work done on an object moving along the following path $$C:\ \vec{r}(t) = \langle e^t \sin t, e^t \cos t \rangle$$ for $$0 \leq t \leq \pi$$.

#### Solution

First, is $$\vec{F}$$ conservative? If so, we can calculate the work done by subtracting the final potential from the initial potential.

$f_y = 2x = g_x \implies \textrm{ conservative}$

Therefore,

\begin{align} W &= \int_C \vec{F} \cdot \vec{r}\ '(t) \ dt = \phi(B) - \phi(A)\\ &A \ : \ \textrm{ when } t=0, \vec{r} = \langle 0,1 \rangle\\ &B \ : \ \textrm{ when } t=\pi, \vec{r} = \langle 0,-e^{\pi} \rangle\\ \\ W &= \phi \left(0,-e^{\pi}\right) - \phi (0,1) = -\left(-e^{\pi}\right)^3+1\\ &= \ans{e^{3\pi}+1} \end{align}

#### Try it yourself:

(click on a problem to show/hide its answer)