Structure preview

Divergence and Gauss’s theorem: from outward flux to the volume interior

Stage 28: sources, sinks and local/global balance. Divergence, Gauss’s theorem, closed surfaces, cavities and singularities with worked examples and a three-dimensional laboratory.

Section: Calculus Updated:

Stage 29: curl and Stokes’s theorem

Gauss: from boundary to volume

Learning-path index

Articles /divergenza-teorema-gauss-flusso-volume
Divergence and Gauss’s theorem: from outward flux to the volume interior

35 min

Stage 27 taught us to add flux through a surface. Now close that surface around a volume: can the balance of what leaves and enters be recovered from the interior? Divergence describes a local balance; Gauss connects all those small balances to flux across the whole boundary. Assumptions matter as much as the formula.

Gauss: from boundary to volume · Learning-path index

1. Inflow, outflow and net balance

Imagine a box in a velocity field. Fluid enters at some points and leaves at others. With outward normal, F·n̂ is positive for outflow and negative for inflow. Total flux is the net balance, not the sum of absolute amounts. It does not measure the fluid already inside the box.

Φ=∬∂V F·n̂_ext dS

Positive net flux suggests production or expansion inside; negative flux suggests absorption or contraction. Interpretation depends on what F represents. For velocity, div F describes local volume expansion; mass conservation with variable density instead involves the mass flux ρF, not simply F.

Explore

2. Divergence is a scalar function

F=(P,Q,R)
div F=∇·F=∂P/∂x+∂Q/∂y+∂R/∂z

Differentiate the first component in x, the second in y and the third in z, then add. The result is a number at each point, not a vector. It is neither P+Q+R, nor the magnitude of F, nor the sum of all nine possible partial derivatives. Here R names the third component; geometric examples also use R for radius, with context distinguishing them.

F=(x,y,z) → div F=1+1+1=3
F=(−x,−y,−z) → div F=−3
F=(1,0,0) → div F=0
F=(−y,x,0) → div F=0
F=(x³,y³,z³) → div F=3x²+3y²+3z²

A nonzero field may have zero divergence. A constant field transports without local net production; a rotational field can turn without local expansion. Divergence and curl answer different questions.

Explore

3. Why derivatives measure local balance

Take a small box with sides Δx,Δy,Δz. Across the two x-normal faces, net flux is approximately [P(x+Δx,y,z)−P(x,y,z)]ΔyΔz. The difference is approximately P_xΔx. Repeat for y and z: net flux is approximately div F times the small volume.

ΔΦ≈(P_x+Q_y+R_z)ΔxΔyΔz
div F(p)=lim[ε→0] Φ(∂Vε)/Vol(Vε)

In the limit, Vε is a regularly shrinking box around p with outward normal, under field regularity assumptions. Arrows need not point away from the origin: F=(10+x,0,0) has divergence 1 near the origin even though all arrows point right. Local differences matter, not an idealized source picture.

Explore

4. Gauss’s theorem: assumptions first

Classically V is a bounded solid with piecewise smooth boundary. Include the entire boundary, oriented out of V. F has continuous first partial derivatives on an open neighbourhood of the solid and its boundary. Corners and multiple boundary components are allowed with the correct orientation on each.

B=∬∂V F·n̂_ext dS
I=∭V div F dV
B=I

The left side is a surface integral, the right a triple integral. dV is a positive volume weight and carries no orientation. This does not compare boundary field values with a centre value: it compares two different integrals. Reversing all normals changes B to −I, while I stays fixed.

Explore

5. The proof on a box

For V=[0,a]×[0,b]×[0,c], faces x=a and x=0 have normals (1,0,0) and (−1,0,0), with area element dy dz. Add their fluxes and use the fundamental theorem in x to obtain a triple integral of P_x.

B_x=∫₀ᶜ∫₀ᵇ[P(a,y,z)−P(0,y,z)]dy dz
P(a,y,z)−P(0,y,z)=∫₀ᵃP_x(x,y,z)dx
B_x=∭V P_x dV
B_y=∭V Q_y dV; B_z=∭V R_z dV
B=B_x+B_y+B_z=∭V(P_x+Q_y+R_z)dV

Two adjacent cells: opposite normals on their shared face make fluxes cancel.
Two adjacent cells: opposite normals on their shared face make fluxes cancel.

For adjacent boxes the common face has opposite normals on the two pieces, so its fluxes cancel exactly. Only the union’s boundary remains. This explains the general theorem’s idea, but does not replace the technical approximation and limit arguments needed for curved boundaries.

Explore

