
\section{Conservative Vector Fields}
In this section, we will assume that $\mathbf{F}$ is smooth on some domain $D \subset \mathbb{R}^n$. We say that $\mathbf{F}$ is \textbf{conservative} if there is a (scalar) function $\phi : D \rightarrow \mathbb{R}$ such that
\begin{equation}\label{2.1eq-conservative}
\mathbf{F} = \nabla \phi \hbox{ on }D.
\end{equation} 
As discussed in Section \ref{sec:vectorFields}, we will call $\phi$ a {\it potential function} for $\mathbf{F}$. A potential function is not unique: if (\ref{2.1eq-conservative}) holds for some $\phi$, then it also holds with $\phi$ replaced by $\phi+C$ for any constant $C$. In questions where we need to find a potential function for a given $\mathbf{F}$, one potential function will be sufficient. 



This section will focus on examples, with the goal of showing you how to prove (or disprove) that a given smooth vector field $\mathbf{F}$ is conservative. 

\begin{example}[Gravitational Field]\label{2.2ex1}
The gravitational field $\mathbf{F} (\mathbf{r}) =- \frac{k \mathbf{r}}{\vert \mathbf{r} \vert^3}$ is conservative on $\mathbf{R}^3 \setminus \{\mathbf{0}\}$.  You can verify this by showing that $\mathbf{F} = \nabla \phi$ for the function $\phi (\mathbf{r}) = \frac{k}{\vert \mathbf{r} \vert}$.



\end{example}

\begin{example}\label{2.2ex2}
The function $\mathbf{F}(x,y) = y \mathbf{i} + x \mathbf{j}$ is conservative,  with $\phi (x,y) = xy$.  Indeed
$$
\phi_x (x,y) = y, \, \phi_y (x,y) = x \Rightarrow \mathbf{F}(x,y) = \nabla \phi,
$$
which verifies \eqref{2.1eq-conservative}. 
\end{example}






\begin{figure}[h]
\begin{minipage}{\linewidth}
\centering
\includegraphics[width = \linewidth]{figures/22fig1.png}
\caption{The gravitational field $\mathbf{F}(\mathbf{r}) = - k \frac{\mathbf{r}}{\vert \mathbf{r} \vert^3}$ from Example \ref{2.2ex1} is shown as green arrows.  The field lines are rays terminating at the origin (which are the red lines). The equipotential surfaces are concentric spheres with common centre at the origin.}
\end{minipage}
\end{figure}








\subsection{Equipotential curves and surfaces} Suppose that $\mathbf{F}$ is a conservative field, with an associated potential function $\phi$.  We will also assume that $\phi$ is $C^1$ on some domain $D$. An \textbf{equipotential curve} (in $\mathbb{R}^2$) or \textbf{equipotential surface} (in $\mathbb{R}^3$) is given by the equation $\phi = C$, where $C$ is a constant. 

Suppose that $\mathbf{r} (t)$ is a field line associated to $\mathbf{F}$, parametrized so that $\lambda (t) = 1$ and $\mathbf{r}' (t) = \mathbf{F}\big(\mathbf{r}(t) \big)$. This implies that
\begin{equation}\label{22-e01}
\mathbf{r}' (t) = \mathbf{F}\big(\mathbf{r}(t) \big) = \nabla \phi \big( \mathbf{r}(t) \big).
\end{equation}
Furthermore, by the Chain Rule and then (\ref{22-e01}) we have
\begin{align*}
\frac{d}{dt} \phi \big(\mathbf{r}(t) \big) &= \nabla \phi \big(\mathbf{r}(t) \big) \cdot \mathbf{r}' (t) = \mathbf{F}\big(\mathbf{r}(t) \big) \cdot \mathbf{F}\big(\mathbf{r}(t)\big)
\\
&=  \vert \mathbf{F}\big(\mathbf{r}(t) \big) \vert^2.
\end{align*}
In particular, we always have
$$
\frac{d}{dt} \phi \big(\mathbf{r}(t) \big) \geq 0,
$$
with $\frac{d}{dt} \phi \big(\mathbf{r}(t) \big) = 0$ if and only if $\mathbf{F}\big(\mathbf{r}(t) \big) = \mathbf{0}.$
Hence, if $\mathbf{F} \neq \mathbf{0}$,  then $\phi$ is always increasing along field curves.

