Calculating Vector Field Divergence- Methods and Examples
What Is Divergence?
Divergence measures how much a vector field spreads out or converges at any point. Think of it as a density check — is fluid flowing away from a point, or piling up there?
A positive divergence means the field is "diverging" — sources pushing outward. A negative divergence means the field is "converging" — sinks pulling inward. Zero divergence means what goes in equals what comes out.
That's it. No mystical interpretations. Just a number at each point telling you if vectors are spreading or compressing.
The Mathematical Definition
In Cartesian coordinates, if you have a vector field F = (P, Q, R) where P, Q, and R are functions of x, y, and z, the divergence is:
∇ · F = ∂P/∂x + ∂Q/∂y + ∂R/∂z
The nabla operator (∇) dotted with the vector field. You take the partial derivative of each component with respect to its corresponding variable, then add them up.
This works in any coordinate system, but the formula changes. That's where most people get tripped up.
Divergence in Different Coordinate Systems
The formula depends on which coordinate system you're using. Using the wrong one is the fastest way to get wrong answers.
| Coordinate System | Divergence Formula | When to Use |
|---|---|---|
| Cartesian (x, y, z) | ∂P/∂x + ∂Q/∂y + ∂R/∂z | Rectangular regions, standard problems |
| Cylindrical (r, θ, z) | (1/r)∂(rP)/∂r + (1/r)∂Q/∂θ + ∂R/∂z | Pipes, cylinders, symmetry around an axis |
| Spherical (ρ, φ, θ) | (1/ρ²)∂(ρ²P)/∂ρ + (1/(ρ sinθ))∂(Q sinθ)/∂θ + (1/(ρ sinθ))∂R/∂φ | Spheres, point sources, radial symmetry |
The cylindrical and spherical formulas look intimidating, but they're just accounting for how the coordinate basis vectors change direction as you move through space.
How to Calculate Divergence
Step 1: Identify Your Vector Field
Write your vector field in component form. For a 3D field, you need three components. For 2D, two.
Step 2: Pick the Right Coordinate System
Match your coordinates to the geometry of your problem. Circular symmetry? Use cylindrical. Spherical symmetry? Use spherical. Otherwise, stick with Cartesian — it's simpler.
Step 3: Take the Partial Derivatives
Differentiate each component with respect to its corresponding coordinate. Treat all other variables as constants.
Step 4: Add the Results
Sum the partial derivatives. That's your divergence — a scalar function telling you the net outflow at each point.
Worked Examples
Example 1: Simple 2D Field
Given F = (x², 3xy)
∂P/∂x = ∂(x²)/∂x = 2x
∂Q/∂y = ∂(3xy)/∂y = 3x
∇ · F = 2x + 3x = 5x
At x = 2, divergence is 10. At x = 0, divergence is zero.
Example 2: Radial Field in 3D
Given F = (x, y, z) — this is just r̂ times r in disguise
∂x/∂x = 1
∂y/∂y = 1
∂z/∂z = 1
∇ · F = 1 + 1 + 1 = 3
Constant divergence of 3 everywhere. This makes sense — the field is expanding uniformly.
Example 3: Cylindrical Coordinates
Given F = (r², 0, 0) — purely radial flow in a cylinder
Using the cylindrical formula: (1/r)∂(r·r²)/∂r = (1/r)∂(r³)/∂r = (1/r)(3r²) = 3r
∇ · F = 3r
The divergence increases linearly with radius. The flow is accelerating outward.
Common Mistakes to Avoid
- Using Cartesian formulas in cylindrical problems — the coordinate basis vectors aren't constant in curvilinear systems
- Forgetting the chain rule in cylindrical/spherical — terms like (1/r)∂(rP)/∂r expand to more than just ∂P/∂r
- Confusing divergence with curl — divergence is a scalar, curl is a vector
- Dropping units — divergence has units of [field] per [length]
Applications
Divergence shows up everywhere in physics and engineering:
- Electromagnetism — ∇ · E = ρ/ε₀ relates electric field divergence to charge density
- Fluid dynamics — ∇ · v = 0 for incompressible flow; nonzero divergence means compression
- Heat transfer — divergence of heat flux tells you where heat is accumulating or dissipating
- Continuity equations — divergence connects local changes to net flow across boundaries
You don't need to memorize applications. Once you understand what divergence measures, you'll recognize where it applies.