STEMviz
Physics · General Physics and Classical Mechanics

Vector Calculus for Physics (Gradient, Divergence and Curl)

The gradient of a scalar field points along its steepest increase, the divergence of a vector field measures flux per unit volume, and the curl measures circulation per unit area; the gradient, divergence and Stokes theorems invert these operators.

Vector Calculus for Physics (Gradient, Divergence and Curl)

Almost every field theory in physics — gravitation, electrostatics, magnetostatics, fluid flow, heat conduction — is written in the language of three differential operators acting on fields: the gradient, the divergence and the curl. This first chapter is a working course in that language. It assumes you can already differentiate and integrate functions of one variable and have met partial derivatives; it builds from there to the three operators, the three integral theorems that invert them, and the handful of identities that the rest of the course will use without comment.

The emphasis throughout is on what the mathematics means physically, in the manner of Griffiths' opening chapter. The gradient is not merely a vector of partial derivatives — it is the direction of steepest increase and encodes the whole local behaviour of a scalar field. The divergence is not a formula to memorise — it is the flux out of an infinitesimal box per unit volume, which is why it appears in every conservation law. The curl measures circulation per unit area, which is why it governs anything that rotates or induces.

How to read this chapter. Keep a page for the identities you derive (Section 6) and a page for the three fundamental theorems (Section 7). Everything in Blocks A–C is applied vector calculus; a derivation later that "just quotes Stokes" is quoting a result you should be able to state precisely from memory by the end of this chapter.

1. Scalar and Vector Fields

A scalar field assigns a single number to every point of space: the temperature T(r⃗)T(\vec{r}) in a room, the electrostatic potential V(r⃗)V(\vec{r}), the air pressure p(r⃗)p(\vec{r}). A vector field assigns a vector to every point: the velocity v⃗(r⃗)\vec{v}(\vec{r}) of a fluid, the electric field E⃗(r⃗)\vec{E}(\vec{r}), the gravitational field g⃗(r⃗)\vec{g}(\vec{r}).

In Cartesian coordinates we write r⃗=x x^+y y^+z z^\vec{r} = x\,\hat{x} + y\,\hat{y} + z\,\hat{z} and a vector field as

F⃗(x,y,z)=Fx(x,y,z) x^+Fy(x,y,z) y^+Fz(x,y,z) z^\vec{F}(x,y,z) = F_x(x,y,z)\,\hat{x} + F_y(x,y,z)\,\hat{y} + F_z(x,y,z)\,\hat{z}

The Cartesian unit vectors x^,y^,z^\hat{x},\hat{y},\hat{z} are constant — the same at every point — which is what makes Cartesian components easy to differentiate. The next chapter deals with the complication that polar and spherical basis vectors are not constant.

2. The Gradient: Steepest Ascent of a Scalar Field

Given a scalar field f(x,y,z)f(x,y,z), its gradient is the vector field

∇f=∂f∂x x^+∂f∂y y^+∂f∂z z^\nabla f = \frac{\partial f}{\partial x}\,\hat{x} + \frac{\partial f}{\partial y}\,\hat{y} + \frac{\partial f}{\partial z}\,\hat{z}

Its meaning comes from the multivariable chain rule. The change in ff produced by an infinitesimal displacement dr⃗=dx x^+dy y^+dz z^d\vec{r} = dx\,\hat{x} + dy\,\hat{y} + dz\,\hat{z} is

df=∂f∂x dx+∂f∂y dy+∂f∂z dz=∇f⋅dr⃗df = \frac{\partial f}{\partial x}\,dx + \frac{\partial f}{\partial y}\,dy + \frac{\partial f}{\partial z}\,dz = \nabla f \cdot d\vec{r}

Writing dr⃗=n^ dsd\vec{r} = \hat{n}\,ds for a step of length dsds in the direction n^\hat{n}, the directional derivative is dfds=∇f⋅n^=∣∇f∣cos⁡θ\dfrac{df}{ds} = \nabla f \cdot \hat{n} = |\nabla f|\cos\theta. This is largest when θ=0\theta = 0, so:

  • ∇f\nabla f points in the direction in which ff increases most rapidly;
  • ∣∇f∣|\nabla f| is that maximum rate of increase (the slope in the steepest direction);
  • ∇f\nabla f is perpendicular to the surfaces of constant ff (level surfaces), because moving along such a surface gives df=0df = 0, hence ∇f⋅dr⃗=0\nabla f \cdot d\vec{r} = 0.

Worked example — gradient of the radial distance. Let r=∣r⃗∣=x2+y2+z2r = |\vec{r}| = \sqrt{x^2+y^2+z^2}. Then ∂r∂x=xr\dfrac{\partial r}{\partial x} = \dfrac{x}{r} and similarly for y,zy,z, so

