Survey of Mathematics

6.2 Gradient fields and potentials

A field is a gradient field when its line integral depends only on the endpoints, equivalently when it vanishes around every closed path; then the integral is the change of a potential, equal mixed partials are a necessary test that is also enough on a convex set, and the angle field on the punctured plane shows why it is not enough in general.

Taught in 375/376Apostol, not taughtBeyond the courseApostol Vol. 2, 10.10 to 10.20 and 11.21MATH 376 Weeks 2 and 3: worksheets 5, 6, 10 and 27, homework 2 problems 4 and 5, homework 3 problem 1, homework 5 problem 4.1, Midterm 1 problem 1, Final problems 1(a) and 3, the lecture of 4 FebruaryGreen, An Essay on the Application of Mathematical Analysis to the Theories of Electricity and Magnetism (1828)

When does a line integral depend only on where the path starts and where it ends? When it does, the integral is a difference of two values of a single function, and a whole curve can be replaced by two points. This chapter shows that this happens exactly for gradient fields, gives a test you can compute, shows by an example where the test lies, and finishes with the physics (energy) and the differential equations that use it. It is the most heavily tested topic of the first half of MATH 376.

Before you start

6.1: the line integral, closed paths, reversing a path flips the sign. 5.5: for a C2C^2 function the mixed partials are equal. 4.4: path-connected sets. 5.3: the derivative of f(r(t))f(r(t)).

Quick checkIf φ\varphi is C2C^2, how are φxy\varphi_{xy} and φyx\varphi_{yx} related?
Quick checkFor F=(y,−x)F = (y, -x) the integral from (1,0)(1, 0) to (0,1)(0, 1) is −1-1 along the segment and −π/2-\pi/2 along the quarter circle. What does this show?
Quick checkIs the plane with the origin removed path-connected?

The picture: when the endpoints are all that matter

The field is F=(y,x)F = (y, x), the gradient of xyxy. Walk the three paths from AA to BB: the three graphs of work so far wiggle differently but end at the same height. Now switch to F=(y,−x)F = (y, -x). The totals come apart. The first kind of field is a gradient field. In the second kind, the work you get depends on the road you take.

The idea, in words

A scalar function φ\varphi is a landscape. Its gradient ∇φ\nabla\varphi points uphill, with size equal to the steepness. Walking along a path, the work of the field ∇φ\nabla\varphi is the amount of height gained: the field pushes you with the steepness times the distance, which is exactly the climb. So it does not matter which road you take, only where you start and where you end. Walk a closed loop, and you return to the height you left, so the total is 00.

Why· Why some fields are not gradients

A swirl does not have a landscape. In the field (y,−x)(y, -x) you can walk around a loop and be pushed the same way the whole time. That would mean climbing at every step and returning to the start, which no landscape allows. The most important example is the angle field of the punctured plane, which has equal mixed partials everywhere and yet is not a gradient: its ‘landscape’ would be the angle θ\theta itself, and the angle goes up by 2π2\pi every time you go round the origin, like a spiral staircase.

Where this came from· Green and the word 'potential'

George Green, a Nottingham baker’s son who worked in the family mill and was largely self-taught, published An Essay on the Application of Mathematical Analysis to the Theories of Electricity and Magnetism in 1828, privately and by subscription; about fifty people subscribed. In it he introduced the word ‘potential’ for the function obtained by adding up the masses (or charges) of a system, each divided by its distance from a given point. The force is the gradient of that function. The essay was almost unknown until William Thomson, later Lord Kelvin, found it around 1845 and had it reprinted in Crelle’s journal. The same essay contains the integral identity now called Green’s theorem, taken up in 6.4.

Gradient fields and potentials

Definition T

Gradient field

A vector field FF on SS is a gradient field (the worksheets say conservative field) if there is a scalar field φ\varphi with ∇φ=F\nabla\varphi = F on all of SS. In the plane, with F=(P,Q)F = (P, Q), this means φx=P\varphi_x = P and φy=Q\varphi_y = Q.

In one lineA vector field FF on a set SS is a gradient field if there is a function φ:S→R\varphi: S \to \mathbb R with ∇φ=F\nabla\varphi = F at every point of SS.

Why it existsIt says the field is the steepness of a landscape, which is what makes its line integral a change in height.

Definition T

Potential

A function φ\varphi with ∇φ=F\nabla\varphi = F is a potential (or potential function) of FF. It is never unique: adding a constant gives another. On a connected open set that is the only freedom, because two potentials differ by a function with zero gradient, and a function with zero gradient on a connected open set is constant (4.4).

In one lineA potential of FF is a function φ\varphi with ∇φ=F\nabla\varphi = F on the whole domain of FF.

Why it existsIt is the landscape: knowing it replaces the whole field by one function, and line integrals by differences of that function.

Definition T

Path independence

The line integral of FF is independent of the path in SS if for any two piecewise smooth paths in SS with the same start and the same end, the integrals of FF along them are equal. A set SS is connected in this chapter if any two of its points are joined by a piecewise smooth path inside SS; for an open set this agrees with 4.4, because the proof there joins points by chains of straight segments.

In one lineThe line integral of FF is independent of the path in SS if any two piecewise smooth paths in SS with the same start and the same end give the same value.

Why it existsIt is the property that lets us write the integral as a function of two points only.

The second fundamental theorem: evaluate with the endpoints

Theorem T Apostol Thm 10.3; MATH 376 lecture of 4 February

Second fundamental theorem for line integrals

Let SS be open, φ\varphi a C1C^1 scalar field on SS, and F=∇φF = \nabla\varphi. For every piecewise smooth path r:[a,b]→Sr: [a, b] \to S lying in SS,

∫rF⋅dr=φ(r(b))−φ(r(a)).\int_r F \cdot dr = \varphi(r(b)) - \varphi(r(a)).

In one lineIf F=∇φF = \nabla\varphi on an open set SS with φ\varphi of class C1C^1, then for any piecewise smooth path r:[a,b]→Sr: [a, b] \to S, ∫rF⋅dr=φ(r(b))−φ(r(a))\int_r F \cdot dr = \varphi(r(b)) - \varphi(r(a)).

Why it is trueIt turns a line integral into a subtraction of two numbers, so the path is irrelevant and you may swap a hard path for an easy one.

ProofMATH 376 lecture of 4 February; Apostol 10.11
The idea: On each smooth piece the chain rule says that phi along the path has derivative F dotted with the velocity, so the integrand is the derivative of phi along the path and the fundamental theorem of calculus evaluates it. The pieces telescope.
On a smooth piece, ddtφ(r(t))=∇φ(r(t))⋅r′(t)\dfrac{d}{dt}\varphi(r(t)) = \nabla\varphi(r(t)) \cdot r'(t).
The chain rule for a scalar field along a path (5.3); it applies because φ\varphi is C1C^1 (so differentiable) and rr is differentiable on the piece [tj−1,tj][t_{j-1}, t_j].
∇φ(r(t))=F(r(t))\nabla\varphi(r(t)) = F(r(t)), so ddtφ(r(t))=F(r(t))⋅r′(t)\dfrac{d}{dt}\varphi(r(t)) = F(r(t)) \cdot r'(t).
The hypothesis ∇φ=F\nabla\varphi = F holds at every point of SS, and the whole path lies in SS.
∫tj−1tjF(r(t))⋅r′(t) dt=φ(r(tj))−φ(r(tj−1))\displaystyle\int_{t_{j-1}}^{t_j} F(r(t)) \cdot r'(t)\,dt = \varphi(r(t_j)) - \varphi(r(t_{j-1})).
Part 2 of the fundamental theorem of calculus, for the continuous function t↦F(r(t))⋅r′(t)t \mapsto F(r(t)) \cdot r'(t) on the piece, whose antiderivative is φ∘r\varphi \circ r.
Add over j=1,…,mj = 1, \dots, m: the sum telescopes to φ(r(tm))−φ(r(t0))\varphi(r(t_m)) - \varphi(r(t_0)).
The end value of one piece is the start value of the next, because rr is continuous at the break points.This is where the continuity of the whole path is used.
So ∫rF⋅dr=φ(r(b))−φ(r(a))\int_r F \cdot dr = \varphi(r(b)) - \varphi(r(a)). ■\blacksquare
tm=bt_m = b and t0=at_0 = a.
Proof workshopGive the reason for each line: the second fundamental theoremApostol 10.11

Each line of the proof is shown in order. Choose the reason that justifies it, then press Check.

  1. ddtφ(r(t))=∇φ(r(t))⋅r′(t)\dfrac{d}{dt}\varphi(r(t)) = \nabla\varphi(r(t)) \cdot r'(t) on each smooth piece.
  2. ∇φ(r(t))=F(r(t))\nabla\varphi(r(t)) = F(r(t)).
  3. ∫tj−1tjF(r(t))⋅r′(t) dt=φ(r(tj))−φ(r(tj−1))\int_{t_{j-1}}^{t_j} F(r(t)) \cdot r'(t)\,dt = \varphi(r(t_j)) - \varphi(r(t_{j-1})).
  4. Adding over the pieces gives φ(r(tm))−φ(r(t0))\varphi(r(t_m)) - \varphi(r(t_0)).

What fails without each hypothesis.

  • F=∇φF = \nabla\varphi on all of the path. On the punctured plane the angle field (−y,x)x2+y2\frac{(-y, x)}{x^2 + y^2} is the gradient of the polar angle θ\theta on each small piece, but θ\theta cannot be a single-valued function around a loop. Around the unit circle the formula would give φ(end)−φ(start)=0\varphi(\text{end}) - \varphi(\text{start}) = 0, while the true integral is 2π2\pi.
  • The path stays inside SS. If the path leaves the set where φ\varphi is defined, for example through a singular point of φ\varphi, the chain rule step has no meaning. This is why the homework below insists that the path avoids the origin.
  • φ\varphi is C1C^1. The chain rule needs a differentiable φ\varphi, and F=∇φF = \nabla\varphi is then continuous.
  • The path is continuous. The telescoping step uses that the pieces join.
Quick checkF=∇φF = \nabla\varphi on all of R2\mathbb R^2, and a path goes from AA to BB along a very complicated curve. What is ∫F⋅dr\int F \cdot dr?
Worked example MATH 376 worksheet 5 exercise 2
Compute ∫CF⋅dr\int_C F \cdot dr for F=(3x2y+1, x3+2y)F = (3x^2y + 1,\ x^3 + 2y) from (0,0)(0, 0) to (1,2)(1, 2), using the potential φ=x3y+x+y2\varphi = x^3y + x + y^2, and check along a path.

Solution.

  1. Check the potential. φx=3x2y+1\varphi_x = 3x^2y + 1 and φy=x3+2y\varphi_y = x^3 + 2y, which are the two components of FF. Verifying ∇φ=F\nabla\varphi = F is the hypothesis of the theorem. Do it before using φ\varphi.
  2. Evaluate at the ends. φ(1,2)=1⋅2+1+4=7\varphi(1, 2) = 1\cdot2 + 1 + 4 = 7 and φ(0,0)=0\varphi(0, 0) = 0. Substitute the endpoints; do not parametrize.
  3. Subtract. ∫CF⋅dr=7−0=7\int_C F \cdot dr = 7 - 0 = 7. The second fundamental theorem: end minus start.
  4. Check with a path. Along r(t)=(t,2t)r(t) = (t, 2t) we have F=(6t3+1, t3+4t)F = (6t^3 + 1,\ t^3 + 4t) and r′=(1,2)r' = (1, 2), so F⋅r′=8t3+8t+1F \cdot r' = 8t^3 + 8t + 1 and ∫01(8t3+8t+1) dt=2+4+1=7\int_0^1 (8t^3 + 8t + 1)\,dt = 2 + 4 + 1 = 7. Any path from (0,0)(0, 0) to (1,2)(1, 2) gives the same value.

Answer. 77.