6. Two boxes: constant and variable divergence

For F=(x,y,z), coordinate-plane faces contribute zero. At x=a, the dot product is a and area is bc, giving abc. The y=b and z=c faces each give abc too. Divergence is 3 everywhere, so the volume calculation is three times the volume.

B=abc+abc+abc=3abc
I=∫₀ᵃ∫₀ᵇ∫₀ᶜ3 dz dy dx=3abc
a=2,b=1,c=3/2 → Vol(V)=3; B=I=9

For F=(x³,y³,z³), div F=3x²+3y²+3z² instead. Do not multiply an arbitrary divergence value by volume; integrate each term in its variable.

I=a³bc+ab³c+abc³=abc(a²+b²+c²)
B_(x=a)=a³bc; B_(y=b)=ab³c; B_(z=c)=abc³
a=2,b=1,c=3/2 → B=I=3(4+1+9/4)=87/4=21.75

Explore

7. Sphere: a simpler calculation

Take the ball of radius R and F=(x,y,z). On its spherical boundary the unit outward normal is (x,y,z)/R. Hence F·n̂=(x²+y²+z²)/R=R. It is constant on this surface, not for an arbitrary field.

B=R·Area(∂V)=R·4πR²=4πR³
I=3·Vol(V)=3·(4πR³/3)=4πR³
R=2 → B=I=32π

The theorem lets us choose the easier side after checking assumptions. The lab nevertheless computes both sides independently. With few samples they may have different errors: Gauss is an analytic identity, not automatic equality between finite sums.

Explore

8. A cylinder needs its caps too

Let V be a cylinder of radius R and height H from z=0 to H. Its full boundary consists of the lateral wall and both disks. For F=(0,0,z), the wall has horizontal normal and zero flux; at z=0 the field vanishes; at the top F·n̂=H.

div F=1
B_laterale=0; B_inferiore=0; B_superiore=HπR²
B=πR²H=∭V1 dV=I
R=2,H=3 → B=I=12π

Removing the caps leaves wall flux zero while the cylinder’s volume integral remains πR²H. No contradiction: the wall is not ∂V. For F=(x,y,z), the wall gives 2πR²H and the upper cap πR²H, totalling 3πR²H.

Explore

9. Zero flux does not mean zero field

In the box, F=(1,0,0) enters through x=0 and leaves through x=a: contributions −bc and +bc cancel. In the ball, F=(−y,x,0) is tangent to every origin-centred sphere: flux is zero pointwise. The lab compares these different mechanisms.

If div F=0 throughout the volume and the other assumptions hold, closed flux is zero. The converse on just one volume is false: positive and negative divergence can cancel. For example F=(x²,0,0) on [−1,1]³ has div F=2x, not identically zero, but total integral and flux vanish by symmetry.

Explore

10. A cavity needs a second boundary

V={r≤ρ≤R}, ρ=√(x²+y²+z²), 0<r<R
F=(x,y,z)/ρ³
div F=(1/ρ³−3x²/ρ⁵)+(1/ρ³−3y²/ρ⁵)+(1/ρ³−3z²/ρ⁵)
=3/ρ³−3ρ²/ρ⁵=0, ρ>0

V is a spherical shell: the origin lies in its cavity, outside V. The field is regular near the shell. On the outer sphere the outward normal points toward increasing radius; on the inner sphere leaving the material means moving toward the centre. The inner normal is therefore opposite to the radial direction.

B_esterno=(1/R²)·4πR²=4π
B_interno=(−1/r²)·4πr²=−4π
B=4π−4π=0=∭V0 dV

The hole does not prevent Gauss: it requires the whole material boundary. Omitting the inner sphere leaves 4π and an incomplete comparison surface. Changing radii does not change these two fluxes for this particular field.

Explore

11. Filling the hole changes the assumptions

Use the same field on the filled ball. Spherical flux is still computable as 4π because the field is defined on the boundary. But F is undefined at the origin, now inside the volume. The C¹-neighbourhood assumption for all of V fails.

Writing “div F=0 for ρ>0, so ball flux is zero” uses the theorem outside its assumptions. The classical argument cannot ignore the singularity. Remove a ball of radius ε to regain a shell: its inner boundary contributes −4π for every ε>0, not vanishing as ε shrinks.

The lab therefore shows boundary flux but disables the interior integral as a classical Gauss check: not applicable, rather than a zero inferred only from regular samples. It does not silently introduce extensions or distributions for point sources.

Explore

12. Orientation, units and connections

