🦖 Bellaziraptor

Unit 5

Vector Fields & Line Integrals

A vector field attaches an arrow to every point in space: the electric field around a charge, the magnetic field around a wire, the velocity of water in a pipe. This unit learns to integrate such a field along a path — which is what work, voltage and circulation all are — and then asks the question that organises all of electromagnetics: when does the answer depend only on where you start and end, and not on the route? Fields with that property have a potential; the electric field of static charges is one, and that is why voltage exists. Fields without it have curl. Two labs let you drag paths through fields and probe the curl and divergence at any point.

1 · Vector fields

\[ \mathbf{F}(x,y) = \langle P(x,y),\ Q(x,y)\rangle = P\,\mathbf{i} + Q\,\mathbf{j} \qquad\qquad \mathbf{F}(x,y,z) = \langle P,\ Q,\ R\rangle \] A vector-valued function of position. To sketch it, evaluate at a grid of points and draw each vector with its tail at the point. Arrows are usually scaled down so they do not overlap — read relative lengths, not absolute ones.
FieldFormulaPictureWhere it comes from
Uniform\(\langle 1, 0\rangle\)Parallel arrows, all equal\(\mathbf{E}\) between capacitor plates; gravity near the ground
Radial\(\langle x, y\rangle\)Arrows away from the origin, growing with distancePosition field; expansion
Inverse-square\(\dfrac{\langle x, y, z\rangle}{(x^2+y^2+z^2)^{3/2}} = \dfrac{\hat{\mathbf r}}{r^2}\)Radial, fading with distanceCoulomb's law: \(\mathbf{E}\) of a point charge; gravity of a mass
Rotational\(\langle -y, x\rangle\)Counterclockwise circles, faster farther outRigid rotation; \(\mathbf{v} = \boldsymbol\omega\times\mathbf{r}\)
Vortex\(\dfrac{\langle -y, x\rangle}{x^2+y^2}\)Circles, slower farther out\(\mathbf{B}\) around a straight wire (Ampère); bathtub drain
Gradient field\(\nabla f\)Perpendicular to the contours of \(f\)\(\mathbf{E} = -\nabla V\); heat flow \(-k\nabla T\)
Most of these are presets in the labs below. Rotational versus vortex is the pair worth staring at: they look alike, but one has curl everywhere and the other has curl only at the origin.

A field of the form \(\mathbf{F} = \nabla f\) is called a gradient field or conservative field, and \(f\) is its potential function. Deciding whether a given field is one of these is the main business of Sections 3 and 4.

2 · Line integrals

Of a scalar function — mass of a wire

\[ \int_C f(x,y,z)\,ds = \int_a^b f\big(\mathbf{r}(t)\big)\,|\mathbf{r}'(t)|\,dt \] Add up \(f\) times a little piece of arc length \(ds = |\mathbf{r}'|\,dt\) along the curve. With \(f = 1\) it is the length of \(C\); with \(f\) a linear density it is the mass of a wire; with \(f\) a charge density it is total charge on the wire. The value does not depend on the direction of travel.

Of a vector field — work

