Unit 6
Surface Integrals, Stokes & Gauss
The last unit integrates a field through a surface — the flux — and then proves the two theorems that relate what a field does on a boundary to what it does inside. Stokes' theorem connects the circulation around a loop to the curl through any surface the loop bounds; the divergence theorem connects the flux out of a closed surface to the divergence inside. Neither is a curiosity: with \(\mathbf{E}\) and \(\mathbf{B}\) in place of \(\mathbf{F}\), they are the step from the integral form of Maxwell's equations to the differential form, and this page ends by taking that step for all four. Two labs: one measures flux through surfaces you choose, the other checks Stokes' theorem on caps of different shapes sharing one boundary.
1 · Parametric surfaces
| Surface | Parametrisation | Parameter region |
|---|---|---|
| Graph \(z = f(x,y)\) | \(\langle x,\ y,\ f(x,y)\rangle\) | \((x,y)\in D\) |
| Sphere of radius \(a\) | \(\langle a\sin\phi\cos\theta,\ a\sin\phi\sin\theta,\ a\cos\phi\rangle\) | \(0\le\theta\le2\pi,\ 0\le\phi\le\pi\) |
| Cylinder of radius \(a\) | \(\langle a\cos\theta,\ a\sin\theta,\ z\rangle\) | \(0\le\theta\le2\pi,\ z_1\le z\le z_2\) |
| Cone \(z = \sqrt{x^2+y^2}\) | \(\langle r\cos\theta,\ r\sin\theta,\ r\rangle\) | \(0\le\theta\le2\pi,\ 0\le r\le h\) |
| Surface of revolution of \(y = g(x)\) about the \(x\)-axis | \(\langle x,\ g(x)\cos\theta,\ g(x)\sin\theta\rangle\) | \(a\le x\le b,\ 0\le\theta\le2\pi\) |
| Plane through \(P_0\) spanned by \(\mathbf{a}, \mathbf{b}\) | \(\mathbf{r}_0 + u\mathbf{a} + v\mathbf{b}\) | \(u, v\in\mathbb{R}\) |
Tangent vectors and the normal
2 · Surface integrals of scalar functions
On a sphere of radius \(a\), \(x^2+y^2+z^2 = a^2\) everywhere, so \(\iint_S (x^2+y^2+z^2)\,dS = a^2\cdot4\pi a^2\) with no parametrising at all. On a cylinder \(x^2+y^2 = a^2\). On a plane \(z = c\), \(dS = dA\). Substitute the surface's own equation into the integrand first; half the time the integral becomes a constant times an area.
3 · Orientation and flux
To integrate a vector field through a surface you must decide which way is “through”. An oriented surface has a chosen unit normal \(\mathbf{n}\) at every point, varying continuously. For a closed surface the convention is outward. For a graph \(z = g(x,y)\) it is usually upward (positive \(\mathbf{k}\)-component). A Möbius strip cannot be oriented at all — it has only one side.
The flux of the electric field out of any closed surface equals the enclosed charge over \(\varepsilon_0\): \(\oiint_S\mathbf{E}\cdot d\mathbf{S} = Q_{\text{enc}}/\varepsilon_0\). For a point charge, \(\mathbf{E} = \dfrac{q}{4\pi\varepsilon_0}\dfrac{\hat{\mathbf r}}{r^2}\) and the flux through a sphere of radius \(a\) is \(\dfrac{q}{4\pi\varepsilon_0 a^2}\cdot 4\pi a^2 = q/\varepsilon_0\), independent of \(a\) — the \(1/r^2\) falloff exactly cancels the \(r^2\) growth of area. The lab below lets you verify that the same flux comes through a cube, a can, or a sphere, as long as the origin is inside.
Flux through a surface
Pick a surface and a field. Short arrows mark the surface normals, coloured green where the field goes out through the surface (\(\mathbf{F}\cdot\mathbf{n} > 0\)) and amber where it goes in. The flux is computed numerically. For closed surfaces the readout also shows \(\iiint\nabla\cdot\mathbf{F}\,dV\) over the inside — Section 5 says they must agree. Try: rotational field, any closed surface (zero flux — the field only circulates); inverse-square, sphere then cube (both \(4\pi\)); uniform field, hemisphere then disk (equal, because the two share a boundary and the field has no divergence).
Drag to orbit. Normals: green = field leaving, amber = field entering, grey = tangent.
| Face | Flux |
|---|
4 · Stokes' theorem
Three things follow:
- The surface does not matter. Any two surfaces with the same boundary give the same flux of \(\nabla\times\mathbf{F}\). So replace an awkward surface by a flat disk with the same rim — the lab below does exactly this with four caps.
- A closed surface has no boundary, so \(\oiint(\nabla\times\mathbf{F})\cdot d\mathbf{S} = 0\) over any closed surface. That is \(\nabla\cdot(\nabla\times\mathbf{F}) = 0\) in integral form.
- If \(\nabla\times\mathbf{F} = \mathbf{0}\) on a simply connected region, every loop integral vanishes — the conservative test of Unit 5, now proved.
Faraday's law: the EMF around a loop equals minus the rate of change of magnetic flux through it, \(\oint_C\mathbf{E}\cdot d\mathbf{r} = -\dfrac{d}{dt}\iint_S\mathbf{B}\cdot d\mathbf{S}\). Apply Stokes to the left side: \(\iint_S(\nabla\times\mathbf{E})\cdot d\mathbf{S} = -\iint_S\dfrac{\partial\mathbf{B}}{\partial t}\cdot d\mathbf{S}\). This holds for every surface \(S\), which is only possible if the integrands are equal: \(\nabla\times\mathbf{E} = -\partial\mathbf{B}/\partial t\). A changing magnetic field gives the electric field curl — which is why the induced \(\mathbf{E}\) has no potential and why KVL fails around a transformer core.
Stokes checker: one boundary, four caps
The orange circle is \(C\), the unit circle in the \(xy\)-plane traversed counterclockwise seen from above. Each cap has that circle as its boundary and is oriented upward, as the right-hand rule requires. The lab computes both sides of Stokes' theorem numerically: the circulation of \(\mathbf{F}\) around \(C\), and the flux of \(\nabla\times\mathbf{F}\) through whichever cap you choose. Switch caps — the flux of the curl does not change, because the boundary did not.
Drag to orbit. Orange: the boundary and \(\mathbf{F}\) along it. Violet: \(\nabla\times\mathbf{F}\) on the cap.
5 · The divergence theorem
Close it. If you need the flux through an open bowl, add the flat lid, apply the divergence theorem to the closed bowl-plus-lid, and subtract the (usually trivial) flux through the lid. This is often far easier than parametrising the bowl.
\(\oiint_S\mathbf{E}\cdot d\mathbf{S} = \dfrac{1}{\varepsilon_0}\iiint_E\rho\,dV\) for every closed surface. Divergence theorem on the left: \(\iiint_E\nabla\cdot\mathbf{E}\,dV = \iiint_E\dfrac{\rho}{\varepsilon_0}\,dV\) for every \(E\), hence \(\nabla\cdot\mathbf{E} = \rho/\varepsilon_0\). Charge density is the divergence of the electric field. The same argument with \(\mathbf{B}\), whose flux out of any closed surface is zero, gives \(\nabla\cdot\mathbf{B} = 0\).
Charge conservation is the same move: current out of a closed surface equals the rate of decrease of charge inside, \(\oiint\mathbf{J}\cdot d\mathbf{S} = -\dfrac{d}{dt}\iiint\rho\,dV\), so \(\nabla\cdot\mathbf{J} = -\partial\rho/\partial t\) — the continuity equation. Kirchhoff's current law is this equation at a node.
6 · Maxwell's equations — the payoff
Every theorem in this course says the same sentence: the integral of a derivative over a region equals the integral of the function over the boundary. Here is the full family.
| Theorem | Region | Boundary | Statement |
|---|---|---|---|
| Fundamental theorem of calculus | interval \([a,b]\) | two endpoints | \(\int_a^b f'(x)\,dx = f(b) - f(a)\) |
| FT for line integrals | curve \(C\) | two endpoints | \(\int_C \nabla f\cdot d\mathbf{r} = f(B) - f(A)\) |
| Green's theorem | plane region \(D\) | closed curve \(\partial D\) | \(\oint_{\partial D} \mathbf{F}\cdot d\mathbf{r} = \iint_D (Q_x - P_y)\,dA\) |
| Stokes' theorem | surface \(S\) | closed curve \(\partial S\) | \(\oint_{\partial S} \mathbf{F}\cdot d\mathbf{r} = \iint_S (\nabla\times\mathbf{F})\cdot d\mathbf{S}\) |
| Divergence theorem | solid \(E\) | closed surface \(\partial E\) | \(\oiint_{\partial E} \mathbf{F}\cdot d\mathbf{S} = \iiint_E \nabla\cdot\mathbf{F}\,dV\) |
And the four laws of electromagnetism, in both forms, with the theorem that connects them:
| Law | Integral form | Theorem | Differential form | Says |
|---|---|---|---|---|
| Gauss (electric) | \(\oiint\mathbf{E}\cdot d\mathbf{S} = \dfrac{Q_{\text{enc}}}{\varepsilon_0}\) | Divergence | \(\nabla\cdot\mathbf{E} = \dfrac{\rho}{\varepsilon_0}\) | Charges are the sources of \(\mathbf{E}\). |
| Gauss (magnetic) | \(\oiint\mathbf{B}\cdot d\mathbf{S} = 0\) | Divergence | \(\nabla\cdot\mathbf{B} = 0\) | No magnetic charges; \(\mathbf{B}\) lines close on themselves. |
| Faraday | \(\oint\mathbf{E}\cdot d\mathbf{r} = -\dfrac{d\Phi_B}{dt}\) | Stokes | \(\nabla\times\mathbf{E} = -\dfrac{\partial\mathbf{B}}{\partial t}\) | Changing \(\mathbf{B}\) curls \(\mathbf{E}\). Generators, transformers, induction. |
| Ampère–Maxwell | \(\oint\mathbf{B}\cdot d\mathbf{r} = \mu_0 I_{\text{enc}} + \mu_0\varepsilon_0\dfrac{d\Phi_E}{dt}\) | Stokes | \(\nabla\times\mathbf{B} = \mu_0\mathbf{J} + \mu_0\varepsilon_0\dfrac{\partial\mathbf{E}}{\partial t}\) | Currents and changing \(\mathbf{E}\) curl \(\mathbf{B}\). Motors, antennas, light. |
7 · Worked examples
1. Surface area of a paraboloid cap
Find the area of the part of \(z = x^2 + y^2\) below \(z = 4\).
Graph over the disk \(x^2+y^2\le4\): \(g_x = 2x\), \(g_y = 2y\), so the stretch factor is \(\sqrt{1 + 4x^2 + 4y^2} = \sqrt{1 + 4r^2}\). Polar, obviously.
Check: larger than the flat disk of radius 2 (area \(4\pi \approx 12.6\)) — a tilted surface always has more area than its shadow — and smaller than the cylinder of radius 2 and height 4 that contains it (\(16\pi \approx 50\)). ✓ The \(r\) from \(dA\) is what made the substitution \(u = 1 + 4r^2\) work.
2. Flux through a hemisphere, directly
Find the flux of \(\mathbf{F} = \langle x, y, z\rangle\) upward through the hemisphere \(z = \sqrt{a^2 - x^2 - y^2}\).
Parametrise with spherical angles, \(\mathbf{r}(\theta,\phi) = \langle a\sin\phi\cos\theta,\ a\sin\phi\sin\theta,\ a\cos\phi\rangle\), \(0\le\phi\le\pi/2\).
(This order gives the outward normal — it is a positive multiple of the position vector. Check with one point: at the north pole it is \(\langle 0,0,a^2\sin\phi\rangle\), upward. ✓)
Check with the divergence theorem: close the hemisphere with the disk \(z = 0\). \(\nabla\cdot\mathbf{F} = 3\), so flux out of the closed half-ball is \(3\cdot\tfrac23\pi a^3 = 2\pi a^3\). Flux through the flat bottom (outward normal \(-\mathbf{k}\)) is \(\iint (-z)\,dA = 0\) since \(z = 0\) there. So the hemisphere alone carries \(2\pi a^3\). ✓
3. Divergence theorem on a cube
Find the outward flux of \(\mathbf{F} = \langle x^2, y^2, z^2\rangle\) through the cube \(0\le x, y, z\le 1\).
Six faces by hand, or one triple integral:
By faces, for comparison: on \(x = 1\) (normal \(+\mathbf{i}\)), flux \(= \iint x^2\,dA = 1\); on \(x = 0\), \(x^2 = 0\) so flux 0. Same for \(y\) and \(z\). Total \(1 + 1 + 1 = 3\). ✓ Note the cube preset in the flux lab shows each face separately.
4. Stokes' theorem: replace a surface by its boundary
Evaluate \(\iint_S (\nabla\times\mathbf{F})\cdot d\mathbf{S}\) where \(\mathbf{F} = \langle y, -x, z^2 e^{z}\rangle\) and \(S\) is the paraboloid \(z = 4 - x^2 - y^2\), \(z\ge0\), oriented upward.
Computing the curl and parametrising the paraboloid is possible but slow. Stokes: the boundary is the circle \(x^2 + y^2 = 4\), \(z = 0\), counterclockwise from above. On it \(z = 0\), so the third component of \(\mathbf{F}\) never contributes.
Check: \((\nabla\times\mathbf{F})_z = \partial_x(-x) - \partial_y(y) = -2\), and through the flat disk of radius 2 that gives \(-2\cdot4\pi = -8\pi\). ✓ Same boundary, same answer, whichever cap you use — the lab's Paraboloid and Flat disk with the \(\langle -y, x, 0\rangle\) field are this example with the sign reversed.
5. Stokes' theorem the other way: a loop integral as a flux
Evaluate \(\oint_C \mathbf{F}\cdot d\mathbf{r}\) for \(\mathbf{F} = \langle -y^2, x, z^2\rangle\), where \(C\) is the intersection of the plane \(y + z = 2\) with the cylinder \(x^2 + y^2 = 1\), counterclockwise from above.
The curve is a tilted ellipse — parametrising it and integrating is messy. Use the flat piece of the plane inside the cylinder as \(S\).
\(S\) is the graph \(z = 2 - y\) over the disk \(D: x^2+y^2\le1\), upward. Using the graph formula with \(g_x = 0\), \(g_y = -1\), \(R = 1 + 2y\):
The \(2y\) integrates to zero over the disk by symmetry. Only the curl's \(z\)-component survived, because \(\mathbf{r}_x\times\mathbf{r}_y = \langle 0, 1, 1\rangle\) and the curl had no \(y\)-component.
6. Gauss's law for a uniformly charged ball, both forms
A ball of radius \(a\) carries uniform charge density \(\rho_0\). Find \(\mathbf{E}\) inside and outside, and verify \(\nabla\cdot\mathbf{E} = \rho/\varepsilon_0\).
Integral form. By symmetry \(\mathbf{E} = E(r)\,\hat{\mathbf{r}}\). Take a Gaussian sphere of radius \(r\); the flux is \(E(r)\cdot4\pi r^2\).
- Outside (\(r > a\)): \(Q_{\text{enc}} = \tfrac43\pi a^3\rho_0\), so \(E = \dfrac{\rho_0 a^3}{3\varepsilon_0 r^2}\) — a point charge's field.
- Inside (\(r < a\)): \(Q_{\text{enc}} = \tfrac43\pi r^3\rho_0\), so \(E = \dfrac{\rho_0 r}{3\varepsilon_0}\) — grows linearly from zero at the centre.
Differential form, inside. \(\mathbf{E} = \dfrac{\rho_0}{3\varepsilon_0}\langle x, y, z\rangle\), so \(\nabla\cdot\mathbf{E} = \dfrac{\rho_0}{3\varepsilon_0}(1 + 1 + 1) = \dfrac{\rho_0}{\varepsilon_0}\). ✓
Outside. \(\mathbf{E}\propto\hat{\mathbf{r}}/r^2\), and the divergence of the inverse-square field is zero away from the origin (as the flux lab shows: same \(4\pi\) through every enclosing surface, so nothing is added in between). \(\nabla\cdot\mathbf{E} = 0 = \rho/\varepsilon_0\) outside the ball. ✓ Both forms of the law, one charge distribution, full agreement.
Checklist
- I can parametrise the standard surfaces and compute \(\mathbf{r}_u\times\mathbf{r}_v\).
- I know \(dS = |\mathbf{r}_u\times\mathbf{r}_v|\,du\,dv\) for scalar integrals and \(d\mathbf{S} = (\mathbf{r}_u\times\mathbf{r}_v)\,du\,dv\) for flux — no absolute value in the second.
- I check the orientation of \(\mathbf{r}_u\times\mathbf{r}_v\) against what the problem asks, and flip if needed.
- I can state Stokes' theorem with matching orientations and use it to swap a surface for another with the same boundary, or for the boundary itself.
- I reach for the divergence theorem on any closed surface, and close open surfaces with a lid when it helps.
- I can derive \(\nabla\cdot\mathbf{E} = \rho/\varepsilon_0\) from Gauss's law and \(\nabla\times\mathbf{E} = -\partial_t\mathbf{B}\) from Faraday's law, and say which theorem each step used.
- I can write all four Maxwell equations in both forms.