B_uscente=I
B_entrante=−I
dS=‖r_u×r_v‖du dv
F·n̂ dS=F·N du dv, N=±(r_u×r_v)

The cross product already contains the area factor: do not multiply by its magnitude again in the flux formula. For velocity in m/s, div F has units 1/s and its volume integral m³/s, matching surface flux. Both sides have the same units.

Green’s flux form connects a planar region’s boundary with two-dimensional divergence. Gauss connects a volume boundary with three-dimensional divergence. Stokes, next, concerns circulation and curl: divergence cannot be swapped with curl, nor flux with work along a curve.

Explore

13. The laboratory: two independent calculations

Choose an experiment, check which boundary is included and compare the sums. Each step adds one boundary cell; the interior advances by proportional layers. Partial sums need not agree: those boundary and volume pieces are not necessarily boundary and interior of the same subsolid.

ΔB=F(r(u*,v*))·N(u*,v*)/n²
ΔV=J_vol(u*,v*,w*)/n³
ΔI=div F(x*,y*,z*) ΔV
B≈ΣΔB; I≈ΣΔI; confronto finale: B con sI, s=±1

The lab uses midpoints, n² cells per surface component and n³ volume cells. The volume Jacobian differs from the area factor. Tables show both; error columns compare against guided-case analytic values. Increasing n illustrates convergence but provides neither proof nor a certified error bound.

The visual cutaway only reveals the interior; it removes no integration faces. Omitting caps or the inner boundary really changes the integrated surface and invalidates the Gauss comparison. The singular field is blocked before volume sampling even if a finite grid would miss the origin.

Explore

Exercises: try before revealing

1. Find the divergence of F=(x²,yz,3z).

Show the explained answer

P_x=2x,Q_y=z,R_z=3, hence div F=2x+z+3. At (1,2,−1) it is 4. Do not differentiate yz in z: it is the second component.

2. Box a=2,b=1,c=3/2 with F=(x,y,z): total flux.

Show the explained answer

Volume abc=3 and div F=3 give I=9. Three far faces contribute 3 each; coordinate-plane faces zero. B=9.

Explore

3. The same box with a sink F=(−x,−y,−z).

Show the explained answer

div F=−3 gives I=−9. Outward flux is −9, indicating net inflow. Geometric volume remains positive, 3.

Explore

4. Constant F=(1,0,0): why is flux zero?

Show the explained answer

x=0 gives −bc=−1.5, x=a gives +1.5; other faces zero. They cancel although those face fluxes are nonzero. Divergence is zero everywhere.

Explore

5. Box and cubic field: find B for a=2,b=1,c=3/2.

Show the explained answer

B=abc(a²+b²+c²)=3(4+1+2.25)=21.75. Far faces give 12,3,6.75. Integrating the variable divergence gives the same analytic value.

Explore

6. Radius-2 sphere, F=(x,y,z): use both formulas.

Show the explained answer

On the boundary F·n̂=2 and area=16π, so B=32π. Inside div F=3 and volume=32π/3, hence I=32π.

Explore

7. Cylinder R=2,H=3, F=(0,0,z): what is missing without caps?

Show the explained answer

The interior gives I=12π. Wall and lower cap give zero; upper cap gives 12π. Without caps B=0 on an open surface: Gauss does not equate it to I.

Explore

8. Cylinder R=2,H=3, F=(x,y,z): split the flux.

Show the explained answer

Wall: 24π; upper cap: 12π; lower cap: zero; total 36π. Volume 12π times divergence 3 gives I=36π.

Explore

9. Shell r=1,R=2 with inverse-square field: normals and fluxes.

Show the explained answer

Outer sphere normal is radial, giving 4π. Inner material normal points toward the centre, giving −4π. Total zero matches the regular shell’s zero divergence integral.

Explore

10. Same field in the filled ball: may we declare zero flux?

Show the explained answer

No. The origin is undefined and the C¹-neighbourhood assumption fails. Direct spherical flux is 4π. Sampling only points away from the origin cannot restore the theorem’s assumptions.

Explore

11. Reverse all normals in the first example: what changes?

Show the explained answer

B changes from 9 to −9 while I stays 9 and volume 3. Compare B=−I, not B=I. In a shell reverse both boundary components, not just the outer one.

Explore

12. Does zero flux on one closed surface imply zero divergence everywhere?

Show the explained answer

No. F=(x²,0,0) on [−1,1]³ has div F=2x, positive for x>0 and negative for x<0. Integral contributions cancel. A zero integral does not require an identically zero function.

Before: surface integrals · Learning-path index

Further reading