← Electricity & Magnetism
∇

Vector Calculus for EM

Electromagnetism is written in the language of vector calculus. Gauss's theorem relates the flux of a vector field through a closed surface to its divergence inside; Stokes's theorem relates the circulation around a closed loop to the curl inside. Mastering these theorems makes Maxwell's equations transparent.

Key Concepts

Gradient
∇f=(∂f/∂x)x^+(∂f/∂y)y^+(∂f/∂z)z^\nabla f=(\partial f/\partial x)\hat x+(\partial f/\partial y)\hat y+(\partial f/\partial z)\hat z points in the direction of steepest ascent of ff and has magnitude equal to the rate of increase. The electric field E⃗=−∇V\vec E=-\nabla V.
Divergence
∇⋅A⃗=∂Ax/∂x+∂Ay/∂y+∂Az/∂z\nabla\cdot\vec A=\partial A_x/\partial x+\partial A_y/\partial y+\partial A_z/\partial z measures the source strength per unit volume. ∇⋅E⃗=ρ/ε0\nabla\cdot\vec E=\rho/\varepsilon_0 (Gauss's law in differential form).
Curl
∇×A⃗\nabla\times\vec A measures the rotation per unit area. ∇×E⃗=−∂B⃗/∂t\nabla\times\vec E=-\partial\vec B/\partial t (Faraday's law in differential form). A conservative field has zero curl.
Stokes's & Gauss's Theorems
Gauss: ∮SA⃗⋅da⃗=∫V(∇⋅A⃗)dτ\oint_S \vec A\cdot d\vec a=\int_V(\nabla\cdot\vec A)d\tau. Stokes: ∮CA⃗⋅dl⃗=∫S(∇×A⃗)⋅da⃗\oint_C\vec A\cdot d\vec l=\int_S(\nabla\times\vec A)\cdot d\vec a. These connect differential to integral forms of Maxwell's equations.

Key Equations

Gauss's theorem
∮SA⃗⋅da⃗=∫V(∇⋅A⃗) dτ\oint_S \vec{A}\cdot d\vec{a} = \int_V (\nabla\cdot\vec{A})\,d\tau
Converts a surface integral to a volume integral.
Stokes's theorem
∮CA⃗⋅dl⃗=∫S(∇×A⃗)⋅da⃗\oint_C \vec{A}\cdot d\vec{l} = \int_S (\nabla\times\vec{A})\cdot d\vec{a}
Converts a line integral to a surface integral.
Helmholtz theorem
A⃗=−∇V+∇×W⃗\vec{A} = -\nabla V + \nabla\times\vec{W}
Any vector field is the sum of an irrotational and a solenoidal part.
Worked Example

Applying the Divergence Theorem

Problem

For the vector field A⃗=rr^\vec A=r\hat r in spherical coordinates (so Ar=rA_r=r), verify the divergence theorem over a sphere of radius RR.

Solution

Divergence: ∇⋅A⃗=(1/r2)∂(r2⋅r)/∂r=(1/r2)⋅3r2=3\nabla\cdot\vec A=(1/r^2)\partial(r^2\cdot r)/\partial r=(1/r^2)\cdot3r^2=3. Volume integral: ∫V3 dτ=3⋅(4πR3/3)=4πR3\int_V3\,d\tau=3\cdot(4\pi R^3/3)=4\pi R^3.

Surface integral: on sphere r=Rr=R, A⃗⋅da⃗=R⋅4πR2⋅dr/∣dr∣\vec A\cdot d\vec a=R\cdot4\pi R^2\cdot dr/|dr|... A⃗⋅r^=R\vec A\cdot\hat r=R, area element da=R2sin⁡θ dθ dϕda=R^2\sin\theta\,d\theta\,d\phi: ∮R da=R⋅4πR2=4πR3\oint R\,da=R\cdot4\pi R^2=4\pi R^3. ✓

Answer Both sides give 4πR34\pi R^3 — the theorem is verified.
Practice

Exercises

7 problems
1 of 7

Explore the gradient field of $f = x^2+y^2+z^2$. Arrows show how $\nabla f$ points uphill — radially outward, growing with $r$. Find |∇f| at the point (1, 2, 2).

gradient field
Explore test radius r |∇f| = 3.00

The gradient always points uphill — radially outward for f=r². Arrows get longer farther from origin since |∇f| = 2r.

|∇f| at (1,2,2)
|∇f| =

Formula: |∇f| = 2√(x²+y²+z²) = 2r

2 of 7

Watch the pulsing Gaussian box: more field exits each face than enters (field grows with position). Find ∇·A for $\vec A = (x, y, z)$.

divergence

Every grid point is a source — arrows get longer away from origin (A grows). The net outward flux per unit volume = divergence.

∇·A for A=(x,y,z)
∇·A =

Formula: ∇·A = ∂Ax/∂x + ∂Ay/∂y + ∂Az/∂z

3 of 7

For A⃗=yx^−xy^\vec A=y\hat x-x\hat y, find ∣∇×A⃗∣|\nabla\times\vec A|.

Unlock Exercise 3

Subscribe to PhysWeb Premium to access all exercises and track your progress.

4 of 7

The divergence theorem: for A⃗=rr^\vec A=r\hat r, ∇⋅A⃗=3\nabla\cdot\vec A=3. For a sphere of radius R=2.0R=2.0 m, find ∮A⃗⋅da⃗=3×(4πR3/3)\oint\vec A\cdot d\vec a=3\times(4\pi R^3/3) (in m³).

Unlock Exercise 4

Subscribe to PhysWeb Premium to access all exercises and track your progress.

5 of 7

The Laplacian of f=r2=x2+y2+z2f=r^2=x^2+y^2+z^2: ∇2f\nabla^2 f.

Unlock Exercise 5

Subscribe to PhysWeb Premium to access all exercises and track your progress.

6 of 7

For E⃗=−∇V\vec E=-\nabla V with V=5x2V=5x^2 (V in volts, x in m), find ExE_x (in V/m) at any xx.

Unlock Exercise 6

Subscribe to PhysWeb Premium to access all exercises and track your progress.

7 of 7

Stokes's theorem: A⃗=yx^\vec A=y\hat x. Integrate over a unit square in the xyxy-plane. ∮A⃗⋅dl⃗\oint\vec A\cdot d\vec l along the boundary = ?

Unlock Exercise 7

Subscribe to PhysWeb Premium to access all exercises and track your progress.

Key Takeaways

  • Gradient ∇f\nabla f points up the slope; divergence ∇⋅A⃗\nabla\cdot\vec A measures sources; curl ∇×A⃗\nabla\times\vec A measures rotation.
  • Gauss's theorem converts surface flux to volume integral of divergence.
  • Stokes's theorem converts loop circulation to surface integral of curl.
  • The Laplacian ∇2=∇⋅∇\nabla^2=\nabla\cdot\nabla appears in Poisson's equation ∇2V=−ρ/ε0\nabla^2 V=-\rho/\varepsilon_0.