Skip to main content

Vector Calculus

Vector calculus studies fields, flow, circulation, and flux. It connects line integrals over curves, double integrals over regions, and surface integrals over surfaces through the Fundamental Theorem for Line Integrals, Green's Theorem, Stokes' Theorem, and the Divergence Theorem.

These theorems are higher-dimensional versions of the Fundamental Theorem of Calculus. They say that an integral over a boundary can often be computed from information inside the region, or that an integral over a region can be converted to a boundary integral when that is easier.

Definitions

A vector field in the plane has form

F(x,y)=P(x,y),Q(x,y).\mathbf{F}(x,y)=\langle P(x,y),Q(x,y)\rangle.

In space,

F(x,y,z)=P,Q,R.\mathbf{F}(x,y,z)=\langle P,Q,R\rangle.

A scalar line integral along a curve CC is

Cfds.\int_C f\,ds.

A vector line integral along r(t)\mathbf{r}(t), atba\le t\le b, is

CFdr=abF(r(t))r(t)dt.\int_C \mathbf{F}\cdot d\mathbf{r} = \int_a^b \mathbf{F}(\mathbf{r}(t))\cdot\mathbf{r}'(t)\,dt.

If F=f\mathbf{F}=\nabla f, then F\mathbf{F} is conservative and ff is a potential function.

Divergence is

F=Px+Qy+Rz.\nabla\cdot\mathbf{F}=P_x+Q_y+R_z.

Curl is

×F.\nabla\times\mathbf{F}.

For a plane field P,Q\langle P,Q\rangle, the scalar curl component is

QxPy.Q_x-P_y.

Flux measures flow through a curve or surface. Circulation measures flow along a curve.

Key results

The Fundamental Theorem for Line Integrals says that if F=f\mathbf{F}=\nabla f and CC goes from point AA to point BB, then

CFdr=f(B)f(A).\int_C \mathbf{F}\cdot d\mathbf{r}=f(B)-f(A).

The proof is the chain rule:

f(r(t))r(t)=ddtf(r(t)).\nabla f(\mathbf{r}(t))\cdot\mathbf{r}'(t) =\frac{d}{dt}f(\mathbf{r}(t)).

Green's Theorem states that for a positively oriented simple closed curve CC bounding region DD,

CPdx+Qdy=D(QxPy)dA.\oint_C P\,dx+Q\,dy = \iint_D\left(Q_x-P_y\right)\,dA.

Stokes' Theorem states

CFdr=S(×F)dS,\oint_C \mathbf{F}\cdot d\mathbf{r} = \iint_S(\nabla\times\mathbf{F})\cdot d\mathbf{S},

where CC is the oriented boundary of SS.

The Divergence Theorem states

SFdS=EFdV,\iint_S \mathbf{F}\cdot d\mathbf{S} = \iiint_E \nabla\cdot\mathbf{F}\,dV,

where SS is a closed outward-oriented surface bounding solid EE.

For a plane field on a simply connected domain, a common test for conservativeness is

Py=Qx.P_y=Q_x.

The domain condition matters. A field may pass the partial derivative test on a domain with a hole but fail to have a global potential.

Orientation is part of every theorem. Green's Theorem uses counterclockwise orientation for positive boundary direction. Stokes' Theorem uses the right-hand rule between the surface normal and boundary orientation. The Divergence Theorem uses outward normals on closed surfaces.

A line integral of a vector field computes accumulated tangential component. Along a parametrized curve r(t)\mathbf{r}(t), the term

F(r(t))r(t)\mathbf{F}(\mathbf{r}(t))\cdot\mathbf{r}'(t)

measures the part of the field pointing along the motion, scaled by speed. This is why vector line integrals model work.

Flux integrals compute normal component. For a parametrized surface r(u,v)\mathbf{r}(u,v), an oriented surface element is

ru×rvdudv.\mathbf{r}_u\times\mathbf{r}_v\,du\,dv.

Then

SFdS=DF(r(u,v))(ru×rv)dudv.\iint_S \mathbf{F}\cdot d\mathbf{S} = \iint_D \mathbf{F}(\mathbf{r}(u,v))\cdot(\mathbf{r}_u\times\mathbf{r}_v)\,du\,dv.

The sign depends on the chosen normal orientation.

Divergence has a source interpretation. Positive divergence means the field has net outward flow near a point; negative divergence means net inward flow. Curl has a rotation interpretation. In a fluid analogy, curl measures the tendency of a small paddle wheel to spin.

The big theorems form a hierarchy. Green's Theorem is a two-dimensional curl theorem. Stokes' Theorem generalizes circulation-curl relationships to surfaces in space. The Divergence Theorem relates flux through a closed surface to source strength in the enclosed volume. Each theorem requires smoothness and orientation hypotheses that should be checked before use.

Conservative fields are path independent. If F=f\mathbf{F}=\nabla f, the work between two endpoints depends only on the endpoints. Equivalently, every closed-loop integral is zero:

CFdr=0.\oint_C \mathbf{F}\cdot d\mathbf{r}=0.

On a simply connected domain, this is closely related to curl being zero. On domains with holes, a field can have zero curl where it is defined but still fail to be globally conservative.

Green's Theorem has two common forms. The circulation form is

CPdx+Qdy=D(QxPy)dA.\oint_C P\,dx+Q\,dy =\iint_D(Q_x-P_y)\,dA.

The flux form is

CFnds=DFdA.\oint_C \mathbf{F}\cdot\mathbf{n}\,ds = \iint_D \nabla\cdot\mathbf{F}\,dA.