Worked example MATH 376 worksheet 6 parts B and C
With F=(2xy3+1, 3x2y2)F = (2xy^3 + 1,\ 3x^2y^2) (a potential is φ=x2y3+x\varphi = x^2y^3 + x), compute (B) the integral along r(t)=(t2+sin⁡πt, t3+cos⁡πt)r(t) = (t^2 + \sin\pi t,\ t^3 + \cos\pi t), 0≤t≤10 \le t \le 1, and (C) the integral along the parabola y=(x−1)2y = (x - 1)^2 from (1,0)(1, 0) to (2,1)(2, 1), by switching to an easier path.

Solution.

  1. (B) Find the exact endpoints. r(0)=(0+sin⁡0, 0+cos⁡0)=(0,1)r(0) = (0 + \sin 0,\ 0 + \cos 0) = (0, 1) and r(1)=(1+sin⁡π, 1+cos⁡π)=(1,0)r(1) = (1 + \sin\pi,\ 1 + \cos\pi) = (1, 0). sin⁡0=0\sin 0 = 0, cos⁡0=1\cos 0 = 1, sin⁡π=0\sin\pi = 0, cos⁡π=−1\cos\pi = -1. A wrong value of one of these changes the answer, so write them out.
  2. (B) Subtract. φ(1,0)−φ(0,1)=(0+1)−(0+0)=1\varphi(1, 0) - \varphi(0, 1) = (0 + 1) - (0 + 0) = 1.
  3. (C) Replace the path. Use L1L_1 from (1,0)(1, 0) to (2,0)(2, 0) and then L2L_2 from (2,0)(2, 0) to (2,1)(2, 1). Same start and end, and the new path lies in R2\mathbb R^2, the domain of FF. Path independence says the integral is unchanged.
  4. (C) On L1L_1: y=0y = 0, dy=0dy = 0, F=(1,0)F = (1, 0), so ∫121 dx=1\int_1^2 1\,dx = 1. On L2L_2: x=2x = 2, dx=0dx = 0, F=(4y3+1,12y2)F = (4y^3 + 1, 12y^2), so ∫0112y2 dy=[4y3]01=4\int_0^1 12y^2\,dy = [4y^3]_0^1 = 4.
  5. Add. 1+4=51 + 4 = 5. Additivity (6.1).
  6. Check with the potential. φ(2,1)−φ(1,0)=(4+2)−(0+1)=5\varphi(2, 1) - \varphi(1, 0) = (4 + 2) - (0 + 1) = 5.

Answer. (B) 11 and (C) 55.

Worked example MATH 376 homework 2 problem 5
The field f=∇φf = \nabla\varphi with φ(x)=−1/∥x∥\varphi(x) = -1/\lVert x \rVert on Rn\mathbb R^n minus the origin. A path from (12,0,…,0)(\frac12, 0, \dots, 0) to (1,0,…,0)(1, 0, \dots, 0) avoids the origin. Compute ∫f⋅dr\int f \cdot dr.

Solution.

  1. Lengths of the endpoints. ∥(1,0,…,0)∥=1\lVert(1, 0, \dots, 0)\rVert = 1 and ∥(12,0,…,0)∥=12\lVert(\frac12, 0, \dots, 0)\rVert = \frac12. A vector with a single non-zero coordinate has length equal to that coordinate.
  2. Potential values. φ(end)=−1\varphi(\text{end}) = -1 and φ(start)=−2\varphi(\text{start}) = -2.
  3. Subtract. −1−(−2)=1-1 - (-2) = 1. The second fundamental theorem. It applies because the path stays in the domain of φ\varphi; the potential is singular at the origin, which is why the problem says the path avoids it.

Answer. 11.

Worked example MATH 376 Final problem 3; see [A.4](/vol2/a4-final/)
Let CC be the unit circle in the plane z=0z = 0, counterclockwise, parametrized by α:[0,1]→R3\alpha: [0, 1] \to \mathbb R^3, and F=(yzcos⁡(xyz), xzcos⁡(xyz), xycos⁡(xyz))F = (yz\cos(xyz),\ xz\cos(xyz),\ xy\cos(xyz)). Compute ∮CF⋅dα\oint_C F \cdot d\alpha.

Solution.

  1. Recognize a gradient. ∇sin⁡(xyz)=(yzcos⁡(xyz), xzcos⁡(xyz), xycos⁡(xyz))\nabla\sin(xyz) = (yz\cos(xyz),\ xz\cos(xyz),\ xy\cos(xyz)). The chain rule on sin⁡(xyz)\sin(xyz): the xx-derivative is cos⁡(xyz)⋅yz\cos(xyz)\cdot yz, and so on. So F=∇φF = \nabla\varphi with φ=sin⁡(xyz)\varphi = \sin(xyz), defined and C1C^1 on all of R3\mathbb R^3.
  2. The path is closed. α(1)=α(0)\alpha(1) = \alpha(0). A circle returns to its start.
  3. Apply the theorem. ∮CF⋅dα=φ(α(1))−φ(α(0))=0\oint_C F \cdot d\alpha = \varphi(\alpha(1)) - \varphi(\alpha(0)) = 0. Equal endpoints, so the difference is 00.

Answer. 00. A second method needs no theorem: on CC we have z=0z = 0, so F=(0,0,xy)F = (0, 0, xy) along the circle and the velocity has third component 00, so F⋅dα=0F \cdot d\alpha = 0 at every step. Do not use Stokes’ theorem by replacing FF with its values on the plane before taking a curl; see the trap below.

The first fundamental theorem: build a potential

Theorem T Apostol Thm 10.4; MATH 376 lecture of 4 February

First fundamental theorem for line integrals

Let SS be open and connected, FF continuous on SS, and suppose the line integral of FF is independent of the path in SS. Fix p∈Sp \in S and define φ(x)=∫pxF⋅dr\varphi(x) = \int_p^x F \cdot dr, the line integral along any piecewise smooth path in SS from pp to xx. Then φ\varphi is C1C^1 and ∇φ=F\nabla\varphi = F.

In one lineIf SS is open and connected, FF is continuous and its line integral is independent of the path, then φ(x)=∫pxF⋅dr\varphi(x) = \int_p^x F \cdot dr (from a fixed base point pp) is a C1C^1 function with ∇φ=F\nabla\varphi = F.

Why it is trueIt says path independence is enough to produce a potential, and gives a formula for it: integrate along any path from a base point.

ProofMATH 376 lecture of 4 February; Apostol 10.14
The idea: To find the partial derivative in direction e_i, extend a path from p to x by a short segment in direction e_i. The difference of potentials is the integral of the i-th component along that segment, which is an average of a continuous function and tends to its value at x.
Fix x∈Sx \in S and a coordinate ii. The value φ(x)\varphi(x) is defined.
SS is connected, so a path from pp to xx exists; independence of the path means all such paths give the same number, so φ(x)\varphi(x) is well defined.
For 0<∣h∣<δ0 < |h| < \delta, the segment σ(s)=x+sei\sigma(s) = x + se_i, ss from 00 to hh, lies in SS.
SS is open: choose δ>0\delta > 0 with the ball of radius δ\delta about xx inside SS. Every point x+seix + se_i with ∣s∣≤∣h∣<δ|s| \le |h| < \delta is within ∣h∣|h| of xx.
φ(x+hei)=φ(x)+∫0hF(x+sei)⋅ei ds\varphi(x + he_i) = \varphi(x) + \displaystyle\int_0^h F(x + se_i) \cdot e_i\,ds.
A path from pp to xx followed by σ\sigma is a path in SS from pp to x+heix + he_i; independence of the path lets us compute φ(x+hei)\varphi(x + he_i) along it. Additivity splits the integral, and σ′=ei\sigma' = e_i.
φ(x+hei)−φ(x)h=1h∫0hFi(x+sei) ds\dfrac{\varphi(x + he_i) - \varphi(x)}{h} = \dfrac1h\displaystyle\int_0^h F_i(x + se_i)\,ds.
Dotting with eie_i picks out the ii-th component. Then move φ(x)\varphi(x) across and divide by hh.
As h→0h \to 0 the right side tends to Fi(x)F_i(x).
FiF_i is continuous at xx: given a tolerance ϵ\epsilon, the values Fi(x+sei)F_i(x + se_i) are within ϵ\epsilon of Fi(x)F_i(x) once ∣h∣|h| is small, so their average over [0,h][0, h] is too.
So ∂iφ(x)=Fi(x)\partial_i\varphi(x) = F_i(x) for every ii, the partials are continuous, and ∇φ=F\nabla\varphi = F. ■\blacksquare
The left side is the definition of the partial derivative; then a function with continuous partial derivatives is C1C^1.

What fails without each hypothesis. Without path independence, φ(x)\varphi(x) depends on the path chosen, so it is not a function. Without connectedness, there is no path from pp to points of other pieces, and φ\varphi is defined on one piece only (build one potential per piece). Without openness, the proof cannot step a little in each direction. Without continuity of FF, the last limit fails.

Three descriptions of the same thing

Theorem T Apostol Thm 10.5; MATH 376 lecture of 4 February

Three equivalent descriptions of a gradient field

Let S⊆RnS \subseteq \mathbb R^n be open and connected, and F:S→RnF: S \to \mathbb R^n continuous. The following are equivalent. (a) FF is the gradient of a potential function in SS. (b) The line integral of FF is independent of the path in SS. (c) The line integral of FF is 00 along every closed piecewise smooth path in SS.

In one lineFor a continuous field on an open connected set, (a) FF is a gradient, (b) its line integral is independent of the path, and (c) its line integral around every closed piecewise smooth path is 00, are equivalent.

Why it is trueIt lets you test for a gradient field in whichever of three ways is easiest: find a potential, compare two paths, or check one closed path.

The proof goes in a circle: (b) implies (a) is the first fundamental theorem, (a) implies (c) is the second fundamental theorem with equal endpoints (φ(r(b))−φ(r(a))=0\varphi(r(b)) - \varphi(r(a)) = 0 when r(b)=r(a)r(b) = r(a)). It remains to show that (c) implies (b).

ProofMATH 376 lecture of 4 February; Apostol 10.15
The idea: Given two paths with the same ends, run the first forward and the second backward: that is a closed path, its integral is 0, and the integral of the backward path is minus the integral of the second.
Define the combined path γ\gamma.
Let α:[a,b]→S\alpha: [a, b] \to S and β:[c,d]→S\beta: [c, d] \to S be piecewise smooth paths from pp to p′p'. Run α\alpha forward, then β\beta backward: γ(t)=α(t)\gamma(t) = \alpha(t) on [a,b][a, b] and γ(t)=β(b+d−t)\gamma(t) = \beta(b + d - t) on [b,b+d−c][b, b + d - c].
γ\gamma is a closed piecewise smooth path in SS.
α(b)=p′=β(d)=β(b+d−b)\alpha(b) = p' = \beta(d) = \beta(b + d - b), so the pieces meet; γ\gamma starts at α(a)=p\alpha(a) = p and ends at β(c)=p\beta(c) = p; and both parts are piecewise smooth.
0=∫γF⋅dγ0 = \displaystyle\int_\gamma F \cdot d\gamma.
Hypothesis (c) applied to γ\gamma.
0=∫αF⋅dα−∫βF⋅dβ0 = \displaystyle\int_\alpha F \cdot d\alpha - \int_\beta F \cdot d\beta.
Additivity over the two parts of γ\gamma, then reversing a path flips the sign of the line integral (6.1).
So ∫αF⋅dα=∫βF⋅dβ\int_\alpha F \cdot d\alpha = \int_\beta F \cdot d\beta: the integral depends only on the end points. ■\blacksquare
Move one term across. The paths α\alpha and β\beta were arbitrary paths with the same ends.
Proof workshopRebuild the proof that zero around closed paths gives path independenceMATH 376 lecture of 4 February

