Gradient field (in plane)


My notes of the excellent lectures 20 and 21 by “Denis Auroux. 18.02 Multivariable Calculus. Fall 2007. Massachusetts Institute of Technology: MIT OpenCourseWare, License: Creative Commons BY-NC-SA.”


When vector field \(\vec F\) is a gradient of function (written using the symbolic \(\nabla\)-operator) \(f(x,y)\), it is called a gradient field $$ \newcommand{pdv}[1]{\tfrac{\partial}{\partial #1}} \shaded{ \vec F = \nabla f = \left\langle \pdv{x}f, \pdv{y}f \right\rangle = \left\langle f_x, f_y \right\rangle } \nonumber $$

Where \(f(x,y)\) is called the potential.

Fundamental theorem

Recall the fundamental theorem of calculus

If you integrate the derivative, you get back the function. $$ \int_a^b \frac{df(t)}{dt}\,dt=f(b)-f(a) \label{eq:fndcalc} $$

In multivariable calculus, it is the same

If you take the line integral of the gradient of a function, what you get back is the function. $$ \shaded{ \int_C\nabla f\cdot d\vec r = f(P_1) – f(P_0) } \label{eq:fundthm} $$ where \(f(x,y)\) is called the potential.
Work in gradient field

Only when the field is a gradient, and you know the function \(f\), you can simplify the evaluation of the line integral for work. $$ \shaded{ \int_C\nabla f\cdot d\vec r=f(P_1)-f(P_0) } \nonumber $$


In coordinates, the gradient field \(\nabla f\) is expressed as $$ \newcommand{pdv}[1]{\tfrac{\partial}{\partial #1}} \nabla f =\left\langle \pdv{x}f, \pdv{y}f \right\rangle =\left\langle M, N \right\rangle \nonumber $$

Recall: the work integral in differential form
$$ \int_C\vec F\cdot d\vec r = \int_C\left( M\,dx + N\,dy \right) \nonumber $$

Substituting \(M\) and \(N\) from the gradient field into the work integral $$ \renewcommand{dv}[2]{\frac{d #1}{d #2}} \renewcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \begin{align} \int_C \nabla f\cdot d\vec r &= \int_C \pdv{f}{x}dx+\pdv{f}{y}dy \nonumber \\ &= \int_C \underline{ \left(\pdv{f}{\color{red} x}\dv{\color{red}x}{t} + \pdv{f}{\color{blue}y}\dv{\color{blue}y}{t}\right)}\,dt \label{eq:subgrad} \end{align} $$

Recall: the multivariable calculus chain rule

$$ \renewcommand{dv}[2]{\frac{d #1}{d #2}} \renewcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \dv{}{t}\,f\left(\,\color{red}x(t),\,\color{blue}y(t)\,\right) = \pdv{f}{\color{red}x}\frac{d\color{red}x}{dt}\,+\, \pdv{f}{\color{blue}y}\frac{d\color{blue}y}{dt} \nonumber $$

Substitute the reverse chain rule to equation \(\eqref{eq:subgrad}\), and integrate the differential of a function $$ \renewcommand{dv}[2]{\frac{d #1}{d #2}} \renewcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \begin{align*} \int_C \nabla f\cdot d\vec r &= \int_{t_0}^{t_1} \dv{}{t} f\color{grey}{\big(\,x(t),\,y(t)\,\big)}\,dt = \int_{t_0}^{t_1} f\color{grey}{\big(\,x(t),\,y(t)\,\big)} \end{align*} $$

By the fundamental theorem of calculus \(\eqref{eq:fndcalc}\) $$ \renewcommand{dv}[2]{\frac{d #1}{d #2}} \renewcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \begin{align*} \int_C \nabla f\cdot d\vec r &= f\color{grey}{\big(\,x(t_1),\,y(t_1)\,\big)} – f\color{grey}{\big(\,x(t_0),\,y(t_0)\,\big)} \end{align*} $$

With the points $$ \left\{ \begin{align*} P_0 &= \big(\,x(t_0),\,x(t_0)\,\big) \\ P_1 &= \big(\,x(t_1),\,x(t_1)\,\big) \end{align*} \right. $$

So, the work done in gradient field \(f\) can be expressed as the difference in potential $$ \renewcommand{dv}[2]{\frac{d #1}{d #2}} \renewcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \shaded{ \int_C \nabla f\cdot d\vec r = f(P_1)-f(P_0) } $$

Physics (using math notation)

A lot of forces are gradients of potentials such as the electric force and the gravitational force. However, magnetic fields are not gradients.

The work done by the electrical (or gravitational) force, is given by the change of the potential energy from the starting point to the ending point.

Note that: physics potentials are the opposite of mathematical potentials. The force \(\vec F\) will be negative the gradient. So in physics, it would be expressed as $$ \vec F=-\nabla f \nonumber $$


Equivalent properties of the work in a gradient field $$ \rm W = \int_C\nabla f\,d\vec r \nonumber $$

  1. Path-independent: the work only depends on at the start and end points, \(f(P_0)\) and \(f(P_1)\).
  2. Conservative: the work is \(0\) along all closed curves. This means a closed loop in a gradient field does not provide energy. Conservativeness means no energy can be extracted from the field for free. The total energy is conserved.
  3. \(Mdx+Ndy\) is an exact differential. That means it can be put in the form \(df\).

See also Curl and Green’s.



Let’s look at the earlier example again: Curve \(C\) starting and ending at \((0,0)\) through vector field \(\vec F\) $$ \begin{array}{l} \vec F = \left\langle y,x \right\rangle \\ C_1: (0,0)\ \mathrm{to}\ (1,0) \\ C_2: \mathrm{unit\ circle\ from}\ (1,0)\ \mathrm{to\ the\ diagonal} \\ C_3: \mathrm{from\ the\ diagonal\ to}\ (0,0) \end{array} \nonumber $$


Try function \(f=xy\). The gradient is $$ \renewcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \begin{align*} \nabla f &= \left\langle \pdv{}{x}xy, \pdv{}{y}xy \right\rangle = \left\langle y,x \right\rangle \end{align*} $$ That means the line integral can just be evaluated by finding the values of \(f\) at the endpoints.


Visualize using a contour plot of \(f=xy\) through gradient field \(\vec F\)

Contour plot of gradient with curve

Along the segments

  • On \(C_1\) the potential stays \(0\).
  • On \(C_2\) $$ \begin{align*} \int_{C_2}\vec F\cdot d\vec r &= f\left(\frac{1}{\sqrt 2},\frac{1}{\sqrt 2}\right) – f(1,0) \\ &= \frac{1}{2}-0=\frac{1}{2} \end{align*} $$
  • On \(C_3\) it decreases back to \(0\).
The sum of the work therefore is \(0\).

When is a vector field a gradient field?

Let vector field \(\vec F=\left\langle M,N\right\rangle\) where \(M\) and \(N\) are functions of \(x\) and \(y\).

When is this a gradient field? $$ \newcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \vec F = \left\langle M, N \right\rangle \stackrel{?}{=} \nabla f = \left\langle \pdv{}{x}f, \pdv{}{y}f \right\rangle \nonumber $$

If \(\vec F\) is a gradient field, \(\vec F=\nabla f\), then $$ \newcommand{dv}[2]{\frac{d #1}{d #2}} \newcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \left\{ \begin{align*} M=\pdv{}{x}f = f_x \\ N=\pdv{}{y}f = f_y \end{align*} \right. $$

Take the partial derivatives of \(M\) and \(N\) $$ \newcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \newcommand{ppdv}[3]{\frac{\partial^2 #1}{\partial #2\partial #3}} \begin{align} M_y=\pdv{M}{y}=\ppdv{}{\color{red}x}{\color{blue}y}f = f_{xy} \label{eq:proof1} \\ N_x=\pdv{M}{x}=\ppdv{}{\color{blue}y}{\color{red}x}f = f_{yx} \label{eq:proof2} \end{align} $$

Recall: the second partial derivative of function \(f\)

$$ \newcommand{dv}[2]{\frac{d #1}{d #2}} \newcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \newcommand{ppdv}[3]{\frac{\partial^2 #1}{\partial #2\partial #3}} \pdv{}{\color{red}x}\left(\pdv{f}{\color{blue}y}\right) =\ppdv{f}{\color{red}x}{\color{blue}y} =\ppdv{f}{\color{blue}y}{\color{red}x} =\pdv{}{\color{blue}y}\left(\pdv{f}{\color{red}x}\right) \nonumber $$

Based on the second partial derivative rule, equations \(\eqref{eq:proof1}\) and \(\eqref{eq:proof2}\) are the same. That implies that a gradient field should have the property $$ \newcommand{dv}[2]{\frac{d #1}{d #2}} \newcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \newcommand{ppdv}[3]{\frac{\partial^2 #1}{\partial #2\partial #3}} \left. \begin{align*} M_y = \ppdv{}{\color{red}x}{\color{blue}y}f = f_{xy} \\ N_x = \ppdv{}{\color{blue}y}{\color{red}x}f = f_{yx} \end{align*} \right\} \Rightarrow M_y=N_x $$

Therefore, \(\vec F=\left\langle M,N \right\rangle\), defined and differentiable everywhere, is a gradient field, when $$ \shaded{ M_y = N_x } \nonumber $$ (Also see the Definition of Curl.)

So, if \(\vec F=\left\langle M,N\right\rangle\) is a gradient field in a region of the plane.

  • \(\Leftrightarrow\) Conservative if \(\int_C \vec F\cdot d\vec r=0\) for any closed curve. To note it is along a closed curve, we note it as \(\oint_C\) $$ \oint_C \vec F\cdot d\vec r=0 \nonumber $$
  • \(\Rightarrow\) \(N_x=M_y\) at every point.
  • \(\Leftarrow\) \(N_x=M_y\) at every point, if \(\vec F\) is defined in the entire plane (or, in a simply connected region). (see later)



Is \(\vec F\) a gradient field? $$ \vec F=\underbrace{-y}_{M}\hat\imath+\underbrace{x}_N\hat\jmath=\left\langle -y,x \right\rangle \nonumber $$

\(\vec F\) is not a gradient field, because $$ \newcommand{dv}[2]{\frac{d #1}{d #2}} \newcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \newcommand{ppdv}[3]{\frac{\partial^2 #1}{\partial #2\partial #3}} \left. \begin{align*} \pdv{M}{y}&=\pdv{}{y}(-y)=-1 \\ \pdv{N}{x}&=\pdv{}{x}x=1 \end{align*} \right\} \Rightarrow \pdv{M}{y}\neq \pdv{N}{x} $$


For what value of \(a\) is \(\vec F\) a gradient field? $$ \vec F = \underbrace{(4x^2+axy)}_{M}\hat\imath+\underbrace{(3y^2+4x^2)}_N\hat\jmath = \left\langle 4x^2+axy, 3y^2+4x^2\right\rangle \nonumber $$

$$ \newcommand{dv}[2]{\frac{d #1}{d #2}} \newcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \newcommand{ppdv}[3]{\frac{\partial^2 #1}{\partial #2\partial #3}} \left. \begin{align*} \pdv{M}{y}&=\pdv{}{y}(4x^2+axy)=ax \\ \pdv{N}{x}&=\pdv{}{x}(3y^2+4x^2)=8x \end{align*} \right\} \Rightarrow a=8 $$ Note that \(x=0\) is not an answer everywhere.

Finding the potential

Recall: from earlier

When the field is a gradient, and you know the function \(f\), you can simplify the evaluation of the line integral for work. $$ \shaded{ \int_C\nabla f\cdot d\vec r=f(P_1)-f(P_0) } \nonumber $$ where \(f(x,y)\) is called the potential

To show the two methods, we will find the potential of the gradient field \(\vec F\) $$ \vec F = \left\langle \underbrace{4x^2+axy}_{=M}, \underbrace{3y^2+4x^2}_{=N} \right\rangle \nonumber $$

Compute line integrals

Apply the fundamental theorem, equation \(\eqref{eq:fundthm}\), to find an expression for the potential at \((x_1,y_1)\) $$ \begin{align} &\int_C\vec F\cdot d\vec r=f(x_1,y_1)-f(0,0) \nonumber \\ \Rightarrow & f(x_1,y_1) = \underbrace{\int_C\vec F\cdot d\vec r}_{\rm{work}} + \underbrace{f(0,0)}_{\mathrm{constant}} \label{eq:method1} \end{align} $$

Apply the work differential, to find the work along \(C\) in gradient field \(\vec F\) $$ \begin{align*} \underline{\int_C\vec F\cdot d\vec r} &= \int_C M\,dx+N\,dy \\ &= \int_C\left(4x^2+8xy\right)dx+\left(3y^2+4x^2\right)dy \end{align*} $$

The work in a gradient is path independent \(\Longrightarrow\) find the easiest path

Paths \(C, C_1, C_2\)

The easiest path is $$ \begin{array}{lll} C_1: & x\ \mathrm{from}\ 0\ \mathrm{to}\ x_1 & y=0 &\Rightarrow dy=0 \\ C_2: & x=x_1 & y\ \mathrm{from}\ 0\ \mathrm{to}\ y_1 &\Rightarrow dx=0 \end{array} \nonumber $$

Work along the curves

  • Along \(C_1\) $$ \begin{align*} \int_{C_1}\vec F\cdot d\vec r &= \int_0^{x_1}(4x^2+0)\,dx + 0 \\ &= \left[\frac{4}{3}x^3\right]_0^{x_1} = \frac{4}{3}{x_1}^3 \end{align*} $$
  • Along \(C_2\) $$ \begin{align*} \int_{C_2}\vec F\cdot d\vec r &= \int_0^{y_1}0+(3y^2+4{x_1}^2)\,dy \\ &= \left[y^3+4{x_1}^2y \right]_0^{y_1} = {y_1}^3+4{x_1}^2y_1 \end{align*} $$

The total work $$ \int_C\vec F\cdot d\vec r = \int_{C_1}\ldots + \int_{C_2}\ldots = \frac{4}{3}{x_1}^3 + {y_1}^3+4{x_1}^2y_1 \nonumber $$

Substitute \(\int_{C_1}, \int_{C_2}\) back in \(\eqref{eq:method1}\) $$ \begin{align*} f(x_1,y_1) &= \int_C\vec F\cdot d\vec r + \rm{c} \\ &= \frac{4}{3}{x_1}^3 + {y_1}^3+4{x_1}^2y_1 + \rm{c} \end{align*} $$

Drop the subscripts $$ f(x,y) = \frac{4}{3}x^3 + 4x^2y_1 + y^3\, (+ \rm{c}) \nonumber $$ If you would take the gradient, you should get \(\vec F\) back.

Compute using antiderivatives

No integrals, but you have to follow the procedure very carefully. A common pitfall, is to treat the second equation, like the first one.

For the example, we want to solve $$ \newcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \left. \begin{align} \pdv{f}{x}&=f_x=4x^2+8xy \label{eq:anti1} \\ \pdv{f}{y}&=f_y=3y^2+4x^2 \label{eq:anti2} \end{align} \right. $$

Integrate equation \(\eqref{eq:anti1}\) in respect to \(x\). The integration constant might depend on \(y\), so we call it \(g(y)\) $$ \newcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \pdv{f}{x} = 4x^2+8xy \xrightarrow{\int dx} f = \underline{\frac{4}{3}x^3 + 4x^2y + g(y)} \label{eq:anti} $$

To get information of \(g(y)\), we look at the other partial. Take the derivative of \(f\) in respect to \(y\) and compare to \(\eqref{eq:anti}\) $$ \require{cancel} \newcommand{pdv}[2]{\frac{\partial #1}{\partial #2}} \begin{align*} \pdv{}{y}\left(\frac{4}{3}x^3 + 4x^2y + g(y)\right) &= 3y^2+\bcancel{4x^2} \\ 0 + \bcancel{4x^2}+\pdv{}{y}g(y) &= 3y^2+\bcancel{4x^2} \Rightarrow \pdv{}{y}g(y) = 3y^2\\ \xrightarrow{\int dy} g(y) &= \int \pdv{}{y}g(y)\,dy = \underline{y^3 + c} \end{align*} $$ \(g(y)\) only depends on \(y\), so \(c\) is a true constant.

Plug this back into equation \(\eqref{eq:anti}\), gives the potential \(f(x,y)\) $$ f = \frac{4}{3}x^3 + 4x^2y + \underline{y^3\ (+ \rm{c})} \nonumber $$

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.