We often describe distributions of mass or charge by describing how much of either lies in a small volume, dV containing the point P. Thus the mass density sometimes denoted as is defined to make represents the mass contained in that volume, while charge density is defined exactly the same way, with as charge density and the amount of charge in volume dV.
If the mass or charge happens to be moving with velocity v(P), we define the current j(P), of either according to The flux of this current through any surface S represents the amount of charge or mass that flows through that surface per unit time.
The flow of mass or charge through surface S per unit time is, with the appropriate current vector
This fact allows us to describe the local conservation of these quantities by equations. That conservation means that the only way the amount of either charge or matter in a given volume changes is by flow through the boundary of the volume. It will increase if that flow is inward and decrease if the net flow is outward. This tells us that the derivative of the integral of the density over any volume V will be the negative of the outward flux of its current over its surface, V
Recall that the divergence theorem tells us that for any vector field W(P), we have
Applying this theorem to the vector field j in the conservation equation, and choosing V to be a fixed volume so that the time derivative only affects the integrand, and using the linearity of derivative and integral to move the derivative inside the integral, we get
and this relation is to hold for all volumes V.
In physics we draw the conclusion from this statement that the integrand is zero everywhere it is defined, and this gives us the differential form of the conservation law
The content of this equation is of course exactly that of the original law: that the change of the amount of mass or charge in a volume is the amount that flows into V less the amount that flows out of it.