All the examples of continuity equations below express the same idea. Continuity equations are the (stronger) local form of conservation laws.
In electromagnetic theory, the continuity equation is derived from two of Maxwell's equations. It states that the divergence of the current density is equal to the negative rate of change of the charge density,
One of Maxwell's equations, Ampère's law, states that
Taking the divergence of both sides results in
but the divergence of a curl is zero, so that
Another one of Maxwell's equations, Gauss's law, states that
Substitute this into equation (1) to obtain
which is the continuity equation.
Current density is the movement of charge density. The continuity equation says that if charge is moving out of a differential volume (i.e. divergence of current density is positive) then the amount of charge within that volume is going to decrease, so the rate of change of charge density is negative. Therefore the continuity equation amounts to a conservation of charge.
In fluid dynamics, a continuity equation is an equation of conservation of mass. Its differential form is
where is density, t is time, and u is fluid velocity.
In quantum mechanics, the conservation of probability also yields a continuity equation. Let P(x, t) be a probability density and write
where J is probability flux.