Skip to main content

Gradient, Divergence, Curl, and Integral Theorems

Maxwell's equations use two dialects of vector calculus. The differential dialect describes what fields do at a point: divergence detects sources and sinks, curl detects local circulation, and gradient points in the direction of fastest scalar increase. The integral dialect describes accumulated behavior over paths, surfaces, and volumes: voltage, flux, circulation, and total enclosed charge or current.

The two dialects are equivalent when fields are sufficiently smooth, but each highlights different physics. Gauss's law is often easiest as a flux integral when symmetry is high; Faraday's law is often clearest as a circulation integral when a changing magnetic flux threads a loop. This page summarizes the tools used throughout applied electromagnetics and connects to vector differential calculus and vector integral calculus.

Four electric dipole configurations are drawn with dense field-line patterns.

Figure: Dipole field lines make superposition, potential gradients, and boundary intuition visible. Image: Wikimedia Commons, Geek3, CC BY-SA 4.0.

Definitions

For a scalar field V(x,y,z)V(x,y,z), the gradient is

V=Vxx^+Vyy^+Vzz^.\nabla V=\frac{\partial V}{\partial x}\hat x+\frac{\partial V}{\partial y}\hat y+\frac{\partial V}{\partial z}\hat z.

It points in the direction of maximum increase of VV. The directional derivative in direction a^\hat a is

dVdl=Va^.\frac{dV}{dl}=\nabla V\cdot\hat a.

For a vector field A=Axx^+Ayy^+Azz^\vec A=A_x\hat x+A_y\hat y+A_z\hat z, divergence is

A=Axx+Ayy+Azz.\nabla\cdot\vec A= \frac{\partial A_x}{\partial x} +\frac{\partial A_y}{\partial y} +\frac{\partial A_z}{\partial z}.

Divergence measures net outward flux density from an infinitesimal volume. Curl is

×A=x^y^z^/x/y/zAxAyAz.\nabla\times\vec A= \begin{vmatrix} \hat x & \hat y & \hat z\\ \partial/\partial x & \partial/\partial y & \partial/\partial z\\ A_x & A_y & A_z \end{vmatrix}.

Curl measures local circulation density. The Laplacian of a scalar is

2V=(V).\nabla^2 V=\nabla\cdot(\nabla V).

In Cartesian coordinates,

2V=2Vx2+2Vy2+2Vz2.\nabla^2 V= \frac{\partial^2 V}{\partial x^2} +\frac{\partial^2 V}{\partial y^2} +\frac{\partial^2 V}{\partial z^2}.

The gradient has units of "scalar units per meter." If VV is electric potential in volts, then V\nabla V has units V/m, matching electric field units. Divergence has units of "vector-field units per meter"; for D\vec D in C/m2^2, D\nabla\cdot\vec D has units C/m3^3, matching volume charge density. Curl also divides by length; for E\vec E in V/m, ×E\nabla\times\vec E has units V/m2^2, matching B/t-\partial\vec B/\partial t because tesla per second is equivalent to V/m2^2.

Line, surface, and volume integrals are respectively written

CAdl,SAdS,Vfdv.\int_C \vec A\cdot d\vec l,\qquad \int_S \vec A\cdot d\vec S,\qquad \int_V f\,dv.

Key results

The divergence theorem converts a closed-surface flux integral into a volume integral:

SAdS=VAdv.\oint_S \vec A\cdot d\vec S=\int_V \nabla\cdot\vec A\,dv.

Stokes's theorem converts a closed-path circulation integral into a surface integral of curl:

CAdl=S(×A)dS.\oint_C \vec A\cdot d\vec l=\int_S(\nabla\times\vec A)\cdot d\vec S.

The orientation matters: the direction of dSd\vec S and the positive traversal direction around CC are connected by the right-hand rule.

Three identities appear repeatedly in electromagnetics:

×(V)=0,\nabla\times(\nabla V)=0, (×A)=0,\nabla\cdot(\nabla\times\vec A)=0,

and

(fA)=fA+Af.\nabla\cdot(f\vec A)=f\nabla\cdot\vec A+\vec A\cdot\nabla f.

The first identity explains why electrostatic fields can be written as E=V\vec E=-\nabla V when ×E=0\nabla\times\vec E=0. The second identity explains why a magnetic flux density can be written as B=×A\vec B=\nabla\times\vec A because it automatically satisfies B=0\nabla\cdot\vec B=0.

The best way to remember the physical roles is by testing small regions. Divergence asks whether more field leaves a tiny closed surface than enters it. Curl asks whether the field tends to push a tiny paddle wheel into rotation. Gradient asks which direction a scalar increases fastest. These tests are qualitative, but they prevent many sign and operator mistakes when reading Maxwell's equations.

Integral theorems also clarify when local and global statements can be exchanged. If D=ρv\nabla\cdot\vec D=\rho_v everywhere inside a volume except at an isolated point charge, the point must be handled as a singular source or by enclosing it in a small surface. Smooth-field assumptions are often hidden in short derivations, but electromagnetic point sources and surface currents frequently create discontinuities that need boundary conditions.

Curvilinear coordinates change the formulas because the unit vectors and scale factors vary. For example, cylindrical divergence is

A=1ρρ(ρAρ)+1ρAϕϕ+Azz.\nabla\cdot\vec A= \frac{1}{\rho}\frac{\partial}{\partial \rho}(\rho A_\rho) +\frac{1}{\rho}\frac{\partial A_\phi}{\partial \phi} +\frac{\partial A_z}{\partial z}.

Spherical divergence is

