Imagine a swimming pool in which the water is constantly being purified. This is actually a common practice in swimming pools: a pump continuously draws the water out, cleans it of impurities and pumps it back in, in such a way that the amount of water in the pool always stays at the same level. Clearly, the balance equation for such a pool has the form
where — the amount of water flowing in after purification, — the amount of dirty water flowing out.
What is the amount of water? In essence it is the product of the flux and the area through which this flux passes; for example, for an arbitrary rectangle of area the flux is given by the formula
Now let us think about a more complex example. We have a rectangular box of water of size , through whose faces water can flow in or out. Then the balance equation changes
where — the difference between the inflowing and outflowing amounts of water through the faces of the box.
This difference, or discrepancy, is essentially the divergence, but we have not quite finished refining it yet, so let us move on. Let us introduce the notion of the difference of fluxes
Taking into account formulas (2) and (4), let us rewrite formula (3) in the following form
Now let us transform the resulting formula into the following form
Now we must split the box into an enormous (potentially infinite) number of primitives whose sizes are very small (potentially zero), and then sum the results over all the primitives.
Let us pass from sums to integrals
When is this integral equal to zero? Obviously, when as much water flows in as flows out of our box, that is, when there are neither sources nor leaks in this volume. The flow of a fluid is essentially a vector field, and we have just obtained a characteristic of this field which, at a specific point, tells us whether there are sources or sinks there. This characteristic is called the divergence and is defined by the formula
One can say that divergence computes a scalar field from a vector field. In practice, divergence is used to determine the sources of a field; for example, one of Maxwell's equations for vacuum looks like this
where — the field strength vector, — the electric charge density, — the electric constant.
It is convenient to write divergence as the dot product of the nabla operator with the vector of the original field