Part 17 - Gradient theorem

Posted on Oct 4, 2023
(Last updated: May 26, 2024)

Introduction

In this part we’ll cover the fundamental theorem of line integrals (also called Gradient theorem).

Definition

Recall the fundamental theorem of calculus: $$ \int_a^b f^\prime(x)\ dx = f(b) - f(a) $$

For line integrals: Let $f: D \subset \mathbb{R}^2 \rarr \mathbb{R}$

Let $C = D$ be parameterized as $\vec{r}(t)$, for $a \leq t \leq b$.

$$ \boxed{\int_C \nabla f \cdot dr = f(\vec{r}(b)) - f(\vec{r}(a))} $$

Notice how this doesn’t depend on the actual curve, but only of the start and endpoint.

Additionally, if we assume that $C$ is closed, meaning the curve starts and ends at the same point: $$ \int_C \nabla \cdot dr = 0 $$

Theorem

Let $D \subset \mathbb{R}^2$ be open (every point in $D$ has a small disc around it, which contains $D$), connected (consists of one single “piece”).

Let $F: D \rarr \mathbb{R}^2$ be a vector field. Then $F$ is conservative (there exists a $f$ such that $\nabla f = F$), if and only if:

$$ \int_C F \cdot dr = 0 \ | \ \text{for every closed curve } C \subset D $$

Proposition

NB: This only applies for $\mathbb{R}^2$.

Suppose $F(x, y) = P(x, y) \vec{i} + Q(x, y) \vec{j}$ is a conservative field. Then:

$$ \dfrac{\partial P}{\partial y} = \dfrac{\partial Q}{\partial x} $$

Proof

If $F$ is conservative, then there is a function, $f: D \subset \mathbb{R}^2 \rarr \mathbb{R}^2$ such that $\nabla f = F$. In other words, $f_x = P$ and $f_y = Q$.

$$ \begin{align*} P_y & = \dfrac{\partial P}{\partial y} \\ & = \dfrac{\partial}{\partial y} \left(\dfrac{\partial f}{\partial x} \right) \\ & = \dfrac{\partial^2 f}{\partial y \partial x} \\ & = \dfrac{\partial^2 f}{\partial x \partial y} \\ & = \dfrac{\partial}{\partial x} \left(\dfrac{\partial f}{\partial y} \right) \\ & = \dfrac{\partial P}{\partial y} \\ & = \boxed{Q_x} \end{align*} $$

Remark

If given a field, $F = P \vec{i} + Q\vec{j}$ and if it is conservative, you can check $P_y = Q_x$, if this is not the case, this means that $F$ is not conservative.

Definition

$D \subset \mathbb{R}^2$ is called simply connected if no “holes” exists.

Theorem

Suppose $D \subset \mathbb{R}^2$ is open, connected and simply connected. If $F: D \rarr \mathbb{R}^2$ is a vector field, $F = P\vec{i} + Q\vec{j}$ and $P_y = Q_x$, then $F$ is conservative.

Let’s now do a bunch of examples to understand all of this theory.

Example

Determine if the following vector fields are conservative: $$ F(x, y) = (x - y)\vec{i} + (x - 2)\vec{j} \\ F(x, y) = (3 + 2xy)\vec{i} + (x^2 - 3y^2)\vec{j} \\ $$

As we can see, both of these have the domain $D = \mathbb{R}^2$. Which means:

In the first case: $$ P_y = -1 Q_x = 1 $$

Which means this is not a conservative vector field.

In the second case: $$ P_y = 2x Q_x = 2x $$

Which means this is a conservative vector field.

Example

$F(x, y) = (3 + 2xy)\vec{i} + (x^2 - 3y^2)\vec{j}$ is conservative. Find a potential for it. (Find $f$, such that $\nabla f = F$).

Let, $f: \mathbb{R}^2 \rarr \mathbb{R}$ be a function with $\nabla f = F$.

Therefore: $$ f_x = 3 + 2xy \\ f_y = x^2 - 3y^2 \\ $$

We generally will use this approach (this doesn’t always work but, it’s a good strategy):

Integrate one of these with respect to “their” variable: $$ f(x, y) = \int f_x(x, y)\ dx = \int 3 + 2xy = 3x + x^2y + g(y) $$