An additional geometric interpretation of (\ref{22-e01}) is as follows. Assume that $\mathbf{F}=\nabla\phi\neq \mathbf{0}$ on $D$. We know from Math 226 that $\nabla \phi$ is perpendicular to the level curves of $\phi$. This shows that the field lines $\mathbf{r}' = \nabla \phi$ are perpendicular to equipotential curves, and always point in the direction of steepest increase of $\phi$.  



\begin{figure}[h]
\begin{minipage}{\linewidth}
\centering
\includegraphics[width = \linewidth]{figures/22fig2.png}
\caption{The conservative field $\mathbf{F}(x,y) = y \mathbf{i} + x \mathbf{j}$ from Example \ref{2.2ex2}, is shown as green arrows. The field lines (shown here in solid blue) are given by equations of the form $y^2 - x^2 = C$ where $C \in \mathbb{R}$ is some constant. The equipotential curves (shown in dashed red) are hyperbolas and satisfy the equations $xy = D$ where $D \in \mathbb{R}$ constant.  As an exercise: check that the quadratic equations $y^2 - x^2 = C$ define field lines for this vector field $\mathbf{F}(x,y)$!}
\end{minipage}
\end{figure}




\subsection{Proving a Field is Conservative/Non-Conservative} The two examples below provide templates for determining whether a given field is conservative (Example \ref{2.2ex3}) or non-conservative (Example \ref{2.2ex4}).

\begin{example}[A Conservative Field in $\mathbb{R}^3$]\label{2.2ex3}
Let 
$$\mathbf{F}(x,y) = \frac{2 \sin (x) \cos (x)}{z} \mathbf{i} - \frac{2 \sin (y) \cos (y)}{z} \mathbf{j} - \frac{\sin^2 (x) + \cos^2 (y) }{z^2} \mathbf{k}$$
on the domain $\mathbb{R}^3 \setminus \{z = 0\}$. Prove $\mathbf{F}$ is conservative by finding a potential function $\phi$.
\end{example}


In order for $\phi$ to be a potential function,  we must have that $\nabla \phi = \mathbf{F}$, so that
$$
\frac{\partial \phi}{\partial x} = \frac{2 \cos (x) \sin (x)}{z},  \,  \, \frac{\partial \phi}{\partial y} = -\frac{2\sin (y) \cos (y)}{z},  \, \, \frac{\partial \phi}{\partial z} = - \frac{\sin^2(x) + \cos^2 (y)}{z^2}.
$$
We use these three equalities to reconstruct our function $\phi (x,y,z)$, as follows. First, note that
$$
\frac{\partial \phi}{\partial x} = \frac{2 \cos (x) \sin (x)}{z} \Rightarrow  \phi (x,y,z) = \int \frac{2 \cos (x) \sin (x)}{z} dx + g(y,z) = \frac{\sin^2 (x)}{z} + g(y,z),
$$
where $g(y,z)$ is some unknown function of the variables $(y,z)$. This unknown function $g(y,z)$ replaces the constant of integration, since we have only integrated in the $x$ variable (and so $\frac{\partial}{\partial x} g(y,z) \equiv 0$). 

Next,
$$
\frac{\partial \phi}{\partial y} = \frac{\partial}{\partial y} \left[\frac{\sin^2(x)}{z} + g(y,z) \right] = \frac{\partial g}{\partial y} (y,z) = -\frac{2 \sin (y) \cos (y)}{z},
$$
and so our unknown function $g(y,z)$ necessarily satisfies
$$
g(y,z) = \int - \frac{2 \cos (y) \sin (y)}{z} dy + h (z) = \frac{\cos^2 (y)}{z} + h(z),
$$
where, now, $h(z)$ is an unknown function in the variable $z$ alone! Hence,  our unknown function $\phi (x,y,z)$ of three variables satisfies
$$
\phi(x,y,z) = \frac{\sin^2 (x)}{z} + \frac{\cos^2 (y)}{z} + h (z).
$$
As a final calculation:
\begin{eqnarray*}
\frac{\partial \phi}{\partial z} & = & \frac{\partial}{\partial z} \left( \frac{\sin^2(x) + \cos^2(y)}{z} + h(z) \right) \\[1ex]
\quad & = & - \frac{\sin^2(x) + \cos^2(y)}{z^2} + h' (z) \\[1ex]
\quad & = &  -\frac{\sin^2(x) + \cos^2(y)}{z^2}.
\end{eqnarray*}
This calculation shows that $h' (z) = 0$,  which just means that $h (z) = C$ is some constant function. Setting $C = 0$,  the function $\phi (x,y,z) = \frac{\sin^2(x) + \cos^2(y)}{z}$ satisfies all three equations.  Hence, $\mathbf{F}$ is conservative, with a potential function $\phi$.

