# What is the divergence of a field?

Finds the divergence div F = ∇ · F of a vector field F = (P, Q, R), and its curl, checked numerically.

- Page: https://www.acalculator.org/math/divergence-calculator
- JSON spec: https://www.acalculator.org/math/divergence-calculator.json
- Version: 0d525301d7c3

## Default answer

Example with the default inputs (P (i component) e^x, Q (j component) y z, R (k component) -y z^2): The divergence of (e^x, y z, -y z^2) is -2y z + z + e^x.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| p | P (i component) | The P component, a function of x, y and z. |
| q | Q (j component) | The Q component, a function of x, y and z. |
| r | R (k component) | The R component, a function of x, y and z. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| div | div F | The divergence P_x + Q_y + R_z. |
| curl | curl F | The curl (R_y − Q_z, P_z − R_x, Q_x − P_y). |

## Method

div F = ∂P/∂x + ∂Q/∂y + ∂R/∂z, each partial derivative from a CAS, checked.

## Assumptions

- Radians. An answer that fails its check is not shown.

## Worked examples

1. p = e^x, q = y z, r = -y z^2 gives div = -2y z + z + e^x. Source: OpenStax Calculus Vol. 3 (Strang and Herman, 2016), 6.5, Ex. 6.48.
2. p = y z, q = x z, r = x y gives div = 0, curl = (0, 0, 0). Source: OpenStax Calculus Vol. 3 (Strang and Herman, 2016), 6.5, Ex. 6.56.
3. p = x^2 z, q = e^y + x z, r = x y z gives div = x y + 2x z + e^y, curl = (x z - x, x^2 - y z, z). Source: OpenStax Calculus Vol. 3 (Strang and Herman, 2016), 6.5, Ex. 6.52.

## FAQ

### What is the divergence of a vector field?

For F = (P, Q, R), the divergence is the scalar function div F = ∇ · F = ∂P/∂x + ∂Q/∂y + ∂R/∂z. It measures how much the field flows out of a tiny box around each point, per unit of volume.

### What does the sign of the divergence mean?

Positive divergence at a point is a source: more of the field flows out than in. Negative divergence is a sink. Zero divergence everywhere means the field is source-free (incompressible), like the flow of water.

### How do I find the divergence of a 2D field?

Type P and Q and set R to 0. The divergence is then ∂P/∂x + ∂Q/∂y. For F = (x, y) it is 1 + 1 = 2.

### What is the difference between divergence and curl?

The divergence is a number at each point and measures outflow. The curl is a vector at each point and measures rotation. The page shows both from the same checked partial derivatives; the curl calculator heads its answer with the curl.

### What is the divergence theorem?

For a solid E with a closed outward surface S, the flux of F out of S equals the triple integral of div F over E: ∬_S F · dS = ∭_E div F dV. A field with div F = 0 has zero net flux through every closed surface.

### Is the divergence of a curl always zero?

Yes. For any field G whose components have continuous second partial derivatives, div(curl G) = 0, because the mixed partial derivatives cancel in pairs.

### How is the answer checked?

Each partial derivative comes from a computer algebra system and must match a numeric difference quotient at 15 test points in x, y and z. The simplified divergence must equal the unsimplified sum at the same points. An answer that fails is not shown.

## Sources

- OpenStax, Calculus Volume 3, section 6.5 Divergence and Curl (retrieved 2026-10-03): https://openstax.org/books/calculus-volume-3/pages/6-5-divergence-and-curl
