Some forces do the same work no matter which route you take. Lifting a box from the floor to a shelf takes the same work against gravity whether you lift it straight up or carry it around the room first. Fields like this are called path independent, and they are exactly the fields with a potential.
Key idea
For a continuous field $\mathbf{F}$ on an open connected region $D$, these are equivalent:
- $\int_C \mathbf{F} \cdot d\mathbf{r}$ depends only on the endpoints of $C$ (path independence).
- $\oint_C \mathbf{F} \cdot d\mathbf{r} = 0$ for every closed curve $C$ in $D$.
- $\mathbf{F} = \nabla f$ for some function $f$ on $D$ (conservative).
Why it works
Path independence and loops: two paths $C_1$, $C_2$ from $A$ to $B$ make a loop $C_1 - C_2$ (out along $C_1$, back along $C_2$ reversed), and $\oint_{C_1 - C_2} = \int_{C_1} - \int_{C_2}$. So "every loop gives ${}0$" is the same as "every two paths agree".
Gradient implies independence: the fundamental theorem gives $f(B) - f(A)$.
Independence implies gradient: fix a point $A$ and define $f(x, y) = \int \mathbf{F} \cdot d\mathbf{r}$ along any path from $A$ to $(x, y)$. Choose a path whose last piece is horizontal, from $(x_0, y)$ to $(x, y)$: then $f(x, y) = \text{(const)} + \int_{x_0}^x P(s, y)\,ds$, and $f_x = P$. A path ending in a vertical piece gives $f_y = Q$.
Gradient implies independence: the fundamental theorem gives $f(B) - f(A)$.
Independence implies gradient: fix a point $A$ and define $f(x, y) = \int \mathbf{F} \cdot d\mathbf{r}$ along any path from $A$ to $(x, y)$. Choose a path whose last piece is horizontal, from $(x_0, y)$ to $(x, y)$: then $f(x, y) = \text{(const)} + \int_{x_0}^x P(s, y)\,ds$, and $f_x = P$. A path ending in a vertical piece gives $f_y = Q$.
Worked examples
Worked example: Two paths, one answer
Compute $\int_C y\,dx + x\,dy$ from $(0, 0)$ to $(1, 2)$ along the segment and along $(0, 0) \to (1, 0) \to (1, 2)$.
- Segment $\langle t, 2t \rangle$: $\int_0^1 (2t \cdot 1 + t \cdot 2)\,dt = 2$.
- Broken path: on $y = 0$ the integrand is ${}0$; on $x = 1$ it is ${}1\,dy$: $\int_0^2 dy = 2$.
- Both give ${}2 = f(1, 2) - f(0, 0)$ with $f = xy$.
Answer: ${}2$ both ways
Worked example: Two paths, two answers
Repeat with $\int_C y\,dx - x\,dy$.
- Segment: $\int_0^1 (2t - 2t)\,dt = 0$.
- Broken path: ${}0$ on the first piece, then $\int_0^2 -1\,dy = -2$.
- Different answers, so $\langle y, -x \rangle$ is not path independent (and $P_y = 1 \ne -1 = Q_x$).
Answer: ${}0$ and $-2$
Worked example: Gravity
Find the work done by gravity $\mathbf{F} = \langle 0, 0, -mg \rangle$ on a mass moved from height $z = h_1$ to $z = h_2$ along any path.
- $\mathbf{F} = \nabla f$ with $f = -mgz$.
- Work $$= f(\text{end}) - f(\text{start}) = -mg(h_2 - h_1).$$
- With potential energy $U = mgz = -f$, the work is $-\Delta U$: the familiar statement that gravity's work equals the loss of potential energy.
Answer: $-mg(h_2 - h_1)$