TExcelTAD
Home › Calculus in Depth › Surface Integrals

Surface Integrals

A surface integral adds up a quantity over a curved surface, the way a line integral adds it up along a curve. There are two kinds: the integral of a scalar function (mass of a curved shell, average temperature on a dome) and the flux of a vector field (how much fluid, heat or light passes through the surface). Both reduce to an ordinary double integral over the parameter domain once you have the parametrisation from Parametric Surfaces and Their Areas.

Scalar surface integrals

Chop the surface SS into patches of area ΔS\Delta S, multiply each by the value of ff at a sample point, and take the limit. Since a patch has area ≈∣ru×rv∣ Δu Δv\approx \lvert \mathbf{r}_u \times \mathbf{r}_v \rvert\,\Delta u\,\Delta v:

∬Sf dS=∬Df(r(u,v))⋅∣ru×rv∣ dAgraph z=g(x,y):∬Sf dS=∬Df(x,y,g(x,y))⋅1+gx2+gy2 dA\begin{aligned} &\iint_S f\,dS = \iint_D f(\mathbf{r}(u, v)) \cdot \lvert \mathbf{r}_u \times \mathbf{r}_v \rvert\,dA \\ &\text{graph } z = g(x, y)\text{:} \quad \iint_S f\,dS = \iint_D f(x, y, g(x, y)) \cdot \sqrt{1 + g_x^2 + g_y^2}\,dA \end{aligned}

With f=1f = 1 you get the surface area back. With f=densityf = \text{density} you get mass; dividing ∬f dS\iint f\,dS by the area gives the average of ff over the surface. The answer does not depend on which parametrisation you pick, just as arc length does not depend on how fast you trace the curve.

python · try it yourself
import sympy as sp

u, v = sp.symbols('u v', real=True)
a = 2
r = sp.Matrix([a*sp.sin(v)*sp.cos(u), a*sp.sin(v)*sp.sin(u), a*sp.cos(v)])
N = r.diff(v).cross(r.diff(u))
dS = a**2 * sp.sin(v)                       # |N|, since sin v >= 0 on [0, pi]
print("|N|^2 - dS^2 simplifies to", sp.simplify(N.dot(N) - dS**2))
z = r[2]
I = sp.integrate(z**2 * dS, (u, 0, 2*sp.pi), (v, 0, sp.pi))
area = sp.integrate(dS, (u, 0, 2*sp.pi), (v, 0, sp.pi))
print("integral of z^2 over the sphere:", I)
print("area:", area, "  average of z^2:", sp.simplify(I / area))
|N|^2 - dS^2 simplifies to 0
integral of z^2 over the sphere: 64*pi/3
area: 16*pi   average of z^2: 4/3

There is a quick check by symmetry: x2x^2, y2y^2 and z2z^2 have the same average over a sphere, and they add up to a2=4a^2 = 4, so each averages 43\frac{4}{3}.

Oriented surfaces and flux

To ask "how much flows through" a surface, you must say which side is the front. An oriented surface comes with a continuous choice of unit normal n\mathbf{n}. Closed surfaces (spheres, boxes) are oriented outward by convention. A Möbius strip has only one side and cannot be oriented, so flux through it is undefined.

The flux of F\mathbf{F} through SS is the scalar integral of the normal component F⋅n\mathbf{F} \cdot \mathbf{n}:

∬SF⋅dS=∬SF⋅n dS=∬DF(r(u,v))⋅(ru×rv) dA\iint_S \mathbf{F} \cdot d\mathbf{S} = \iint_S \mathbf{F} \cdot \mathbf{n}\,dS = \iint_D \mathbf{F}(\mathbf{r}(u, v)) \cdot (\mathbf{r}_u \times \mathbf{r}_v)\,dA

The ∣ru×rv∣\lvert \mathbf{r}_u \times \mathbf{r}_v \rvert in dSdS cancels the one hidden in n=(ru×rv)/∣ru×rv∣\mathbf{n} = (\mathbf{r}_u \times \mathbf{r}_v)/\lvert \mathbf{r}_u \times \mathbf{r}_v \rvert, so you never need to normalise. Just check that ru×rv\mathbf{r}_u \times \mathbf{r}_v points to the side you want; if not, flip the sign. For a graph z=g(x,y)z = g(x, y) with upward normal, rx×ry=⟨−gx,−gy,1⟩\mathbf{r}_x \times \mathbf{r}_y = \langle -g_x, -g_y, 1 \rangle and for F=⟨P,Q,R⟩\mathbf{F} = \langle P, Q, R \rangle:

∬SF⋅dS=∬D(−Pgx−Qgy+R) dA\iint_S \mathbf{F} \cdot d\mathbf{S} = \iint_D (-P g_x - Q g_y + R)\,dA