∇r=x x^+y y^+z z^r=r⃗r=r^\nabla r = \frac{x\,\hat{x} + y\,\hat{y} + z\,\hat{z}}{r} = \frac{\vec{r}}{r} = \hat{r}

The distance from the origin increases fastest as you move directly away from the origin, at unit rate — exactly as it must. A short extension: for any function g(r)g(r) of distance alone, the chain rule gives ∇g(r)=g′(r) r^\nabla g(r) = g'(r)\,\hat{r}, so ∇ ⁣(1r)=−1r2 r^\nabla\!\left(\dfrac{1}{r}\right) = -\dfrac{1}{r^2}\,\hat{r}. This single result — the gradient of the 1/r1/r potential of a point source — is why both the electrostatic and the gravitational field fall off as 1/r21/r^2.

3. The Del Operator

The three operators are unified by treating

∇≡x^ ∂∂x+y^ ∂∂y+z^ ∂∂z\nabla \equiv \hat{x}\,\frac{\partial}{\partial x} + \hat{y}\,\frac{\partial}{\partial y} + \hat{z}\,\frac{\partial}{\partial z}

as a vector differential operator. It is not a vector — it has no value until it acts on something — but it obeys enough of the algebra of vectors that the notation is worth keeping. Acting on a scalar ff by ordinary multiplication it gives the gradient ∇f\nabla f; dotted into a vector field it gives the divergence ∇⋅F⃗\nabla \cdot \vec{F}; crossed into a vector field it gives the curl ∇×F⃗\nabla \times \vec{F}. Because ∇\nabla contains derivatives, order matters: ∇⋅F⃗\nabla \cdot \vec{F} is a scalar field, but F⃗⋅∇\vec{F}\cdot\nabla is a scalar operator, and the two are entirely different objects.

4. The Divergence: Flux per Unit Volume

The divergence of a vector field is the scalar field

∇⋅F⃗=∂Fx∂x+∂Fy∂y+∂Fz∂z\nabla \cdot \vec{F} = \frac{\partial F_x}{\partial x} + \frac{\partial F_y}{\partial y} + \frac{\partial F_z}{\partial z}

Its physical meaning is outward flux per unit volume. Consider an infinitesimal box of sides dx,dy,dzdx,dy,dz centred on a point. The flux of F⃗\vec{F} out of the two faces perpendicular to x^\hat{x} is

[Fx ⁣(x+dx2)−Fx ⁣(x−dx2)]dy dz≈∂Fx∂x dx dy dz\left[F_x\!\left(x+\tfrac{dx}{2}\right) - F_x\!\left(x-\tfrac{dx}{2}\right)\right]dy\,dz \approx \frac{\partial F_x}{\partial x}\,dx\,dy\,dz

Adding the analogous contributions from the other two pairs of faces and dividing by the volume dx dy dzdx\,dy\,dz gives exactly ∇⋅F⃗\nabla \cdot \vec{F}. A positive divergence marks a source (field lines beginning there); a negative divergence marks a sink. A field with ∇⋅F⃗=0\nabla \cdot \vec{F} = 0 everywhere is called solenoidal — its field lines never begin or end, and the magnetic field is the canonical example.

Worked example. For F⃗=r⃗=x x^+y y^+z z^\vec{F} = \vec{r} = x\,\hat{x} + y\,\hat{y} + z\,\hat{z}, ∇⋅F⃗=1+1+1=3\nabla \cdot \vec{F} = 1 + 1 + 1 = 3: this radially expanding field has a uniform source density, consistent with the fact that a sphere of radius RR encloses a flux 4πR34\pi R^3 equal to 33 times its volume. For the inverse-square field F⃗=r^/r2\vec{F} = \hat{r}/r^2, a direct computation gives ∇⋅F⃗=0\nabla \cdot \vec{F} = 0 everywhere except the origin, where the field diverges and the naive derivative fails; the flux out of any surface enclosing the origin is 4π4\pi, which is Gauss's law in embryo and is handled rigorously with the Dirac delta in a later chapter.

5. The Curl: Circulation per Unit Area

The curl of a vector field is the vector field

∇×F⃗=∣x^y^z^∂∂x∂∂y∂∂zFxFyFz∣=(∂Fz∂y−∂Fy∂z)x^+(∂Fx∂z−∂Fz∂x)y^+(∂Fy∂x−∂Fx∂y)z^\nabla \times \vec{F} = \begin{vmatrix} \hat{x} & \hat{y} & \hat{z} \\[2pt] \dfrac{\partial}{\partial x} & \dfrac{\partial}{\partial y} & \dfrac{\partial}{\partial z} \\[6pt] F_x & F_y & F_z \end{vmatrix} = \left(\frac{\partial F_z}{\partial y} - \frac{\partial F_y}{\partial z}\right)\hat{x} + \left(\frac{\partial F_x}{\partial z} - \frac{\partial F_z}{\partial x}\right)\hat{y} + \left(\frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y}\right)\hat{z}