\[ \int_C \mathbf{F}\cdot d\mathbf{r} = \int_C \mathbf{F}\cdot\mathbf{T}\,ds = \int_a^b \mathbf{F}\big(\mathbf{r}(t)\big)\cdot\mathbf{r}'(t)\,dt = \int_C P\,dx + Q\,dy + R\,dz \] Four notations, one integral. At each point take the component of \(\mathbf{F}\) along the direction of travel, and add it up along the curve. The rightmost form is the one you compute with: substitute \(x = x(t), dx = x'(t)\,dt\), etc., and integrate in \(t\). It does depend on direction — reversing the curve flips the sign.
The procedure
  1. Parametrise \(C\): \(\mathbf{r}(t)\), \(a\le t\le b\), in the stated direction. Segment from \(A\) to \(B\): \(\mathbf{r}(t) = A + t(B - A)\), \(0\le t\le1\). Circle: \(\langle a\cos t, a\sin t\rangle\). Graph \(y = g(x)\): \(\langle t, g(t)\rangle\).
  2. Substitute into \(\mathbf{F}\) so it becomes a function of \(t\).
  3. Dot with \(\mathbf{r}'(t)\) and integrate from \(a\) to \(b\).

A piecewise path (say two sides of a triangle) is the sum of the integrals over the pieces — parametrise each separately.

Voltage is a line integral

The potential difference between two points is \(V_B - V_A = -\int_A^B\mathbf{E}\cdot d\mathbf{r}\) — the work per unit charge done against the field. When \(\mathbf{E}\) is conservative (Section 3) this depends only on \(A\) and \(B\), which is why a voltmeter can report a single number. The electromotive force around a closed loop is \(\mathcal{E} = \oint\mathbf{E}\cdot d\mathbf{r}\); it is zero for electrostatic fields and nonzero for the induced fields of Faraday's law.

Interactive lab

Work along a path through a field

Choose a field and a path, then drag the endpoints. The integral \(\int_C\mathbf{F}\cdot d\mathbf{r}\) is computed numerically as you move; the graph on the right shows \(\mathbf{F}\cdot\mathbf{T}\) along the path, and the shaded area is the work. The experiment to run: pick a conservative field, keep \(A\) and \(B\) fixed, and switch between the straight segment, the arc and the detour — the work does not change. Pick the shear or rotational field and it does. Then try the closed loops.

Field
Path

Drag \(A\) or \(B\). Arrows show the field; the orange path is \(C\) with its direction marked.

\(\mathbf{F}\cdot\mathbf{T}\) against arc length \(s\). Shaded area (sign included) is \(\int_C\mathbf{F}\cdot d\mathbf{r}\).

C F·dr
Path length
f(B) − f(A) if F = ∇f
Field
This field

3 · The fundamental theorem for line integrals

\[ \int_C \nabla f\cdot d\mathbf{r} = f\big(\mathbf{r}(b)\big) - f\big(\mathbf{r}(a)\big) \] If the field is a gradient, its line integral is just the potential at the end minus the potential at the start — no matter what path. Proof is one line: by the chain rule \(\nabla f\cdot\mathbf{r}'(t) = \tfrac{d}{dt}f(\mathbf{r}(t))\), and the ordinary FTC finishes it.

For a field defined on an open connected region, the following are equivalent — each one is a way to say conservative:

  1. \(\mathbf{F} = \nabla f\) for some potential \(f\).
  2. \(\int_C\mathbf{F}\cdot d\mathbf{r}\) is independent of path — it depends only on the endpoints.
  3. \(\oint_C\mathbf{F}\cdot d\mathbf{r} = 0\) for every closed curve \(C\).
Kirchhoff's voltage law is statement 3

The electrostatic field is conservative: \(\mathbf{E} = -\nabla V\). So \(\oint\mathbf{E}\cdot d\mathbf{r} = 0\) around any loop — go around a circuit and the voltage rises and drops sum to zero. KVL is not a circuit axiom; it is the fundamental theorem for line integrals applied to a conservative field. And it fails when there is a changing magnetic flux through the loop, because then \(\mathbf{E}\) is no longer conservative. Unit 6.

4 · Testing for a conservative field and finding the potential

\[ \mathbf{F} = \langle P, Q\rangle \text{ conservative on a simply-connected region} \quad\Longleftrightarrow\quad \frac{\partial P}{\partial y} = \frac{\partial Q}{\partial x} \] Necessity is Clairaut: if \(P = f_x\) and \(Q = f_y\), then \(P_y = f_{xy} = f_{yx} = Q_x\). Sufficiency needs the region to have no holes (simply connected). In 3D the test is \(\nabla\times\mathbf{F} = \mathbf{0}\), which is the same condition for all three pairs of components at once.
The hole matters

The vortex \(\mathbf{F} = \langle -y, x\rangle/(x^2+y^2)\) satisfies \(P_y = Q_x\) everywhere it is defined — but the region excludes the origin, so it is not simply connected, and in fact \(\oint\mathbf{F}\cdot d\mathbf{r} = 2\pi\) around any loop enclosing the origin. Try it in the lab: Vortex field, Circle path. This field is \(\mathbf{B}\) around a wire; the \(2\pi\) is Ampère's law catching the current through the loop.

Finding \(f\) from \(\mathbf{F}\)

  1. Integrate \(P\) with respect to \(x\): \(f = \int P\,dx + g(y)\). The “constant” is an arbitrary function of \(y\).
  2. Differentiate that \(f\) with respect to \(y\) and set it equal to \(Q\). Solve for \(g'(y)\) — it must contain no \(x\) (if it does, the field is not conservative and you made an error in the test).
  3. Integrate \(g'\) to get \(g\), and write down \(f\). Add a constant if you like; it never matters.

In three variables, do the same with three steps: the “constant” after integrating in \(x\) is \(g(y,z)\), and after matching \(Q\) it becomes \(h(z)\).

5 · Green's theorem

\[ \oint_C P\,dx + Q\,dy = \iint_D\left(\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}\right)dA \] \(C\) is the boundary of the plane region \(D\), traversed counterclockwise (the region on your left). It converts a line integral around a loop into a double integral over the inside — or back. Note that the integrand on the right is exactly the quantity that the conservative test says must vanish: for a conservative field both sides are zero, which is statement 3 above.

Two ways to use it:

  • Loop integral is ugly, region is simple: compute the double integral instead. \(\oint (y^3)\,dx + (x^3)\,dy\) around a circle becomes \(\iint 3(x^2 + y^2)\,dA\), which is trivial in polar.
  • Area from a boundary walk: choose \(P, Q\) with \(Q_x - P_y = 1\):
    \[ A = \oint_C x\,dy = -\oint_C y\,dx = \frac12\oint_C x\,dy - y\,dx \]
    A planimeter — the mechanical device surveyors used to measure map areas by tracing the outline — is this formula built in brass.

The flux form

\[ \oint_C \mathbf{F}\cdot\mathbf{n}\,ds = \iint_D \left(\frac{\partial P}{\partial x} + \frac{\partial Q}{\partial y}\right)dA = \iint_D \nabla\cdot\mathbf{F}\,dA \] Same theorem, applied to the rotated field \(\langle Q, -P\rangle\). The left side is the outward flux of \(\mathbf{F}\) through the boundary; the right side is the divergence integrated inside. This is the 2D preview of the divergence theorem, and of Gauss's law.

Regions with holes are handled by cutting them into simply connected pieces; the cuts cancel, and the result is that the outer boundary goes counterclockwise while each inner boundary goes clockwise.

6 · Curl and divergence

Both Green's theorem integrands have names, and both generalise to 3D. They are the two things the del operator \(\nabla = \langle\partial_x, \partial_y, \partial_z\rangle\) can do to a vector field.

\[ \operatorname{div}\mathbf{F} = \nabla\cdot\mathbf{F} = \frac{\partial P}{\partial x} + \frac{\partial Q}{\partial y} + \frac{\partial R}{\partial z} \] A scalar: the net outflow per unit volume at a point. Positive where field lines are born (a source — a positive charge for \(\mathbf{E}\)), negative where they die (a sink), zero where they just pass through. For an incompressible fluid \(\nabla\cdot\mathbf{v} = 0\); for the magnetic field \(\nabla\cdot\mathbf{B} = 0\) always — there are no magnetic charges.
\[ \operatorname{curl}\mathbf{F} = \nabla\times\mathbf{F} = \begin{vmatrix}\mathbf{i} & \mathbf{j} & \mathbf{k}\\ \partial_x & \partial_y & \partial_z\\ P & Q & R\end{vmatrix} = \left\langle R_y - Q_z,\ P_z - R_x,\ Q_x - P_y\right\rangle \] A vector: the rotation per unit area at a point. Its direction is the axis a tiny paddle wheel would spin about (right-hand rule); its magnitude is twice the angular velocity. For a 2D field the only component is \(Q_x - P_y\), pointing along \(\mathbf{k}\) — the Green's theorem integrand.
IdentityIn wordsConsequence
\(\nabla\times(\nabla f) = \mathbf{0}\)Gradients have no curlConservative ⇒ irrotational. The converse holds on simply connected regions.
\(\nabla\cdot(\nabla\times\mathbf{F}) = 0\)Curls have no divergenceSince \(\nabla\cdot\mathbf{B} = 0\), \(\mathbf{B}\) can be written as a curl: \(\mathbf{B} = \nabla\times\mathbf{A}\), the vector potential.
\(\nabla\cdot(\nabla f) = \nabla^2 f\)The Laplacian\(\nabla^2 V = -\rho/\varepsilon_0\): Poisson's equation, the master equation of electrostatics.
\(\nabla\cdot(f\mathbf{F}) = f\,\nabla\cdot\mathbf{F} + \nabla f\cdot\mathbf{F}\)Product ruleUsed constantly in deriving energy-conservation statements.
Both zero identities are Clairaut's theorem in disguise — mixed partials cancel in pairs. Verify one of them by hand once; it takes four lines.
Interactive lab

Divergence & curl probe

Drag the probe anywhere in the field. The small circle around it measures two things numerically: the net outward flux through the circle (divided by its area, this approaches \(\nabla\cdot\mathbf{F}\)) and the circulation around it (divided by its area, this approaches the curl). The paddle wheel spins at the rate the curl predicts. Shrink the circle and watch the estimates converge to the analytic values. The vortex field is the one to think about: the wheel does not turn anywhere — except that a circle around the origin still has circulation \(2\pi\).

Field

Drag the probe. Green arrows: outward component of \(\mathbf{F}\) on the circle (flux). Violet: tangential component (circulation).

Radius ε0.50
x1.00
y0.60
Show
This field
Flux out ÷ area
∇·F at the probe
Circulation ÷ area
(∇×F)z at the probe

7 · Worked examples

1. Work along a parabola, computed directly

Find \(\int_C \mathbf{F}\cdot d\mathbf{r}\) for \(\mathbf{F} = \langle xy, y^2\rangle\) along \(y = x^2\) from \((0,0)\) to \((1,1)\).

Parametrise: \(\mathbf{r}(t) = \langle t, t^2\rangle\), \(0\le t\le1\), so \(\mathbf{r}'(t) = \langle 1, 2t\rangle\).

\[ \mathbf{F}(\mathbf{r}(t)) = \langle t\cdot t^2,\ (t^2)^2\rangle = \langle t^3, t^4\rangle \] \[ \int_C\mathbf{F}\cdot d\mathbf{r} = \int_0^1 \langle t^3, t^4\rangle\cdot\langle 1, 2t\rangle\,dt = \int_0^1 (t^3 + 2t^5)\,dt = \frac14 + \frac13 = \frac{7}{12} \]

Is it conservative? \(P_y = x\), \(Q_x = 0\). Not equal, so no — and the answer along the straight line \(\langle t, t\rangle\) is \(\int_0^1 (t^2 + t^2)\,dt = 2/3 \ne 7/12\). Path matters here.

2. Find the potential, then use the fundamental theorem

Show \(\mathbf{F} = \langle 2xy + 3,\ x^2 - 4y\rangle\) is conservative, find \(f\), and evaluate \(\int_C\mathbf{F}\cdot d\mathbf{r}\) along any path from \((1, 0)\) to \((2, 3)\).

Test: \(P_y = 2x\), \(Q_x = 2x\). ✓ Defined everywhere, so conservative.

\[ f = \int (2xy + 3)\,dx = x^2y + 3x + g(y) \] \[ f_y = x^2 + g'(y) \overset{!}{=} x^2 - 4y \;\Rightarrow\; g'(y) = -4y \;\Rightarrow\; g = -2y^2 \] \[ f(x,y) = x^2y + 3x - 2y^2 \]
\[ \int_C\mathbf{F}\cdot d\mathbf{r} = f(2,3) - f(1,0) = (12 + 6 - 18) - (0 + 3 - 0) = 0 - 3 = -3 \]

No parametrisation needed. Check by differentiating \(f\): \(f_x = 2xy + 3\) ✓, \(f_y = x^2 - 4y\) ✓.

3. Green's theorem turns a loop into a disk

Evaluate \(\oint_C (y^3 - \sin x)\,dx + (x^3 + e^{y^2})\,dy\), \(C\) the circle \(x^2+y^2 = 4\) counterclockwise.

Direct evaluation is hopeless (\(e^{y^2}\)). Green: \(Q_x - P_y = 3x^2 - 3y^2\cdot(-1)\)… careful: \(P = y^3 - \sin x\), so \(P_y = 3y^2\); \(Q = x^3 + e^{y^2}\), so \(Q_x = 3x^2\).

\[ \oint_C = \iint_D (3x^2 - 3y^2)\,dA = 3\int_0^{2\pi}\!\!\int_0^2 r^2(\cos^2\theta - \sin^2\theta)\,r\,dr\,d\theta = 3\int_0^2 r^3\,dr\int_0^{2\pi}\cos 2\theta\,d\theta = 0 \]

The \(\sin x\) and \(e^{y^2}\) terms never mattered — they are the \(x\)-only and \(y\)-only parts, which are conservative on their own and contribute zero around any loop. Only the \(y^3\,dx + x^3\,dy\) part could survive, and by symmetry it cancels too.

4. Area of an ellipse by Green's theorem

Find the area enclosed by \(x = a\cos t,\ y = b\sin t\).

\[ A = \frac12\oint_C x\,dy - y\,dx = \frac12\int_0^{2\pi}\Big[(a\cos t)(b\cos t) - (b\sin t)(-a\sin t)\Big]dt = \frac{ab}{2}\int_0^{2\pi}(\cos^2 t + \sin^2 t)\,dt = \pi ab \]

The symmetric form \(\tfrac12\oint x\,dy - y\,dx\) is usually the cleanest because the cross terms combine into \(\cos^2 + \sin^2\). Compare doing this as \(\iint dA\) with Cartesian limits involving \(\sqrt{1 - x^2/a^2}\).

5. Curl and divergence of a 3D field

For \(\mathbf{F} = \langle xz,\ xyz,\ -y^2\rangle\) find \(\nabla\cdot\mathbf{F}\) and \(\nabla\times\mathbf{F}\).

\[ \nabla\cdot\mathbf{F} = \partial_x(xz) + \partial_y(xyz) + \partial_z(-y^2) = z + xz + 0 = z(1 + x) \]
\[ \nabla\times\mathbf{F} = \begin{vmatrix}\mathbf{i}&\mathbf{j}&\mathbf{k}\\ \partial_x&\partial_y&\partial_z\\ xz&xyz&-y^2\end{vmatrix} = \langle \partial_y(-y^2) - \partial_z(xyz),\ \partial_z(xz) - \partial_x(-y^2),\ \partial_x(xyz) - \partial_y(xz)\rangle \] \[ = \langle -2y - xy,\ x - 0,\ yz - 0\rangle = \langle -y(2 + x),\ x,\ yz\rangle \]

Since the curl is not zero, \(\mathbf{F}\) is not conservative — no potential exists and its line integrals are path-dependent. Check the identity \(\nabla\cdot(\nabla\times\mathbf{F}) = 0\): \(\partial_x(-2y - xy) + \partial_y(x) + \partial_z(yz) = -y + 0 + y = 0\). ✓

6. Ampère's law from the vortex field

The magnetic field of a long straight wire carrying current \(I\) along the \(z\)-axis is \(\mathbf{B} = \dfrac{\mu_0 I}{2\pi}\dfrac{\langle -y, x, 0\rangle}{x^2+y^2}\). Compute \(\oint_C\mathbf{B}\cdot d\mathbf{r}\) around the circle of radius \(a\) centred on the wire, and show that \(\nabla\times\mathbf{B} = \mathbf{0}\) away from the wire.

Loop: \(\mathbf{r}(t) = \langle a\cos t, a\sin t, 0\rangle\), \(\mathbf{r}' = \langle -a\sin t, a\cos t, 0\rangle\). On the circle \(x^2 + y^2 = a^2\):

\[ \mathbf{B}\cdot\mathbf{r}' = \frac{\mu_0 I}{2\pi a^2}\big[(-a\sin t)(-a\sin t) + (a\cos t)(a\cos t)\big] = \frac{\mu_0 I}{2\pi} \quad\Longrightarrow\quad \oint_C\mathbf{B}\cdot d\mathbf{r} = \frac{\mu_0 I}{2\pi}\cdot 2\pi = \mu_0 I \]

Independent of \(a\) — Ampère's law: the circulation of \(\mathbf{B}\) equals \(\mu_0\) times the enclosed current.

Curl: with \(P = -y/(x^2+y^2)\), \(Q = x/(x^2+y^2)\):

\[ Q_x = \frac{(x^2+y^2) - x(2x)}{(x^2+y^2)^2} = \frac{y^2 - x^2}{(x^2+y^2)^2},\qquad P_y = \frac{-(x^2+y^2) + y(2y)}{(x^2+y^2)^2} = \frac{y^2 - x^2}{(x^2+y^2)^2} \]

So \(Q_x - P_y = 0\) wherever the field is defined. Zero curl everywhere, yet nonzero circulation around the origin: the region has a hole (the wire), so the conservative test does not apply. All of the “curl” is concentrated in the wire itself — which is precisely the differential form of Ampère's law, \(\nabla\times\mathbf{B} = \mu_0\mathbf{J}\), with \(\mathbf{J}\) zero outside the wire.

Checklist

  • I can parametrise segments, circles, and graphs, in the stated direction, and compute \(\int_C\mathbf{F}\cdot d\mathbf{r}\) as \(\int\mathbf{F}(\mathbf{r}(t))\cdot\mathbf{r}'(t)\,dt\).
  • I know reversing the path flips the sign of a vector line integral but not a scalar one.
  • I test \(P_y = Q_x\) (or \(\nabla\times\mathbf{F} = \mathbf{0}\)) and remember the simply-connected condition.
  • I can construct a potential function and use \(f(B) - f(A)\) instead of parametrising.
  • I can state Green's theorem with the correct orientation and use it in both directions, including for area.
  • I can compute divergence and curl, and say what each measures physically.
  • I know why KVL holds for electrostatics and why Ampère's law gives \(\mu_0 I\) regardless of the loop's size.