A=1r2r(r2Ar)+1rsinθθ(Aθsinθ)+1rsinθAϕϕ.\nabla\cdot\vec A= \frac{1}{r^2}\frac{\partial}{\partial r}(r^2 A_r) +\frac{1}{r\sin\theta}\frac{\partial}{\partial\theta}(A_\theta\sin\theta) +\frac{1}{r\sin\theta}\frac{\partial A_\phi}{\partial\phi}.

These forms are not memorization trivia; they encode the expanding area of cylindrical and spherical shells.

One practical study method is to connect each operator to a limiting integral definition. Divergence is closed flux divided by small volume as the volume shrinks. Curl is circulation around a small loop divided by loop area as the loop shrinks. Gradient is the vector that makes dV=VdldV=\nabla V\cdot d\vec l for small displacement. These limiting ideas explain why the integral theorems are not separate facts pasted onto the differential formulas; they are the finite-region versions of the same local measurements.

Visual

OperatorInputOutputPhysical reading in EM
V\nabla VscalarvectorField from potential, steepest change
A\nabla\cdot\vec AvectorscalarSource density or flux expansion
×A\nabla\times\vec AvectorvectorCirculation density
2V\nabla^2 VscalarscalarCurvature, Poisson/Laplace equations
CAdl\oint_C\vec A\cdot d\vec lvector on pathscalarCirculation, voltage-like integral
SAdS\oint_S\vec A\cdot d\vec Svector on surfacescalarFlux through a closed surface

Worked example 1: Gradient and directional derivative

Problem: Let V(x,y,z)=3x2y+yz2V(x,y,z)=3x^2y+yz^2. Find V\nabla V at (1,2,1)(1,2,-1) and the directional derivative in the direction a^=(2x^+y^+2z^)/3\hat a=(2\hat x+\hat y+2\hat z)/3.

Step 1: Differentiate with respect to each coordinate:

Vx=6xy,Vy=3x2+z2,Vz=2yz.\begin{aligned} \frac{\partial V}{\partial x} &= 6xy,\\ \frac{\partial V}{\partial y} &= 3x^2+z^2,\\ \frac{\partial V}{\partial z} &= 2yz. \end{aligned}

Step 2: Evaluate at (1,2,1)(1,2,-1):

V=12x^+4y^4z^.\nabla V=12\hat x+4\hat y-4\hat z.

Step 3: Dot with a^\hat a:

dVdl=(12x^+4y^4z^)2x^+y^+2z^3.\frac{dV}{dl}=(12\hat x+4\hat y-4\hat z)\cdot \frac{2\hat x+\hat y+2\hat z}{3}.

Step 4: Compute:

dVdl=24+483=203.\frac{dV}{dl}=\frac{24+4-8}{3}=\frac{20}{3}.

Check: The maximum possible directional derivative is V=122+42+(4)2=13.3\vert \nabla V\vert =\sqrt{12^2+4^2+(-4)^2}=13.3, and 20/3=6.6720/3=6.67 is less than that.

Worked example 2: Verify the divergence theorem for a cube

Problem: For A=xx^+yy^+zz^\vec A=x\hat x+y\hat y+z\hat z, verify the divergence theorem over the cube 0x,y,za0\le x,y,z\le a.

Step 1: Compute divergence:

A=xx+yy+zz=3.\nabla\cdot\vec A= \frac{\partial x}{\partial x}+\frac{\partial y}{\partial y}+\frac{\partial z}{\partial z}=3.

Step 2: Integrate over the cube volume:

VAdv=0a0a0a3dxdydz=3a3.\int_V \nabla\cdot\vec A\,dv=\int_0^a\int_0^a\int_0^a 3\,dx\,dy\,dz=3a^3.

Step 3: Compute flux through faces. At x=ax=a, Ax^=a\vec A\cdot\hat x=a, so flux is aa2=a3a\cdot a^2=a^3. At x=0x=0, A(x^)=x=0\vec A\cdot(-\hat x)=-x=0, so flux is zero.

Step 4: By symmetry, the y=ay=a and z=az=a faces each contribute a3a^3, while the y=0y=0 and z=0z=0 faces contribute zero.

Step 5: Total closed-surface flux:

SAdS=a3+a3+a3=3a3.\oint_S\vec A\cdot d\vec S=a^3+a^3+a^3=3a^3.

Check: The surface and volume results agree, so the divergence theorem holds for this field and region.

Code

import sympy as sp

x, y, z = sp.symbols("x y z", real=True)
V = 3*x**2*y + y*z**2
grad_V = [sp.diff(V, var) for var in (x, y, z)]
point = {x: 1, y: 2, z: -1}
grad_at_point = [g.subs(point) for g in grad_V]

A = [x, y, z]
div_A = sum(sp.diff(Ai, var) for Ai, var in zip(A, (x, y, z)))

print("gradient =", grad_V)
print("gradient at point =", grad_at_point)
print("divergence =", sp.simplify(div_A))

Common pitfalls

  • Using Cartesian formulas in cylindrical or spherical problems without scale factors.
  • Forgetting that Stokes's theorem requires a consistent path direction and surface normal.
  • Treating \nabla like an ordinary vector in every algebraic context. It is a differential operator, so product rules matter.
  • Assuming zero divergence means zero field. It means no local net source, not no field.
  • Assuming zero curl means zero field. It means locally conservative in a simply connected region, not necessarily absent.
  • Applying integral theorems across singularities without isolating them. Point charges and line currents require care.
  • Treating a zero closed integral as proof that the integrand is zero everywhere. Cancellation over a path or surface can hide local structure unless the result holds for every possible region.

Connections