Notice the $g(y)$, since we can a function depending on y if we differentiate with respect to $x$.

Let’s now differentiate this with respect to the other variable: $$ f_y(x, y) = 0 + x^2 + g^\prime(y) $$

Now we have two equations for $f_y$: $$ x^2 - 3y^2 = x^2 + g^\prime(y) \\ g^\prime(y) = -3y^2 \\ g(y) = -y^3 + C $$

Which means: $$ f(x, y) = 3x + x^2y -y^3 + C $$

Let’s do the other way around as well: $$ f(x, y) = \int f_y(x, y)\ dy = \int x^2 - 3y^2 = x^2y - y^3 + g(x) $$

$$ f_x(x, y) = 2xy + g^\prime(x) $$

$$ 3 + 2xy = 2xy + g^\prime(x) \\ g^\prime(x) = 3 \\ g(x) = 3x + C $$

$$ f(x, y) = x^2y - y^3 + 3x + C \ | \ \text{same!} $$

Example

Evaluate $\int_C F \cdot dr$ where, $F(x, y) = (3 + 2xy)\vec{i} + (x^2 - 3y^2)\vec{j}$ and $C = \vec{r}(t) = (e^t sin(t))\vec{i} + (e^t cos(t))\vec{j}$.

For $0 \leq t \leq \pi$.

Since we already now that $F$ is conservative, which means there exists a $\nabla f = F$, which we calculated in the last question, since the domain of the potential is $\mathbb{R}^2$ as well, we can use the fundamental theorem of line integrals!

$$ \int_C F \cdot dr = \int_C \nabla f \cdot dr = f(\vec{r}(\pi)) - f(\vec{r}(0)) $$

Remember that: $$ f(x, y) = x^2y - y^3 + 3x + C $$

Let’s calculate the start and end point: $$ \vec{r}(0) = \langle 0, 1 \rangle \\ \vec{r}(\pi) = \langle 0, -e^{\pi} \rangle \\ $$

$$ f(0, 1) = -1 + C f(0, -e^{\pi}) = -(-e^{\pi})^3 + C = e^{3\pi} + C $$

Which means: $$ \int_C F \cdot dr = (e^{3\pi} + C) - (-1 + C) = \boxed{e^{3\pi} + 1} $$

Conservation of energy

(This is just a motivation of the name, nothing really important, but I found it cool so).

Suppose $F$ is a force field, suppose that it moves an object with mass, $m$, along a curve $C$, paramterized as $\vec{r}(t)$ for $a \leq t \leq b$. According to Newtons second law of motion: $$ F = ma $$

We can write this as: $$ F(\vec{r}(t)) = m \vec{r^{\prime\prime}}(t) $$

The work done by the force field: $$ W = \int_C F \cdot dr = \int_a^b F(\vec{r^\prime}(t)) \cdot \vec{r^\prime}(t)\ dt $$

Using Newtons second law of motion: $$ \int_a^b m \vec{r^{\prime\prime}}(t) \cdot \vec{r^\prime}(t)\ dt = m \int_a^b \vec{r^{\prime\prime}}(t) \cdot \vec{r^\prime}(t)\ dt $$

$$ \dfrac{m}{2} \int_a^b \dfrac{d}{dt} \left| \vec{r^\prime}(t) \right|^2\ dt $$

$$ \dfrac{m}{2} \left( \left| \vec{r^\prime}(b) \right|^2 - \left| \vec{r^\prime}(a) \right|^2 \right)\ dt $$

$$ \dfrac{m}{2} \left( \left| \vec{v}(b) \right|^2 - \left| \vec{v}(a) \right|^2 \right)\ dt $$

Using that $K_E = \dfrac{mv^2}{2}$: $$ K_E(b) - K_E(a) $$

Suppose now that $\nabla f = F$. The potential energy of the object is $P_E(t) = -f(\vec{r}(t))$

$$ W = \int_C F \cdot dr = \int_C - \nabla P \cdot dr = -(P_E(b) - P_E(a)) $$

Which means: $$ K_E(b) - K_E(a) = -(P_E(b) - P_E(a)) $$

$$ \boxed{K_E(b) + P_E(b) = K_E(a) + P_E(a)} $$

Which is the law of conservation of energy!