MathLabs

Analysis

Vector calculus

Differentiation and integration of vector fields: divergence, curl, and the integral theorems relating them.

IntuitionFields that swirl and spread: intuition for divergence and curl

Picture the velocity of flowing water at every point in space: this is a vector field F(x,y,z)\mathbf{F}(x,y,z), an arrow attached to each point that tells you the direction and speed of the flow there. Two simple questions about F\mathbf{F} turn out to control almost everything in electromagnetism and fluid dynamics: does the flow spread outward from a point like water gushing from a source, or does it swirl around an axis like a whirlpool? The first tendency is measured by the divergence ∇⋅F\nabla \cdot \mathbf{F}, a scalar telling you the net rate at which flow is created (positive) or destroyed (negative) at each point; the second is measured by the curl ∇×F\nabla \times \mathbf{F}, a vector pointing along the local axis of rotation, whose length is the rate of spin.

Interactive 3D plot of a saddle-shaped scalar potential surface, used to illustrate a gradient vector field with zero divergence and zero curl.
A saddle-shaped potential φ(x,y)=x2−y2\varphi(x,y) = x^2 - y^2: its gradient field F=∇φ=(2x,−2y)\mathbf{F} = \nabla \varphi = (2x, -2y) has divergence 00 and curl 00 everywhere, a special "harmonic" case where the flow neither spreads nor swirls, only redirects along the saddle's slopes.

UndergraduateFormal definitions: divergence, curl, and the boundary integral theorems

Definition: Divergence of a vector field

For a differentiable vector field F=(F1,F2,F3)\mathbf{F} = (F_1, F_2, F_3) on R3\mathbb{R}^3, the divergence ∇⋅F\nabla \cdot \mathbf{F} is the scalar function measuring the net outward flux per unit volume at each point: intuitively, div⁡F(p)>0\operatorname{div}\mathbf{F}(p) > 0 means an infinitesimal ball around pp is a net source of flow, while div⁡F(p)<0\operatorname{div}\mathbf{F}(p) < 0 means it is a net sink.

∇⋅F=∂F1∂x+∂F2∂y+∂F3∂z\nabla \cdot \mathbf{F} = \frac{\partial F_1}{\partial x} + \frac{\partial F_2}{\partial y} + \frac{\partial F_3}{\partial z}

The curl ∇×F\nabla \times \mathbf{F} measures rotation instead: if you dip a tiny paddle wheel into the flow at a point and orient its axis along ∇×F(p)\nabla \times \mathbf{F}(p), the wheel spins the fastest, with angular speed proportional to ∣∇×F(p)∣|\nabla \times \mathbf{F}(p)|. A field with ∇×F=0\nabla \times \mathbf{F} = \mathbf{0} everywhere is called irrotational (or conservative, if also defined on a simply connected region), and it is exactly the fields that arise as a gradient F=∇φ\mathbf{F} = \nabla \varphi of some scalar potential φ\varphi.

∇×F=(∂F3∂y−∂F2∂z, ∂F1∂z−∂F3∂x, ∂F2∂x−∂F1∂y)\nabla \times \mathbf{F} = \left( \frac{\partial F_3}{\partial y} - \frac{\partial F_2}{\partial z},\ \frac{\partial F_1}{\partial z} - \frac{\partial F_3}{\partial x},\ \frac{\partial F_2}{\partial x} - \frac{\partial F_1}{\partial y} \right)
The three boundary integral theorems of vector calculus
TheoremDomain and its boundaryIntegral identity
Green's theoremPlanar region DD, boundary curve ∂D\partial D∮∂D(P dx+Q dy)=∬D(∂Q∂x−∂P∂y)dA\oint_{\partial D} (P\,dx + Q\,dy) = \iint_D \left(\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}\right) dA
Stokes' theoremSurface SS in space, boundary curve ∂S\partial S∮∂SF⋅dr=∬S(∇×F)⋅dS\oint_{\partial S} \mathbf{F} \cdot d\mathbf{r} = \iint_S (\nabla \times \mathbf{F}) \cdot d\mathbf{S}
Divergence theorem (Gauss)Solid region VV in space, boundary surface ∂V\partial V∬∂VF⋅dS=∭V(∇⋅F) dV\iint_{\partial V} \mathbf{F} \cdot d\mathbf{S} = \iiint_V (\nabla \cdot \mathbf{F})\,dV

UndergraduateCore theorems: Green's theorem and the Divergence theorem

Let D⊂R2D \subset \mathbb{R}^2 be a region with positively oriented, piecewise-smooth boundary curve ∂D\partial D, and let P(x,y)P(x,y) and Q(x,y)Q(x,y) have continuous partial derivatives on an open region containing DD. Then ∮∂D(P dx+Q dy)=∬D(∂Q∂x−∂P∂y)dA\oint_{\partial D} (P\,dx + Q\,dy) = \iint_D \left(\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}\right) dA.

Why is it true?

