# Line Integration

Vector calculus is about differentiation and integration of vector fields. Here we will focus on integration.

## Definitions

### Parametric function

a function with one-dimensional input and a multi-dimensional output.

Parametric functions may be expressed as a set of equations, such as
$$f(t) =\left\{ \begin{array}{l} f_x(t)=t^3-3t\\ f_y(t)=3t^2 \end{array} \right. \nonumber$$
or as a vector:
$$f(t) = \left\langle\; t^3-3t,\; 3t^2\; \right\rangle \label{eq:parmcurve}$$ $$ds=\sqrt{(dx)^2 + (dy)^2}$$

The curve length $$r$$ of function $$y=f(x)$$ is expressed as:

$$s=\int\sqrt{(dx)^2 + (dy)^2} \nonumber$$

For a more compact notation, we rewrite the curve length formula, using $$\int_C$$ for the integral along a curve, and $$ds$$ as the tiny step of the curve we’re integrating over.
$$\shaded{ s=\int_C ds},\ \ \mathrm{where}\ \ \left\{ \begin{array}{l} C=\mathrm{description\ of\ the\ curve} \\ ds=\sqrt{(dx)^2+(dy)^2} \end{array} \right. \label{eq:functionints}$$
Putting the $$C$$ at the base of the integral reminds us to find where curve $$C$$ is defined, and place the relevant bounds on the integral when it is time to compute.

Here we will consider a similar curve, but in the input domain $$(x,y)$$, depicted as an horizontal plane. A function value $$f(x,y)$$ can then be displayed on the $$z$$-axis. Curve $$C$$ on $$xy$$-input plane

## Parametric curve length

The compact notation of the curve length $$\eqref{eq:functionints}$$ merely says that the arc length of curve $$C$$ is the integral over tiny steps along $$C$$, while hiding the definition of curve $$C$$. Here we are adding the definition of the curve to the equation.

Let $$\vec{r}(t)$$ describe curve $$C$$, as a parametric function of variable $$t$$, such that $$\vec{r}(t_a)$$ and $$\vec{r}(t_b)$$ are the endpoints of $$C$$.
$$\shaded{ \vec{r}(t)=\left\langle\; f_x(t),\ f_y(t) \;\right\rangle } \label{eq:curvefnc}$$

The curve $$\vec{r}(t)$$ on the input domain is plotted on a horizontal $$xy$$-plane from point $$a$$ to $$b$$, as shown below. Curve $$\vec{r}(t)$$ and bounds on $$xy$$-input-domain

Let $$t_i$$ and $$t_i + \Delta t$$ be a parametric input values, with corresponding function values $$\vec{r}(t_i)$$ and $$\vec{r}(t_i+\Delta t)$$. $$\Delta s$$ and $$\vec{r}'(t_i)$$on $$xy$$-plane

The resulting output change $$\Delta s$$ follows as:
$$\Delta s = \vec{r}(t_i+\Delta t)-\vec{r}(t_i) \label{eq:deltas}$$

Recall the definition of derivative, in terms of $$f(x)$$ and $$x$$.

$$f\color{red}'(x)=\lim_{\Delta x\rightarrow 0} \frac {f(x_i+\Delta x)-f(x_i)}{\Delta x} \nonumber$$

In terms of $$\vec{r}(t)$$ and $$t$$ the derivative is expressed as:
$$\vec{r}\color{red}'(t_i)=\lim_{\Delta t\rightarrow 0} \frac {\overbrace{\vec{r}(t_i+\Delta t)-\vec{r}(t_i)}^{\mathrm{output\ change}}} {\underbrace{\Delta t}_{\mathrm{step\ size}}} \nonumber$$

Recall that the derivative of parametric function $$\vec{r}(t)$$ is simply the derivative of each component.

$$\vec{r}'(t)=\left\langle\; f_x'(t),\ f_y'(t) \;\right\rangle \nonumber$$

The resulting output change $$ds$$ $$\eqref{eq:deltas}$$, can thus be described in terms of the derivative vector $$\vec{r}\color{red}'(t)$$.
$$ds = \lim_{\Delta t\rightarrow 0} \overbrace{r(t_i+\Delta t)-r(t_i)}^{\mathrm{output\ change}} =\lim_{\Delta t\rightarrow 0} r\color{red}'(t_i)\overbrace{\Delta t}^{\mathrm{step\ size}} \nonumber$$

As $$\Delta t\rightarrow 0$$ this step in the tangent direction ($$r\color{red}'(t_i)\Delta t$$), equals the step along the curve $$ds$$ itself. The magnitude of this step ($$ds$$) follows.
$$\shaded{ ds=\left| \vec{r}\color{red}'(t) \right| \;dt } \label{eq:ds}$$

Choose $$t_a$$ and $$t_b$$ so that the points $$\vec{r}(t_a)$$ and $$\vec{r}(t_b)$$ correspond to the begin and end of curve $$\vec{r}(t)$$.
\left\{ \begin{align*} \vec{r}(t_a)&\triangleq a \\ \vec{r}(t_b)&\triangleq b \end{align*} \right.

The length of the parametric curve $$\vec{r}(t)$$ between $$a$$ and $$b$$, can now be expressed as:
$$s=\int_{t_a}^{t_b}\left| \vec{r}\color{red}'(t)\right|dt \nonumber$$

## Line integral in scalar field

Line integrals in scalar fields will help us answer questions such as

“A rescue team follows a path in a area where for each position the degree of radiation is defined. Compute the total amount of radiation gathered by the rescue team.”

### Definitions

A multi-variable function that returns a scalar value for each input.

Here will visualize scalar functions with the input values on an $$xy$$-plane, and the corresponding output values on the $$z$$-plane. Similar to how a relief map shows the elevation at each point $$(x,y)$$ on a map.

Recall an ordinary integral:

An ordinary integral $$\int_a^b f(x)\;dx$$ is evaluated along the $$x$$-axis. To “integrate” over a path is to cut the path into tiny segments, so that in each part the function value is essentially unchanging. Then we add up the function values, weighted (multiplied) by a correspondingly small number. The result is a weighted sum of the function $$f(x)\ \forall_{a\leq x \le b}$$.

A line integral extends this idea by evaluating a function $$f(x,y)$$ along a curve $$C$$.
$$\int_C f(t)\;ds \nonumber$$

### Line Integral

Let $$\vec{r}(t)$$ $$\eqref{eq:curvefnc}$$ describe curve $$C$$, as a parametric function of variable $$t$$, such that $$\vec{r}(t_a)$$ and $$\vec{r}(t_b)$$ are the endpoints of $$C$$.
\left\{ \begin{align*} \vec{r}(t_a)&=a \\ \vec{r}(t_b)&=b \end{align*} \right.

The line integral is visualized as the area between the curve $$\vec{r}(t)$$ and the corresponding function values $$f\left(\vec{r}(t)\right)$$. Line integral in vector field $$f(x,y$$ along curve $$\vec{r}(t)$$

To find this area, we integrate the function $$f(\vec{r}(t))$$ over curve $$\vec{r}(t)$$.
$$\int_C f\left(\vec r(t)\right)\;ds \label{eq:scalarfieldint1}$$

Substitute the step magnitude $$ds$$ from equation $$\eqref{eq:ds}$$ in $$\eqref{eq:scalarfieldint1}$$. The integral of scalar field $$f(t)$$ over curve $$\vec{r}(t)$$ between $$a$$ and $$b$$ follows as:
$$\shaded{ \int_{t_a}^{t_b} f\left(\vec r(t)\right)\;\left| \vec{r}'(t) \right| \;dt } \label{eq:scalarfieldint}$$

## Line integral in vector field

Line integrals in vector fields will help us answer questions such as

A ship sails from an island to another one along a fixed route. Knowing all the sea currents, how much energy will be needed.

### Definitions

A vector field is defined as:

A multi-variable function that returns a vector value for each input.

An vector field $$\vec{F}$$ with inputs $$x,y,z$$, and $$P,Q,R$$ functions of $$x,y,z$$, is expressed as:
$$\vec F(x,y,z) = \hat\imath P + \hat\jmath Q + \hat k R = \left\langle P, Q, R \right\rangle$$

Vector fields are drawn as a grid of ($$x,y)$$ input values, from where arrows represent the magnitude and direction of the output vector. An example of a vector field is shown below. Plot of $$\vec{v}=\left\langle\;x^2y,\;y^2\;\right\rangle$$

In physics, work is defined as:

Whenever a force is applied to an object, causing the object to move, work is done by the force.

Work is force times distance, but only the component of the force in the direction of the displacement does any work.
$$W=F\;d\;\cos\theta \nonumber$$ where $$\theta$$ is the angle between force ($$\vec{F}$$) and displacement ($$\vec{s}$$) as shown in the figure below. $$W=F\;d\;\cos\theta$$

Recall that the dot product is the product of the “length” of vectors “in the same direction”.

$$\overrightarrow{a} \cdot \overrightarrow{b} = |\overrightarrow{a}|\ |\overrightarrow{b}|\ \cos\theta \nonumber$$

Thus work can be expressed it as the dot product between the force vector $$\vec{F}$$ and displacement vector $$\vec{s}$$
$$\shaded{ W=\vec{F}\cdot\vec{s} } \label{eq:work}$$

### Work in a vector field

So far work was described in respect of a constant force vector and a straight displacement. Now we extend this to changing force and a displacement over a curved path. $$\vec{F}(x,y)$$ and curve $$C$$

Let $$\vec{r}(t)$$ $$\eqref{eq:curvefnc}$$ describe curve $$C$$, as a parametric function of variable $$t$$, such that $$\vec{r}(t_a)$$ and $$\vec{r}(t_b)$$ are the endpoints of $$C$$.

Imagine breaking up the the curve ($$C$$) into many tiny displacement vectors $$\Delta \vec{r_i}$$. $$\vec{F_i}$$ and $$\Delta\vec{r_i}$$

Work for each displacement vector ($$\Delta\vec{r_i}$$) can expressed as the dot product of $$\vec{F_i}$$ and $$\Delta\vec{r_i}$$ according to $$\eqref{eq:work}$$.
$$\Delta W_i = \vec{F_i}\cdot \Delta\vec{r_i} \nonumber$$

Force $$F_i$$ expands to $$\vec{F}(x_i,y_i)$$. Where $$\left\langle x_i,y_i\right\rangle$$ is a point on the parametric curve, $$\vec{r}(t_i)$$.
$$\Delta W_i =\vec{F}\left(\vec{r}(t_i)\right) \cdot \Delta\vec{r}(t_i) \nonumber$$

The Riemann sum for the total work $$W$$ along the curve follows as:
$$W \approx\sum_i\vec{F}\left(\vec{r}(t_i)\right) \cdot \Delta\vec{r}(t_i) \nonumber$$

Note that $$\Delta\vec{r_i}$$ is not a scalar but a vector. We can not integrate over a vector. Instead we replace it with how much the partical has moved $$\frac{d\vec{r}}{dt}\;dt$$.

The expression for work of a force field $$\vec{F}$$ on a particle traveling along curve $$\vec{r}(t)\ \forall_{t_a\leq t\leq t_b}$$ follows
$$\shaded{ W=\int_C\vec F\cdot d\vec r= \int_{t_a}^{t_b} \vec{F}\left(\vec{r}(t)\right) \cdot \frac{\vec r(t)}{dt}\;dt } \nonumber$$

where $$d\vec r=\left\langle dx, dy, dz\right\rangle$$
$$W=\int_C Pdx+Qdy+Rdz \nonumber$$

The work integral can then be written as the differential
$$\shaded{ W = \int_C\vec F\cdot d\vec r= \int_C\left( Pdx + Qdy + Rdz \right) } \label{eq:workdiff}$$
$$P,Q,R$$ depend on $$x,y,z$$. However $$x,y,z$$ are related. To evaluate express $$x,y,z$$ in terms of a single variable, $$x,y$$, $$z$$, or a parametric parameter $$t$$ and substitute that variable to get an ordinary integral.

Notes

• We assume that the force doesn’t affect the trajectory.
• The result depends on the curve, but not on the parameterization of the curve. In the example, we could have expressed the curve as $$\vec{r}=\left\langle \sin\theta, \sin^2\theta \right\rangle$$ for $$0\leq\theta\leq\frac{\pi}{2}$$.

#### Examples in a plane

Let a particle move over curve $$\vec{r}=\left\langle t,\;t^2 \right\rangle$$ for $$0 \leq t \leq 1$$, in force field $$\vec{F}=\left\langle -y, x \right\rangle$$. What work does the force exert on the particle? Plot of $$\vec{F}$$ and $$\vec{r}$$
##### Method 1

\begin{align*} \int_C\vec{F}\cdot d\vec{r} &= \int_0^1\vec{F}\left(\vec{r}(t)\right)\cdot \frac{d\vec{r}}{dt}\;dt \\ &= \int_0^1\vec{F}(\left\langle t,t^2\right\rangle)\cdot \frac{d}{dt}\left\langle t,t^2\right\rangle dt \\ &= \int_0^1\left\langle -t^2,t \right\rangle \cdot \left\langle 1,2t\right\rangle dt \\ &= \int_0^1 (-t^2+2t^2)\;dt \\ &= \int_0^1 t^2\;dt = \left[ \frac{1}{3}t^3\right]_0^1 =\frac{1}{3} \end{align*}

##### Method 2

Using the differential notation
\begin{align*} \int_C \vec{F}\cdot d\vec{r} &=\int_C \left\langle -y,x \right\rangle \cdot \left\langle dx, dy\right\rangle \\ &= \int_C -y\;dx+x\;dy \end{align*}

Bring it in terms of a single variable, $$t$$
$$\left\{ \begin{array}{lll} x=t & \Rightarrow \frac{d}{dt}x=\frac{d}{dt}t &\Rightarrow dx=dt \\ y=t^2 & \Rightarrow \frac{d}{dt}y = \frac{d}{dt}t^2& \Rightarrow dy=2t\;dt \end{array} \right. \nonumber$$

Substitute the above expressions for $$x, y, dx$$ and $$dy$$.
\begin{align*} \int_C \vec{F}\cdot d\vec{r} &= \int_C \left(-t^2\;dt+t\;2t\;dt\right) \\ &= \int_0^1\left( -t^2\;dt+t\;2t\;dt \right) \\ &= \int_0^1 t^2\;dt = \left[ \frac{1}{3}t^3\right]_0^1=\frac{1}{3} \end{align*} \nonumber

#### Another example in a plane

Curve $$C$$ enclosing the unit disc for $$0\leq\theta\leq\frac{\pi}{4}$$
\begin{align*} \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{align*} Plot of $$\vec{F}$$ and $$C$$

Substituting $$\vec F$$ in the work integral
$$\int_{C_i} y\;dx + x\;dy$$

For $$C_1$$, along the $$x$$-axis, we can just use the $$x$$ variable and $$y=0, dy=0$$
$$W_1 = \int_{C_1} \bcancel{y}_0\;dx + x\;\bcancel{dy}_0=0$$

For $$C_2$$, part of unit circle
$$x=\cos\theta \Rightarrow dx =-\sin\theta\ d\theta \\ y=\sin\theta \Rightarrow dy = \cos\theta\ d\theta \\ 0 \leq \theta \leq \tfrac{\pi}{4}$$

Substituting in the work integral for $$C_2$$
\begin{align*} W_2 &= \int_{C_2} \left(\sin\theta(-\sin\theta\ d\theta) + \cos\theta\cos\theta\ d\theta \right)\\ &= \int_0^\tfrac{\pi}{4} \underbrace{\cos^2\theta – \sin^2\theta}_{\cos(2\theta)}\ d\theta =\left[ \tfrac{1}{2}\sin(2\theta) \right]_0^\frac{\pi}{4} = \tfrac{1}{2} \end{align*}

For $$C_3$$, the work from $$\left(\tfrac{1}{\sqrt 2},\tfrac{1}{\sqrt 2}\right)$$ to $$(0,0)$$ would be the opposite of $$(0,0)$$ to $$\left(\tfrac{1}{\sqrt 2},\tfrac{1}{\sqrt 2}\right)$$.
$$x=t \Rightarrow dx =d\theta \\ y=t \Rightarrow dy =d\theta \\ 0 \leq t \leq \tfrac{1}{\sqrt 2}$$

Substituting in the negated work integral for $$C_3$$
\begin{align*} W_3 &= -\int_{-C_3}t\;d\theta+t\;d\theta \\ &= -\int_{0}^{\frac{1}{\sqrt 2}}2t\;d\theta = -\left[t^2 \right]_0^{\frac{1}{\sqrt 2}}=-\frac{1}{2} \end{align*}

Total work
$$W = W_1+W_2+W_3=0+\frac{1}{2}-\frac{1}{2} = 0$$

#### Examples in space

Let $$\vec F$$ be a force field. What work does the force exert on the particle in two different trajectories?
$$\vec F=\left\langle yz,xz,xy\right\rangle$$

##### Trajectory A

Let a particle move over curve $$C$$, in force field $$\vec F$$. What work does the force exert on the particle?
$$C: x=t^2, y=t^2, z=t, 0 \le t \le 1$$ Plot of $$\vec{F}$$ and $$C$$

Express $$x,y,z$$ in terms of parametric variable $$t$$
\begin{align*} x=t^3 &\Rightarrow dx = 3t^2\;dt\\ y=t^2 & \Rightarrow dy = 2t\;dt\\ z=t & \Rightarrow dz = dt \end{align*}

Substituting $$x,y,z,dx,dy,dz$$ in the integral expression
\begin{align} \int_C\vec F\cdot d\vec r &=\int_C yz\;dx+xz\;dy+xy\;dz \label{eq:example3dwork} \\ &=\int_0^1 t^3.3t^2dt+t^4.2t\;dt+t^5dt \nonumber \\ &= \int_0^1 6t^5dt = \left[t^6\right]_0^1=1 \nonumber \\ \end{align}

##### Trajectory B

Let a particle move over curve $$C$$ consisting of three line segments, in the same force field $$\vec F=\left\langle yz,xz,xy\right\rangle$$. What work does the force exert on the particle?
\begin{align*} C_1&: \mathrm{from\ } (0,0,0) \mathrm{\ to\ }(1,0,0) \\ C_2&: \mathrm{from\ } (1,0,0) \mathrm{\ to\ }(1,1,0) \\ C_3&: \mathrm{from\ } (1,1,0) \mathrm{\ to\ }(1,1,1) \\ \end{align*} Plot of $$\vec{F}$$ and $$C$$

Curves $$C_1,C_2$$ are in the $$xy$$-plane, so $$z=0$$ and therefore $$dz=0$$.

Substituting $$z$$ and $$dz$$ in equation $$\eqref{eq:example3dwork}$$, only leaves
\begin{align*} \int_{C_{1,2}}\vec F\cdot d\vec r &=\int_C y\bcancel{z}_0\;dx+x\bcancel{z}_0\;dy+xy\;\bcancel{dz}_0 \\ &=\int_C xz\;dy = 0 \end{align*}

For $$C_3$$:
$$\begin{array}{l} x=1 \Rightarrow dx=0 \\ y=1 \Rightarrow dy=0 \\ z \mathrm{\ from\ } 0 \mathrm{\ to\ } 1 \end{array} \nonumber$$

Substituting $$x,y,dx,dy$$ in the line integral along $$C_3$$
\begin{align*} \int_{C_3}\vec F\;d\vec r &=\int_C yz\;dx+xz\;dy+xy\;dz \\ &=\int_C z.0+1.z.0+1.1\;dz \\ &=\int_0^1 dz = \left[z\right]_0^1=1 \\ \end{align*}

$$\int_C\vec F\;d\vec r= \int_{C_1}\vec F\;d\vec r + \int_{C_2}\vec F\;d\vec r + \int_{C_3}\vec F\;d\vec r = 1 \nonumber$$

##### Compare

Trajectory A and B have the same answer, because the vector field is a (conservative) gradient field. Both paths go from the origin to $$(1,1,1)$$. Plot of $$\vec{F}$$ and $$C$$

Find a function, what’s gradient is this vector field. It might be $$xyz$$
\newcommand{pdv}{\tfrac{\partial}{\partial #1}} \begin{align*} \vec F &= \nabla(xyz) \\ &= \left\langle \pdv{x}xyz, \pdv{y}xyz, \pdv{z}xyz \right\rangle \\ &= \left\langle yz, xz, xy \right\rangle \end{align*}

Knowing this, we could have used the fundamental theorem of calculus for line integrals.
$$\shaded{ \int_C\nabla f\cdot d\vec r = f(P_1)-f(P_o) } \nonumber$$

Substituting $$f(x,y,z)=xyz$$
\begin{align*} \int_C\nabla f\cdot d\vec r &= f(1,1,1) – f(0,0,0) \\ &= 1 – 0 = 1 \end{align*}

#### Geometric approach

A geometric approach can be easier when the field and the curve are relatively simple and have a geometric relation to each other.

The direction of $$d\vec r$$ is tangent to the curve, and its length is the arc length $$ds$$
$$\shaded{ d\vec r=\left\langle dx,dy\right\rangle = \hat T ds }$$

Or, viewed as the derivative to $$t$$
$$\frac{d\vec r}{dt}=\left\langle \frac{dx}{dt},\frac{dy}{dt}\right\rangle = \hat T \frac{ds}{dt}$$

The line integral for work can be expressed as
$$\shaded{ \int_C \vec F\cdot d\vec r = \int_C \underbrace{\vec F\cdot\hat T}_{scalar} ds } \nonumber$$
$$\vec F\cdot\hat T$$ is a scalar quantity. The force projected to the tangent direction of a trajectory and then integrated along the curve.

#### Geometric approach examples

Let $$C$$ be a a circle with radius $$a$$, at the origin and counter-clockwise. What work does the force exert on the particle in two different force fields?

Let a particle move over curve $$C$$, in force field $$\vec F = \hat\imath x+\hat\jmath y$$. What work does the force exert on the particle? $$C$$ in radiant force field

$$\vec F\perp \hat T \Rightarrow \vec F\cdot \hat T=0 \Rightarrow \int_C\vec F\cdot\hat T ds=0 \nonumber$$

##### Uniform rotation force field

Let a particle move over curve $$C$$, in force field $$\vec F=-\hat\imath y+\hat\jmath x$$. What work does the force exert on the particle? $$C$$ in force field with uniform rotation

\renewcommand{\parallelsum}{\mathbin{\!/\mkern-5mu/\!}} \begin{align*} \vec F \parallelsum \hat T &\Rightarrow \vec F\cdot \hat T=|\vec F|=a \\ &\Rightarrow \int_C a\ ds=a\underbrace{\int_C ds}_{\mathrm{length\ of\ }C}=a.a.2\pi=2\pi a^2 \end{align*}

### Work in a gradient field

When vector field $$\vec F$$ is a gradient of function $$f(x,y)$$, it is called a gradient field
$$\shaded{ \vec F=\nabla f } \nonumber$$ where $$f(x,y)$$ is called the potential.

In physics, the work done by the electrical force, is given by the change in value of the potential from the starting point to the ending point. The potential energy tells us how much energy is stored in the force field. 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$$

Recall the fundamental theorem of calculus

if you integrate the derivative, you get back the function.
$$\int_a^b f'(t)\;dt=f(b)-f(a)$$

In multivariable calculus, it is the same. It tells you:

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) } \nonumber$$

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}{\tfrac{\partial}{\partial #1}} \nabla f =\left\langle \pdv{x}f, \pdv{y}f, \pdv{z}f \right\rangle \nonumber$$

Substituting this in $$\eqref{eq:workdiff}$$, and integrating the differential of a function (like in single variable calculus)
\renewcommand{dv}{\frac{d #1}{d #2}} \renewcommand{pdv}{\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 \\ &= \int_C \underbrace{ \left(\pdv{f}{x}\dv{x}{t} + \pdv{f}{y}\dv{y}{t}\right)}_ {\dv{}{t}\;f\left(\;x(t),\;y(t)\;\right)}dt \end{align*}

Recall: the multivariable calculus chain rule

$$\renewcommand{dv}{\frac{d #1}{d #2}} \renewcommand{pdv}{\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$$

Apply the chain rule
\renewcommand{dv}{\frac{d #1}{d #2}} \renewcommand{pdv}{\frac{\partial #1}{\partial #2}} \begin{align*} \int_C \nabla f\cdot d\vec r &= \int_{t_0}^{t_1} \dv{f}{t}\;dt = \int_{t_0}^{t_1} f \\ &=\Big[\ f\big(\;x(t),\;y(t)\;\big)\ \Big]_{t_0}^{t_1} \end{align*}

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

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

#### Physics using math notation

If force $$\vec F$$ is the gradient of a potential
$$\vec F=\nabla f$$

The work of $$\vec F$$ is the change in potential.

E.g. gravitational or electrical field vs. gravitational or electrical potential (voltage).

Conservativeness means no energy can be extracted from the field for free. Total energy is conserved.

Equivalent properties of the work $$\int_C\nabla f d\vec r$$:

1. Path-independent: it only depends on $$f(P_0)$$ and $$f(P_1)$$ at the start and end points.
2. Conservative: the work is $$0$$ along all closed curves. This means a closed loop in a gradient field does not provide energy.
3. Equivalent to $$\vec F$$ is a gradient field $$\vec F=\left\langle f_x,f_y\right\rangle$$
4. $$Mdx+Ndy$$ is an exact differential. That means it can be put in the form $$df$$.

#### Example

Let’s look at the earlier example again: Curve $$C$$ starting and ending at $$(0,0)$$ through vector field $$\vec F$$
\begin{align*} \vec F &= \left\langle y,x \right\rangle \end{align*}

A function whose gradient that would result in this vector field is
\begin{align*} f &= xy \\ \Rightarrow \nabla f &= \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.

Adding the contour plot of $$f=xy$$ to gradient field $$\vec F$$

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?

Testing whether $$\vec F=\left\langle M,N\right\rangle$$ is a gradient field.

If $$\vec F=\nabla f$$:
\newcommand{dv}{\tfrac{d #1}{d #2}} \newcommand{pdv}{\tfrac{\partial #1}{\partial #2}} \left\{ \begin{align*} M=\pdv{}{x}f = f_x\\ N=\pdv{}{y}f = f_y \end{align*} \right.

Recall: the second partial derivative of function $$f$$

$$\newcommand{dv}{\frac{d #1}{d #2}} \newcommand{pdv}{\frac{\partial #1}{\partial #2}} \newcommand{ppdv}{\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$$

Applying this second partial derivative
\newcommand{dv}{\frac{d #1}{d #2}} \newcommand{pdv}{\frac{\partial #1}{\partial #2}} \newcommand{ppdv}{\frac{\partial^2 #1}{\partial #2\partial #3}} \left. \begin{align*} M=\pdv{}{x}f = f_x &\Longrightarrow M_y=\pdv{M}{y}=\ppdv{}{x}{y}f\\ N=\pdv{}{y}f = f_y &\Longrightarrow N_x=\pdv{M}{x}=\ppdv{}{y}{x}f \end{align*} \right\} \Rightarrow M_y=N_x

That implies that a gradient field should have the property
\newcommand{dv}{\frac{d #1}{d #2}} \newcommand{pdv}{\frac{\partial #1}{\partial #2}} \newcommand{ppdv}{\frac{\partial^2 #1}{\partial #2\partial #3}} \left. \begin{align*} M_y=\ppdv{}{x}{y}f\\ N_x=\ppdv{}{y}{x}f \end{align*} \right\} \Rightarrow M_y=N_x

Conversely, if

1. $$\vec F=\left\langle M,N\right\rangle$$ is defined and differentiable everywhere, and
2. $$M_y=M_x$$

then $$\vec F$$ is a gradient field.

#### Example

##### One

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

$$\vec F$$ is not a gradient field, because
\newcommand{dv}{\frac{d #1}{d #2}} \newcommand{pdv}{\frac{\partial #1}{\partial #2}} \newcommand{ppdv}{\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}

##### Two

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

\newcommand{dv}{\frac{d #1}{d #2}} \newcommand{pdv}{\frac{\partial #1}{\partial #2}} \newcommand{ppdv}{\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 of a gradient field

Can only be done if $$N_x=M_y$$.

#### Method: computing line integrals

Compute
\begin{align*} &\int_C\vec F\cdot d\vec r=f(x_1,y_1)-f(0,0) \\ \Rightarrow & f(x_1,y_1) =\int_C\vec F\cdot d\vec r + \underbrace{f(0,0)}_{\mathrm{constant}} \end{align*} $$C, C_1, C_2$$ in $$\vec F$$

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$$

For $$\vec F$$
$$\left\langle 4x^2+8xy,3y^2+4x^2\right\rangle \nonumber$$

\begin{align*} \int_C\vec F\cdot d\vec r &= \int_C\left(4x^2+8xy\right)dx+\left(3y^2+4x^2\right)dy \\ \end{align*}

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*}

Substitute $$\int_{C_1}, \int_{C_2}$$ back
$$f(x_1,y_1) = \frac{4}{3}{x_1}^3 + {y_1}^3+4{x_1}^2y_1+c \nonumber$$

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

#### Method: Using Antiderivatives

No integrals, but you have to follow the procedure carefully.

A common pitfall, is to treat the second equation, like the first one. This is much more error prone.

Want to solve
\newcommand{pdv}{\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.

Integrating equation $$\eqref{eq:anti1}$$ in respect to $$x$$
$$f = \frac{4}{3}x^3 + 4x^2y + g(y) \label{eq:anti}$$ The integration constant might depend on $$y$$, so we call it $$g(y)$$.

Thus, we kind of know what $$f$$ is. Differentiating equation $$\eqref{eq:anti}$$ to $$y$$
\newcommand{pdv}{\frac{\partial #1}{\partial #2}} \begin{align*} \pdv{}{y}f = f_y &= \frac{4}{3}x^3 + 4x^2y + g(y) \\ &= 0 + 4x^2+\pdv{}{y}g(y) \end{align*}

Match this to equation $$\eqref{eq:anti2}$$
\require{cancel} \newcommand{pdv}{\frac{\partial #1}{\partial #2}} \begin{align*} \bcancel{4x^2}+\pdv{}{y}g(y) &= 3y^2+\bcancel{4x^2} \\ \Rightarrow \pdv{}{y}g(y) &= 3y^2 \\ \Rightarrow g(y) &= 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 + y^3\ (+ c) \nonumber$$

### Recap

$$\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 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)
Embedded software developer
Passionately curious and stubbornly persistent. Enjoys to inspire and consult with others to exchange the poetry of logical ideas.

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