Example: the flux of F=⟨x,y,z2⟩\mathbf{F} = \langle x, y, z^2 \rangle upward through the paraboloid z=4−x2−y2z = 4 - x^2 - y^2 above the xyxy-plane. Here gx=−2xg_x = -2x and gy=−2yg_y = -2y, so the integrand is 2x2+2y2+(4−x2−y2)22x^2 + 2y^2 + (4 - x^2 - y^2)^2, and polar coordinates finish the job.

python · try it yourself
import numpy as np
import sympy as sp

r, th = sp.symbols('r theta', nonnegative=True)
integrand = 2*r**2 + (4 - r**2)**2                       # -P g_x - Q g_y + R in polar form
exact = sp.integrate(integrand * r, (r, 0, 2), (th, 0, 2*sp.pi))
print("exact flux:", exact, "≈", round(float(exact), 6))

# numeric check: midpoint rule on the parameter grid (x, y) = (rho cos t, rho sin t)
n = 600
rho = (np.arange(n) + 0.5) * 2 / n
t = (np.arange(n) + 0.5) * 2 * np.pi / n
R, T = np.meshgrid(rho, t)
x, y = R * np.cos(T), R * np.sin(T)
z = 4 - x**2 - y**2
F_dot_n = x * (2 * x) + y * (2 * y) + z**2               # F · <-g_x, -g_y, 1>
print("numeric flux:", round(float(np.sum(F_dot_n * R) * (2 / n) * (2 * np.pi / n)), 6))
exact flux: 112*pi/3 ≈ 117.286126
numeric flux: 117.286102

Light through a patch

Irradiance is a flux. A point light at LL with intensity II creates the field F(p)=I⋅(p−L)/∣p−L∣3\mathbf{F}(p) = I \cdot (p - L)/\lvert p - L \rvert^3, an inverse-square law. The power that lands on a floor patch is the flux of F\mathbf{F} through it with the normal facing the light; F⋅n\mathbf{F} \cdot \mathbf{n} contains the cosine of the angle between the light ray and the surface normal, which is Lambert's cosine law. For a light at height hh over the centre of a disc of radius aa, the flux has the closed form 2πI(1−h/h2+a2)2\pi I\left(1 - h/\sqrt{h^2 + a^2}\right), the solid angle of the disc as seen from the light.

python · try it yourself
import numpy as np

h, a, I = 2.0, 1.5, 1.0
n = 2000
rho = (np.arange(n) + 0.5) * a / n
# floor point (x, y, 0), light at (0, 0, h); with normal -k, F·n = I*h / |p - L|^3
F_dot_n = I * h / (rho**2 + h**2) ** 1.5
flux = np.sum(F_dot_n * rho) * (a / n) * 2 * np.pi        # theta integral is trivial: symmetry
exact = 2 * np.pi * I * (1 - h / np.hypot(h, a))
print(f"numeric flux {flux:.6f}, closed form {exact:.6f} (= 0.4π)")

inner = np.sum((F_dot_n * rho)[rho < 0.5]) * (a / n) * 2 * np.pi
print(f"share landing within radius 0.5: {inner / flux:.1%} of the area-share {0.5**2 / a**2:.1%}")
numeric flux 1.256637, closed form 1.256637 (= 0.4π)
share landing within radius 0.5: 14.9% of the area-share 11.1%

The centre of the disc gets more light per square metre than its area alone suggests: it is closer and faces the light head-on.

In software

  • Rendering. The irradiance at a point is an integral of incoming radiance times cos⁡θ\cos\theta over the hemisphere; area lights are handled by turning it into a surface integral over the light's surface, with the same cos⁡θ/distance2\cos\theta / \text{distance}^2 factor as above. Path tracers estimate these integrals by Monte Carlo sampling.
  • Physically based sound and heat. Acoustic and thermal radiosity solvers compute "form factors", the flux of one patch's emission through another patch, as double surface integrals.
  • Simulation. Drag and pressure forces on a body are surface integrals of pressure times the normal over its mesh; finite-volume fluid codes integrate flux over each cell face.
  • Meshes. On a triangle mesh, ∬f dS\iint f\,dS becomes ∑f(centroid)⋅(triangle area)\sum f(\text{centroid}) \cdot (\text{triangle area}), and flux becomes ∑F(centroid)⋅(12e1×e2)\sum \mathbf{F}(\text{centroid}) \cdot (\frac{1}{2}\mathbf{e}_1 \times \mathbf{e}_2), the un-normalised face normal.

Exercises

Exercise 1: Average height of a hemisphere

Find the average value of zz over the upper hemisphere x2+y2+z2=9x^2 + y^2 + z^2 = 9, z≥0z \ge 0.

Answer

32\frac{3}{2}.

