25. Conservative fields, potential functions, and path independence
§12.2's worked example ended on a striking coincidence: work computed along a specific curved path matched the potential function's change between the endpoints exactly, as if the path itself never mattered. This lesson shows that's no coincidence at all — it's the vector-calculus version of the Fundamental Theorem of Calculus, and it holds for exactly the gradient fields §12.0 introduced.
The Fundamental Theorem of Line Integrals
If \vec F=\nabla f for some scalar function f, and C is any curve from point A to point B, then \int_C\vec F\cdot d\vec r=f(B)-f(A)
This is the Fundamental Theorem of Calculus (§4.3), one dimension up. There, \int_a^bF'(x)\,dx=F(b)-F(a) — the integral of a derivative depends only on the endpoints. Here, \int_C\nabla f\cdot d\vec r is the integral of a gradient, and it too depends only on the endpoints, f(B)-f(A), regardless of which curve connects them.
Proof sketch: by §10.4's chain rule, if \vec r(t) parametrizes C from t=a to t=b, then \frac{d}{dt}f(\vec r(t))=\nabla f(\vec r(t))\cdot\vec r'(t) — exactly the line-integral integrand from §12.2. So
\int_C\nabla f\cdot d\vec r=\int_a^b\frac{d}{dt}f(\vec r(t))\,dt=f(\vec r(b))-f(\vec r(a))=f(B)-f(A)
by the ordinary single-variable Fundamental Theorem, applied to the composite function f(\vec r(t)).
Conservative fields and path independence
A vector field with this property — \vec F=\nabla f for some potential f — is called conservative. The theorem above shows conservative fields have path independence: the work done moving from A to B is the same no matter which route is taken, as long as start and end points match.
A direct consequence: for a conservative field, circulation around any closed curve is exactly zero. A closed curve has A=B, so f(B)-f(A)=f(A)-f(A)=0 — a fact §12.2 previewed as a genuine possibility but didn't yet explain: it's automatic whenever the field is a gradient. (§12.2's rotational field \langle-y,x\rangle had nonzero circulation precisely because it fails to be conservative — checkable directly by the test below.)
Testing whether a field is conservative
Computing every possible path's line integral to check for agreement is impossible. Instead, use §10.2's Clairaut's theorem: if $\vec F=\langle P,Q\rangle=\nabla f=\langle f_x,f_y\rangle$, then P=f_x and Q=f_y, so
P_y=f_{xy}\qquad Q_x=f_{yx}
By Clairaut's theorem, f_{xy}=f_{yx} whenever both are continuous — so a conservative field must satisfy P_y=Q_x everywhere. On a domain with no holes (a simply connected domain), the converse also holds: P_y=Q_x everywhere is sufficient to guarantee \vec F is conservative.
\boxed{P_y=Q_x\iff\vec F=\langle P,Q\rangle\text{ is conservative}}
(on a simply connected domain)
Checking §12.2's rotational field: \vec F=\langle-y,x\rangle gives P_y=-1, Q_x=1 — not equal, confirming algebraically what the nonzero circulation already showed geometrically: this field is not conservative.
Finding the potential function
The same integrate-then-match procedure from §12.0's worked example, applied systematically: integrate P with respect to x (treating y as constant) to get a candidate f up to an unknown function of y; differentiate that candidate with respect to y, match against Q, and solve for the unknown piece.
Doing it in Python
Testing whether \vec F(x,y)=\langle2xy,x^2+3y^2\rangle is conservative, and finding its potential:
import sympy as sp
x, y = sp.symbols('x y')
P, Q = 2*x*y, x**2 + 3*y**2
P_y = sp.diff(P, y)
Q_x = sp.diff(Q, x)
print(f"P_y = {P_y}, Q_x = {Q_x}, conservative: {P_y == Q_x}")
f = sp.integrate(P, x)
g_prime = sp.simplify(Q - sp.diff(f, y))
g = sp.integrate(g_prime, y)
potential = f + g
print(f"potential function f(x,y) = {potential}")
Using the Fundamental Theorem of Line Integrals to compute work instantly, without ever parametrizing a path:
import sympy as sp
x, y = sp.symbols('x y')
potential = x**2*y + y**3 # found above
work = potential.subs({x: 1, y: 2}) - potential.subs({x: 0, y: 0})
print(f"work from (0,0) to (1,2), any path = {work}")
Confirming path independence directly — computing work along two different paths between the same two points and checking they agree:
import sympy as sp
t = sp.Symbol('t')
x, y = sp.symbols('x y')
F = sp.Matrix([2*x*y, x**2 + 3*y**2])
# path 1: straight line from (0,0) to (1,2)
path1 = sp.Matrix([t, 2*t])
work1 = sp.integrate(F.subs({x: path1[0], y: path1[1]}).dot(path1.diff(t)), (t, 0, 1))
# path 2: a parabola from (0,0) to (1,2)
path2 = sp.Matrix([t, 2*t**2])
work2 = sp.integrate(F.subs({x: path2[0], y: path2[1]}).dot(path2.diff(t)), (t, 0, 1))
print(f"work along the straight line: {work1}")
print(f"work along the parabola: {work2}")
print(f"match: {work1 == work2}")
Worked example
Determine whether \vec F(x,y)=\langle2xy,x^2+3y^2\rangle is conservative, and if so, find the work done moving from (0,0) to (1,2) along any path.
Test: P=2xy\Rightarrow P_y=2x. Q=x^2+3y^2\Rightarrow Q_x=2x.
P_y=Q_x=2x\ \Longrightarrow\ \boxed{\text{conservative}}
Find the potential: integrate P with respect to x:
f(x,y)=\int2xy\,dx=x^2y+g(y)
Differentiate with respect to y and match against Q:
f_y=x^2+g'(y)\overset!=x^2+3y^2\ \Longrightarrow\ g'(y)=3y^2\ \Longrightarrow\ g(y)=y^3
f(x,y)=x^2y+y^3
Apply the Fundamental Theorem of Line Integrals:
W=f(1,2)-f(0,0)=\big[(1)^2(2)+2^3\big]-\big[0+0\big]=2+8=\boxed{10}
Sanity check. This matches §12.2's worked-example preview exactly, where the same field's work along a specific parabolic path was computed directly as 10 — here recovered in three lines, with no path or parametrization ever entering the calculation at all. That's the entire value of recognizing a conservative field: it converts a potentially difficult line integral into a simple function evaluation. ✓
Your turn
1. Determine whether \vec F(x,y)=\langle3x^2y,x^3+2y\rangle is conservative.
2. If the field in problem 1 is conservative, find its potential function and compute the work from (0,0) to (2,1).
3. True or false: for a conservative field, the work done moving from A back to A along any closed loop is always zero.
Solutions
1. P=3x^2y\Rightarrow P_y=3x^2. Q=x^3+2y\Rightarrow Q_x=3x^2.
P_y=Q_x=3x^2\ \Longrightarrow\ \boxed{\text{conservative}}
2. f(x,y)=\int3x^2y\,dx=x^3y+g(y). Match: $f_y=x^3+g'(y)\overset!=x^3+2y \Rightarrow g'(y)=2y\Rightarrow g(y)=y^2$.
f(x,y)=x^3y+y^2
W=f(2,1)-f(0,0)=\big[(8)(1)+1\big]-0=\boxed9
3. True. This is exactly the direct consequence stated in the concept section: a closed loop has A=B, so \int_C\vec F\cdot d\vec r=f(A)-f(A)=0 for any conservative field and any closed curve at all — no computation of the specific loop is even needed once the field is known to be conservative.
Check yourself in code
Determine whether \vec F(x,y)=\langle2xy,x^2+3y^2\rangle is conservative, find its potential function, and compute the work from (0,0) to (1,2).
Print exactly this:
conservative: True
potential = x**2*y + y**3
work = 10
import sympy as sp
x, y = sp.symbols('x y')
P, Q = 2*x*y, x**2 + 3*y**2
P_y = sp.diff(P, y)
Q_x = sp.diff(Q, x)
print("conservative: ...")
f = sp.integrate(P, x)
g_prime = sp.simplify(Q - sp.diff(f, y))
g = sp.integrate(g_prime, y)
potential = f + g
print("potential = ...")
work = potential.subs({x: 1, y: 2}) - potential.subs({x: 0, y: 0})
print("work = ...")
import sympy as sp
x, y = sp.symbols('x y')
P, Q = 2*x*y, x**2 + 3*y**2
P_y = sp.diff(P, y)
Q_x = sp.diff(Q, x)
print(f"conservative: {P_y == Q_x}")
f = sp.integrate(P, x)
g_prime = sp.simplify(Q - sp.diff(f, y))
g = sp.integrate(g_prime, y)
potential = f + g
print(f"potential = {potential}")
work = potential.subs({x: 1, y: 2}) - potential.subs({x: 0, y: 0})
print(f"work = {work}")
A conservative field \vec F=\nabla f satisfies the Fundamental Theorem of Line Integrals, \int_C\vec F\cdot d\vec r=f(B)-f(A) — §4.3's Fundamental Theorem one dimension up — which makes work path-independent and forces circulation around any closed loop to vanish. The component test P_y=Q_x, a direct application of Clairaut's theorem from §10.2, identifies conservative fields without computing a single line integral, and the same integrate-then-match procedure that found §12.0's potential functions locates the potential whenever the test passes.
Next: Green's theorem, which converts a circulation integral around a closed curve into a double integral over the region it encloses — and explains, in full generality, exactly why the test P_y=Q_x works.