Stokes' and Divergence Theorems

A fluid swirls through a wire loop bent into a saddle shape. A magnetic field pierces a bowl-shaped membrane spanning that loop. How does the circulation of the fluid around the wire relate to the flow of "spin" through the bowl? Separately, consider a gas expanding inside a lumpy balloon. How does the amount of gas leaking through the balloon's skin relate to how much the gas is expanding at each interior point? These two questions seem to concern totally different physical setups. Yet they are answered by the same piece of mathematics wearing two different costumes: Stokes' theorem and the divergence theorem. Both results are vast generalizations of Green's Theorem. Green's theorem related a line integral around a plane curve to a double integral over the enclosed region. The leap from Green's theorem to Stokes' and divergence theorems is a leap in dimension. It is also a leap in geometric imagination. Curves become surfaces, and planar regions become solid regions in space. The boundary of a two-dimensional patch becomes a genuinely three-dimensional object living in a curved surface. The unifying insight is one instance of a deep principle. That principle states: "the integral of a derivative over a domain equals the integral of the original quantity over the domain's boundary." This single idea powers the Fundamental Theorem of Calculus, Green's theorem, Stokes' theorem, and the divergence theorem all at once. Why does this matter beyond aesthetics? Stokes' theorem is the rigorous backbone of Maxwell's equations in integral form. It explains why a changing magnetic flux induces an electromotive force around a loop (Faraday's law). The divergence theorem underlies continuity equations in fluid dynamics. It also underlies the derivation of Gauss's law in electrostatics, and heat-diffusion equations in engineering. In pure mathematics, both theorems are the first steps toward de Rham cohomology. This machinery measures how "holes" in a space obstruct the existence of potentials. That obstruction is already visible in the study of Conservative Fields and Potentials. This article builds the calculus needed to state these theorems precisely. It covers surface integrals, orientation of surfaces and their boundaries, curl, and divergence. It proves both theorems from first principles, via Change of Variables and the Jacobian and Green's theorem. It also works through concrete asymmetric examples showing the machinery in action. These examples include the delicate bookkeeping of orientation that most treatments gloss over.

Key takeaways
  • Stokes' theorem: the circulation of a vector field around the boundary of an oriented surface equals the flux of its curl through the surface.
  • The divergence theorem: the flux of a vector field out of a closed surface equals the integral of its divergence over the enclosed solid.
  • Both generalize Green's theorem, which is really the flat, planar case of each.
  • Orientation is not optional bookkeeping — it is half of the theorem's content; get it backward and every sign flips.
  • Surface integrals of vector fields require a chosen unit normal; surface area/scalar integrals do not.
  • Key idea: integrating a "derivative" (curl, divergence) over a region equals integrating the original field over the region's boundary — one theorem, three names.

Where this lives today

Stokes' theorem is the mathematical content of Faraday's law of induction and Ampère's law in Maxwell's equations, both of which relate a curl (a local rotational rate of a field) to a circulation around a loop — this is precisely how integral-form electromagnetism is taught in physics. The divergence theorem is the rigorous version of Gauss's law relating electric flux through a closed surface to enclosed charge, and it underlies the derivation of the heat equation and the continuity equation in fluid dynamics (mass conservation: ∂tρ+∇⋅(ρv)=0\partial_t\rho + \nabla\cdot(\rho\mathbf{v}) = 0 is derived by applying the divergence theorem to an arbitrary control volume). In computer graphics and computational geometry, discretized versions of Stokes' theorem underlie mesh-based flux computations and are the basis of discrete exterior calculus. In probability and PDE theory, the divergence theorem is the key tool converting boundary-value problems into weak/variational formulations (integration by parts in several variables, essential to the theory of Sobolev spaces and finite element methods). Both theorems are the first two nontrivial instances of the generalized Stokes' theorem for differential forms, ∫Mdω=∫∂Mω\int_M d\omega = \int_{\partial M}\omega, which unifies the Fundamental Theorem of Calculus, Green's theorem, Stokes' theorem, and the divergence theorem into a single statement in the language of manifolds and exterior derivatives.

Ask the tutor: How do Stokes' and the divergence theorem generalize further to differential forms on manifolds, and what exactly is the "generalized Stokes' theorem"?

DefinitionOriented surfaces, surface integrals, curl, and divergence

Let S⊂R3S \subset \mathbb{R}^3 be a piecewise smooth parametrized surface, meaning there is a map

r:D→R3,r(u,v)=(x(u,v),y(u,v),z(u,v)),\mathbf{r} : D \to \mathbb{R}^3, \qquad \mathbf{r}(u,v) = (x(u,v), y(u,v), z(u,v)),

where D⊂R2D \subset \mathbb{R}^2 is a region bounded by a piecewise smooth simple closed curve, r\mathbf{r} is C1C^1 on DD, and ru×rv≠0\mathbf{r}_u \times \mathbf{r}_v \neq \mathbf{0} except possibly on a set of measure zero (allowing finitely many singular curves/points, e.g. the pole of a sphere).

Orientation. An orientation of SS is a continuous choice of unit normal vector n(P)\mathbf{n}(P) at each point P∈SP \in S. For a parametrized surface this is given by

n=ru×rv∥ru×rv∥.\mathbf{n} = \frac{\mathbf{r}_u \times \mathbf{r}_v}{\lVert \mathbf{r}_u \times \mathbf{r}_v \rVert}.

If SS is the boundary of a solid region Ω\Omega, the outward orientation chooses n\mathbf{n} pointing away from Ω\Omega at every point.

Surface integral of a scalar function f:S→Rf: S \to \mathbb{R}:

∬Sf dA=∬Df(r(u,v)) ∥ru×rv∥ du dv.\iint_S f\, dA = \iint_D f(\mathbf{r}(u,v)) \, \lVert \mathbf{r}_u \times \mathbf{r}_v \rVert \, du\, dv.

Surface integral of a vector field (flux), for F:S→R3\mathbf{F}: S \to \mathbb{R}^3 continuous and SS oriented by n\mathbf{n}:

∬SF⋅dS:=∬S(F⋅n) dA=∬DF(r(u,v))⋅(ru×rv) du dv.\iint_S \mathbf{F} \cdot d\mathbf{S} := \iint_S (\mathbf{F} \cdot \mathbf{n}) \, dA = \iint_D \mathbf{F}(\mathbf{r}(u,v)) \cdot (\mathbf{r}_u \times \mathbf{r}_v) \, du\, dv.

Boundary orientation (right-hand rule). If SS has a boundary curve ∂S\partial S, its induced orientation is the one such that, walking along ∂S\partial S with your head pointing along n\mathbf{n}, the surface SS lies to your left. Equivalently, if DD's boundary ∂D\partial D is oriented counterclockwise, then ∂S=r(∂D)\partial S = \mathbf{r}(\partial D) inherits its orientation from that of ∂D\partial D under r\mathbf{r}.

Curl and divergence. For F=(P,Q,R)\mathbf{F} = (P,Q,R) a C1C^1 vector field on an open set in R3\mathbb{R}^3,

curl⁡F=∇×F=(∂R∂y−∂Q∂z, ∂P∂z−∂R∂x, ∂Q∂x−∂P∂y),\operatorname{curl} \mathbf{F} = \nabla \times \mathbf{F} = \left( \frac{\partial R}{\partial y} - \frac{\partial Q}{\partial z},\ \frac{\partial P}{\partial z} - \frac{\partial R}{\partial x},\ \frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y} \right),
div⁡F=∇⋅F=∂P∂x+∂Q∂y+∂R∂z.\operatorname{div} \mathbf{F} = \nabla \cdot \mathbf{F} = \frac{\partial P}{\partial x} + \frac{\partial Q}{\partial y} + \frac{\partial R}{\partial z}.

