# Math Insight

### The gradient theorem for line integrals

In one-variable calculus, the fundamental theorem of calculus was a useful tool for evaluating integrals. If you are integrating a function $g(t)$ and it turns out that the function is the derivative of another function $g(t)=G'(t)$, then integrating the function $g(t)$ is simple. The integral of $g$ is just the difference in the values of $G(t)$ at the endpoints. We could write the result as \begin{gather} \int_a^b G'(t) dt = G(b)-G(a).\label{onevarfund} \end{gather}

For line integrals of vector fields, there is a similar fundamental theorem. In some cases, we can reduce the line integral of a vector field $\dlvf$ along a curve $\dlc$ to the difference in the values of another function $f$ evaluated at the endpoints of $\dlc$, \begin{gather} \dlint = f(Q)-f(P),\label{onlyendpoints} \end{gather} where $\dlc$ starts at the point $P$ and ends at the point $Q$. If we let $\dlvf: \R^n \to \R^n$ (confused?) be a $n$-dimensional vector field, then it must be that $f: \R^n \to \R$ is a scalar-valued function, as the line integral evaluates to a single number.

This sounds good, but there is an important catch: it will only work for integrating specials kinds of vector fields. Clearly, equation \eqref{onlyendpoints} could possibly be true only if the line integral along $\dlc$ depends only on the endpoints of $\dlc$ and doesn't depend on the particular path the $\dlc$ takes. In other words, we can hope for a similar fundamental theorem for line integrals only if the vector field is conservative (also called path-independent). If the vector field $\dlvf$ is path-dependent, then it will be impossible to reduce its line integral to values of a function at the path endpoints.

We can easily derive what a conservative vector field should look like and in the process obtain our fundamental theorem for line integrals. Let the curve $\dlc$ from point $P$ to $Q$ be parametrized by $\dllp(t)$ for $a < t < b$. This means $P=\dllp(a)$, $Q=\dllp(b)$, and the line integral $\dlint$ can be written as $\dplint$. The desired relaationship between $\dlvf$ and $f$ described by equation \eqref{onlyendpoints} can be rewritten as \begin{gather} \dplint = f(\dllp(b))-f(\dllp(a)). \label{withparam} \end{gather}

In this form, equation \eqref{withparam} is starting to look like our original equation \eqref{onevarfund} for the fundamental theorem of calculus. If we let $G(t) = f(\dllp(t))$, then the right hand side of equation \eqref{withparam} is indeed $G(b)-G(a)$. For equation \eqref{withparam} to be valid, we just need $\dlvf(\dllp(t))\cdot \dllp'(t)$ to be equal to $G'(t)$.

Since $G(t) = f(\dllp(t))$ is a composition of functions, we can compute its derivative using the chain rule. For $\dllp: \R \to \R^n$ and $f: \R^n \to \R$, the chain rule can be written as \begin{gather*} G'(t) = Df(\dllp(t)) D\dllp(t) = \nabla f(\dllp(t)) \cdot \dllp'(t). \end{gather*} The gradient vector $\nabla f$ is just the vector form of the $1 \times n$ derivative matrix $Df$, and the derivative of a parametrized curve is the tangent vector $\dllp'(t)$.

We're in luck! The expression for $G'(t)$ is in exactly the form we need. $G'(t)$ will be equal to $\dlvf(\dllp(t))\cdot \dllp'(t)$ under the condition that we find a function $f$ so that the vector field $\dlvf$ is the gradient $\nabla f$. Let's assume that $\dlvf=\nabla f$. Then, finally, by the one-variable fundamental theorem of calculus of equation \eqref{onevarfund}, we know that the desired relationship of equation \eqref{withparam} is valid in the form \begin{gather*} \plint{a}{b}{\nabla f}{\dllp}= f(\dllp(b))-f(\dllp(a)). \end{gather*}

Rewriting this expression in terms of the original curve $\dlc$ from point $P$ to point $Q$, we obtain the gradient theorem for line integrals: \begin{gather} \lint{\dlc}{\nabla f} = f(Q)-f(P).\label{gradienttheorem} \end{gather} This theorem is also called the fundamental theorem for line integrals, as it is a generalization of the one variable fundamental theorem of calculus of equation \eqref{onevarfund} to line integrals along a curve.

#### How to use the gradient theorem

The gradient theorem makes evaluating line integrals $\dlint$ very simple, if we happen to know that $\dlvf=\nabla f$. The function $f$ is called the potential function of $\dlvf$. Typically, though you just have the vector field $\dlvf$, and the trick is to know if a potential function exists and, if so, how find it.

It is clear from the above function that a vector field has a potential function only if it is conservative (or path-independent). It turns out the converse is true as well, so that a potential function $f$ exists satisfying $\nabla f = \dlvf$ if and only if $\dlvf$ is conservative. So, the two steps for using the gradient theorem to evaluate a line integral $\dlint$ are

1. determine if $\dlvf$ is conservative, and
2. find the potential function $f$ if $\dlvf$ is conservative.

With the potential function $f$ in hand, evaluating $\dlint$ is as simple as calculating the values of $f$ at the endpoints of $\dlc$ and subtracting, according to the gradient theorem of equation \eqref{gradienttheorem}. wThis final step is illustrated by a simple example.

#### Transform integrals to boundaries

The fundamental theorem of calculus transformed the integral of the derivative $G'(t)$ along an interval $[a,b]$ to values of the function $G(t)$ at the endpoints $t=a$ and $t=b$. This feature of transforming the integral of a function's derivative over some set into function values at the boundary unites all four fundamental theorems of vector calculus. This parallel is very obvious for the gradient theorem, as it equates the integral of a gradient $\nabla f$ over a curve to the function values at the endpoints of the curve.

The other three fundamental theorems do the same transformation. The difference is that the boundaries of the sets are more complicated, so the “function values at the boundary” are actually integrals of the function along the boundary. Green's theorem and Stokes' theorem convert integrals of one type of derivative (the curl) of a vector field to the values of the vector field along the boundary. Since the boundary is a curve, the evaluation of the vector field function along the boundary is a line integral. The divergence theorem converts integrals of another type of derivative (the divergence) of a vector field to values of the vector field along the boundary. Since the boundary is a surface, the evaluation of the vector field function along the boundary is a surface integral.