Foundations to Frontier
Tests
A. Mathematical Foundations › A3 Calculus and Analysis › Vector calculus

Line and Surface Integrals

Line integrals add things up along a curve: length, mass, or the work a force does along a route. Surface integrals add up over a surface: area, or the flux of a field through it. For gradient fields the work depends only on the endpoints, and that one fact separates conservative forces from route-dependent ones like drag.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Adding up along a route

Cycling with the wind at your back, the wind helps every metre. Turn around and it fights every metre. To total how much the wind helped on a whole ride, you add up “how much it pushed along my direction” times “how far I went”, piece by piece. That total is a line integral. With a force, it’s the work done.

Here’s the surprise. For some forces, like gravity, the total depends only on where you start and finish, not on the route. Climbing a hill costs the same energy against gravity by the steep path or the zig-zag one. For others, like wind or friction, the route matters a lot.

Work along a path: does the route matter?
AB
work ∫F·dr on this route = -3.6726
on the straight route = -0.0000
route length = 4.010
F·T against arc length (area = work)work against bulge −3 … 3
Not conservative: going counter-clockwise around the origin gains work, going clockwise loses it. Orange segments: the field helps (F·T > 0). Blue: it opposes.
Why engineers care

Planning a drone route, a rover traverse or a spacecraft trajectory means adding up energy along a path. The conservative part, gravity, is fixed by the endpoints. The rest, drag, wind and friction, is what route planning can actually improve.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Riding with a tailwind, the wind's work on you is…
  2. 2. Lifting a box 2 m by a straight or a winding path, gravity's work is…
  3. 3. Friction's work on a longer route is…

Level 1: Beginner

★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.

Curves as parametrizations

Describe a curve CC by r(t)\mathbf r(t) for t∈[a,b]t\in[a,b]. Its velocity r′(t)\mathbf r'(t) has length ∣r′(t)∣|\mathbf r'(t)|, so a small piece has length ds=∣r′(t)∣ dtds = |\mathbf r'(t)|\,dt.

Integral Formula Example
arc length ∫ab∣r′(t)∣ dt\int_a^b\lvert\mathbf r'(t)\rvert\,dt circle of radius RR: 2πR2\pi R
scalar (mass of a wire) ∫Cf ds=∫abf(r(t))∣r′(t)∣ dt\int_C f\,ds = \int_a^b f(\mathbf r(t))\lvert\mathbf r'(t)\rvert\,dt density times length
vector (work) ∫CF⋅dr=∫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 force along the motion

Example: F=(−y,x)\mathbf F = (-y, x) around the unit circle r=(cos⁡t,sin⁡t)\mathbf r = (\cos t, \sin t). Then F⋅r′=sin⁡2t+cos⁡2t=1\mathbf F\cdot\mathbf r' = \sin^2t + \cos^2t = 1, so the work is 2π2\pi.

Example: a constant force F=(2,0)\mathbf F = (2, 0) from (0,0)(0,0) to (3,4)(3,4) does work F⋅Δr=6\mathbf F\cdot\Delta\mathbf r = 6 along any route.

📝 Quick check (Level 1)
0/3 answered
  1. 1. Arc length of a circle of radius 3?
  2. 2. The work of F = (2, 0) from (0, 0) to (3, 4)?
  3. 3. ds equals…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.

The fundamental theorem for line integrals

If F=∇ϕ\mathbf F = \nabla\phi, then ddtϕ(r(t))=∇ϕ⋅r′(t)\frac{d}{dt}\phi(\mathbf r(t)) = \nabla\phi\cdot\mathbf r'(t) by the chain rule (A3.2-4), so

∫C∇ϕ⋅dr=ϕ(r(b))−ϕ(r(a))\int_C\nabla\phi\cdot d\mathbf r = \phi(\mathbf r(b)) - \phi(\mathbf r(a))

Consequences for gradient (conservative) fields:

  • the work depends only on the endpoints;
  • around any closed loop the work is 0;
  • ϕ\phi is the (negative) potential energy.

To test a field on a simply connected domain, check that its curl vanishes (A3.4-1).