\smallskip

Notice that, in the above example,  each calculation re-wrote $\phi(x,y,z)$ as a function of ``one less'' variable,  with the conclusion that the final function $h (z)$ was computable as a function of $z$ alone (i.e. in this case, a constant function).  This is not always possible, as the next example shows. 

\begin{example}[A Non-Conservative Field in $\mathbb{R}^2$]\label{2.2ex4}
In this example, we give three separate proofs that the smooth vector field $\mathbf{F} (x,y) = -y \mathbf{i} + x \mathbf{j}$ is \underline{not} conservative on $\mathbb{R}^2$. Each proof provides a different insight into the problem.
\end{example}

\medskip
\noindent
\underline{Proof \#1 (Calculation)}.  In the first proof, we assume that a potential function $\phi(x,y)$ satisfying
$$
\frac{\partial \phi}{\partial x} = - y, \,\, \frac{\partial \phi}{\partial y} = x,
$$
exists, and then arrive at a contradiction.  This follows the same template as Example \ref{2.2ex3}.  First, we know that
$$
\frac{\partial \phi}{\partial x} = - y \Rightarrow \phi(x,y) = - \int y dx = -xy + g(y),
$$
for some unknown function $g(y)$ in the variable $y$ alone.  Then, as a second step,
$$
\frac{\partial \phi}{\partial y} = \frac{\partial}{\partial y} \big(-xy + g(y)\big) = -x + g' (y) = x.
$$
So, we have that $g' (y) = 2x$. This is a contradiction, since $g$ should be a function of the variable $y$ alone. 

\medskip\noindent
\underline{Proof \#2 (Geometric)}.   From Section \ref{sec:vectorFields}, we know that the field lines of $\mathbf{F}(x,y) = -y \mathbf{i} + x \mathbf{j}$ are circles centered at the origin. Now, suppose that $\mathbf{F}$ were conservative,
with $\mathbf{F} = \nabla \phi$.  Then, $\phi (\mathbf{r} (t))$ would necessarily increase along any field line $\mathbf{r}(t)$.  But this leads to a contradiction! 

Indeed, choose some starting point $\mathbf{r}_0 = \mathbf{r}(t_0)$ on the field line $\mathbf{r}$ (which is a circle).  Then, there necessarily exists some $t_1 > t_0$ such that $\mathbf{r}(t_1) = \mathbf{r}_0$ (this corresponds to a full rotation of the circle). However, since $\phi$ is increasing, we then have
$$
\phi (\mathbf{r}_0) = \phi (\mathbf{r}(t_0)) < \phi (\mathbf{r}(t_1) ) = \phi (\mathbf{r}_0),
$$
a contradiction.

\medskip\noindent
\underline{Proof \#3 (Equality of Mixed Partials)}.  Suppose again that $\mathbf{F} = \nabla \phi$ for some $C^2$ function\footnote{
How do we know that $\phi$ is $C^2$? If $\mathbf{F} = \nabla \phi$, then $\phi_x=-y$ and $\phi_y=x$ have continuous derivatives of all orders, therefore so does $\phi!$
} $\phi$. Then,
$$
F_1 = \frac{\partial \phi}{\partial x}, \, \, F_2 = \frac{\partial \phi}{\partial y}.
$$
Since $\phi$ is $C^2$, by Claireux's theorem on the equality of mixed partials one obtains
$$
\frac{\partial F_1}{\partial y} = \frac{\partial^2 \phi}{\partial y \partial x} = \frac{\partial^2 \phi}{\partial x \partial y} = \frac{\partial F_2}{\partial x}.
$$
But if $F_1 = - y$ and $F_2 = x$, then $\frac{\partial F_1}{\partial y} =-1$ and $\frac{\partial F_2}{\partial x}=1$, again a contradiction.

\bigskip


Example \ref{2.2ex4} illustrates how the quality of ``being a conservative vector field'' is quite restrictive, having  both geometric (Proof \#2) and analytic (Proof \#3) consequences for $\mathbf{F}$.



\subsection{Conservative Fields and Equality of Mixed Partial Derivatives}We record the idea of Proof \#3 in Example \ref{2.2ex4} as the following.

\begin{proposition}\label{2.2prop-consmixedpartials}
Suppose that $\mathbf{F} = F_1 \mathbf{i} + F_2 \mathbf{j} + F_3 \mathbf{k}$ is a $C^1$ vector field on a domain $D \subset \mathbb{R}^3$.  If $\mathbf{F}$ is conservative, then one necessarily has
\begin{equation}\label{2.2eq-equalityofpartials}
\frac{\partial F_1}{\partial y} = \frac{\partial F_2}{\partial x}, \quad \frac{\partial F_1}{\partial z} = \frac{\partial F_3}{\partial x}, \quad \frac{\partial F_2}{\partial z} = \frac{\partial F_3}{\partial y}.
\end{equation}

\end{proposition}

\begin{proof}
Since $\mathbf{F} = \nabla \phi$ for some $C^2$ function $\phi : D \rightarrow \mathbb{R}$,  we can use the equality of the mixed partial derivatives of $\phi$ to derive the equations \eqref{2.2eq-equalityofpartials}.
\end{proof}

For a smooth vector field $\mathbf{F} = F_1 \mathbf{i} + F_2 \mathbf{j}$ on $D \subset \mathbb{R}^3$, we have $F_3=0$ and there is no $z$ dependence, so that (\ref{2.2eq-equalityofpartials}) reduces to $\frac{\partial F_1}{\partial y} = \frac{\partial F_2}{\partial x}$.


Proposition \ref{2.2prop-consmixedpartials} gives a handy tool for proving that a given vector field is \textit{not} conservative. After all, if \eqref{2.2eq-equalityofpartials} fails for a given smooth vector field $\mathbf{F}$, then it is necessarily non-conservative.  This is just the contrapositive of Proposition \ref{2.2prop-consmixedpartials}.

However, it is also entirely possible for a vector field $\mathbf{F}$ to satisfy equation \eqref{2.2prop-consmixedpartials} on its domain of definition and \textit{still not be conservative}. This is demonstrated by the following example.

\begin{example}
Let
$$
\mathbf{F}(x,y) = - \frac{y}{x^2 + y^2} \mathbf{i} + \frac{x}{x^2 + y^2} \mathbf{j},
$$
so that $\mathbf{F}$ is a smooth vector field on $\mathbb{R}^2 \setminus \{(0,0)\}$. Then
$$
\frac{\partial F_1}{\partial y} = \frac{y^2 - x^2}{(x^2 + y^2)^2} = \frac{\partial F_2}{\partial x},
$$
so that the corresponding two-dimensional equation \eqref{2.2eq-equalityofpartials} of Proposition \ref{2.2prop-consmixedpartials} holds.  Nevertheless, $\mathbf{F}$ fails to be conservative on its domain.

\smallskip
\noindent
To prove that $\mathbf{F}$ is non-conservative, we show that its field lines are the circles
$$
\mathbf{r} (t) = a \cos (t) \mathbf{i} + a \sin (t) \mathbf{j}.
$$
Note that
$$
\mathbf{r}' (t) = \underbrace{-a \sin (t)}_{\mathbf{y}(t)} \mathbf{i} + \underbrace{a \cos (t)}_{x(t)} \mathbf{j},
$$
so that
\begin{eqnarray*}
\mathbf{F}\big(\mathbf{r}(t)\big) & = & \frac{y(t)}{x^2 (t) + y^2 (t)} \mathbf{i} + \frac{x(t)}{x^2 (t) + y^2 (t)} \mathbf{j} \\[1ex]
\quad & = & \frac{y(t)}{a^2} \mathbf{i} + \frac{x(t)}{a^2} \mathbf{j}.
\end{eqnarray*}
Therefore, we have $\mathbf{r}' (t) = a^2 \mathbf{F}(\mathbf{r}(t))$, and so $\mathbf{r}$ is indeed a field line of $\mathbf{F}$.
As in Proof \#2 in Example \ref{2.2ex4}, this shows that $\mathbf{F}$ is not conservative on $\mathbb{R}^2$.
\end{example}


\section*{Worked Problems}
\begin{enumerate}[1.]
\item
{\it Let ${\bf F}=F_1(x) \ii +F_2(y) \jj +F_3(z) \kk$ be a smooth vector field on $\rr^3$--so, each component function is a single-variable function. Prove that ${\bf F}$ is conservative on $\rr^3$, by finding a function $\phi$ such that ${\bf F}= \nabla \phi$.}

\medskip 

Since $F_1$ is continuous on $\rr$, the Fundamental Theorem of Calculus asserts that the function $f_1(x)=\int_0^x F_1(t)dt$ defined on $\rr$ satisfies $\frac{d}{dx} f_1 (x) = F_1(x)$ for each $x \in \rr$. Similarly, there are functions $f_2, f_3$ defined on $\rr$ with $\frac{d}{dy} f_2(y) = F_2(y)$ and $\frac{d}{dz} f_3(z) = F_3(z)$. Define $\phi: \rr^3 \to \rr$ by
	\[\phi(x,y,z) = f_1(x) + f_2(y) + f_3(z) \]
Then 
	\[\frac{\partial \phi}{\partial x} = \frac{\partial}{\partial x}(f_1(x) + f_2(y) + f_3(z)) = \frac{d}{dx} f_1(x) = F_1(x) ,\]
and similarly, $\frac{\partial \phi}{\partial y} = F_2(y)$, $\frac{\partial \phi}{\partial z} = F_3(z)$. 

\medskip





\item{\it
Find all values of the parameters $a,b,c$ 
such that the vector field 
$${\bf F}(x,y)=(3x^2+2x)e^{ax+y}z^c \ii+ e^{ax+y}x^bz^c\jj+ ce^{ax+y} x^b z^2 \kk$$
 is conservative on $\mathbb{R}^3$. For such $a,b,c$, 
find a potential function for ${\bf F}$.}


\medskip

Suppose that ${\bf F}$ is conservative, with ${\bf F}=\nabla f$. Then we must have
$$
\frac{\partial}{\partial y}f(x,y,z)=F_2=e^{ax+y}x^bz^c,$$
so that $f(x,y,z)=e^{ax+y}x^bz^c + g(x,z)$. We must also have (assuming, for now, that $b\neq 0$, see below)
$$
\frac{\partial}{\partial x}f(x,y,z)=(ax^b + bx^{b-1})e^{ax+y}z^c + \frac{\partial g(x,z)}{\partial x}= F_1 = (3x^2+2x)e^{ax+y}z^c ,
$$
so that $a=3$, $b=2$, and $g=g(z)$. 
Note that if we had $b=0$, then we would have 
$$
\frac{\partial}{\partial x}f(x,y,z)=e^{ax+y}z^c + \frac{\partial g(x,z)}{\partial x},
$$
and that does not match the equation for $F_1$.
Finally,  
$$
\frac{\partial}{\partial z}f(x,y,z)= c e^{ax+y}x^bz^{c-1} + g'(z)= ce^{ax+y} x^b z^2,
$$
so that $c=3$ and we can take $g\equiv 0$. The answer is $a=c=3$, $b=2$, and 
$f(x,y,z)= e^{3x+y} x^2 z^3$.

\end{enumerate}

\section*{Practice Problems}
\begin{enumerate}[1.]


\item
{ Let ${\bf F}(x,y,z)=e^y \ii+ (xe^y-\cos z) \jj+y\sin z$ in $\R^3$. 
Prove that ${\bf F}$ conservative, and find a potential function $f$.}

\medskip

\item
{ Consider the vector field $$\displaystyle {\bf G}=\frac{F_1(x)}{F_3(z)}\ii + \frac{F_2(y)}{F_3(z)}\jj + \kk,$$
where $F_1,F_2,F_3$ are smooth functions on a domain $D\subset \rr^3$ and $F_3$ is never zero on $D$. Does ${\bf G}$ 
have to be conservative on $D$? 
If yes, prove it. If no, give a counterexample.}




\medskip

\item
{Give an example of two smooth vector fields ${\bf F}$ and ${\bf G}$ on $\rr^2$ such that
${\bf F}$ and ${\bf G}$ have the same field lines, ${\bf F}$ is conservative, and 
${\bf G}$ is not conservative. 

\smallskip\noindent
(Hint: Worked Problem 1 of this Section might be helpful in constructing a simple conservative field $\mathbf{F}$. Then, try modifying it to make a $\mathbf{G}$ that has the same field lines but is non-conservative.)}


\medskip

\item {Find all functions $f(y)$ and $g(x)$, where $f(y)$ depends only on $y$ and $g(x)$ depends only on $x$,
such that the vector field ${\bf F}(x,y)=f(y)\ii+g(x)\jj$ is conservative on $\mathbb{R}^2$. For such $f$ 
and $g$, find the potential function for ${\bf F}$.}

\end{enumerate}