The right side sums the local 'circulation density' ∂Q∂x−∂P∂y\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y} (the 2D curl) over every point of DD; the interior circulations of adjacent tiny cells cancel along their shared edges, leaving only the circulation along the outer boundary ∂D\partial D.

Proof

First prove it for a rectangle R=[a,b]×[c,d]R = [a,b]\times[c,d] with D=RD = R. By Fubini's theorem, ∬R∂Q∂x dA=∫cd(Q(b,y)−Q(a,y))dy\iint_R \frac{\partial Q}{\partial x}\,dA = \int_c^d \left(Q(b,y) - Q(a,y)\right) dy and ∬R∂P∂y dA=∫ab(P(x,d)−P(x,c))dx\iint_R \frac{\partial P}{\partial y}\,dA = \int_a^b \left(P(x,d) - P(x,c)\right) dx.

These are exactly the line integrals of Q dyQ\,dy along the right and left edges of RR and of P dxP\,dx along the top and bottom edges, so ∬R(∂Q∂x−∂P∂y)dA=∮∂R(P dx+Q dy)\iint_R \left(\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}\right) dA = \oint_{\partial R} (P\,dx + Q\,dy), matching the theorem for a rectangle.

For a general region DD, approximate it by a fine grid of small rectangles covering DD. Apply the rectangle case to each small piece and sum over all pieces. Every interior edge shared by two adjacent pieces is traversed once in each direction by the two pieces' boundaries, so the two line integral contributions along that shared edge cancel exactly.

What remains after cancellation is precisely the line integral around the outer boundary ∂D\partial D, while the sum of the double integrals over the small rectangles converges to ∬D(∂Q∂x−∂P∂y)dA\iint_D \left(\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}\right) dA as the grid is refined, proving the identity for DD.

Let V⊂R3V \subset \mathbb{R}^3 be a solid region with outward-oriented, piecewise-smooth boundary surface ∂V\partial V, and let F\mathbf{F} have continuous partial derivatives on an open region containing VV. Then ∬∂VF⋅dS=∭V(∇⋅F) dV\iint_{\partial V} \mathbf{F} \cdot d\mathbf{S} = \iiint_V (\nabla \cdot \mathbf{F})\,dV.

Why is it true?

Just as in Green's theorem, the volume integral of divergence sums up the local 'net outflow per unit volume' over every tiny box inside VV; the outflow across faces shared by adjacent boxes cancels, leaving only the flux across the outer boundary ∂V\partial V.

Proof

First prove it for a rectangular box B=[a1,b1]×[a2,b2]×[a3,b3]B = [a_1,b_1]\times[a_2,b_2]\times[a_3,b_3] with V=BV = B, where F=(F1,F2,F3)\mathbf{F} = (F_1, F_2, F_3). By Fubini's theorem, ∭B∂F1∂x dV=∬(F1(b1,y,z)−F1(a1,y,z))dy dz\iiint_B \frac{\partial F_1}{\partial x}\,dV = \iint \left(F_1(b_1,y,z) - F_1(a_1,y,z)\right) dy\,dz, and analogous identities hold for the yy- and zz-derivative terms.

Each right-hand side is exactly the outward flux of the corresponding component of F\mathbf{F} through a pair of opposite faces of BB, with the outward normal pointing along the positive or negative coordinate direction on each face. Summing the three coordinate contributions gives ∭B(∇⋅F) dV=∬∂BF⋅dS\iiint_B (\nabla \cdot \mathbf{F})\,dV = \iint_{\partial B} \mathbf{F} \cdot d\mathbf{S}.

For a general solid region VV, approximate it by a fine grid of small rectangular boxes filling VV. Apply the box case to each box and sum over all boxes. Every interior face shared by two adjacent boxes has outward normals pointing in opposite directions on the two sides, so the corresponding flux contributions across that shared face cancel exactly.

The remaining, uncancelled flux is precisely through the outer boundary surface ∂V\partial V, while the sum of volume integrals over the small boxes converges to ∭V(∇⋅F) dV\iiint_V (\nabla \cdot \mathbf{F})\,dV as the grid is refined, establishing the identity for VV.

UndergraduateReal-World Applications and Worked Examples

Divergence, curl, and the boundary integral theorems are the mathematical backbone of classical field theory: Maxwell's equations of electromagnetism are stated entirely in terms of ∇⋅E\nabla \cdot \mathbf{E}, ∇⋅B\nabla \cdot \mathbf{B}, ∇×E\nabla \times \mathbf{E}, and ∇×B\nabla \times \mathbf{B}; fluid dynamics uses the Divergence theorem to derive the continuity equation for mass conservation and identifies incompressible flow with ∇⋅F=0\nabla \cdot \mathbf{F} = 0; and aerospace engineering applies Stokes' theorem to relate the circulation of airflow around an airfoil (lift) to the vorticity ∇×F\nabla \times \mathbf{F} inside the boundary layer.

Example: Verifying the Divergence theorem for a radial field on a sphere