Its physical meaning is circulation per unit area. Take a small rectangular loop of sides dx,dydx,dy in the xyxy-plane and compute ∮F⃗⋅dℓ⃗\oint \vec{F}\cdot d\vec{\ell} around it; the four edge contributions combine to (∂Fy∂x−∂Fx∂y)dx dy\left(\dfrac{\partial F_y}{\partial x} - \dfrac{\partial F_x}{\partial y}\right)dx\,dy, which is the zz-component of the curl times the area of the loop. The direction of ∇×F⃗\nabla\times\vec{F} is the axis about which the circulation is greatest, by the right-hand rule; its magnitude is that maximum circulation per unit area. A field with ∇×F⃗=0\nabla \times \vec{F} = 0 everywhere is called irrotational, and Section 7 shows that such a field is the gradient of a potential.

Worked example. The field F⃗=−y x^+x y^\vec{F} = -y\,\hat{x} + x\,\hat{y} describes rigid rotation about the zz-axis. Its curl is (∂x∂x−∂(−y)∂y)z^=2 z^\left(\dfrac{\partial x}{\partial x} - \dfrac{\partial(-y)}{\partial y}\right)\hat{z} = 2\,\hat{z}, a uniform vector along the rotation axis — and indeed a rigidly rotating fluid with angular velocity ω⃗\vec{\omega} has velocity v⃗=ω⃗×r⃗\vec{v} = \vec{\omega}\times\vec{r} and ∇×v⃗=2ω⃗\nabla\times\vec{v} = 2\vec{\omega}. The curl literally measures twice the local angular velocity of the field. By contrast the inverse-square field r^/r2\hat{r}/r^2 has zero curl everywhere it is defined, which is why electrostatic fields do no net work around a closed loop.

6. Second Derivatives and the Standard Identities

Applying ∇\nabla twice gives five combinations, of which two are identically zero and one defines a new operator.

  • The Laplacian of a scalar: ∇⋅(∇f)=∇2f=∂2f∂x2+∂2f∂y2+∂2f∂z2\nabla\cdot(\nabla f) = \nabla^2 f = \dfrac{\partial^2 f}{\partial x^2} + \dfrac{\partial^2 f}{\partial y^2} + \dfrac{\partial^2 f}{\partial z^2}. It appears in Laplace's equation ∇2V=0\nabla^2 V = 0, Poisson's equation and the wave and diffusion equations.
  • Curl of a gradient is zero: ∇×(∇f)=0⃗\nabla\times(\nabla f) = \vec{0} for any twice-differentiable ff, because mixed partial derivatives commute.
  • Divergence of a curl is zero: ∇⋅(∇×F⃗)=0\nabla\cdot(\nabla\times\vec{F}) = 0 for any twice-differentiable F⃗\vec{F}, for the same reason.

Two product rules are used constantly and are worth memorising:

∇⋅(fA⃗)=f (∇⋅A⃗)+A⃗⋅(∇f),∇×(∇×A⃗)=∇(∇⋅A⃗)−∇2A⃗\nabla\cdot(f\vec{A}) = f\,(\nabla\cdot\vec{A}) + \vec{A}\cdot(\nabla f), \qquad \nabla\times(\nabla\times\vec{A}) = \nabla(\nabla\cdot\vec{A}) - \nabla^2\vec{A}

The second — "curl curl equals grad div minus Laplacian" — is the identity that turns Maxwell's equations into wave equations.

7. The Three Fundamental Theorems

Each operator has an integral theorem that inverts it, generalising the ordinary fundamental theorem of calculus ∫abdfdx dx=f(b)−f(a)\int_a^b \dfrac{df}{dx}\,dx = f(b) - f(a).

Gradient theorem (fundamental theorem for line integrals). For a path from a⃗\vec{a} to b⃗\vec{b},

∫a⃗b⃗(∇f)⋅dℓ⃗=f(b⃗)−f(a⃗)\int_{\vec{a}}^{\vec{b}} (\nabla f)\cdot d\vec{\ell} = f(\vec{b}) - f(\vec{a})

The integral depends only on the endpoints, so ∮(∇f)⋅dℓ⃗=0\oint (\nabla f)\cdot d\vec{\ell} = 0 around any closed loop.