Solution
dS=9sin⁡v du dv,z=3cos⁡v,0≤v≤π/2∬z dS=∫02π∫0π/227cos⁡vsin⁡v dv du=2π⋅27⋅12=27πarea=2π⋅9=18πaverage=27π/18π=32\begin{aligned} &dS = 9\sin v\,du\,dv, \quad z = 3\cos v, \quad 0 \le v \le \pi/2 \\ \iint z\,dS &= \int_0^{2\pi} \int_0^{\pi/2} 27\cos v \sin v\,dv\,du = 2\pi \cdot 27 \cdot \tfrac{1}{2} = 27\pi \\ \text{area} &= 2\pi \cdot 9 = 18\pi \\ \text{average} &= 27\pi / 18\pi = \frac{3}{2} \end{aligned}

Half the radius: for a sphere, equal heights get equal area (Archimedes' hat-box theorem), so zz is uniform on [0,3][0, 3].

Exercise 2: Flux through a tilted square

Find the upward flux of F=⟨1,2,3⟩\mathbf{F} = \langle 1, 2, 3 \rangle through the part of the plane z=x+2yz = x + 2y above the unit square 0≤x,y≤10 \le x, y \le 1.

Answer

−2.

Solution
g=x+2y,gx=1,gy=2−Pgx−Qgy+R=−1⋅1−2⋅2+3=−2(constant)flux=−2⋅1=−2\begin{aligned} &g = x + 2y, \quad g_x = 1, \quad g_y = 2 \\ -P g_x - Q g_y + R &= -1 \cdot 1 - 2 \cdot 2 + 3 = -2 && \text{(constant)} \\ \text{flux} &= -2 \cdot 1 = -2 \end{aligned}

Negative: the constant field crosses the tilted plane from its upper side to its lower side.

Exercise 3: Flux out of a cylinder wall

Find the outward flux of F=⟨x,y,5⟩\mathbf{F} = \langle x, y, 5 \rangle through the side x2+y2=4x^2 + y^2 = 4, 0≤z≤30 \le z \le 3, of a cylinder (not the top or bottom).

Answer

24π24\pi.

Solution
r(u,v)=⟨2cos⁡u,2sin⁡u,v⟩ru×rv=⟨2cos⁡u,2sin⁡u,0⟩(points outward)F⋅(ru×rv)=4cos⁡2u+4sin⁡2u=4flux=∫03∫02π4 du dv=24π\begin{aligned} \mathbf{r}(u, v) &= \langle 2\cos u, 2\sin u, v \rangle \\ \mathbf{r}_u \times \mathbf{r}_v &= \langle 2\cos u, 2\sin u, 0 \rangle && \text{(points outward)} \\ \mathbf{F} \cdot (\mathbf{r}_u \times \mathbf{r}_v) &= 4\cos^2 u + 4\sin^2 u = 4 \\ \text{flux} &= \int_0^3 \int_0^{2\pi} 4\,du\,dv = 24\pi \end{aligned}

The zz-component of F\mathbf{F} is parallel to the wall and contributes nothing.

Exercise 4: Light on a square tile (code)

A point light of intensity 1 sits at (0,0,1)(0, 0, 1). Estimate the flux through the floor square −1≤x,y≤1-1 \le x, y \le 1 (normal facing the light) with a midpoint grid. The exact value is 2π/32\pi/3, a sixth of the full 4π4\pi, because the square is one face of a cube centred at the light.

Answer

2π/3≈2.0943952\pi/3 \approx 2.094395.

Solution

F⋅n=1/(x2+y2+1)3/2\mathbf{F} \cdot \mathbf{n} = 1/(x^2 + y^2 + 1)^{3/2}. By symmetry the six faces of the cube [−1,1]2×[0,2][-1, 1]^2 \times [0, 2] each get one sixth of the total flux 4π4\pi of an inverse-square field.

python · try it yourself
import numpy as np
n = 1000
s = -1 + (np.arange(n) + 0.5) * 2 / n
X, Y = np.meshgrid(s, s)
flux = np.sum(1 / (X**2 + Y**2 + 1) ** 1.5) * (2 / n) ** 2
print(round(float(flux), 6), round(2 * np.pi / 3, 6))
2.094396 2.094395

Test yourself

Why can't you compute the flux through a Möbius strip?

  1. It has no area
  2. It is not orientable: there is no consistent choice of normal
  3. Its boundary is not closed
  4. Its parametrisation is not smooth anywhere

In ∬DF(r(u,v))⋅(ru×rv) dA\iint_D \mathbf{F}(\mathbf{r}(u, v)) \cdot (\mathbf{r}_u \times \mathbf{r}_v)\,dA, why is there no ∣ru×rv∣\lvert \mathbf{r}_u \times \mathbf{r}_v \rvert factor?

  1. It is always 1
  2. It cancels against the length hidden in the unit normal
  3. It is only needed for scalar integrals over graphs
  4. It is absorbed into F\mathbf{F}

A constant field F=⟨0,0,7⟩\mathbf{F} = \langle 0, 0, 7 \rangle passes through a curved surface whose shadow on the xyxy-plane has area 3 (upward normal, the surface is a graph). The flux is…

  1. 7
  2. 3
  3. 21
  4. It depends on the shape of the surface