Both compare boundary behavior with a region integral, but one uses tangential circulation and the other uses outward normal flux.

The Divergence Theorem is especially useful when a direct surface integral would require several surface pieces. If a closed surface is made from a cylinder plus caps, direct flux requires each piece. The divergence theorem may replace all pieces with one triple integral over the enclosed solid.

Stokes' Theorem is useful because many different surfaces can have the same boundary curve. If orientation is handled consistently, the surface integral of curl is the same over any convenient surface spanning the boundary. Choosing a flat disk instead of a curved cap can turn a difficult integral into an easy one.

Visual

TheoremBoundary integralInterior integralMain idea
FTC for line integralswork along pathpotential differenceconservative fields
Greencirculation around plane curvedouble integral of curl2D boundary to region
Stokescirculation around space curvesurface integral of curlboundary to surface
Divergenceflux through closed surfacetriple integral of divergencesurface to volume

Worked example 1: work in a conservative field

Problem. Let

F(x,y)=2x,2y.\mathbf{F}(x,y)=\langle 2x,2y\rangle.

Find the work done along any path from (1,0)(1,0) to (0,2)(0,2).

Method.

  1. Look for a potential function ff with
f=2x,2y.\nabla f=\langle2x,2y\rangle.
  1. Integrate fx=2xf_x=2x with respect to xx:
f(x,y)=x2+g(y).f(x,y)=x^2+g(y).
  1. Differentiate with respect to yy:
fy=g(y).f_y=g'(y).
  1. Match fy=2yf_y=2y:
g(y)=2yg(y)=y2+C.g'(y)=2y \quad\Rightarrow\quad g(y)=y^2+C.
  1. A potential is
f(x,y)=x2+y2.f(x,y)=x^2+y^2.
  1. Apply the Fundamental Theorem for Line Integrals:
CFdr=f(0,2)f(1,0).\int_C \mathbf{F}\cdot d\mathbf{r} =f(0,2)-f(1,0).
  1. Evaluate:
f(0,2)=4,f(1,0)=1.f(0,2)=4, \qquad f(1,0)=1.

Checked answer. The work is 41=34-1=3. The path does not matter because the field is conservative.

Worked example 2: Green's Theorem around the unit circle

Problem. Evaluate

Cydx+xdy\oint_C -y\,dx+x\,dy

where CC is the positively oriented unit circle.

Method.

  1. Identify
P=y,Q=x.P=-y, \qquad Q=x.
  1. Compute partial derivatives:
Qx=1,Py=1.Q_x=1, \qquad P_y=-1.
  1. The curl scalar is
QxPy=1(1)=2.Q_x-P_y=1-(-1)=2.
  1. The unit circle bounds the disk DD of area π\pi.

  2. Apply Green's Theorem:

Cydx+xdy=D2dA.\oint_C -y\,dx+x\,dy =\iint_D 2\,dA.
  1. Evaluate:
D2dA=2Area(D)=2π.\iint_D 2\,dA=2\operatorname{Area}(D)=2\pi.

Checked answer. The circulation is 2π2\pi. The positive orientation is counterclockwise, matching Green's Theorem.

A direct parametrization check gives the same value. Let

r(t)=cost,sint,0t2π.\mathbf{r}(t)=\langle\cos t,\sin t\rangle, \qquad 0\le t\le 2\pi.

Then

dr=sint,costdtd\mathbf{r}=\langle-\sin t,\cos t\rangle\,dt

and

F(r(t))=sint,cost.\mathbf{F}(\mathbf{r}(t))=\langle-\sin t,\cos t\rangle.

The dot product is 11, so the line integral is

02π1dt=2π.\int_0^{2\pi}1\,dt=2\pi.

The direct computation also confirms the orientation. The parametrization cost,sint\langle\cos t,\sin t\rangle moves counterclockwise, so it matches the positive orientation assumed by Green's Theorem.

If the circle were traversed clockwise, the same computation would give 2π-2\pi. The region integral from Green's Theorem would still be 2π2\pi, but the theorem's positive-orientation hypothesis would be violated, so a negative sign would be needed.

For flux, the analogous orientation choice is the normal direction. On a closed surface, "outward" is the standard convention. On an open surface, the problem must specify or imply a normal direction, and the boundary orientation for Stokes' Theorem must match that choice by the right-hand rule.

The safest workflow is to name the theorem, state the orientation, rewrite the integral in the theorem's notation, and only then compute. This prevents mixing a circulation integral with a flux theorem or applying a closed-surface theorem to an open surface by accident during setup and checking work later on.

That workflow keeps geometry and algebra aligned throughout the computation and final interpretation clearly enough for checking answers carefully.

Code

from math import cos, sin, pi

def line_integral_circle(n=10000):
total = 0.0
dt = 2*pi / n
for i in range(n):
t = (i + 0.5) * dt
x, y = cos(t), sin(t)
dx_dt, dy_dt = -sin(t), cos(t)
p, q = -y, x
total += (p * dx_dt + q * dy_dt) * dt
return total

print(line_integral_circle())

Common pitfalls

  • Ignoring orientation. Reversing a curve reverses circulation.
  • Checking Py=QxP_y=Q_x for a conservative field without checking domain conditions.
  • Confusing flux with circulation. Flux uses normal direction; circulation uses tangent direction.
  • Applying the Divergence Theorem to a surface that is not closed without adding missing pieces or using another method.
  • Forgetting that Stokes' Theorem requires compatible boundary and normal orientations.
  • Treating F\nabla\cdot\mathbf{F} and ×F\nabla\times\mathbf{F} as interchangeable. Divergence measures source strength; curl measures rotational tendency.

Connections