Intuition

Think of div⁡F(P)\operatorname{div}\mathbf{F}(P) as the net outflow rate per unit volume at PP: if you shrink a small ball around PP to a point, div⁡F(P)\operatorname{div}\mathbf{F}(P) is the limit of (flux out of the ball)/(volume of the ball). Positive divergence means PP is a source; negative means a sink. The divergence theorem says: sum up all the tiny local outflows throughout a solid Ω\Omega, and the interior contributions cancel wherever fluid passes from one infinitesimal cell into its neighbor — only the outflow through the outer skin ∂Ω\partial \Omega survives, because that's the only place flow isn't immediately reabsorbed by an adjacent cell. Curl works the same way but measures rotation. curl⁡F(P)⋅n\operatorname{curl}\mathbf{F}(P) \cdot \mathbf{n} is the limit of (circulation of F\mathbf{F} around a tiny loop with normal n\mathbf{n} centered at PP)/(area enclosed), as the loop shrinks. Stokes' theorem tiles a big surface SS with tiny oriented patches; adjacent patches share an edge traversed in opposite directions, so all interior edge-contributions cancel in pairs, leaving only the outer boundary ∂S\partial S. What remains is exactly the sum of the (curl · normal)-contributions from every patch — the surface integral of the curl.

Figure
Tiling a surface: interior edges cancel, leaving only the boundary circulation
Surface S tiled by small oriented cells shared edge: cancels with neighbor ∂S: only the outer edge survives ∮∂S F·dr = ∬S (curl F)·n dA

Intuition, continued: divergence as outflow density

Figure
Divergence theorem: local outflow sums to total flux through the boundary
Solid Ω, tiled by small boxes; interior faces cancel outflow in = outflow out (cancels) flux through ∂Ω survives ∬∂Ω F·dS = ∭Ω div F dV
TheoremStokes' Theorem

Let SS be a piecewise smooth, oriented surface in R3\mathbb{R}^3 with unit normal n\mathbf{n}, parametrized by r:D→R3\mathbf{r}: D \to \mathbb{R}^3 on a region DD whose boundary ∂D\partial D is a piecewise smooth simple closed curve traversed counterclockwise. Suppose SS's boundary ∂S=r(∂D)\partial S = \mathbf{r}(\partial D) is a piecewise smooth simple closed curve, given the induced (right-hand-rule) orientation. Let F\mathbf{F} be a C1C^1 vector field on an open subset of R3\mathbb{R}^3 containing SS. Then

∮∂SF⋅dr=∬S(∇×F)⋅dS.\oint_{\partial S} \mathbf{F} \cdot d\mathbf{r} = \iint_S (\nabla \times \mathbf{F}) \cdot d\mathbf{S}.
Proof

Technique: reduce to Green's theorem via the change-of-variables/pullback of the line and surface integrals, then a direct componentwise computation. Write F=(P,Q,R)\mathbf{F} = (P, Q, R) and r(u,v)=(x(u,v),y(u,v),z(u,v))\mathbf{r}(u,v) = (x(u,v), y(u,v), z(u,v)), all C1C^1 (we treat the smooth case; piecewise smooth follows by summing over pieces, since both sides of the claimed identity are additive over a decomposition of SS into finitely many smooth pieces whose shared internal boundary curves are traversed in opposite directions by adjacent pieces and hence cancel — this is exactly the cancellation used in Green's theorem for regions with holes or unions of simple regions).