Orientation and parametrization

  • ∫CF⋅dr\int_C\mathbf F\cdot d\mathbf r flips sign when you traverse CC backwards. It doesn’t change under any forward reparametrization.
  • ∫Cf ds\int_C f\,ds doesn’t depend on direction or parametrization at all, because dsds is always positive.

Surface integrals

Parametrize a surface by r(u,v)\mathbf r(u,v). A small patch has area dS=∣ru×rv∣ du dvdS = |\mathbf r_u\times\mathbf r_v|\,du\,dv and unit normal n=ru×rv∣ru×rv∣\mathbf n = \frac{\mathbf r_u\times\mathbf r_v}{|\mathbf r_u\times\mathbf r_v|}. The flux of F\mathbf F through the surface is

∬SF⋅n dS=∬F(r(u,v))⋅(ru×rv) du dv\iint_S\mathbf F\cdot\mathbf n\,dS = \iint\mathbf F(\mathbf r(u,v))\cdot(\mathbf r_u\times\mathbf r_v)\,du\,dv

This is the amount of fluid, light or field passing through per unit time. For a sphere of radius RR in angles (θ,φ)(\theta,\varphi), dS=R2sin⁡θ dθ dφdS = R^2\sin\theta\,d\theta\,d\varphi and the total area is 4πR24\pi R^2.

🐍 Exercise 1: line integrals, path independence and its failure
Write Simpson-rule scalar and vector line integrals. Compute a helix's length and a rotation's circulation, then show that a gradient field gives the same work on a straight and a wiggly route while the rotation field doesn't.
📝 Quick check (Level 2)
0/3 answered
  1. 1. F = ∇(xy) from (0, 0) to (2, 3): work?
  2. 2. Reversing a route changes ∫F·dr by…
  3. 3. The area element on a parametrized surface is…

Level 3: Advanced

★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.

Proofs

Fundamental theorem. Let g(t)=ϕ(r(t))g(t) = \phi(\mathbf r(t)). The chain rule gives g′(t)=∇ϕ(r(t))⋅r′(t)g'(t) = \nabla\phi(\mathbf r(t))\cdot\mathbf r'(t). By the 1-D fundamental theorem (A3.1-6), ∫abg′ dt=g(b)−g(a)\int_a^bg'\,dt = g(b) - g(a). ∎

Reparametrization invariance. Let t=σ(s)t = \sigma(s) with σ′>0\sigma' > 0, and r~(s)=r(σ(s))\tilde{\mathbf r}(s) = \mathbf r(\sigma(s)). Then r~′(s)=r′(σ(s))σ′(s)\tilde{\mathbf r}'(s) = \mathbf r'(\sigma(s))\sigma'(s). Substituting t=σ(s)t = \sigma(s) turns ∫F(r~)⋅r~′ ds\int\mathbf F(\tilde{\mathbf r})\cdot\tilde{\mathbf r}'\,ds into ∫F(r)⋅r′ dt\int\mathbf F(\mathbf r)\cdot\mathbf r'\,dt. If σ′<0\sigma' < 0, the limits swap and the sign flips. ∎

Converse: path independence implies a gradient. If the work is path-independent on a connected open set, then ϕ(x):=∫x0xF⋅dr\phi(\mathbf x) := \int_{\mathbf x_0}^{\mathbf x}\mathbf F\cdot d\mathbf r is well defined. Differentiating along a short straight segment in direction ei\mathbf e_i gives ∂iϕ=Fi\partial_i\phi = F_i. So the following are equivalent: conservative, path-independent, zero circulation on every loop.

Why the vortex has circulation 2π at every radius

For F=(−y,x)/r2\mathbf F = (-y, x)/r^2 on a circle of radius RR, F⋅r′=R2/R2=1\mathbf F\cdot\mathbf r' = R^2/R^2 = 1, so ∮=2π\oint = 2\pi, independent of RR. The curl is 0 everywhere except the origin, so all the “spin” sits at the hole. Physically, this is a line vortex, or the magnetic field around a current-carrying wire (Ampère’s law, A3.4-3).

