Math Insight

The process of finding a potential function of a conservative vector field is a multi-step procedure that involves both integration and differentiation, while paying close attention to the variables you are integrating or differentiating with respect to. For this reason, given a vector field $\dlvf$, we recommend that you first determine that that $\dlvf$ is indeed conservative before beginning this procedure. That way you know a potential function exists so the procedure should work out in the end.

In this page, we focus on finding a potential function of a two-dimensional conservative vector field. We address three-dimensional fields in another page.

We introduce the procedure for finding a potential function via an example. Let's use the vector field \begin{align*} \dlvf(x,y) = (y \cos x+y^2, \sin x+2xy-2y). \end{align*}

The first step is to check if $\dlvf$ is conservative. Since \begin{align*} \pdiff{\dlvfc_2}{x} &= \pdiff{}{x}(\sin x+2xy-2y) = \cos x+2y\\ \pdiff{\dlvfc_1}{y} &= \pdiff{}{y}(y \cos x+y^2) = \cos x+2y, \end{align*} we conclude that the scalar curl of $\dlvf$ is zero, as \begin{align*} \pdiff{\dlvfc_2}{x} - \pdiff{\dlvfc_1}{y} = 0. \end{align*} Next, we observe that $\dlvf$ is defined on all of $\R^2$, so there are no tricks to worry about. The vector field $\dlvf$ is indeed conservative.

Since $\dlvf$ is conservative, we know there exists some potential function $f$ so that $\nabla f = \dlvf$. As a first step toward finding $f$, we observe that the condition $\nabla f = \dlvf$ means that \begin{align*} \left(\pdiff{f}{x},\pdiff{f}{y}\right) &= (\dlvfc_1, \dlvfc_2)\\ &= (y \cos x+y^2, \sin x+2xy-2y). \end{align*} This vector equation is two scalar equations, one for each component. We need to find a function $f(x,y)$ that satisfies the two conditions \begin{align} \pdiff{f}{x}(x,y) = y \cos x+y^2 \label{cond1} \end{align} and \begin{align} \pdiff{f}{y}(x,y) = \sin x+2xy -2y. \label{cond2} \end{align} Let's take these conditions one by one and see if we can find an $f(x,y)$ that satisfies both of them. (We know this is possible since $\dlvf$ is conservative. If $\dlvf$ were path-dependent, the procedure that follows would hit a snag somewhere.)

Let's start with condition \eqref{cond1}. We can take the equation \begin{align*} \pdiff{f}{x}(x,y) = y \cos x+y^2, \end{align*} and treat $y$ as though it were a number. In other words, we pretend that the equation is \begin{align*} \diff{f}{x}(x) = a \cos x + a^2 \end{align*} for some number $a$. We can integrate the equation with respect to $x$ and obtain that \begin{align*} f(x)= a \sin x + a^2x +C. \end{align*} But, then we have to remember that $a$ really was the variable $y$ so that \begin{align*} f(x,y) = y \sin x + y^2x +C. \end{align*} But actually, that's not right yet either. Since we were viewing $y$ as a constant, the integration “constant” $C$ could be a function of $y$ and it wouldn't make a difference. The partial derivative of any function of $y$ with respect to $x$ is zero. We can replace $C$ with any function of $y$, say $g(y)$, and condition \eqref{cond1} will be satisfied. A new expression for the potential function is \begin{align} f(x,y) = y \sin x + y^2x +g(y). \label{midstep} \end{align} If you are still skeptical, try taking the partial derivative with respect to $x$ of $f(x,y)$ defined by equation \eqref{midstep}. Since $g(y)$ does not depend on $x$, we can conclude that $\displaystyle \pdiff{}{x} g(y) = 0$. Indeed, condition \eqref{cond1} is satisfied for the $f(x,y)$ of equation \eqref{midstep}.

Now, we need to satisfy condition \eqref{cond2}. We can take the $f(x,y)$ of equation \eqref{midstep} (so we know that condition \eqref{cond1} will be satisfied) and take its partial derivative with respect to $y$, obtaining \begin{align*} \pdiff{f}{y}(x,y) &= \pdiff{}{y} \left( y \sin x + y^2x +g(y)\right)\\ &= \sin x + 2yx + \diff{g}{y}(y). \end{align*} Comparing this to condition \eqref{cond2}, we are in luck. We can easily make this $f(x,y)$ satisfy condition \eqref{cond2} as long as \begin{align*} \diff{g}{y}(y)=-2y. \end{align*} If the vector field $\dlvf$ had been path-dependent, we would have found it impossible to satisfy both condition \eqref{cond1} and condition \eqref{cond2}. We would have run into trouble at this point, as we would have found that $\diff{g}{y}$ would have to be a function of $x$ as well as $y$. Since $\diff{g}{y}$ is a function of $y$ alone, our calculation verifies that $\dlvf$ is conservative.

If we let \begin{align*} g(y) = -y^2 +k \end{align*} for some constant $k$, then \begin{align*} \pdiff{f}{y}(x,y) = \sin x + 2yx -2y, \end{align*} and we have satisfied both conditions.

Combining this definition of $g(y)$ with equation \eqref{midstep}, we conclude that the function \begin{align*} f(x,y) = y\sin x + y^2x -y^2 +k \end{align*} is a potential function for $\dlvf.$ You can verify that indeed \begin{align*} \nabla f = (y\cos x + y^2, \sin x + 2xy -2y) = \dlvf(x,y). \end{align*}

With this in hand, calculating the integral \begin{align*} \dlint \end{align*} is simple, no matter what path $\dlc$ is. We can apply the gradient theorem to conclude that the integral is simply $f(\vc{q})-f(\vc{p})$, where $\vc{p}$ is the beginning point and $\vc{q}$ is the ending point of $\dlc$. (For this reason, if $\dlc$ is a closed curve, the integral is zero.)

We might like to give a problem such as find \begin{align*} \dlint \end{align*} where $\dlc$ is the curve given by the following graph.

A complicated curve

The answer is simply \begin{align*} \dlint &= f(\pi/2,-1) - f(-\pi,2)\\ &=-\sin \pi/2 + \frac{\pi}{2}-1 + k - (2 \sin (-\pi) - 4\pi -4 + k)\\ &=- \sin \pi/2 + \frac{9\pi}{2} +3= \frac{9\pi}{2} +2 \end{align*} (The constant $k$ is always guaranteed to cancel, so you could just set $k=0$.)

If the curve $\dlc$ is complicated, one hopes that $\dlvf$ is conservative. It's always a good idea to check if $\dlvf$ is conservative before computing its line integral \begin{align*} \dlint. \end{align*} You might save yourself a lot of work.