Showing the Law of Conservation of Mass is equivalent to the continuity equation? Let $\textbf{v}(t,x,y,z)$ be a continuously differentiable vector field over the region $D$ in space and let $p(t,x,y,z)$ be a continuously differentiable scalar function. The variable $t$ represents the time domain. 
The Law of Conservation of Mass asserts that:
$$\frac{\mathrm{d}}{\mathrm{d}t}\iiint\limits_Dp(t,x,y,z)\ \mathrm{d}V=-\iint\limits_Sp\textbf{v}\cdot \textbf{n}\ \mathrm{d}\sigma$$
where $S$ is the surface enclosing $D$, $\textbf{v}$ is a velocity flow field and $p$ is the density of the fluid at point $(x,y,z)$ at time $t$.
Use the Divergence Theorem and Leibniz's Rule, $$\frac{\mathrm{d}}{\mathrm{d}t}\iiint\limits_Dp(t,x,y,z)\ \mathrm{d}V=\iiint\limits_D\frac{\partial{p}}{\partial{t}}\ \mathrm{d}V$$
to show that the Law of Conservation of Mass is equivalent to the continuity equation, $$\nabla \cdot p\textbf{v} \ +\frac{\partial{p}}{\partial{t}}=0.$$
I know the Divergence Theorem states the outward flux of a vector field across a closed surface equals the triple integral of the divergence of said field over the region enclosed by said surface. I'm just not sure how to apply it here. Any help would be appreciated.  
 A: Given the regularity of $p$ and $\mathbb{v}$ we have
$$\int_D \frac{\partial p}{\partial t} \, dV = \frac{d}{dt}\int_Dp \, dV  = - \int_S p\mathbb{v} \cdot \mathbb{n} \, d\sigma = -\int_D \nabla \cdot (p \mathbb{v}) \, dV,$$
and it follows that
$$\tag{*}\int_D \left[\frac{\partial p}{\partial t} + \nabla \cdot (p \mathbb{v})\right]\, dV =0.$$
You cannot immediately conclude that for all $\mathbb{x} \in D$
$$\frac{\partial p}{\partial t} + \nabla \cdot (p \mathbb{v})=0,$$
since the integrand could assume both positive and negative values. However, the conservation law applies to any region $R \subset D$. At any point where the integrand is positive (or negative) it is of the same sign throughout a neighborhood $R$ by continuity and 
$$\int_R \left[\frac{\partial p}{\partial t} + \nabla \cdot (p \mathbb{v})\right]\, dV =0 $$
implies that for all $\mathbb{x} \in R$ we have
$$\tag{**}\frac{\partial p}{\partial t} + \nabla \cdot (p \mathbb{v})=0.$$
To show equivalence, if (**) holds at every point, then the integral over any region is zero. Reversing the above steps we  prove the converse.