Surface orientation

A surface needs a consistent normal to have a signed flux. The Möbius strip has none: it’s non-orientable. Flux reverses with the normal, while the scalar integral ∬f dS\iint f\,dS doesn’t care.

Exercise 3.1: Compute ∮ y dx around the unit circle counter-clockwise

With x=cos⁡tx = \cos t and y=sin⁡ty = \sin t, dx=−sin⁡t dtdx = -\sin t\,dt. So ∫02π−sin⁡2t dt=−π\int_0^{2\pi}-\sin^2t\,dt = -\pi, minus the enclosed area (a preview of Green’s theorem).

📝 Quick check (Level 3)
0/3 answered
  1. 1. Conservative ⇔ path-independent ⇔ …
  2. 2. The vortex circulation around radius R is…
  3. 3. The Möbius strip is…

Level 4: Expert

★★★★★ Expert⏱ 45 minResearchers: original papers and open problems.

Energy along trajectories

A drone, rover or arm moving through a force field spends energy E=−∫CFenv⋅drE = -\int_C\mathbf F_{\text{env}}\cdot d\mathbf r against its environment. Split the environmental force into a conservative part (gravity: −mg Δh-mg\,\Delta h fixed by the endpoints) and a dissipative part (aerodynamic drag in a wind field, rolling resistance on terrain). The dissipative part is path-dependent, so route choice matters. This is the basis of wind-aware drone planning and of energy-optimal rover traverses on Mars, where terrain resistance and slope enter the cost map (Carsten et al., 2009). Soaring birds and gliders exploit wind gradients the same way (dynamic soaring; Sachs, 2005).

🐍 Exercise 2 (research): energy-optimal drone route in wind
A drone flies from A to B at constant ground speed through a wind field that grows with altitude. Compute gravity's work (the same for every route) and drag's work (route-dependent) along a family of bent routes, and find the energy-optimal bend.

Flux in science and engineering

  • Radiation and heat:
    • Solar power on a panel is the flux of sunlight through it: ∬S⋅n dS\iint\mathbf S\cdot\mathbf n\,dS, which depends on the incidence angle.
    • Spacecraft thermal design integrates radiative flux over every surface (view factors).
  • Aerodynamics:
    • Lift and drag are surface integrals of pressure and shear stress over the vehicle skin.
    • Mass flow through an engine inlet is ∬ρu⋅n dS\iint\rho\mathbf u\cdot\mathbf n\,dS.
  • Electromagnetism:
    • Magnetic flux through a coil gives the induced voltage (Faraday).
    • The flux of the electric field through a closed surface counts the enclosed charge (Gauss’s law, A3.4-3; Practice Code 5).
  • Path integrals in learning:
    • Integrated gradients attributes a model’s output to input features by a line integral of the gradient along a straight path from a baseline (Sundararajan et al., 2017). The fundamental theorem guarantees the attributions sum to f(x)−f(x0)f(\mathbf x) - f(\mathbf x_0) (the “completeness” axiom).
    • Hamiltonian/Lagrangian neural networks learn conservative dynamics by parametrizing a potential, so energy is conserved by construction (Greydanus et al., 2019).

References

  1. J. E. Marsden, A. Tromba (2011). Vector Calculus, 6th ed. Freeman.
  2. M. Spivak (1965). Calculus on Manifolds. Benjamin.
  3. M. Sundararajan, A. Taly, Q. Yan (2017). “Axiomatic attribution for deep networks.” ICML.
  4. S. Greydanus, M. Dzamba, J. Yosinski (2019). “Hamiltonian neural networks.” NeurIPS.
  5. G. Sachs (2005). “Minimum shear wind strength required for dynamic soaring of albatrosses.” Ibis, 147.
  6. J. Carsten, A. Rankin, D. Ferguson, A. Stentz (2009). “Global planning on the Mars Exploration Rovers: software integration and surface testing.” Journal of Field Robotics, 26(4).
  7. J. Nocedal, S. Wright (2006). Numerical Optimization, 2nd ed. Springer. (For the route optimization.)