Step 1: Reduce the line integral over ∂S\partial S to a line integral over ∂D\partial D. By definition of the line integral of a vector field along a parametrized curve, and since ∂S=r(∂D)\partial S = \mathbf{r}(\partial D) with the induced orientation matching r\mathbf{r} applied to the counterclockwise orientation of ∂D\partial D,

∮∂SF⋅dr=∮∂DF(r(u,v))⋅(xu du+xv dv, yu du+yv dv, zu du+zv dv)\oint_{\partial S} \mathbf{F} \cdot d\mathbf{r} = \oint_{\partial D} \mathbf{F}(\mathbf{r}(u,v)) \cdot \big(x_u\, du + x_v\, dv,\ y_u\, du + y_v\, dv,\ z_u\, du + z_v\, dv\big)
=∮∂D[(Pxu+Qyu+Rzu) du+(Pxv+Qyv+Rzv) dv].= \oint_{\partial D} \Big[ (P x_u + Q y_u + R z_u)\, du + (P x_v + Q y_v + R z_v)\, dv \Big].

Call the integrand's coefficient of dudu as A(u,v):=Pxu+Qyu+RzuA(u,v) := P x_u + Q y_u + R z_u and the coefficient of dvdv as B(u,v):=Pxv+Qyv+RzvB(u,v) := P x_v + Q y_v + R z_v, so the right side is ∮∂D(A du+B dv)\oint_{\partial D} (A\, du + B\, dv).

Step 2: Apply Green's theorem in the (u,v)(u,v)-plane. Since ∂D\partial D is a piecewise smooth simple closed curve oriented counterclockwise and A,BA, B are C1C^1 functions of (u,v)(u,v) (as compositions and products of C1C^1 functions, using that P,Q,RP,Q,R are C1C^1 and x,y,zx,y,z are C1C^1), Green's Theorem applies directly:

∮∂D(A du+B dv)=∬D(∂B∂u−∂A∂v)du dv.\oint_{\partial D} (A\, du + B\, dv) = \iint_D \left( \frac{\partial B}{\partial u} - \frac{\partial A}{\partial v} \right) du\, dv.

Step 3: Compute Bu−AvB_u - A_v and show it equals (∇×F)⋅(ru×rv)(\nabla \times \mathbf{F}) \cdot (\mathbf{r}_u \times \mathbf{r}_v). Differentiate using the chain rule, remembering P,Q,RP,Q,R are functions of (x,y,z)=r(u,v)(x,y,z) = \mathbf{r}(u,v):

Bu=∂∂u(Pxv+Qyv+Rzv)=(Pxxu+Pyyu+Pzzu)xv+Pxvu+(similarly for Q,R terms).B_u = \frac{\partial}{\partial u}(P x_v + Q y_v + R z_v) = (P_x x_u + P_y y_u + P_z z_u) x_v + P x_{vu} + (\text{similarly for } Q,R \text{ terms}).