Let F(x,y,z)=(x,y,z)\mathbf{F}(x,y,z) = (x,y,z) and let SS be the sphere x2+y2+z2=a2x^2+y^2+z^2=a^2 of radius aa, oriented outward, enclosing the ball VV. Verify the Divergence theorem ∬SF⋅dS=∭V(∇⋅F) dV\iint_S \mathbf{F} \cdot d\mathbf{S} = \iiint_V (\nabla \cdot \mathbf{F})\,dV by computing both sides directly.

Solution

Compute the right-hand side first: ∇⋅F=∂x∂x+∂y∂y+∂z∂z=1+1+1=3\nabla \cdot \mathbf{F} = \frac{\partial x}{\partial x} + \frac{\partial y}{\partial y} + \frac{\partial z}{\partial z} = 1+1+1 = 3, a constant. So ∭V(∇⋅F) dV=3⋅vol⁡(V)=3⋅43πa3=4πa3\iiint_V (\nabla \cdot \mathbf{F})\,dV = 3 \cdot \operatorname{vol}(V) = 3 \cdot \frac{4}{3}\pi a^3 = 4\pi a^3.

Now compute the left-hand side directly. On the sphere SS, the outward unit normal is n=1a(x,y,z)\mathbf{n} = \frac{1}{a}(x,y,z), since the position vector itself points radially outward and has length aa on SS. So F⋅n=1a(x2+y2+z2)=a2a=a\mathbf{F} \cdot \mathbf{n} = \frac{1}{a}(x^2+y^2+z^2) = \frac{a^2}{a} = a.

Since F⋅n=a\mathbf{F} \cdot \mathbf{n} = a is constant over SS, the flux integral is simply this constant times the surface area: ∬SF⋅dS=a⋅area⁡(S)=a⋅4πa2=4πa3\iint_S \mathbf{F} \cdot d\mathbf{S} = a \cdot \operatorname{area}(S) = a \cdot 4\pi a^2 = 4\pi a^3, matching the volume integral exactly.

Example: Computing area with Green's theorem

Let CC be the unit circle x2+y2=1x^2+y^2=1 traversed counterclockwise. Use Green's theorem with P=−yP=-y, Q=xQ=x to verify the area formula area⁡(D)=12∮C(x dy−y dx)\operatorname{area}(D) = \frac{1}{2}\oint_C (x\,dy - y\,dx) for the unit disk DD.

Solution

With P=−yP=-y and Q=xQ=x, Green's theorem gives ∮C(−y dx+x dy)=∬D(∂x∂x−∂(−y)∂y)dA=∬D(1−(−1)) dA=2∬DdA=2area⁡(D)\oint_C (-y\,dx + x\,dy) = \iint_D \left(\frac{\partial x}{\partial x} - \frac{\partial(-y)}{\partial y}\right) dA = \iint_D (1 - (-1))\,dA = 2\iint_D dA = 2\operatorname{area}(D).

Compute the line integral directly by parametrizing CC as x=cos⁡θx=\cos\theta, y=sin⁡θy=\sin\theta for θ∈[0,2π]\theta \in [0, 2\pi], so dx=−sin⁡θ dθdx = -\sin\theta\,d\theta and dy=cos⁡θ dθdy = \cos\theta\,d\theta: ∮C(−y dx+x dy)=∫02π(sin⁡2θ+cos⁡2θ)dθ=∫02π1 dθ=2π\oint_C (-y\,dx + x\,dy) = \int_0^{2\pi} \left(\sin^2\theta + \cos^2\theta\right) d\theta = \int_0^{2\pi} 1\,d\theta = 2\pi.

Since area⁡(D)=π\operatorname{area}(D) = \pi for the unit disk, the double-integral side gives 2area⁡(D)=2π2\operatorname{area}(D) = 2\pi, which matches the directly computed line integral 2π2\pi exactly, confirming Green's theorem and the area formula area⁡(D)=12∮C(x dy−y dx)\operatorname{area}(D) = \frac{1}{2}\oint_C (x\,dy - y\,dx).

Compute the divergence ∇⋅F\nabla \cdot \mathbf{F} of F(x,y,z)=(x2,y2,z2)\mathbf{F}(x,y,z) = (x^2, y^2, z^2) at the point (1,1,1)(1,1,1).

Compute the curl ∇×F\nabla \times \mathbf{F} of the rotational field F(x,y,z)=(y,−x,0)\mathbf{F}(x,y,z) = (y,-x,0).

At a point where ∇⋅F>0\nabla \cdot \mathbf{F} > 0 for a fluid's velocity field F\mathbf{F}, what is happening physically?

Which theorem relates a surface integral of ∇×F\nabla \times \mathbf{F} over an open surface SS to a line integral around its boundary curve ∂S\partial S?

References

  1. Jerrold E. Marsden, Anthony J. Tromba (2012). Vector Calculus
  2. H. M. Schey (2005). Div, Grad, Curl, and All That: An Informal Text on Vector Calculus
  3. Tom M. Apostol (1969). Calculus, Vol. 2: Multi-Variable Calculus and Linear Algebra with Applications