Tap the lines in the order a proof would write them. Each line can only use what is already above it.

    Notice what the theorem does not say. Zero around some closed paths, even around infinitely many, is not enough: the field F=(x,xy)F = (x, xy) has ∮F⋅dr=0\oint F \cdot dr = 0 around every circle centred at the origin (Apostol’s note), and yet it is not a gradient, because Py=0≠y=QxP_y = 0 \ne y = Q_x. Condition (c) must hold for every closed path.

    Worked example MATH 376 worksheet 5 exercise 4
    Let F=(y2,x)F = (y^2, x). (a) Is it a gradient field? (b) Compute ∫F⋅dr\int F \cdot dr from (0,0)(0, 0) to (1,1)(1, 1) along C1C_1, the line y=xy = x, and along C2C_2, the path that goes right along the xx-axis to (1,0)(1, 0) and then up to (1,1)(1, 1).

    Solution.

    1. (a) Use the test. Py=2yP_y = 2y and Qx=1Q_x = 1, which differ at, for example, (0,0)(0, 0). So FF is not a gradient field (the test is proved below). One point where the mixed partials differ is enough.
    2. (b) C1C_1. r1=(t,t)r_1 = (t, t), r1′=(1,1)r_1' = (1, 1), F(r1)=(t2,t)F(r_1) = (t^2, t), so ∫01(t2+t) dt=13+12=56\int_0^1 (t^2 + t)\,dt = \frac13 + \frac12 = \frac56.
    3. (b) C2C_2, first leg. r=(t,0)r = (t, 0), r′=(1,0)r' = (1, 0), F=(0,t)F = (0, t), so F⋅r′=0F \cdot r' = 0 and the integral is 00.
    4. (b) C2C_2, second leg. r=(1,t)r = (1, t), r′=(0,1)r' = (0, 1), F=(t2,1)F = (t^2, 1), so ∫011 dt=1\int_0^1 1\,dt = 1.
    5. Add the legs. 0+1=10 + 1 = 1.

    Answer. 56\frac56 along C1C_1 and 11 along C2C_2: the integral is path dependent, so condition (b) fails and FF is not a gradient. Two paths with different values prove ‘not a gradient’ even when the mixed partials are hard to compare.

    Worked example MATH 376 homework 2 problem 4 (parts (b) and (d), the disc and the annulus, are in the ladder)
    Decide which of these sets are connected, and describe the paths: (a) x2+y2≥0x^2 + y^2 \ge 0; (c) x2+y2>0x^2 + y^2 > 0; (e) x2+y2>1x^2 + y^2 > 1 and (x−3)2+y2>1(x - 3)^2 + y^2 > 1; (f) x2+y2<1x^2 + y^2 < 1 or (x−3)2+y2<1(x - 3)^2 + y^2 < 1.

    Solution.

    1. (a) The whole plane. Connected: the segment r(t)=(1−t)P+tQr(t) = (1 - t)P + tQ joins PP to QQ and lies in the set. Every point of the plane is in the set.
    2. (c) The plane minus the origin. Connected. If the segment PQPQ misses the origin, use it. If it contains the origin, pick RR off the line PQPQ and use the segments PRPR then RQRQ. The line PRPR meets the line PQPQ only at PP, which is not the origin, so PRPR misses the origin; the same for RQRQ.
    3. (e) The plane minus two closed unit discs. Connected. From PP go vertically to height +10+10 (if yP≥0y_P \ge 0) or −10-10, then horizontally to x=6x = 6, then to the matching height for QQ, then horizontally and vertically to QQ. The discs lie in ∣y∣≤1|y| \le 1, so the lines y=±10y = \pm 10 miss them, and the line x=6x = 6 misses both. A disc centred on the xx-axis meets a vertical line in a chord symmetric about y=0y = 0, so a point above (below) the chord can climb (descend) without entering the disc.
    4. (f) Two disjoint open discs. Not connected. Suppose a path (x(t),y(t))(x(t), y(t)) in the set joined a point of the first disc to a point of the second. Then x(t)x(t) is continuous, starts below 11 and ends above 22, so by the intermediate value theorem x(t)=1.5x(t) = 1.5 for some tt. But 1.51.5 is not in (−1,1)∪(2,4)(-1, 1) \cup (2, 4), the possible xx-values: a contradiction. The same reasoning as ‘a continuous image of a connected set is connected’ in 4.4, in plain form.

    Answer. (a), (c), (e) are connected; (f) is not. Connectedness is what the first fundamental theorem needs.

    A test you can compute

    The three descriptions concern every path in SS, which cannot be checked directly. A test with derivatives can.

    Theorem T Apostol Thm 10.6; MATH 376 worksheet 5

    Necessary condition for a gradient

    Let F=(f1,…,fn)F = (f_1, \dots, f_n) be C1C^1 on an open set SS. If FF is a gradient on SS, then Difj=DjfiD_if_j = D_jf_i on SS for all i,ji, j. In the plane, F=(P,Q)F = (P, Q): ∂P∂y=∂Q∂x\dfrac{\partial P}{\partial y} = \dfrac{\partial Q}{\partial x}. In space with F=(P,Q,R)F = (P, Q, R) there are three pairs: Py=QxP_y = Q_x, Pz=RxP_z = R_x, Qz=RyQ_z = R_y; equivalently the curl (Ry−Qz, Pz−Rx, Qx−Py)(R_y - Q_z,\ P_z - R_x,\ Q_x - P_y) is the zero vector.

    In one lineIf F=(f1,…,fn)F = (f_1, \dots, f_n) is C1C^1 on an open set and is a gradient, then ∂fi/∂xj=∂fj/∂xi\partial f_i/\partial x_j = \partial f_j/\partial x_i for all i,ji, j; in the plane, Py=QxP_y = Q_x.

    Why it is trueIt is a two-line computation that proves a field is not a gradient the moment one pair of mixed partials differs.

    ProofApostol 10.16
    The idea: If F is the gradient of phi, the components are first partials of phi, and the condition says the mixed second partials of phi agree, which they do by the equality of mixed partials.
    Suppose F=∇φF = \nabla\varphi for a function φ\varphi on SS.
    F=∇φF = \nabla\varphi means fi=Diφf_i = D_i\varphi.
    Then Djfi=DjDiφD_jf_i = D_jD_i\varphi and Difj=DiDjφD_if_j = D_iD_j\varphi.
    FF is C1C^1, so the first partials of φ\varphi are C1C^1, which makes φ\varphi of class C2C^2 (5.5).
    DjDiφ=DiDjφD_jD_i\varphi = D_iD_j\varphi, so Djfi=DifjD_jf_i = D_if_j. ■\blacksquare
    Equality of mixed partials for a C2C^2 function (5.5).

    The condition is only necessary. Failing it proves that FF is not a gradient. Passing it proves nothing by itself, as the angle field shows in a moment. State ’FF is C1C^1’ when you use the test, because the equality of mixed partials needs continuity of the second partials (there are functions whose mixed partials exist and differ at a point).

    Worked example MATH 376 homework 3 problem 1
    Which of these fields on R2\mathbb R^2 are gradient fields? (1) f=2ex12+x22(x1,x2)f = 2e^{x_1^2 + x_2^2}(x_1, x_2); (2) f=(cos⁡(x12+x2), sin⁡x2)f = (\cos(x_1^2 + x_2),\ \sin x_2); (3) f=(x12+x2, x24+x1)f = (x_1^2 + x_2,\ x_2^4 + x_1); (4) f=(ex12+x2, x1+x22)f = (e^{x_1^2 + x_2},\ x_1 + x_2^2).

    Solution.

    1. The domain. Each field is C1C^1 on R2\mathbb R^2, which is convex. So the test ∂x2f1=∂x1f2\partial_{x_2}f_1 = \partial_{x_1}f_2 decides both ways (the convex-set theorem below).
    2. (1) f1=2x1ex12+x22f_1 = 2x_1e^{x_1^2 + x_2^2}, f2=2x2ex12+x22f_2 = 2x_2e^{x_1^2 + x_2^2}. Then ∂x2f1=4x1x2ex12+x22=∂x1f2\partial_{x_2}f_1 = 4x_1x_2e^{x_1^2 + x_2^2} = \partial_{x_1}f_2. A gradient field; a potential is φ=ex12+x22\varphi = e^{x_1^2 + x_2^2}. ∇φ=ex12+x22(2x1,2x2)=f\nabla\varphi = e^{x_1^2 + x_2^2}(2x_1, 2x_2) = f.
    3. (2) ∂x2f1=−sin⁡(x12+x2)\partial_{x_2}f_1 = -\sin(x_1^2 + x_2) and ∂x1f2=0\partial_{x_1}f_2 = 0. At (0,π/2)(0, \pi/2) the first is −1-1. Not a gradient field. One point of difference is enough.
    4. (3) ∂x2f1=1=∂x1f2\partial_{x_2}f_1 = 1 = \partial_{x_1}f_2. A gradient field; φ=x133+x1x2+x255\varphi = \frac{x_1^3}{3} + x_1x_2 + \frac{x_2^5}{5} is a potential.
    5. (4) ∂x2f1=ex12+x2\partial_{x_2}f_1 = e^{x_1^2 + x_2} and ∂x1f2=1\partial_{x_1}f_2 = 1. At (0,1)(0, 1) they are ee and 11. Not a gradient field.

    Answer. (1) and (3) are gradient fields; (2) and (4) are not.

    Worked example MATH 376 practice Midterm 1 problem 1(b); see [A.5](/vol2/a5-practice-exams/)
    Does f(x,y)=(2xy1+x2, y2)f(x, y) = \Big(\dfrac{2xy}{1 + x^2},\ y^2\Big) have a potential function on R2\mathbb R^2?

    Solution.

    1. Smoothness. f1f_1 is a quotient of polynomials with a denominator that is never 00, and f2f_2 is a polynomial. So ff is C1C^1 on R2\mathbb R^2. The test needs C1C^1.
    2. Mixed partials. ∂yf1=2x1+x2\partial_yf_1 = \dfrac{2x}{1 + x^2} and ∂xf2=0\partial_xf_2 = 0. y2y^2 does not depend on xx.
    3. Compare. 2x1+x2≠0\dfrac{2x}{1 + x^2} \ne 0 for x≠0x \ne 0. They agree only on the line x=0x = 0.

    Answer. No. If a potential existed, it would be C2C^2, its mixed partials would agree, and they do not. (The definition asked in part (a): φ\varphi is a potential of ff if ∇φ=f\nabla\varphi = f, that is φx=f1\varphi_x = f_1 and φy=f2\varphi_y = f_2 at every point of R2\mathbb R^2.)

    Worked example MATH 376 worksheet 6, the curl test
    Is F=(yz, xz, xy+2z)F = (yz,\ xz,\ xy + 2z) conservative on R3\mathbb R^3?

    Solution.

    1. First component of the curl. ∂y(xy+2z)−∂z(xz)=x−x=0\partial_y(xy + 2z) - \partial_z(xz) = x - x = 0. Ry−QzR_y - Q_z.
    2. Second. ∂z(yz)−∂x(xy+2z)=y−y=0\partial_z(yz) - \partial_x(xy + 2z) = y - y = 0. Pz−RxP_z - R_x.
    3. Third. ∂x(xz)−∂y(yz)=z−z=0\partial_x(xz) - \partial_y(yz) = z - z = 0. Qx−PyQ_x - P_y.
    4. Conclude. The curl is zero on R3\mathbb R^3, which is convex, so FF is conservative. The sufficient condition on a convex set, proved next.

    Answer. Yes. A potential is φ=xyz+z2\varphi = xyz + z^2: φx=yz\varphi_x = yz, φy=xz\varphi_y = xz, φz=xy+2z\varphi_z = xy + 2z.

    Quick checkWhile building a potential for F=(P,Q)F = (P, Q) you reach g′(y)=2xyg'(y) = 2xy. What do you conclude?

    When equal mixed partials are enough

    Definition T

    Convex set

    A set SS is convex if the segment between any two of its points stays in SS. Discs, rectangles, half planes and the whole plane or space are convex; an annulus is not.

    In one lineA set SS is convex if for any two points p,qp, q in SS, the whole segment (1−t)p+tq(1 - t)p + tq, 0≤t≤10 \le t \le 1, lies in SS.

    Why it existsConvexity lets you draw a straight line from one fixed point to any other point of the set, which is the path used to build a potential by an explicit formula.

    Theorem T Apostol Thm 10.9; MATH 376 week 3

    Equal mixed partials suffice on a convex set

    Let SS be open and convex, F=(P,Q)F = (P, Q) of class C1C^1 on SS with Py=QxP_y = Q_x on SS. Then FF is a gradient field on SS. In space the same holds if all three pairs of mixed partials agree.

    In one lineIf SS is open and convex, F=(P,Q)F = (P, Q) is C1C^1 on SS and Py=QxP_y = Q_x, then FF is a gradient field on SS; in space the same holds when the curl is zero.

    Why it is trueIt turns the practical test into an if and only if on the domains that occur in most problems: the plane, space, discs and boxes.

    ProofApostol 10.21 (the Poincare lemma); MATH 376 week 3
    The idea: Move coordinates so that the origin is in S. Define phi by integrating F along the straight segment from the origin to the point. Differentiate under the integral sign; the hypothesis P_y = Q_x makes the integrand into the derivative of t times P, which integrates to P.
    Define φ(x,y)=∫01[xP(tx,ty)+yQ(tx,ty)] dt\varphi(x, y) = \displaystyle\int_0^1 \big[xP(tx, ty) + yQ(tx, ty)\big]\,dt.
    The segment r(t)=(tx,ty)r(t) = (tx, ty) lies in SS because SS is convex. Here r′=(x,y)r' = (x, y), so F(r(t))⋅r′(t)=xP(tx,ty)+yQ(tx,ty)F(r(t)) \cdot r'(t) = xP(tx, ty) + yQ(tx, ty).
    φx=∫01[P+xtPx+ytQx] dt\varphi_x = \displaystyle\int_0^1 \big[P + xtP_x + ytQ_x\big]\,dt.
    Differentiate under the integral sign (allowed because the integrand and its xx-derivative are continuous in (x,t)(x, t) when P,QP, Q are C1C^1; the rule is proved in analysis). The product rule on xP(tx,ty)xP(tx, ty) gives P+xtPxP + xtP_x, and on yQ(tx,ty)yQ(tx, ty) gives ytQxytQ_x, with P,Px,QxP, P_x, Q_x evaluated at (tx,ty)(tx, ty).
    φx=∫01[P+t(xPx+yPy)] dt\varphi_x = \displaystyle\int_0^1 \big[P + t(xP_x + yP_y)\big]\,dt.
    Replace QxQ_x by PyP_y. This is the one place the hypothesis Py=QxP_y = Q_x is used.
    The integrand is the derivative of tP(tx,ty)tP(tx, ty), so φx=[tP(tx,ty)]t=0t=1=P(x,y)\varphi_x = \big[tP(tx, ty)\big]_{t=0}^{t=1} = P(x, y).
    Product rule and chain rule: ddt[tP(tx,ty)]=P+t(xPx+yPy)\frac{d}{dt}\big[tP(tx, ty)\big] = P + t(xP_x + yP_y).
    Likewise φy=Q(x,y)\varphi_y = Q(x, y), so ∇φ=F\nabla\varphi = F. ■\blacksquare
    The same calculation with the roles exchanged: differentiate in yy, replace PyP_y by QxQ_x, and recognize ddt[tQ(tx,ty)]\frac{d}{dt}\big[tQ(tx, ty)\big].
    Definition A

    Simply connected set

    An open connected set SS in the plane is simply connected (Apostol 11.21) if for every simple closed curve in SS, the region inside the curve (in the sense of 6.4) also lies in SS. Intuitively, SS has no holes. The plane and every convex set are simply connected. A disc with the centre removed, or an annulus, or the plane with the origin removed, is not.

    In one lineAn open connected set in the plane is simply connected if it has no holes: every simple closed curve in it encloses a region lying entirely inside the set.

    Why it existsIt is the exact condition on the domain that makes equal mixed partials sufficient, and the punctured plane is the standard set that fails it.

    Theorem A Apostol Thm 11.11

    Equal mixed partials suffice on a simply connected set

    Let SS be an open simply connected set in the plane and F=(P,Q)F = (P, Q) a C1C^1 field on SS. Then FF is a gradient on SS if and only if Py=QxP_y = Q_x everywhere on SS. The proof cuts the region between two paths with equal ends into pieces bounded by simple closed curves and applies Green’s theorem to each (6.4); the lecture stated the result without proof in the first weeks.

    In one lineIf SS is open and simply connected in the plane and F=(P,Q)F = (P, Q) is C1C^1 with Py=QxP_y = Q_x, then FF is a gradient on SS.

    Why it is trueIt extends the test from convex sets to every domain without holes, such as a simply connected region with a curved boundary.

    The angle field: equal mixed partials, no potential

    Worked example MATH 376 worksheet 5 exercise 3
    Let F=(−y, x)x2+y2F = \dfrac{(-y,\ x)}{x^2 + y^2} on R2\mathbb R^2 minus the origin. (a) Show Py=QxP_y = Q_x. (b) Compute ∮F⋅dr\oint F \cdot dr around the unit circle. (c) Why is there no contradiction with the theorem that gradient fields have integral zero around closed curves?

    Solution.

    1. (a) Name the parts. P=−yx2+y2P = \dfrac{-y}{x^2 + y^2} and Q=xx2+y2Q = \dfrac{x}{x^2 + y^2}; both are C1C^1 away from the origin. The denominator is 00 only at the origin.
    2. (a) Differentiate. Py=−(x2+y2)+y⋅2y(x2+y2)2=y2−x2(x2+y2)2P_y = \dfrac{-(x^2 + y^2) + y\cdot2y}{(x^2 + y^2)^2} = \dfrac{y^2 - x^2}{(x^2 + y^2)^2} and Qx=(x2+y2)−x⋅2x(x2+y2)2=y2−x2(x2+y2)2Q_x = \dfrac{(x^2 + y^2) - x\cdot2x}{(x^2 + y^2)^2} = \dfrac{y^2 - x^2}{(x^2 + y^2)^2}. Quotient rule on each.
    3. (a) Compare. They are equal at every point of the domain. So the necessary condition holds.
    4. (b) Parametrize. r(t)=(cos⁡t,sin⁡t)r(t) = (\cos t, \sin t), 0≤t≤2π0 \le t \le 2\pi, r′=(−sin⁡t,cos⁡t)r' = (-\sin t, \cos t), and F(r(t))=(−sin⁡t,cos⁡t)F(r(t)) = (-\sin t, \cos t). On the unit circle x2+y2=1x^2 + y^2 = 1.
    5. (b) Dot and integrate. F⋅r′=sin⁡2t+cos⁡2t=1F \cdot r' = \sin^2 t + \cos^2 t = 1, so ∮F⋅dr=∫02π1 dt=2π\oint F \cdot dr = \int_0^{2\pi} 1\,dt = 2\pi.
    6. (c) Explain. The theorem says a gradient field has integral 00 around closed paths, so condition (c) fails and FF is not a gradient field on this domain. The converse ‘equal partials implies gradient’ needs a convex or simply connected domain, and the punctured plane has a hole at the origin. There is no contradiction.

    Answer. Py=QxP_y = Q_x; the circulation is 2π2\pi; FF is not a gradient on the punctured plane. Locally it is: on the right half plane φ=arctan⁡(y/x)\varphi = \arctan(y/x) has φx=P\varphi_x = P and φy=Q\varphi_y = Q, and φ\varphi is the polar angle. Going once round the origin the angle increases by 2π2\pi, so no single-valued potential exists on the whole punctured plane.

    Worked example MATH 376 homework 5 problem 4.1
    True or false: a C2C^2 field on its domain in R3\mathbb R^3 with curl⁡F=0\operatorname{curl}F = 0 is a gradient field. Give a proof or a counterexample.

    Solution.

    1. Guess it is false without a condition on the domain. Take F=(−y, x, 0)x2+y2F = \dfrac{(-y,\ x,\ 0)}{x^2 + y^2} on D=R3D = \mathbb R^3 minus the zz-axis. The angle field extended to space; it is undefined on the whole axis.
    2. Compute the curl. Ry−Qz=0R_y - Q_z = 0 and Pz−Rx=0P_z - R_x = 0 because P,QP, Q do not depend on zz and R=0R = 0; and Qx−Py=y2−x2(x2+y2)2−y2−x2(x2+y2)2=0Q_x - P_y = \frac{y^2 - x^2}{(x^2 + y^2)^2} - \frac{y^2 - x^2}{(x^2 + y^2)^2} = 0. The two-variable computation above.
    3. A closed path. r(t)=(cos⁡t,sin⁡t,0)r(t) = (\cos t, \sin t, 0) lies in DD and goes round the zz-axis, with F⋅r′=1F \cdot r' = 1, so ∮F⋅dr=2π≠0\oint F \cdot dr = 2\pi \ne 0. A gradient has zero circulation.

    Answer. False. The correct statement needs a simply connected (for example convex) domain.

    Why· The picture behind the angle field

    The angle field is ‘the gradient of θ\theta’ except that θ\theta is not a function on the punctured plane: it has no consistent value, because turning once round the origin brings you back to the same point with θ\theta increased by 2π2\pi. Locally, on any piece that does not circle the origin, you can pick a branch of θ\theta, and the mixed-partials test sees only the local picture, so it passes. The line integral sees the global picture. Think of a spiral staircase: every small patch of it is a ramp, so slope is defined and consistent locally, but there is no height function on the floor plan because walking round the stair column brings you back to the same spot at a different level.

    Python labThe angle field adds 2 pi for every lap around the origin, and nothing otherwise
    import numpy as np
    c, s = np.cos, np.sin
    
    def lap(F, r, dr, laps=1, n=40000):
        t = np.linspace(0, 2 * np.pi * laps, n + 1); m = (t[:-1] + t[1:]) / 2
        (x, y), (u, v) = r(m), dr(m); P, Q = F(x, y)
        return np.sum(P * u + Q * v) * (2 * np.pi * laps / n)
    
    def curve(cx, cy, a, b, w=1):                       # ellipse about (cx, cy); w = -1 runs it clockwise
        return (lambda t: (cx + a * c(t), cy + b * s(w * t)),
                lambda t: (-a * s(t), w * b * c(w * t)))
    
    angle = lambda x, y: (-y / (x**2 + y**2), x / (x**2 + y**2))
    grad = lambda x, y: (10 * x / (x**2 + y**2)**5, 10 * y / (x**2 + y**2)**5)
    both = lambda x, y: tuple(p + q for p, q in zip(angle(x, y), grad(x, y)))
    
    cases = [("unit circle", curve(0, 0, 1, 1), 1), ("circle off-centre", curve(0.5, 0, 1, 1), 1),
             ("ellipse 3 by 1", curve(0, 0, 3, 1), 1), ("circle missing origin", curve(3, 0, 1, 1), 1),
             ("unit circle clockwise", curve(0, 0, 1, 1, -1), 1), ("unit circle twice", curve(0, 0, 1, 1), 2)]
    print(f"{'':24s}{'angle field':>12s}{'gradient field':>16s}{'sum':>9s}   (2*pi = {2 * np.pi:.4f})")
    for name, (r, dr), k in cases:
        print(f"{name:24s}" + "".join(f"{lap(F, r, dr, k):{w}.4f}" for F, w in ((angle, 12), (grad, 16), (both, 9))))

    Try this. Run it. The angle field gives 2*pi = 6.2832 for every closed curve that goes once counterclockwise around the origin (the unit circle, an off-centre circle that still contains the origin, a 3 by 1 ellipse), 0 for a circle that misses the origin, -2*pi when the unit circle is run clockwise, and 4*pi when it is run twice. The shape of the curve does not matter, only how many times it winds round the missing point. The field 10 (x, y) (x^2+y^2)^-5 has a potential (-5/4 (x^2+y^2)^-4) and gives 0 on every curve here. Adding it to the angle field changes nothing: the last column equals the first. Try a curve of your own, for example a circle of radius 0.2 centred at (0.3, 0): does it enclose the origin?

    Worked example MATH 376 Final problem 1(a), 4 points; see [A.4](/vol2/a4-final/)
    Let f(x,y)=10 (x,y) (x2+y2)−5f(x, y) = 10\,(x, y)\,(x^2 + y^2)^{-5} on R2\mathbb R^2 minus the origin. Verify that ff has a potential function, and find it.

    Solution.

    1. The mixed partials. P=10x(x2+y2)−5P = 10x(x^2 + y^2)^{-5} and Q=10y(x2+y2)−5Q = 10y(x^2 + y^2)^{-5}. Then Py=10x⋅(−5)(x2+y2)−6⋅2y=−100xy(x2+y2)−6P_y = 10x\cdot(-5)(x^2 + y^2)^{-6}\cdot2y = -100xy(x^2 + y^2)^{-6} and Qx=−100xy(x2+y2)−6Q_x = -100xy(x^2 + y^2)^{-6}. The chain rule on the power, with inner derivative 2y2y or 2x2x.
    2. They are not enough here. Py=QxP_y = Q_x, but the domain, the plane minus the origin, is not simply connected. The angle field also passes this test, and it has no potential. Another check is needed.
    3. Integrate PP in xx. With u=x2+y2u = x^2 + y^2, 10x dx=5 du10x\,dx = 5\,du, so ∫10x(x2+y2)−5 dx=−54(x2+y2)−4\int 10x(x^2 + y^2)^{-5}\,dx = -\frac54(x^2 + y^2)^{-4}, and φ=−54(x2+y2)4+g(y)\varphi = -\dfrac{5}{4(x^2 + y^2)^4} + g(y). Treat yy as a constant during the substitution.
    4. Match QQ. φy=−54⋅(−4)(x2+y2)−5⋅2y+g′(y)=10y(x2+y2)−5+g′(y)\varphi_y = -\frac54\cdot(-4)(x^2 + y^2)^{-5}\cdot2y + g'(y) = 10y(x^2 + y^2)^{-5} + g'(y), which equals QQ when g′=0g' = 0.
    5. Verify. With φ=−54(x2+y2)4\varphi = -\dfrac{5}{4(x^2 + y^2)^4}: φx=10x(x2+y2)−5=P\varphi_x = 10x(x^2 + y^2)^{-5} = P and φy=Q\varphi_y = Q, and φ\varphi is C1C^1 on the whole punctured plane. An explicit φ\varphi with ∇φ=f\nabla\varphi = f proves directly that ff has a potential. This is the cleanest answer, and it needs no further argument.

    Answer. φ(x,y)=−54(x2+y2)4\varphi(x, y) = -\dfrac{5}{4(x^2 + y^2)^4}. The instructor said afterwards (Piazza, post 23) that on this domain checking the mixed partials alone is not enough. Either exhibit a potential, as above, or check also that the integral around circles centred at the missing point is 00: here f⋅CR′=10R−10(−R2cos⁡tsin⁡t+R2sin⁡tcos⁡t)=0f \cdot C_R' = 10R^{-10}(-R^2\cos t\sin t + R^2\sin t\cos t) = 0, which he said suffices. (Why it suffices: for a C1C^1 field with Py=QxP_y = Q_x on the punctured plane, Green’s theorem on the region between a closed curve and a small circle about the origin shows that the integral around a simple counterclockwise loop that encloses the origin equals the integral around that circle. For a general closed curve it is the winding number of the curve about the origin times the integral around one circle (a fact proved in analysis courses, not here). See 6.4. So if the circles give 00, every closed curve gives 00, and condition (c) holds.)

    Quick checkF=(P,Q)F = (P, Q) is C1C^1 on the plane minus the origin and Py=QxP_y = Q_x there. Which conclusion is justified?
    Quick checkWhich domain is a place where equal mixed partials do NOT guarantee a potential?
    Where this came from· Ørsted, Ampère and the field that circles a wire

    In 1820 Hans Christian Ørsted found that an electric current deflects a compass needle, and showed that the force circles the wire rather than pointing along it. Ampère, hearing the news in Paris, repeated and extended the experiments within weeks, showing among other things that two parallel wires attract or repel depending on the directions of their currents. The magnetic field of a long straight wire is exactly the angle field: it goes round the wire. In the early 1860s Maxwell added a term (the displacement current) to Ampère’s circuital law so that it fits with changing electric fields. The equal-partials-but-no-potential subtlety of this chapter is why the magnetic field of a current cannot be written as a gradient everywhere, while the electric field of static charges can.

    Constructing a potential

    Two variables

    1. Test. Check Py=QxP_y = Q_x and the domain. If the test fails, there is no potential. If it holds on a convex domain, there is one.
    2. Integrate PP in xx: φ=∫P dx+g(y)\varphi = \int P\,dx + g(y). The ‘constant’ of integration is a function of yy alone.
    3. Match QQ: differentiate in yy and set φy=Q\varphi_y = Q; solve for g′(y)g'(y). The result must depend on yy only.
    4. Integrate g′g' to find gg; any constant is free.
    5. Verify: compute φx\varphi_x and φy\varphi_y and check that they equal PP and QQ.
    Worked example MATH 376 Midterm 1 problem 1, 9 points; see [A.2](/vol2/a2-midterm-1/)
    Let f(x,y)=(2xy+excos⁡y, x2−exsin⁡y)f(x, y) = (2xy + e^x\cos y,\ x^2 - e^x\sin y). (a) Write an explicit formula for a potential function and verify it. (b) Compute the line integral of ff along α:[0,2π]→R2\alpha: [0, 2\pi] \to \mathbb R^2, α(t)=(t7et2(2π−t), sin⁡t esin⁡t)\alpha(t) = \big(t^7e^{t^2}(2\pi - t),\ \sin t\,e^{\sin t}\big).

    Solution.

    1. Test. P=2xy+excos⁡yP = 2xy + e^x\cos y and Q=x2−exsin⁡yQ = x^2 - e^x\sin y. Then Py=2x−exsin⁡y=QxP_y = 2x - e^x\sin y = Q_x. Both are C1C^1 on the convex set R2\mathbb R^2, so a potential exists.
    2. Integrate PP in xx. φ=x2y+excos⁡y+g(y)\varphi = x^2y + e^x\cos y + g(y).
    3. Match QQ. φy=x2−exsin⁡y+g′(y)\varphi_y = x^2 - e^x\sin y + g'(y) must equal x2−exsin⁡yx^2 - e^x\sin y, so g′=0g' = 0; take g=0g = 0.
    4. Write the potential. φ(x,y)=x2y+excos⁡y\varphi(x, y) = x^2y + e^x\cos y.
    5. Verify, in writing. φx=2xy+excos⁡y=P\varphi_x = 2xy + e^x\cos y = P and φy=x2−exsin⁡y=Q\varphi_y = x^2 - e^x\sin y = Q, so ∇φ=f\nabla\varphi = f. Graders give a separate part of the credit for this step. A correct potential with no justification that its gradient equals ff lost 3 of the 7 points on the rubric.
    6. (b) Use the endpoints. α(0)=(0, 0⋅e0)=(0,0)\alpha(0) = (0,\ 0\cdot e^0) = (0, 0) and α(2π)=((2π)7e4π2⋅0, sin⁡2π esin⁡2π)=(0,0)\alpha(2\pi) = \big((2\pi)^7e^{4\pi^2}\cdot0,\ \sin2\pi\,e^{\sin2\pi}\big) = (0, 0). The factor (2π−t)(2\pi - t) is 00 at t=2πt = 2\pi and sin⁡2π=0\sin2\pi = 0. Check which factor (2π−t)(2\pi - t) multiplies: here it stands outside the exponential.
    7. Subtract. The path is closed, so ∫f⋅dα=φ(0,0)−φ(0,0)=0\int f \cdot d\alpha = \varphi(0, 0) - \varphi(0, 0) = 0.

    Answer. (a) φ=x2y+excos⁡y\varphi = x^2y + e^x\cos y (up to a constant). (b) 00, with no integration at all.

    Worked example MATH 376 worksheet 27 problem 2; worksheet 5 exercises 1.1 and 1.2 are the same type
    Is F=(2xy+3, x2+4y)F = (2xy + 3,\ x^2 + 4y) conservative? Find a potential and compute ∫F⋅dr\int F \cdot dr from (0,0)(0, 0) to (1,2)(1, 2).

    Solution.

    1. Test. Py=2x=QxP_y = 2x = Q_x on the convex set R2\mathbb R^2. So FF is conservative.
    2. Integrate. φ=∫(2xy+3) dx=x2y+3x+g(y)\varphi = \int(2xy + 3)\,dx = x^2y + 3x + g(y).
    3. Match. φy=x2+g′(y)=x2+4y\varphi_y = x^2 + g'(y) = x^2 + 4y, so g′=4yg' = 4y and g=2y2g = 2y^2.
    4. Potential. φ=x2y+3x+2y2\varphi = x^2y + 3x + 2y^2. Check: φx=2xy+3\varphi_x = 2xy + 3 and φy=x2+4y\varphi_y = x^2 + 4y.
    5. Evaluate. φ(1,2)=2+3+8=13\varphi(1, 2) = 2 + 3 + 8 = 13 and φ(0,0)=0\varphi(0, 0) = 0, so the integral is 1313.

    Answer. Conservative; φ=x2y+3x+2y2+C\varphi = x^2y + 3x + 2y^2 + C; the integral is 1313. (Worksheet 5: (2xy+y2, x2+2xy)(2xy + y^2,\ x^2 + 2xy) has φ=x2y+xy2\varphi = x^2y + xy^2, and (yex, ex+2y)(ye^x,\ e^x + 2y) has φ=yex+y2\varphi = ye^x + y^2.)

    Worked example MATH 376 practice Final problem 1; see [A.5](/vol2/a5-practice-exams/)
    Let f(x,y)=(2xycos⁡(x2y)esin⁡(x2y), x2cos⁡(x2y)esin⁡(x2y))f(x, y) = \big(2xy\cos(x^2y)e^{\sin(x^2y)},\ x^2\cos(x^2y)e^{\sin(x^2y)}\big). (a) Verify that ff has a potential and find it. (b) Compute ∫f⋅dα\int f \cdot d\alpha for α(t)=(t2−t, t3)\alpha(t) = (t^2 - t,\ t^3), 0≤t≤10 \le t \le 1.

    Solution.

    1. Spot the pattern. Let u=x2yu = x^2y, so ux=2xyu_x = 2xy and uy=x2u_y = x^2. Then f=cos⁡u esin⁡u (ux,uy)f = \cos u\,e^{\sin u}\,(u_x, u_y). Both components share the factor cos⁡u esin⁡u\cos u\,e^{\sin u} times the corresponding partial of uu.
    2. Guess a potential. φ=esin⁡u=esin⁡(x2y)\varphi = e^{\sin u} = e^{\sin(x^2y)}, since dduesin⁡u=cos⁡u esin⁡u\frac{d}{du}e^{\sin u} = \cos u\,e^{\sin u}.
    3. Verify. By the chain rule, φx=esin⁡ucos⁡u⋅2xy=f1\varphi_x = e^{\sin u}\cos u\cdot2xy = f_1 and φy=esin⁡ucos⁡u⋅x2=f2\varphi_y = e^{\sin u}\cos u\cdot x^2 = f_2. So ∇φ=f\nabla\varphi = f on all of R2\mathbb R^2, which proves that a potential exists without comparing mixed partials, a longer product-rule computation.
    4. Endpoints. α(1)=(0,1)\alpha(1) = (0, 1) and α(0)=(0,0)\alpha(0) = (0, 0).
    5. Evaluate. φ(0,1)=esin⁡0=1\varphi(0, 1) = e^{\sin0} = 1 and φ(0,0)=esin⁡0=1\varphi(0, 0) = e^{\sin0} = 1, so the integral is 1−1=01 - 1 = 0.

    Answer. φ=esin⁡(x2y)\varphi = e^{\sin(x^2y)} and the integral is 00. (By the other route, integrating QQ in yy first with du=x2 dydu = x^2\,dy gives the same φ\varphi and is shorter than integrating PP in xx.)

    Three variables

    1. Test: all three pairs of mixed partials agree (curl =0= 0) on a convex or simply connected domain.
    2. Integrate PP in xx: φ=∫P dx+g(y,z)\varphi = \int P\,dx + g(y, z). Now the ‘constant’ can depend on yy and zz.
    3. Match QQ: φy=Q\varphi_y = Q gives gyg_y; integrate in yy: g=∫gy dy+h(z)g = \int g_y\,dy + h(z).
    4. Match RR: φz=R\varphi_z = R gives h′(z)h'(z); integrate.
    5. Verify all three partials.
    Worked example MATH 376 worksheet 10 problem 2
    Find the work done by F=(2xy, x2+z, y)F = (2xy,\ x^2 + z,\ y) moving from (0,0,0)(0, 0, 0) to (1,2,3)(1, 2, 3).

    Solution.

    1. Curl test. ∂x(x2+z)=2x=∂y(2xy)\partial_x(x^2 + z) = 2x = \partial_y(2xy); ∂z(2xy)=0=∂x(y)\partial_z(2xy) = 0 = \partial_x(y); ∂y(y)=1=∂z(x2+z)\partial_y(y) = 1 = \partial_z(x^2 + z). All three pairs match on the convex set R3\mathbb R^3, so a potential exists.
    2. Integrate PP in xx. φ=x2y+g(y,z)\varphi = x^2y + g(y, z).
    3. Match QQ. φy=x2+gy=x2+z\varphi_y = x^2 + g_y = x^2 + z, so gy=zg_y = z and g=yz+h(z)g = yz + h(z).
    4. Match RR. φz=y+h′(z)=y\varphi_z = y + h'(z) = y, so h′=0h' = 0; take h=0h = 0. Then φ=x2y+yz\varphi = x^2y + yz.
    5. Verify. φx=2xy\varphi_x = 2xy, φy=x2+z\varphi_y = x^2 + z, φz=y\varphi_z = y.
    6. Work. φ(1,2,3)−φ(0,0,0)=(2+6)−0=8\varphi(1, 2, 3) - \varphi(0, 0, 0) = (2 + 6) - 0 = 8.

    Answer. 88.

    Your answerFind the work done by F=(yz+1, xz, xy+2z)F = (yz + 1,\ xz,\ xy + 2z) in moving from (0,0,0)(0, 0, 0) to (1,2,3)(1, 2, 3).
    Your answerφ(x,y)=x2y+excos⁡y\varphi(x, y) = x^2y + e^x\cos y is a potential for f=(2xy+excos⁡y, x2−exsin⁡y)f = (2xy + e^x\cos y,\ x^2 - e^x\sin y). What is ∫f⋅dr\int f \cdot dr along any path from (0,0)(0, 0) to (1,π)(1, \pi)?

    A potential can also be built directly from the first fundamental theorem. On a domain where the broken line from a base point (0,0)(0, 0) to (x,0)(x, 0) to (x,y)(x, y) stays inside, φ(x,y)=∫0xP(s,0) ds+∫0yQ(x,t) dt\varphi(x, y) = \int_0^x P(s, 0)\,ds + \int_0^y Q(x, t)\,dt. For F=(2xy+y2, x2+2xy)F = (2xy + y^2,\ x^2 + 2xy) this gives 0+∫0y(x2+2xt) dt=x2y+xy20 + \int_0^y(x^2 + 2xt)\,dt = x^2y + xy^2, the same potential as above (Apostol 10.17).

    Conservative forces and energy

    Definition T

    Potential energy

    A force field with a potential φ\varphi (F=∇φF = \nabla\varphi) is called conservative. The scalar −φ-\varphi is its potential energy. In 3-space the level sets of φ\varphi are the equipotential surfaces (in the plane, equipotential lines); moving along one does no work, because F=∇φF = \nabla\varphi is perpendicular to the level sets (5.3). Many physics books define F=−∇UF = -\nabla U, with U=−φU = -\varphi the potential energy; the two agree.

    In one lineIf a force field FF has a potential φ\varphi, the potential energy is −φ-\varphi (Apostol's sign convention), so that kinetic plus potential energy stays constant.

    Why it existsIt is the bookkeeping that turns the work-energy theorem into conservation of energy: what the particle gains in speed it loses in potential energy.

    Theorem A Apostol 10.6, example 2

    The work-energy theorem

    A particle of mass mm moves along a path r(t)r(t) under a force field FF, and its speed at time tt is v(t)=∥r′(t)∥v(t) = \lVert r'(t) \rVert. Then ∫r(a)r(b)F⋅dr=12mv(b)2−12mv(a)2\displaystyle\int_{r(a)}^{r(b)} F \cdot dr = \tfrac12mv(b)^2 - \tfrac12mv(a)^2.

    In one lineFor a particle of mass mm moving under a force field FF, the work done in a time interval equals the change in kinetic energy 12mv2\frac12mv^2.

    Why it is trueIt links a line integral over space to a change of speed, and with a potential gives conservation of mechanical energy.

    ProofApostol 10.6
    The idea: Newton's second law says the force is m times the acceleration, so F dotted with the velocity is m times velocity dotted with acceleration, which is the derivative of one half m v squared. Integrate.
    Write v(t)=r′(t)v(t) = r'(t) for the velocity vector, so F(r(t))=mv′(t)F(r(t)) = mv'(t).
    Newton's second law: F(r(t))=mr′′(t)F(r(t)) = mr''(t).
    F(r(t))⋅r′(t)=mv′(t)⋅v(t)=ddt(12m∥v(t)∥2)F(r(t)) \cdot r'(t) = mv'(t) \cdot v(t) = \dfrac{d}{dt}\Big(\tfrac12m\lVert v(t) \rVert^2\Big).
    Product rule: ddt(v⋅v)=2v⋅v′\frac{d}{dt}(v \cdot v) = 2v \cdot v', and v⋅v=∥v∥2v \cdot v = \lVert v \rVert^2 is the squared speed.
    Integrating from aa to bb gives ∫abF(r(t))⋅r′(t) dt=12m∥v(b)∥2−12m∥v(a)∥2\int_a^b F(r(t)) \cdot r'(t)\,dt = \tfrac12m\lVert v(b) \rVert^2 - \tfrac12m\lVert v(a) \rVert^2. ■\blacksquare
    The fundamental theorem of calculus.

    If F=∇φF = \nabla\varphi, the second fundamental theorem says that the same work is φ(r(b))−φ(r(a))\varphi(r(b)) - \varphi(r(a)). Equating the two, 12mv(b)2−φ(r(b))=12mv(a)2−φ(r(a))\tfrac12mv(b)^2 - \varphi(r(b)) = \tfrac12mv(a)^2 - \varphi(r(a)): kinetic plus potential energy is constant, the principle of conservation of mechanical energy, which is why such a field is called conservative. In a conservative field no net work is done around a closed path. Friction and viscosity are not conservative: they turn mechanical energy into heat, and the work they do around a loop is negative.

    Worked example Apostol 10.12 (conservation of energy)
    Gravity near the Earth is F=(0,0,−mg)F = (0, 0, -mg). Find a potential, the work done when a 6060 kg hiker climbs from sea level to a hut at 20002000 m by any route, and the speed of a 11 kg bead released from rest that slides down a frictionless wire from height 4040 m to height 1010 m.

    Solution.

    1. Potential. φ=−mgz\varphi = -mgz, since ∇φ=(0,0,−mg)\nabla\varphi = (0, 0, -mg). The potential energy is −φ=mgz-\varphi = mgz.
    2. Work of gravity on the hiker. φ(hut)−φ(start)=−mg⋅2000+0=−60⋅9.8⋅2000=−1.176×106\varphi(\text{hut}) - \varphi(\text{start}) = -mg\cdot2000 + 0 = -60\cdot9.8\cdot2000 = -1.176\times10^6 J. Negative: gravity opposes the climb. Only the height gained matters, not the zigzags of the route.
    3. Energy for the bead. Kinetic energy gained equals potential energy lost: 12mv2=mg(40−10)\tfrac12mv^2 = mg(40 - 10), so v=2g⋅30=588≈24.2v = \sqrt{2g\cdot30} = \sqrt{588} \approx 24.2 m/s. The mass cancels. The shape of the wire is irrelevant, as long as it is frictionless.

    Answer. φ=−mgz\varphi = -mgz; the work is about −1.18×106-1.18\times10^6 J; the speed is about 24.224.2 m/s.

    Your answerA roller-coaster car starts from rest at height 4040 m and, ignoring friction, passes a point at height 1010 m. What is its speed in m/s? Use g=9.8g = 9.8 m/s2^2.

    Exact differential equations

    Definition A

    Exact differential equation

    The equation P(x,y) dx+Q(x,y) dy=0P(x, y)\,dx + Q(x, y)\,dy = 0 is exact on an open connected set SS if the field (P,Q)(P, Q) is a gradient field on SS, say ∇φ=(P,Q)\nabla\varphi = (P, Q). Then every differentiable solution y=Y(x)y = Y(x) satisfies φ(x,Y(x))=C\varphi(x, Y(x)) = C for a constant CC: the function g(x)=φ(x,Y(x))g(x) = \varphi(x, Y(x)) has derivative φx+φyY′=P+QY′=0\varphi_x + \varphi_yY' = P + QY' = 0 by the chain rule. Conversely, if φ(x,y)=C\varphi(x, y) = C defines yy as a differentiable function of xx, that function solves the equation (Apostol Thm 10.7).

    In one lineA first-order equation P(x,y) dx+Q(x,y) dy=0P(x, y)\,dx + Q(x, y)\,dy = 0 is exact if (P,Q)(P, Q) is a gradient field; then its solutions are the level curves φ(x,y)=C\varphi(x, y) = C.

    Why it existsIt solves a differential equation by finding a potential, so everything in this chapter becomes a method for first-order equations.

    Worked example Apostol 10.19, using the field of MATH 376 worksheet 27 problem 2
    Solve (2xy+3) dx+(x2+4y) dy=0(2xy + 3)\,dx + (x^2 + 4y)\,dy = 0 with y(0)=1y(0) = 1.

    Solution.

    1. Recognize exactness. (P,Q)=(2xy+3, x2+4y)(P, Q) = (2xy + 3,\ x^2 + 4y) has Py=2x=QxP_y = 2x = Q_x on R2\mathbb R^2, with potential φ=x2y+3x+2y2\varphi = x^2y + 3x + 2y^2 from the example above. The equation is exact.
    2. Write the solutions. x2y+3x+2y2=Cx^2y + 3x + 2y^2 = C.
    3. Use the initial condition. At x=0x = 0, y=1y = 1: 0+0+2=C0 + 0 + 2 = C, so C=2C = 2. The equation 2y2=22y^2 = 2 at x=0x = 0 gives y=±1y = \pm1; the condition picks y=1y = 1.
    4. Solve for yy if you like. 2y2+x2y+(3x−2)=02y^2 + x^2y + (3x - 2) = 0, so y=−x2+x4−8(3x−2)4y = \dfrac{-x^2 + \sqrt{x^4 - 8(3x - 2)}}{4}, the branch with y(0)=164=1y(0) = \frac{\sqrt{16}}{4} = 1.

    Answer. x2y+3x+2y2=2x^2y + 3x + 2y^2 = 2.

    Where it is used

    Used inside maths· Inside maths: closed versus exact

    The statement ‘equal mixed partials but no potential’ is the first example of cohomology. A field with Py=QxP_y = Q_x is called closed; a field with a potential is called exact; every exact field is closed, and on a convex set every closed field is exact, but on the punctured plane the angle field is closed and not exact. The extent to which closed fails to imply exact measures the holes of the domain, and the angle field, with circulation 2π2\pi, counts how many times a loop goes round the origin: the winding number of 6.4. In complex analysis the same field is the form dθ=Im⁡(dz/z)d\theta = \operatorname{Im}(dz/z), where z=reiθz = re^{i\theta}, and the fact that θ\theta is not single valued is why log⁡z\log z has branches. Exact differential equations (above) turn the whole story into a method for ODEs; separable equations and equations with an integrating factor are special cases.

    Used in the real world· Used in the real world: Ampère's law, escape speed and gradient descent

    A long straight wire along the zz-axis carrying a current II produces the magnetic field B=μ0I2π (−y, x, 0)x2+y2B = \dfrac{\mu_0I}{2\pi}\,\dfrac{(-y,\ x,\ 0)}{x^2 + y^2}: the angle field, scaled. Its size at distance ρ\rho from the wire is μ0I/(2πρ)\mu_0I/(2\pi\rho); for I=10I = 10 A and ρ=1\rho = 1 cm this is 4π×10−7⋅102π⋅0.01=2×10−4\frac{4\pi\times10^{-7}\cdot10}{2\pi\cdot0.01} = 2\times10^{-4} tesla. The circulation of BB around any loop that goes once counterclockwise round the wire is μ0I=4π×10−6≈1.26×10−5\mu_0I = 4\pi\times10^{-6} \approx 1.26\times10^{-5} T·m, and around any loop that does not encircle the wire it is 00: this is Ampère’s circuital law, and the numerical lab above ran exactly this calculation. Since the circulation is not zero, BB is not a gradient on the space outside the wire. Locally a ‘magnetic scalar potential’ φ=μ0I2πθ\varphi = \frac{\mu_0I}{2\pi}\theta exists, but it jumps by μ0I\mu_0I every lap.

    For gravity, the potential of the Earth (mass MM, radius RR) outside it is φ=GMm/r\varphi = GMm/r, whose gradient is −GMm r/r3-GMm\,\mathbf r/r^3, Newton’s attraction. The work needed to lift a mass from the surface to infinity is φ(∞)−φ(R)=−GMm/R\varphi(\infty) - \varphi(R) = -GMm/R, so the escape speed solves 12mv2=GMm/R\frac12mv^2 = GMm/R, giving v=2GM/Rv = \sqrt{2GM/R}. With GM=3.986×1014GM = 3.986\times10^{14} m3^3/s2^2 and R=6.371×106R = 6.371\times10^6 m this is 11,18611{,}186 m/s, about 11.211.2 km/s, independent of the shape of the trajectory, because the force is conservative.

    In machine learning, gradient descent follows −∇L-\nabla L for a loss LL. That field is conservative with potential −L-L, so ‘progress’ is a function: the loss goes down along every trajectory, and a closed loop of training steps cannot return to the same parameters with a lower loss. Methods that use a vector field that is not a gradient (the updates of two networks trained against each other, as in GANs) can circulate, which is one reason they are harder to train.

    Your answerThe magnetic field of a long straight wire carrying I=10I = 10 A is the angle field scaled by μ0I/2π\mu_0I/2\pi, with μ0=4π×10−7\mu_0 = 4\pi\times10^{-7}. What is its circulation (in tesla metres) around a loop that goes once counterclockwise around the wire?
    Your answerUsing GM=3.986×1014GM = 3.986\times10^{14} m3^3/s2^2 and R=6.371×106R = 6.371\times10^6 m, what is the escape speed from the Earth's surface in m/s, 2GM/R\sqrt{2GM/R}?

    Traps

    Watch out· Equal mixed partials do not prove a potential on a domain with a hole

    On the 376 final the field of problem 1(a) was 10(x,y)(x2+y2)−510(x, y)(x^2 + y^2)^{-5} on the plane minus the origin, and the instructor said afterwards that checking only Py=QxP_y = Q_x is not enough there. Write the potential and verify it, or check that the integral around circles centred at the origin is 00. The cleanest is to exhibit φ=−54(x2+y2)−4\varphi = -\frac{5}{4}(x^2 + y^2)^{-4} and compute its gradient.

    Watch out· A correct potential with no check is worth less

    On the 376 midterm, a student got all 7 points for problem 1(a), but the rubric shows what was at stake: one item gives only partial credit for a correct potential function without a justification of why its gradient equals ff, and it deducts 3 of the 7 points. The habit to keep is to end every potential with ‘check: φx=⋯=P\varphi_x = \dots = P and φy=⋯=Q\varphi_y = \dots = Q’.

    Watch out· Evaluate the endpoints exactly, and use them as a difference

    The theorem is end minus start. On Midterm 1 problem 1(b) the curve looked frightening, but its endpoints were both (0,0)(0, 0) (the factor 2π−t2\pi - t vanishes at t=2πt = 2\pi and sin⁡2π=0\sin2\pi = 0), so the integral is 00 and no integration is needed. Write out the trigonometric values at the endpoints (as in sin⁡π=0\sin\pi = 0, cos⁡π=−1\cos\pi = -1 in worksheet 6 part B) rather than doing them in your head, and do not forget that the potential at the start may not be 00.

    Watch out· Restrict after differentiating, not before

    On the 376 final, a student answered problem 3 with 00, which was right and earned full credit, but their written method contained a false sentence: they replaced FF by its values on the plane z=0z = 0, namely (0,0,xy)(0, 0, xy), and then wrote curl⁡F=(x,−y,0)\operatorname{curl}F = (x, -y, 0). A curl needs derivatives in all three directions, including zz, so restricting first computes the curl of a different field (the true curl of FF is the zero vector). The line integral around CC only uses values of FF along CC, so replacing FF by the field that agrees with it on CC is allowed; replacing it before taking a curl is not. The safe routes are the potential sin⁡(xyz)\sin(xyz) or evaluating the field on the curve. See A.1.

    Watch out· Zero around a few closed paths does not make a gradient

    F=(x,xy)F = (x, xy) has zero circulation around every circle centred at the origin and is not a gradient (Py=0P_y = 0, Qx=yQ_x = y). Condition (c) must hold for every closed path. The instructor’s remark that circles about the missing point suffice applies only to fields that already satisfy Py=QxP_y = Q_x on the punctured plane.

    Watch out· Keep track of the domain

    The theorems say ‘open and connected’ (first fundamental), ‘open’ (second), and ‘convex or simply connected’ (the test is sufficient). A path must stay inside the domain of φ\varphi: the potential −1/∥x∥-1/\lVert x \rVert is singular at the origin. A set that is not connected, such as two discs, needs a separate potential on each piece, and the potentials may differ by different constants.

    Watch out· Sign of the potential in physics

    The mathematical potential has ∇φ=F\nabla\varphi = F and the work is φ(end)−φ(start)\varphi(\text{end}) - \varphi(\text{start}). Physics books write F=−∇UF = -\nabla U for the potential energy UU, so the work is U(start)−U(end)U(\text{start}) - U(\text{end}). For gravity, φ=−mgz\varphi = -mgz and U=mgzU = mgz. Check which convention a problem uses.

    Problems

    check

    Is F=(x,y)F = (x, y) a gradient on R2\mathbb R^2? Find the line integral from (0,0)(0, 0) to (3,4)(3, 4).

    Solution

    Py=0=QxP_y = 0 = Q_x on the convex set R2\mathbb R^2, so FF is a gradient; φ=12(x2+y2)\varphi = \frac12(x^2 + y^2). The integral is φ(3,4)−φ(0,0)=12⋅25=12.5\varphi(3, 4) - \varphi(0, 0) = \frac12\cdot25 = 12.5.

    checkMATH 376 homework 2 problem 4(b) and (d)

    Are (b) the open unit disc and (d) the open annulus 1<x2+y2<21 < x^2 + y^2 < 2 connected? Give the paths.

    Solution

    (b) Yes: the disc is convex, since ∥(1−t)P+tQ∥≤(1−t)∥P∥+t∥Q∥<1\lVert(1 - t)P + tQ\rVert \le (1 - t)\lVert P \rVert + t\lVert Q \rVert < 1 by the triangle inequality, so the segment from PP to QQ works. (d) Yes: write P,QP, Q in polar form (rP,θP)(r_P, \theta_P), (rQ,θQ)(r_Q, \theta_Q) with rP,rQ∈(1,2)r_P, r_Q \in (1, \sqrt2). Move radially from (rP,θP)(r_P, \theta_P) to (rQ,θP)(r_Q, \theta_P) (every radius in between is in (1,2)(1, \sqrt2)), then along the circle of radius rQr_Q from angle θP\theta_P to θQ\theta_Q. The annulus is connected but not simply connected.

    check

    A field has ∮F⋅dr=0\oint F \cdot dr = 0 around the unit circle. Does it follow that FF is a gradient field on R2\mathbb R^2?

    Solution

    No. Condition (c) must hold for every closed path. The field F=(x,xy)F = (x, xy) has zero circulation around circles centred at the origin and is not a gradient.

    check

    Find a potential for F=(3x2+2y, 2x+4y3)F = (3x^2 + 2y,\ 2x + 4y^3) on R2\mathbb R^2.

    Solution

    Py=2=QxP_y = 2 = Q_x. φ=∫(3x2+2y) dx=x3+2xy+g(y)\varphi = \int(3x^2 + 2y)\,dx = x^3 + 2xy + g(y), φy=2x+g′=2x+4y3\varphi_y = 2x + g' = 2x + 4y^3, so g=y4g = y^4. φ=x3+2xy+y4\varphi = x^3 + 2xy + y^4. Check: φx=3x2+2y\varphi_x = 3x^2 + 2y, φy=2x+4y3\varphi_y = 2x + 4y^3.

    useMATH 376 worksheet 6 part A style

    Compute ∫F⋅dr\int F \cdot dr for F=(ey, xey+1)F = (e^y,\ xe^y + 1) along the curve r(t)=(cos⁡t+t, sin⁡(πt))r(t) = (\cos t + t,\ \sin(\pi t)), 0≤t≤10 \le t \le 1.

    Solution

    Py=ey=QxP_y = e^y = Q_x, so FF is a gradient; φ=xey+y\varphi = xe^y + y (φx=ey\varphi_x = e^y, φy=xey+1\varphi_y = xe^y + 1). The endpoints are r(0)=(1,0)r(0) = (1, 0) and r(1)=(cos⁡1+1, sin⁡π)=(1+cos⁡1, 0)r(1) = (\cos1 + 1,\ \sin\pi) = (1 + \cos1,\ 0). So the integral is φ(1+cos⁡1,0)−φ(1,0)=(1+cos⁡1)−1=cos⁡1\varphi(1 + \cos1, 0) - \varphi(1, 0) = (1 + \cos1) - 1 = \cos1.

    usenew (MATH 376 homework 3 problem 1 style)

    Decide whether F=(2xy+z2, x2+2yz, y2+2xz)F = (2xy + z^2,\ x^2 + 2yz,\ y^2 + 2xz) is a gradient field on R3\mathbb R^3, and if so find the work from (0,0,0)(0, 0, 0) to (1,1,1)(1, 1, 1).

    Solution

    Curl: Ry−Qz=2y−2y=0R_y - Q_z = 2y - 2y = 0, Pz−Rx=2z−2z=0P_z - R_x = 2z - 2z = 0, Qx−Py=2x−2x=0Q_x - P_y = 2x - 2x = 0. Integrate PP: φ=x2y+xz2+g(y,z)\varphi = x^2y + xz^2 + g(y, z); φy=x2+gy=x2+2yz\varphi_y = x^2 + g_y = x^2 + 2yz so g=y2z+h(z)g = y^2z + h(z); φz=2xz+y2+h′=y2+2xz\varphi_z = 2xz + y^2 + h' = y^2 + 2xz so h′=0h' = 0. φ=x2y+xz2+y2z\varphi = x^2y + xz^2 + y^2z, and the work is φ(1,1,1)−0=3\varphi(1, 1, 1) - 0 = 3.

    useMATH 376 worksheet 5 exercise 4 style

    Show that F=(xy, x)F = (xy,\ x) is not a gradient by comparing two paths from (0,0)(0, 0) to (1,1)(1, 1): the line y=xy = x and the path through (1,0)(1, 0).

    Solution

    Along y=xy = x: r=(t,t)r = (t, t), F=(t2,t)F = (t^2, t), r′=(1,1)r' = (1, 1), ∫01(t2+t) dt=56\int_0^1 (t^2 + t)\,dt = \frac56. Along the xx-axis then up: first leg y=0y = 0, F=(0,x)F = (0, x), dr=(dx,0)dr = (dx, 0), contributes 00; second leg x=1x = 1, F=(y,1)F = (y, 1), dr=(0,dy)dr = (0, dy), contributes ∫011 dy=1\int_0^1 1\,dy = 1. The values 56≠1\frac56 \ne 1 differ, so the integral is path dependent. (The mixed partials are Py=xP_y = x and Qx=1Q_x = 1, which also differ.)

    usenew (exact equation)

    Solve (3x2y+1) dx+(x3+2y) dy=0(3x^2y + 1)\,dx + (x^3 + 2y)\,dy = 0.

    Solution

    The field (3x2y+1,x3+2y)(3x^2y + 1, x^3 + 2y) is the gradient of φ=x3y+x+y2\varphi = x^3y + x + y^2 (worksheet 5 exercise 2). The solutions satisfy x3y+x+y2=Cx^3y + x + y^2 = C.

    proveMATH 376 lecture of 4 February

    Prove that the potential of a gradient field on an open connected set is unique up to an additive constant.

    Solution

    Let φ1\varphi_1 and φ2\varphi_2 be potentials of FF on the open connected set SS and put h=φ1−φ2h = \varphi_1 - \varphi_2. Then ∇h=F−F=O\nabla h = F - F = O on SS. By the theorem of 4.4 (zero gradient on a connected open set means constant), hh is constant. Alternatively, by the second fundamental theorem, for any path from a base point pp to xx, φ1(x)−φ1(p)=∫F⋅dr=φ2(x)−φ2(p)\varphi_1(x) - \varphi_1(p) = \int F \cdot dr = \varphi_2(x) - \varphi_2(p), so h(x)=h(p)h(x) = h(p) for all xx.

    provenew (compare Apostol 10.6)

    Prove that a conservative force field does no net work on a particle that goes once around a closed path, and use the work-energy theorem to deduce that the particle’s speed is the same when it returns.

    Solution

    If F=∇φF = \nabla\varphi and rr is closed, the work is φ(r(b))−φ(r(a))=0\varphi(r(b)) - \varphi(r(a)) = 0 by the second fundamental theorem. By the work-energy theorem this work equals 12mv(b)2−12mv(a)2\frac12mv(b)^2 - \frac12mv(a)^2, so v(b)2=v(a)2v(b)^2 = v(a)^2, and since speeds are non-negative, v(b)=v(a)v(b) = v(a).

    proveMATH 376 homework 5 problem 4.1 / Apostol 10.16 example 2

    Show that the field F=(−y, x)x2+y2F = \dfrac{(-y,\ x)}{x^2 + y^2} on the punctured plane has Py=QxP_y = Q_x but is not a gradient. Then show that F+∇ψF + \nabla\psi is not a gradient for any C1C^1 function ψ\psi on the punctured plane.

    Solution

    The first part is the example above. For the second part: if F+∇ψ=∇χF + \nabla\psi = \nabla\chi on the punctured plane, then F=∇(χ−ψ)F = \nabla(\chi - \psi) would be a gradient there, which was shown false. (Equivalently, ∮(F+∇ψ)⋅dr=2π+0=2π\oint(F + \nabla\psi) \cdot dr = 2\pi + 0 = 2\pi around the unit circle, since the circulation of a gradient is 00.)

    provenew (the converse direction of the three descriptions)

    Let SS be open and connected, and FF continuous on SS. Prove (b) implies (c) directly: if the line integral of FF is independent of the path, then it is 00 around every closed piecewise smooth path.

    Solution

    Let γ:[a,b]→S\gamma: [a, b] \to S be closed, γ(a)=γ(b)=p\gamma(a) = \gamma(b) = p. Compare γ\gamma with the constant path c(t)=pc(t) = p on [a,b][a, b], which has the same start and the same end. The constant path has velocity 00, so ∫cF⋅dc=0\int_c F \cdot dc = 0. By path independence, ∫γF⋅dγ=∫cF⋅dc=0\int_\gamma F \cdot d\gamma = \int_c F \cdot dc = 0.

    provenew (the gradient of a composite)

    Let φ\varphi be a C1C^1 scalar field on an open set, G:R→RG: \mathbb R \to \mathbb R a C1C^1 function, and F=G′(φ)∇φF = G'(\varphi)\nabla\varphi. Show that FF is a gradient field and find a potential. Apply it to the field of the practice final, (2xycos⁡(x2y)esin⁡(x2y), x2cos⁡(x2y)esin⁡(x2y))\big(2xy\cos(x^2y)e^{\sin(x^2y)},\ x^2\cos(x^2y)e^{\sin(x^2y)}\big).

    Solution

    By the chain rule, ∇(G(φ))=G′(φ)∇φ=F\nabla(G(\varphi)) = G'(\varphi)\nabla\varphi = F. So G∘φG \circ \varphi is a potential. In the example, φ=x2y\varphi = x^2y, ∇φ=(2xy,x2)\nabla\varphi = (2xy, x^2) and G′(u)=cos⁡u esin⁡uG'(u) = \cos u\,e^{\sin u}, so G(u)=esin⁡uG(u) = e^{\sin u} and the potential is esin⁡(x2y)e^{\sin(x^2y)}, as found above.

    stretchApostol 10.15, note (new check)

    Show that F=(x, xy)F = (x,\ xy) is not a gradient field on R2\mathbb R^2 although ∮F⋅dr=0\oint F \cdot dr = 0 for every circle centred at the origin. Then find a closed path with non-zero integral.

    Solution

    Py=0≠y=QxP_y = 0 \ne y = Q_x (at (0,1)(0, 1), say), so FF is not a gradient. On the circle r(t)=(Rcos⁡t,Rsin⁡t)r(t) = (R\cos t, R\sin t): F⋅r′=Rcos⁡t⋅(−Rsin⁡t)+R2cos⁡tsin⁡t⋅Rcos⁡t=−R2cos⁡tsin⁡t+R3cos⁡2tsin⁡tF \cdot r' = R\cos t\cdot(-R\sin t) + R^2\cos t\sin t\cdot R\cos t = -R^2\cos t\sin t + R^3\cos^2t\sin t, and both terms integrate to 00 over [0,2π][0, 2\pi] (∫cos⁡tsin⁡t dt\int\cos t\sin t\,dt and ∫cos⁡2tsin⁡t dt=−cos⁡3t3\int\cos^2t\sin t\,dt = -\frac{\cos^3t}{3} vanish over a full period). A closed path with non-zero integral: the boundary of the unit square [0,1]2[0, 1]^2, counterclockwise: bottom contributes ∫01x dx=12\int_0^1 x\,dx = \frac12, right side (x=1x = 1, dr=(0,dy)dr = (0, dy)) contributes ∫01y dy=12\int_0^1 y\,dy = \frac12, top (y=1y = 1, from x=1x = 1 to 00, F=(x,x)F = (x, x), dr=(dx,0)dr = (dx, 0)) contributes ∫10x dx=−12\int_1^0 x\,dx = -\frac12, left side (x=0x = 0) contributes 00. Total 12≠0\frac12 \ne 0. (This is Green’s theorem: Qx−Py=yQ_x - P_y = y and ∬[0,1]2y dA=12\iint_{[0,1]^2} y\,dA = \frac12.)

    stretchnew (potential from a radial field)

    A radial field is F=h(ρ) (x,y,z)F = h(\rho)\,(x, y, z), with ρ=x2+y2+z2\rho = \sqrt{x^2 + y^2 + z^2} and hh continuous on (0,∞)(0, \infty). Show that FF is a gradient on R3\mathbb R^3 minus the origin and find a potential in terms of an antiderivative of ρh(ρ)\rho h(\rho). What does this say about the gravitational field −GMm r/ρ3-GMm\,\mathbf r/\rho^3?

    Solution

    Let HH be an antiderivative of ρh(ρ)\rho h(\rho), so H′(ρ)=ρh(ρ)H'(\rho) = \rho h(\rho). Then ∇H(ρ)=H′(ρ)∇ρ=ρh(ρ)⋅(x,y,z)ρ=h(ρ)(x,y,z)=F\nabla H(\rho) = H'(\rho)\nabla\rho = \rho h(\rho)\cdot\frac{(x, y, z)}{\rho} = h(\rho)(x, y, z) = F, because ∇ρ=(x,y,z)/ρ\nabla\rho = (x, y, z)/\rho. So H(ρ)H(\rho) is a potential, and every radial field is conservative. For gravity h(ρ)=−GMm/ρ3h(\rho) = -GMm/\rho^3, so ρh(ρ)=−GMm/ρ2\rho h(\rho) = -GMm/\rho^2 and H(ρ)=GMm/ρH(\rho) = GMm/\rho, the Newtonian potential.

    Summary

    • A gradient field has a potential φ\varphi with ∇φ=F\nabla\varphi = F. Potentials differ by constants on a connected open set.
    • Second fundamental theorem: ∫r∇φ⋅dr=φ(end)−φ(start)\int_r \nabla\varphi \cdot dr = \varphi(\text{end}) - \varphi(\text{start}) for any piecewise smooth path in the domain. Evaluate the endpoints exactly; a closed path gives 00.
    • First fundamental theorem and equivalences: on an open connected set, for a continuous field, (a) FF is a gradient, (b) its line integral is path independent, (c) it is 00 around every closed path, are equivalent. Two paths with different values, or one closed path with a non-zero value, prove that FF is not a gradient.
    • Test: if FF is C1C^1 and a gradient, then Py=QxP_y = Q_x (in space, curl F=0F = 0). This is necessary; it is also sufficient on a convex set (explicit formula) and on a simply connected set (via Green’s theorem).
    • The angle field (−y,x)x2+y2\dfrac{(-y, x)}{x^2 + y^2} on the punctured plane has Py=QxP_y = Q_x and circulation 2π2\pi around the origin, so it has no potential. On a domain with a hole, find an explicit potential and verify it, or check the circulation.
    • Construct a potential by integrating PP in xx, adding g(y)g(y) (or g(y,z)g(y, z)), matching QQ (and RR), then verifying every component.
    • Energy: the work of a force equals the change of kinetic energy; for a conservative force it is also the change of the potential, so kinetic plus potential energy is constant. An exact equation P dx+Q dy=0P\,dx + Q\,dy = 0 is solved by the level curves of a potential.

    Watch and read

    The same ideas explained by someone else. Use these when an explanation here does not land.

    Where this sits

    Comes from
    4.4 Connectedness and path-connectedness
    5.2 Directional derivatives, partial derivatives and the gradient
    5.5 Higher partial derivatives and the equality of mixed partials
    6.1 Paths and line integrals
    Leads to
    6.4 Green's theorem and change of variables
    Same idea elsewhere
    MATH 376: The most heavily tested idea of the first half of the course: potentials appeared on Midterm 1 problem 1, on the Final (problems 1 and 3) and on both practice exams. Every worksheet and homework problem on potentials is worked below: worksheet 5 exercises 1 to 4, worksheet 6 parts A to C and the curl test, worksheet 10 problem 2, worksheet 27 problem 2, homework 2 problems 4 and 5, homework 3 problem 1, homework 5 problem 4.1. The exam problems are in 9.2, 9.4 and 9.5.
    MATH 521 and 551: The pair 'equal mixed partials, but no potential' is the first example of cohomology: closed forms that are not exact. The punctured plane has a one-dimensional space of such forms, spanned by the angle field, and the winding number counts how many times a loop goes round.
    MATH 340 and CS 532: Gradient descent follows the field $-\nabla L$ of a loss $L$, so the loss is its potential. A learned vector field that is not a gradient has loops along which 'progress' is not a number going down.
    Physics: Conservative forces are exactly the ones with a potential energy. Friction is not conservative: its work around a closed loop is negative. The electric field of static charges is a gradient; the magnetic field of a current is not, and its circulation is Ampère's law.