Carrying this out fully for all three terms of BB and subtracting the analogous expansion of AvA_v, every second-derivative term (PxuvP x_{uv}, etc.) is symmetric in u,vu,v (since x,y,z∈C2x,y,z \in C^2 is not even needed if we only assume r∈C1\mathbf{r}\in C^1 and work formally — in fact for the standard proof one assumes r∈C2\mathbf{r} \in C^2 so mixed partials are equal by Clairaut's theorem) and cancels between BuB_u and AvA_v. What survives is exactly:

Bu−Av=(Ry−Qz)(yuzv−zuyv)+(Pz−Rx)(zuxv−xuzv)+(Qx−Py)(xuyv−yuxv).B_u - A_v = (R_y - Q_z)(y_u z_v - z_u y_v) + (P_z - R_x)(z_u x_v - x_u z_v) + (Q_x - P_y)(x_u y_v - y_u x_v).

The right side is precisely the dot product

(∇×F)⋅(ru×rv),(\nabla \times \mathbf{F}) \cdot (\mathbf{r}_u \times \mathbf{r}_v),

since ru×rv=(yuzv−zuyv, zuxv−xuzv, xuyv−yuxv)\mathbf{r}_u \times \mathbf{r}_v = (y_u z_v - z_u y_v,\ z_u x_v - x_u z_v,\ x_u y_v - y_u x_v) and ∇×F=(Ry−Qz,Pz−Rx,Qx−Py)\nabla \times \mathbf{F} = (R_y - Q_z, P_z - R_x, Q_x - P_y) by definition. This is verified by direct expansion of the dot product, term by term, matching each of the three products above.

Step 4: Recognize the surface integral of the curl. By definition of the flux integral,

∬S(∇×F)⋅dS=∬D(∇×F)(r(u,v))⋅(ru×rv) du dv=∬D(Bu−Av) du dv.\iint_S (\nabla \times \mathbf{F}) \cdot d\mathbf{S} = \iint_D (\nabla \times \mathbf{F})(\mathbf{r}(u,v)) \cdot (\mathbf{r}_u \times \mathbf{r}_v) \, du\, dv = \iint_D (B_u - A_v)\, du\, dv.

Conclusion. Chaining Steps 1–4,

∮∂SF⋅dr=∮∂D(A du+B dv)=∬D(Bu−Av) du dv=∬S(∇×F)⋅dS.\oint_{\partial S} \mathbf{F} \cdot d\mathbf{r} = \oint_{\partial D}(A\,du + B\,dv) = \iint_D (B_u - A_v)\, du\, dv = \iint_S (\nabla\times\mathbf{F})\cdot d\mathbf{S}.

For a piecewise smooth SS built from finitely many smooth patches S1,…,SkS_1,\dots,S_k glued along curves, apply the above to each SiS_i and sum; each internal gluing curve is traversed twice with opposite orientation by the induced orientations of adjacent patches (by consistency of the right-hand rule across the gluing), so those line integral contributions cancel, leaving exactly ∮∂S\oint_{\partial S} over the true outer boundary. ■\blacksquare

∎
TheoremThe Divergence Theorem (Gauss's Theorem)

Let Ω⊂R3\Omega \subset \mathbb{R}^3 be a bounded solid region whose boundary ∂Ω\partial \Omega is a piecewise smooth closed surface, oriented outward. Suppose Ω\Omega is zz-simple, yy-simple, and xx-simple (i.e. it is simultaneously expressible as a region between two graphs over the xyxy-, xzxz-, and yzyz-planes respectively; more generally, suppose Ω\Omega can be partitioned into finitely many such regions). Let F=(P,Q,R)\mathbf{F} = (P,Q,R) be a C1C^1 vector field on an open set containing Ω‾\overline{\Omega}. Then

∬∂ΩF⋅dS=∭Ω(∇⋅F) dV.\iint_{\partial \Omega} \mathbf{F} \cdot d\mathbf{S} = \iiint_\Omega (\nabla \cdot \mathbf{F})\, dV.
Proof

Technique: reduce to three separate one-variable applications of the Fundamental Theorem of Calculus via Fubini's theorem, exactly as Green's theorem is proved for simple regions, then patch together via additivity for the general (piecewise-simple) case. By linearity of both sides in F=(P,Q,R)\mathbf{F} = (P,Q,R), it suffices to prove the three separate identities

∬∂ΩR k⋅dS=∭ΩRz dV,∬∂ΩQ j⋅dS=∭ΩQy dV,∬∂ΩP i⋅dS=∭ΩPx dV,\iint_{\partial\Omega} R\,\mathbf{k}\cdot d\mathbf{S} = \iiint_\Omega R_z\, dV, \qquad \iint_{\partial\Omega} Q\,\mathbf{j}\cdot d\mathbf{S} = \iiint_\Omega Q_y\, dV, \qquad \iint_{\partial\Omega} P\,\mathbf{i}\cdot d\mathbf{S} = \iiint_\Omega P_x\, dV,

and add them. We prove the first; the other two are identical after permuting coordinate names.

Step 1: Use zz-simplicity. Since Ω\Omega is zz-simple, write

Ω={(x,y,z):(x,y)∈D, ϕ1(x,y)≤z≤ϕ2(x,y)}\Omega = \{ (x,y,z) : (x,y) \in D,\ \phi_1(x,y) \le z \le \phi_2(x,y) \}

for some region DD in the xyxy-plane and C1C^1 functions ϕ1≤ϕ2\phi_1 \le \phi_2. The boundary ∂Ω\partial\Omega then consists of: the top S2={z=ϕ2(x,y)}S_2 = \{z = \phi_2(x,y)\} with outward normal pointing upward-ish, the bottom S1={z=ϕ1(x,y)}S_1 = \{z=\phi_1(x,y)\} with outward normal pointing downward-ish, and a lateral part S0S_0 (possibly empty) consisting of vertical line segments (where the boundary of DD is traced with zz ranging over [ϕ1,ϕ2][\phi_1,\phi_2]), on which the outward normal is horizontal, so k⋅n=0\mathbf{k}\cdot\mathbf{n} = 0 there.

Step 2: Compute the right side by Fubini and the Fundamental Theorem of Calculus.

∭ΩRz dV=∬D(∫ϕ1(x,y)ϕ2(x,y)Rz(x,y,z) dz)dx dy=∬D[R(x,y,ϕ2(x,y))−R(x,y,ϕ1(x,y))] dx dy,\iiint_\Omega R_z\, dV = \iint_D \left( \int_{\phi_1(x,y)}^{\phi_2(x,y)} R_z(x,y,z)\, dz \right) dx\, dy = \iint_D \Big[ R(x,y,\phi_2(x,y)) - R(x,y,\phi_1(x,y)) \Big]\, dx\, dy,

using the Fundamental Theorem of Calculus in the innermost integral (valid since RR is C1C^1, so RzR_z is continuous in zz for fixed (x,y)(x,y)), and Fubini's theorem to justify iterating the triple integral as an iterated double-then-single integral (valid since RzR_z is continuous on the bounded region Ω\Omega, hence integrable).

Step 3: Compute the left side directly. Parametrize S2S_2 by (x,y)↦(x,y,ϕ2(x,y))(x,y) \mapsto (x,y,\phi_2(x,y)) over DD. Then rx×ry=(−∂xϕ2,−∂yϕ2,1)\mathbf{r}_x \times \mathbf{r}_y = (-\partial_x\phi_2, -\partial_y\phi_2, 1), which has positive zz-component, matching the outward (upward) orientation on the top. So

∬S2R k⋅dS=∬DR(x,y,ϕ2(x,y))⋅1 dx dy.\iint_{S_2} R\,\mathbf{k}\cdot d\mathbf{S} = \iint_D R(x,y,\phi_2(x,y)) \cdot 1 \, dx\, dy.

Parametrize S1S_1 the same way by (x,y)↦(x,y,ϕ1(x,y))(x,y)\mapsto(x,y,\phi_1(x,y)); this gives normal (−∂xϕ1,−∂yϕ1,1)(-\partial_x\phi_1,-\partial_y\phi_1,1) with positive zz-component, but the outward normal on the bottom surface points downward, so the outward-oriented flux is the negative of the one computed from this parametrization:

∬S1R k⋅dS=−∬DR(x,y,ϕ1(x,y)) dx dy.\iint_{S_1} R\,\mathbf{k}\cdot d\mathbf{S} = -\iint_D R(x,y,\phi_1(x,y))\, dx\, dy.

On the lateral surface S0S_0, the outward unit normal is horizontal (its zz-component is 00, since the lateral surface is generated by moving vertically along the boundary of DD), so k⋅n=0\mathbf{k}\cdot\mathbf{n} = 0 pointwise and

∬S0R k⋅dS=0.\iint_{S_0} R\,\mathbf{k}\cdot d\mathbf{S} = 0.

Summing,

∬∂ΩR k⋅dS=∬S2+∬S1+∬S0=∬D[R(x,y,ϕ2(x,y))−R(x,y,ϕ1(x,y))] dx dy.\iint_{\partial\Omega} R\,\mathbf{k}\cdot d\mathbf{S} = \iint_{S_2} + \iint_{S_1} + \iint_{S_0} = \iint_D \Big[ R(x,y,\phi_2(x,y)) - R(x,y,\phi_1(x,y)) \Big]\, dx\, dy.

Step 4: Conclude. Comparing Steps 2 and 3, both equal the same double integral over DD, so

∬∂ΩR k⋅dS=∭ΩRz dV.\iint_{\partial\Omega} R\,\mathbf{k}\cdot d\mathbf{S} = \iiint_\Omega R_z\, dV.

By the symmetric argument using yy-simplicity and xx-simplicity of Ω\Omega (relabeling coordinates), the analogous identities hold for QjQ\mathbf{j} and PiP\mathbf{i}. Adding all three:

∬∂ΩF⋅dS=∬∂Ω(Pi+Qj+Rk)⋅dS=∭Ω(Px+Qy+Rz) dV=∭Ω∇⋅F dV.\iint_{\partial\Omega} \mathbf{F}\cdot d\mathbf{S} = \iint_{\partial\Omega}(P\mathbf{i}+Q\mathbf{j}+R\mathbf{k})\cdot d\mathbf{S} = \iiint_\Omega (P_x+Q_y+R_z)\, dV = \iiint_\Omega \nabla\cdot\mathbf{F}\, dV.

General Ω\Omega. If Ω\Omega is only piecewise-simple, partition it into finitely many simple pieces Ω1,…,Ωm\Omega_1,\dots,\Omega_m (each simultaneously xx-, yy-, zz-simple) glued along shared internal boundary surfaces. Apply the identity to each piece and sum. Each internal gluing surface receives opposite outward normals from the two adjacent pieces (since "outward from Ωi\Omega_i" is "inward to Ωj\Omega_j" on their shared face), so those flux contributions cancel in pairs, and the sum of the volume integrals is ∭Ω∇⋅F dV\iiint_\Omega \nabla\cdot\mathbf{F}\,dV by additivity of the integral over the partition. What remains on the left is exactly ∬∂ΩF⋅dS\iint_{\partial\Omega}\mathbf{F}\cdot d\mathbf{S}. ■\blacksquare

∎
CorollaryGreen's theorem as the flat special case

If S⊂R3S \subset \mathbb{R}^3 is a flat region DD in the xyxy-plane, oriented by n=k\mathbf{n} = \mathbf{k}, and F=(P(x,y),Q(x,y),0)\mathbf{F} = (P(x,y), Q(x,y), 0), then ∇×F=(0,0,Qx−Py)\nabla\times\mathbf{F} = (0,0,Q_x - P_y), and Stokes' theorem reduces exactly to

∮∂DP dx+Q dy=∬D(Qx−Py) dA,\oint_{\partial D} P\,dx + Q\,dy = \iint_D (Q_x - P_y)\, dA,

which is Green's Theorem. Similarly, taking Ω\Omega to be a cylinder D×[0,1]D \times [0,1] collapsed appropriately and F\mathbf{F} independent of zz recovers Green's theorem as a planar flux statement from the divergence theorem, confirming both are genuine 3D generalizations of the same 2D result.

Worked examples

Example 1 (Stokes' theorem, a non-planar, non-symmetric boundary curve). Let F(x,y,z)=(yz, xz+x2, xy−z3)\mathbf{F}(x,y,z) = (yz,\, xz + x^2,\, xy - z^3), and let SS be the portion of the paraboloid z=4−x2−y2z = 4 - x^2 - y^2 lying above the plane z=0z=0, oriented with upward-pointing normal (i.e., the normal with positive zz-component). We compute ∮∂SF⋅dr\oint_{\partial S} \mathbf{F}\cdot d\mathbf{r} using Stokes' theorem. Curl. ∇×F=(∂y(xy−z3)−∂z(xz+x2), ∂z(yz)−∂x(xy−z3), ∂x(xz+x2)−∂y(yz))\nabla\times\mathbf{F} = (\partial_y(xy-z^3) - \partial_z(xz+x^2),\ \partial_z(yz) - \partial_x(xy-z^3),\ \partial_x(xz+x^2) - \partial_y(yz))

=(x−x, y−y, (z+2x)−z)=(0,0,2x).= (x - x,\ y - y,\ (z+2x) - z) = (0, 0, 2x).

Setting up the flux integral. Parametrize SS by (x,y)↦(x,y,4−x2−y2)(x,y)\mapsto(x, y, 4-x^2-y^2) over D={x2+y2≤4}D = \{x^2+y^2\le 4\} (the boundary circle of radius 22, where z=0z=0). Then rx×ry=(2x,2y,1)\mathbf{r}_x\times\mathbf{r}_y = (2x, 2y, 1), which has positive zz-component — matching the required upward orientation. So

∬S(∇×F)⋅dS=∬D(0,0,2x)⋅(2x,2y,1) dA=∬D2x dA.\iint_S (\nabla\times\mathbf{F})\cdot d\mathbf{S} = \iint_D (0,0,2x)\cdot(2x,2y,1)\, dA = \iint_D 2x\, dA.

Since DD is the disk of radius 2 centered at the origin — symmetric under x→−xx \to -x — and the integrand 2x2x is odd in xx, this integral is 00:

∬D2x dx dy=0.\iint_D 2x\, dx\, dy = 0.

Conclusion. By Stokes' theorem,

∮∂SF⋅dr=0.\oint_{\partial S} \mathbf{F}\cdot d\mathbf{r} = 0.

As a sanity check, one could verify directly: ∂S\partial S is the circle x=2cos⁡t,y=2sin⁡t,z=0x=2\cos t, y = 2\sin t, z=0, t∈[0,2π]t\in[0,2\pi], traversed counterclockwise (matching upward normal by the right-hand rule). There, F=(0,4cos⁡2t,4cos⁡tsin⁡t)\mathbf{F} = (0, 4\cos^2 t, 4\cos t\sin t) since z=0z=0 on this curve simplifies yz=0yz=0 and xz=0xz=0. With dr=(−2sin⁡t,2cos⁡t,0) dtd\mathbf{r} = (-2\sin t, 2\cos t, 0)\,dt,

F⋅dr=0⋅(−2sin⁡t)+4cos⁡2t⋅2cos⁡t dt+0=8cos⁡3t dt,\mathbf{F}\cdot d\mathbf{r} = 0\cdot(-2\sin t) + 4\cos^2 t \cdot 2\cos t\,dt + 0 = 8\cos^3 t\, dt,

and ∫02π8cos⁡3t dt=0\int_0^{2\pi} 8\cos^3 t \, dt = 0 since cos⁡3\cos^3 integrates to zero over a full period. This confirms the value 00 independently.

Example 2 (Divergence theorem, an asymmetric solid). Let F(x,y,z)=(x3, y3+xz2, 3z+x2y)\mathbf{F}(x,y,z) = (x^3,\, y^3 + xz^2,\, 3z + x^2y), and let Ω\Omega be the solid bounded below by z=0z=0 and above by z=1−x2−y2z = 1 - x^2 - y^2 (a paraboloid cap sitting on the disk x2+y2≤1x^2+y^2\le 1). Compute the total outward flux ∬∂ΩF⋅dS\iint_{\partial\Omega}\mathbf{F}\cdot d\mathbf{S}. Divergence.

∇⋅F=3x2+(3y2+0)+3=3x2+3y2+3.\nabla\cdot\mathbf{F} = 3x^2 + (3y^2 + 0) + 3 = 3x^2 + 3y^2 + 3.

(The cross-terms xz2xz^2 and x2yx^2 y do not survive differentiation in their own variable: ∂y(y3+xz2)=3y2\partial_y(y^3+xz^2) = 3y^2, and ∂z(3z+x2y)=3\partial_z(3z+x^2y) = 3.) Volume integral via cylindrical coordinates. Ω={(r,θ,z):0≤r≤1, 0≤θ≤2π, 0≤z≤1−r2}\Omega = \{(r,\theta,z) : 0\le r\le 1,\ 0\le\theta\le 2\pi,\ 0\le z\le 1-r^2\}, and ∇⋅F=3r2+3\nabla\cdot\mathbf{F} = 3r^2+3. So

∭Ω(3x2+3y2+3) dV=∫02π∫01∫01−r2(3r2+3) r dz dr dθ.\iiint_\Omega (3x^2+3y^2+3)\,dV = \int_0^{2\pi}\int_0^1 \int_0^{1-r^2} (3r^2+3)\, r\, dz\, dr\, d\theta.

Integrate over zz first: ∫01−r2dz=1−r2\int_0^{1-r^2} dz = 1-r^2. So the integral becomes

2π∫01(3r2+3)(1−r2) r dr=2π∫01(3r3+3r−3r5−3r3)dr=2π∫01(3r−3r5) dr.2\pi \int_0^1 (3r^2+3)(1-r^2)\, r\, dr = 2\pi\int_0^1 \left(3r^3 + 3r - 3r^5 - 3r^3\right) dr = 2\pi\int_0^1 (3r - 3r^5)\, dr.

(Notice the 3r33r^3 terms cancel exactly.) Then

∫01(3r−3r5) dr=[3r22−r62]01=32−12=1.\int_0^1 (3r - 3r^5)\, dr = \left[\frac{3r^2}{2} - \frac{r^6}{2}\right]_0^1 = \frac{3}{2} - \frac{1}{2} = 1.

So

∭Ω∇⋅F dV=2π⋅1=2π.\iiint_\Omega \nabla\cdot\mathbf{F}\, dV = 2\pi \cdot 1 = 2\pi.

By the divergence theorem, ∬∂ΩF⋅dS=2π\iint_{\partial\Omega}\mathbf{F}\cdot d\mathbf{S} = 2\pi — computed entirely without parametrizing the two boundary pieces (the disk at z=0z=0 and the curved cap) separately, illustrating the theorem's real computational power: a genuinely three-piece flux computation collapses to a single triple integral.

CounterexampleWhy F\mathbf{F} must be C1C^1 (or at least defined and smooth) on all of SS — a punctured domain breaks the divergence theorem

Consider F(x,y,z)=(x,y,z)(x2+y2+z2)3/2\mathbf{F}(x,y,z) = \dfrac{(x,y,z)}{(x^2+y^2+z^2)^{3/2}}, the inverse-square field, which is C1C^1 on R3∖{0}\mathbb{R}^3 \setminus \{\mathbf{0}\} but undefined (and blows up) at the origin. A direct computation shows ∇⋅F=0\nabla\cdot\mathbf{F} = 0 at every point where F\mathbf{F} is defined (this is the standard fact that the inverse-square field is divergence-free away from its singularity). Let Ω\Omega be the solid ball of radius 11 centered at the origin, so ∂Ω\partial\Omega is the unit sphere with outward normal n=(x,y,z)\mathbf{n} = (x,y,z) (since on the unit sphere, the outward unit normal is the position vector). Then on ∂Ω\partial\Omega,

F⋅n=(x,y,z)⋅(x,y,z)1=x2+y2+z2=1,\mathbf{F}\cdot\mathbf{n} = \frac{(x,y,z)\cdot(x,y,z)}{1} = x^2+y^2+z^2 = 1,

so

∬∂ΩF⋅dS=∬∂Ω1 dA=4π(surface area of the unit sphere).\iint_{\partial\Omega} \mathbf{F}\cdot d\mathbf{S} = \iint_{\partial\Omega} 1\, dA = 4\pi \quad (\text{surface area of the unit sphere}).

If we naively applied the divergence theorem to Ω\Omega (the full solid ball), we would compute ∭Ω∇⋅F dV=∭Ω0 dV=0\iiint_\Omega \nabla\cdot\mathbf{F}\, dV = \iiint_\Omega 0\, dV = 0, giving the false conclusion 4π=04\pi = 0. The resolution: F\mathbf{F} is not C1C^1 on an open set containing Ω‾\overline{\Omega} — it isn't even defined at the origin, which lies inside Ω\Omega — so the hypothesis of the divergence theorem fails, and the theorem simply does not apply. This is exactly the field appearing in Gauss's law for a point charge; the "missing" flux 4π4\pi is entirely accounted for by the singularity at the origin, which is why electrostatics textbooks are careful to state Gauss's law with a source term (a Dirac delta) precisely at such singular points.

Scope, edge cases & common traps

SituationWhat to watch for
Choosing orientation of ∂S\partial SMust match SS's normal via the right-hand rule; reversing SS's normal reverses ∂S\partial S's direction and flips the sign of both sides.
Surface with several boundary components (e.g. an annular patch)Each boundary circle needs its own induced orientation; the "outer" and "inner" boundary curves are traversed in opposite senses (as in Green's theorem for regions with holes).
Applying the divergence theorem with a vector field singular inside Ω\OmegaThe theorem fails outright (see counterexample); must exclude a small ball around the singularity and integrate over the resulting region, tracking the extra inner boundary.
Non-orientable surfaces (Möbius band)Stokes' theorem as stated does not apply — no continuous global choice of normal exists, so "∂S\partial S with induced orientation" cannot be defined.
Confusing dSd\mathbf{S} (vector, needs orientation) with dAdA (scalar, orientation-independent)Only flux integrals (∬F⋅dS\iint \mathbf{F}\cdot d\mathbf{S}) depend on orientation; scalar surface integrals (∬f dA\iint f\, dA, e.g. surface area or mass) do not.

The mathematician behind it

Origins · 1 minGeorge Gabriel Stokes and how this was discovered
GG
George Gabriel Stokes
1819–1903 · Cambridge, mathematical physics and fluid dynamics

Stokes was a Cambridge-based mathematical physicist whose work spanned fluid dynamics (the Navier–Stokes equations bear his name), the theory of light, and the mathematics underlying what we now call vector calculus. The theorem bearing his name was actually communicated to him by Lord Kelvin in a letter and later set as a Smith's Prize examination question at Cambridge in 1854 — a fact so well documented that the result is sometimes wryly noted to be "Stokes' theorem" in the same sense that many theorems are named after the person who popularized rather than first proved them. The general divergence theorem, meanwhile, is independently associated with Mikhail Ostrogradsky, Carl Friedrich Gauss, and George Green, each of whom proved special cases in the 1820s–1830s while studying gravitation, electrostatics, and heat flow.

History
- 1813 — George Green begins developing potential theory in Nottingham, laying groundwork for what becomes Green's theorem.
- 1828 — Green publishes his essay on electricity and magnetism, containing an early special case of the divergence theorem.
- 1831 — Mikhail Ostrogradsky presents a general proof of the divergence theorem to the Paris Academy.
- 1839–41 — Gauss and others apply divergence-type identities systematically to electrostatics, cementing the name "Gauss's theorem."
- 1854 — Stokes sets his namesake theorem as a Smith's Prize problem at Cambridge, based on a result Kelvin had shown him in 1850.
Is Stokes' theorem the same as "the" Stokes' theorem for differential forms?

Not quite the same statement, but they're deeply related. The classical Stokes' theorem discussed here is a special, concrete case — surfaces and curves in R3\mathbb{R}^3 — of the general Stokes' theorem for differential forms on manifolds, ∫Mdω=∫∂Mω\int_M d\omega = \int_{\partial M} \omega. That general version also specializes to give Green's theorem, the divergence theorem, and even the Fundamental Theorem of Calculus, all as instances of one formula in the language of exterior derivatives and manifolds-with-boundary. The classical vector calculus version predates and motivates the general one; it is proved independently (as done above) using only multivariable calculus, without needing the machinery of differential forms.

Why does the divergence theorem require the boundary surface to be closed?

Divergence measures net local outflow, and a triple integral of divergence over a solid Ω\Omega only has a chance of matching a flux if that flux accounts for every direction fluid could leave Ω\Omega — which requires integrating over the entire boundary surface, with no gaps. If ∂Ω\partial\Omega were not closed (say, a surface with an open edge), fluid could "leak" through that missing edge without being counted, breaking the balance between local outflow and boundary flux. This is why the theorem is stated for ∂Ω\partial\Omega, the full topological boundary of a solid region — by construction, always a closed surface (or union of closed surfaces, e.g. for a solid with an internal cavity).

Do I need to check orientability of a surface before applying Stokes' theorem?

Yes — implicitly, this is a hypothesis of the theorem. Stokes' theorem as stated requires SS to have a continuous choice of unit normal, i.e. to be orientable. A Möbius band is the standard example of a non-orientable surface: it has only one "side," so no continuous normal field exists globally, and there is no well-defined notion of "the" induced boundary orientation compatible with a normal. In practice, every surface parametrized by a single C1C^1 map r:D→R3\mathbf{r}:D\to\mathbb{R}^3 with DD a planar region is automatically orientable (the formula ru×rv\mathbf{r}_u\times\mathbf{r}_v gives a continuous normal), so this hypothesis is usually satisfied without extra work — but it is worth knowing it is a genuine hypothesis, not a triviality.

How does the divergence theorem let us avoid parametrizing complicated surfaces?

As in Worked Example 2, if ∂Ω\partial\Omega consists of several pieces (a flat base plus a curved cap, say), computing the flux directly requires setting up and evaluating a separate surface integral for each piece, with its own parametrization and normal vector. The divergence theorem replaces all of that with a single triple integral of ∇⋅F\nabla\cdot\mathbf{F} over the solid Ω\Omega, often expressible in convenient coordinates (cylindrical, spherical) matched to the solid's shape rather than to any one piece of its boundary. This is frequently a dramatic simplification, especially when ∇⋅F\nabla\cdot\mathbf{F} turns out to be a simple polynomial, as in the worked example, versus the potentially messy vector algebra needed to integrate F\mathbf{F} directly over a curved cap.

What is the fastest way to remember which surface integral formula (scalar vs. flux) to use?

Ask what physical quantity you're computing. If it's something like area, mass, or "total value of ff spread over the surface" — with no directional meaning — you want the scalar surface integral ∬Sf dA\iint_S f\, dA, which needs no orientation at all. If it's a flow, current, or field passing through the surface — where direction matters, and reversing the surface's normal should flip the sign of the answer — you want the flux integral ∬SF⋅dS=∬S(F⋅n) dA\iint_S \mathbf{F}\cdot d\mathbf{S} = \iint_S(\mathbf{F}\cdot\mathbf{n})\,dA, which requires you to fix an orientation first.

Can Stokes' theorem or the divergence theorem be used to test whether a vector field is conservative or divergence-free?

Yes, in a useful indirect way. If F\mathbf{F} is a C1C^1 gradient field (F=∇f\mathbf{F} = \nabla f) on a simply connected domain, then ∇×F=0\nabla\times\mathbf{F} = \mathbf{0} identically (a fact proved directly from equality of mixed partials), so Stokes' theorem immediately forces ∮∂SF⋅dr=0\oint_{\partial S}\mathbf{F}\cdot d\mathbf{r} = 0 for every closed surface boundary ∂S\partial S in the domain — consistent with the path-independence property from Conservative Fields and Potentials. Conversely, computing a nonzero circulation for some loop certifies F\mathbf{F} is not conservative. The divergence theorem gives an analogous diagnostic for whether a field can be a curl of something (a "vector potential"): since ∇⋅(∇×G)=0\nabla\cdot(\nabla\times\mathbf{G}) = 0 always, a field with nonzero total flux out of some closed surface cannot be written globally as ∇×G\nabla\times\mathbf{G}.

Why do both theorems require the vector field to be C¹, not just continuous?

The proofs given here use partial derivatives of the components of F\mathbf{F} (to form curl and divergence) and rely on the Fundamental Theorem of Calculus and Green's theorem, both of which need those derivatives to exist and be continuous to justify differentiating under the integral sign and applying Fubini's theorem cleanly. Weaker hypotheses (e.g. F\mathbf{F} merely differentiable, or curl/divergence existing only in a distributional sense) do admit generalized versions of both theorems, but these require more delicate real-analysis machinery — such as Lebesgue integration and Sobolev space theory — well beyond the classical statement given here.

Before this