# Conceptual question on volume current density and derivation of the continuity equation

The expression for the volume integral of the volume charge density is

$$\int_{V} (\nabla \cdot\vec{J}) d\tau = -\frac{d}{dt} \int_{V} \rho d\tau = -\int_{V} (\frac{\partial \rho}{\partial t}) d\tau$$

I understand physically that as charge flows out of a differential volume, the divergence of the volume current density is positive and that the volume charge density would decrease

But I need more clear explanation for these equations, how did we go from $$\int_{V} (\nabla \cdot\vec{J}) d\tau$$
to $$-\frac{d}{dt} \int_{V} \rho d\tau$$ mathematiclly? When you think about it conceptually it is intuitive but I'm talking about the mathetmatics here, also how did we get from $$-\frac{d}{dt} \int_{V} \rho d\tau$$ to $$\int_{V} (\frac{\partial \rho}{\partial t}) d\tau$$

Is it because in this case $$\rho$$ might depend on the position? Maybe my questions are trivial but I don't have a strong background in multivariable calculus, I'll try my best to understand, so any insight would be appreciated.

Consider a surface $$S$$ enclosing a volume $$V$$, the net current moving into the volume $$V$$ is

$$I = -\int_S {\rm d}^2{\bf S} \cdot {\bf J} \tag{1}$$

And your intuition here works: since $${\rm d}{\bf S}$$ points outwards, if the flow of current is into the volume, the inner product is negative, so you need the minus sign. And you know that the current is just

$$I = \frac{{\rm d}q(t)}{{\rm d}t} = \frac{{\rm d}}{{\rm d}t}\int_{V}{\rm d}^3{\bf r} ~\rho({\bf r}, t) \tag{2}$$

where $${\bf \rho}$$ is the charge density. Now note that you are integrating w.r.t to the coordinates, and taking the derivative w.r.t to time, so these two operations commute, but when if you interchange them you need to take into account that the quantity you are taking the time-derivative of ($$\rho$$) now depends on both the coordinates and time. In other words

$$I = \frac{{\rm d}}{{\rm d}t}\int_{V}{\rm d}^3{\bf r} ~\rho({\bf r}, t) = \int_{V}{\rm d}^3{\bf r} ~\frac{\partial}{\partial t}\rho({\bf r}, t)\tag{3}$$

Replace (3) in (1)

$$\int_{V}{\rm d}^3{\bf r} ~\frac{\partial}{\partial t}\rho({\bf r}, t) = -\int_S {\rm d}^2{\bf S} \cdot {\bf J} \tag{4}$$

Now apply the divergence theorem

$$\int_{V}{\rm d}^3{\bf r} ~\frac{\partial}{\partial t}\rho({\bf r}, t) = -\int_V {\rm d}^3{\bf r} \nabla \cdot {\bf J} \tag{5}$$

• Exactly what I needed! – khaled014z Dec 6 '18 at 15:02