Continuity Equations in Electromagnetism
Formulas
The following formula is known as the continuity equation.
$$ \dfrac{\partial \rho}{\partial t}=-\nabla \cdot \mathbf{J} $$
Explanation1
The continuity equation mathematically expresses the law of conservation of charge in a local region. The law of conservation of charge states that the original amount of charge does not suddenly disappear or newly appear; the initial amount of charge is maintained. This is true not only for the entire universe but also for the small regions visible to us. If there is a change in the total charge within a space, that amount of charge must have entered or left through the boundary of that space. It’s like I can’t leave my room (space) without passing through the door (boundary of space). If I disappeared from the room, it’s clear I left through the door, and if I went out through the door, it’s clear that I disappeared from the room.
Derivation
The charge within a volume $\mathcal{V}$ is as follows.
$$ Q(t)=\int_\mathcal{V} \rho (\mathbf{r},t) d \tau $$
And the current flowing out through the boundary $\mathcal{S}$ of $\mathcal{V}$ is $\displaystyle \oint_\mathcal{S} \mathbf{J} \cdot d\mathbf{a}$, so
$$ \dfrac{dQ}{dt}=-\oint_\mathcal{S} \mathbf{J} \cdot d\mathbf{a} $$
The reason for the opposite sign is obvious. If I left the room, the change in the number of people in the room (left-side) is $-1$, but the number of people who left through the door (right-side) is $1$. From the above two equations, the following equation holds.
$$ \int_\mathcal{V} \dfrac{ \partial \rho}{\partial t} d \tau= -\oint_\mathcal{S} \mathbf{J} \cdot d\mathbf{a} $$
Applying the divergence theorem on the right side gives
$$ \int_\mathcal{V} \dfrac{ \partial \rho}{\partial t} d \tau= -\int_\mathcal{V} \nabla \cdot \mathbf{J} d\tau $$
Since the above equation holds for any space $\mathcal{V}$, the following equation is valid.
$$ \dfrac{ \partial \rho}{\partial t} = -\nabla \cdot \mathbf{J} $$
David J. Griffiths, Introduction to Electrodynamics (4th Edition, 2014), p239-240 ↩︎