Divergence theorem (Gauss's theorem). For a volume V\mathcal{V} bounded by the closed surface S\mathcal{S},

∭V(∇⋅F⃗) dτ=∯SF⃗⋅da⃗\iiint_{\mathcal{V}} (\nabla\cdot\vec{F})\,d\tau = \oiint_{\mathcal{S}} \vec{F}\cdot d\vec{a}

The total source strength inside a region equals the net flux through its boundary — the mathematical content of every "flux = enclosed charge" law.

Stokes' theorem. For a surface S\mathcal{S} bounded by the closed curve C\mathcal{C},

∬S(∇×F⃗)⋅da⃗=∮CF⃗⋅dℓ⃗\iint_{\mathcal{S}} (\nabla\times\vec{F})\cdot d\vec{a} = \oint_{\mathcal{C}} \vec{F}\cdot d\vec{\ell}

The total circulation density over a surface equals the circulation around its rim. Faraday's law and Ampère's law are both statements of this theorem applied to a physical field.

Worked example — verifying Stokes. Take F⃗=−y x^+x y^\vec{F} = -y\,\hat{x} + x\,\hat{y} (curl 2z^2\hat{z}, from Section 5) and let S\mathcal{S} be the disc x2+y2≤R2x^2+y^2\le R^2 in the z=0z=0 plane, with C\mathcal{C} its boundary circle traversed counter-clockwise. The surface integral is ∬2 z^⋅z^ da=2πR2\iint 2\,\hat{z}\cdot\hat{z}\,da = 2\pi R^2. The line integral: on the circle F⃗⋅dℓ⃗=(−y dx+x dy)\vec{F}\cdot d\vec{\ell} = (-y\,dx + x\,dy), and parametrising by x=Rcos⁡ϕx = R\cos\phi, y=Rsin⁡ϕy = R\sin\phi gives ∮(R2sin⁡2ϕ+R2cos⁡2ϕ) dϕ=2πR2\oint (R^2\sin^2\phi + R^2\cos^2\phi)\,d\phi = 2\pi R^2. The two agree, as Stokes' theorem guarantees.

8. Common Pitfalls

  • Confusing which operator acts on what. Gradient acts on a scalar and returns a vector; divergence acts on a vector and returns a scalar; curl acts on a vector and returns a vector. "∇×f\nabla\times f" for scalar ff is meaningless.
  • Forgetting that ∇\nabla does not commute. ∇⋅F⃗≠F⃗⋅∇\nabla\cdot\vec{F} \ne \vec{F}\cdot\nabla; the first is a number, the second an operator. Product rules pick up two terms because ∇\nabla differentiates each factor in turn.
  • Applying ∇⋅(r^/r2)=0\nabla\cdot(\hat{r}/r^2) = 0 at the origin. The formula is valid only away from the singularity; the enclosed flux is 4π4\pi, encoded by a delta function.
  • Dropping the non-constant basis vectors when computing divergence or curl in polar or spherical coordinates. The Cartesian formulas above do not carry over term-by-term; use the standard curvilinear expressions.
  • Assuming zero curl proves a potential exists globally. It does so only on a simply connected domain; a field like −y x^+x y^x2+y2\dfrac{-y\,\hat{x}+x\,\hat{y}}{x^2+y^2} has zero curl but no single-valued potential on a loop around the axis.
  • Sign and orientation errors in the theorems. Stokes requires the right-hand rule between da⃗d\vec{a} and the sense of C\mathcal{C}; the divergence theorem requires the outward normal.

Summary

  • A scalar field assigns a number, a vector field a vector, to each point; Cartesian basis vectors are constant, which is why Cartesian components differentiate cleanly.
  • Gradient: ∇f\nabla f points along steepest increase of ff, has magnitude equal to that slope, and is normal to level surfaces; df=∇f⋅dr⃗df = \nabla f\cdot d\vec{r}. Key result: ∇g(r)=g′(r) r^\nabla g(r) = g'(r)\,\hat{r}, so ∇(1/r)=−r^/r2\nabla(1/r) = -\hat{r}/r^2.
  • Divergence: ∇⋅F⃗\nabla\cdot\vec{F} is outward flux per unit volume; positive at sources, zero for a solenoidal field.
  • Curl: ∇×F⃗\nabla\times\vec{F} is circulation per unit area; it equals twice the local angular velocity of the field and is zero for an irrotational field.
  • Second derivatives: ∇2f\nabla^2 f is the Laplacian; ∇×(∇f)=0⃗\nabla\times(\nabla f) = \vec{0} and ∇⋅(∇×F⃗)=0\nabla\cdot(\nabla\times\vec{F}) = 0 identically; ∇×(∇×A⃗)=∇(∇⋅A⃗)−∇2A⃗\nabla\times(\nabla\times\vec{A}) = \nabla(\nabla\cdot\vec{A}) - \nabla^2\vec{A}.
  • Three theorems: gradient theorem (line integral of ∇f\nabla f = endpoint difference), divergence theorem (volume integral of ∇⋅F⃗\nabla\cdot\vec{F} = surface flux), Stokes' theorem (surface integral of ∇×F⃗\nabla\times\vec{F} = boundary circulation). These are the backbone of every field law in the course.