Understanding where the continuity equation comes from Suppose we have a random variable $X$ taking values in $\mathbb{R}^k$ and that this random variable has a smooth density $p(x)$ over all of $\mathbb{R}^k$. Suppose further that I have a smooth vector field $\mathbf{g} : \mathbb{R}^k\to\mathbb{R}^k$ and let $\phi_t(x)$ denote the flow of this vector field to time $t$ starting from initial position $\phi_0(x) = x$. It seems to be a result that if I transform $X_t\overset{\text{def.}}{=} \phi_t(X)$ then the density of $X_t$ obeys a continuity equations:
$$
\frac{\partial}{\partial t} p_t(x) = -\text{div}(p_t \mathbf{g})
$$
How does one prove this result?
I actually know this result to be a special case of the Fokker-Planck equation governing stochastic differential equations. The proof I know for Fokker-Planck requires Dynkin's formula, stopping times, infinitesimal generators for diffusions, and operator adjoints. I have a feeling that a simpler proof should exist for the case wherein the diffusion coefficient is zero, as I have described.
 A: BOTTOM LINE UP FRONT: You can apply the Reynolds Transport Theorem to the scalar field $p$.
Fix $A\subset\mathbb{R}^k$. This set evolves according to the flow $\phi_t$: at time $t$, the "material points" that "occupied" $A$ at time 0, occupy the set $\phi_t(A)$. The integral of $p$ over $\phi_t(A)$ is
\begin{equation}
\int_{\phi_t(A)}p(t,x)dV.
\end{equation}
The Reynolds Transport Theorem shows that
\begin{equation}
\frac{d}{dt}\int_{\phi_t(A)}p(t,x)dV = \int_{\phi_t(A)}\frac{\partial p}{\partial t}(t,x)dV + \int_{\partial\phi_t(A)}p(t,x)\mathbf{g}(x)\cdot\mathbf{n}(x)dS,
\end{equation}
where $\partial\phi_t(A)$ is the boundary of $\phi_t(A)$, $\mathbf{n}(x)$ is the outward-facing unit normal vector at $x\in\partial\phi_t(A)$, and $dS$ is the differential area on $\partial\phi_t(A)$.
By the Divergence Theorem,
\begin{equation}
\int_{\partial\phi_t(A)}p(t,x)\mathbf{g}(x)\cdot\mathbf{n}(x)dS = \int_{\phi_t(A)}\textrm{div}(p(t,x)\mathbf{g}(x))dV.
\end{equation}
So far we have
\begin{equation}
\frac{d}{dt}\int_{\phi_t(A)}p(t,x)dV = \int_{\phi_t(A)}\left[\frac{\partial p}{\partial t}(t,x) + \textrm{div}(p(t,x)\mathbf{g}(x))\right]dV.
\end{equation}
If the probability attached to each evolving set is constant, then the time derivative on the left-hand side is zero for all (well-behaved) sets $A$. The only way this can be true for such a wide class of sets is if the integrand is identically zero (or zero almost everywhere, if you're into that sort of thing).


The Reynolds Transport Theorem

We can express the integral over $\phi_t(A)$ as an integral over $A$ as follows:
\begin{equation}
\int_{\phi_t(A)}p(t,\tilde{x})dV(\tilde{x}) = \int_{A}p(t,\phi_t(x))J(t,x)dV(x),
\end{equation}
where $dV(\tilde{x})$ it the volume measure on $\phi_t(A)$, $dV(x)$ is volume measure on $A$, and $J$ is the Jacobian determinant of the map $x\mapsto\phi_t(x)$.
\begin{equation}
\frac{d}{dt}\int_{A}p(t,\phi_t(x))J(t,x)dV(x) = \int_{A}\frac{d}{dt}\left[p(t,\phi_t(x))J(t,x)\right]dV(x)
\end{equation}

Let $y(t,x) = \phi_t(x)$.
\begin{equation}
\begin{split}
\frac{d}{dt}p(t,\phi_t(x)) &=~ \frac{d}{dt}p(t,y(t,x))\\
&=~ \frac{\partial p}{\partial t}(t,y(t,x)) + \sum_{i=1}^{k}\frac{\partial p}{\partial x_i}(t,y(t,x))\frac{\partial y_i}{\partial t}(t,x)\\
&=~ \frac{\partial p}{\partial t} + (\nabla p)\cdot\mathbf{g},
\end{split}
\end{equation}
where the spatial argument of each term in the last line is $y(t,x) = \phi_t(x)$.

\begin{equation}
\begin{split}
\frac{d}{dt}J(t,x) &=~ \frac{d}{dt}\det\left(\textrm{grad}~\phi_t(x)\right)\\
&=~ \frac{d}{dt}\det\left(\textrm{grad}~y(t,x)\right)\\
&=~ \textrm{div}\left(\frac{\partial y}{\partial t}(t,x)\right)J(t,x)\\
&=~ \textrm{div}\left(\mathbf{g}(y(t,x))\right)J(t,x)
\end{split}
\end{equation}

When we put these terms together, the integrand over $A$ is seen to be
\begin{equation}
\begin{split}
\frac{d}{dt}\left[p(t,y(t,x))J(t,x)\right] &=~ J(t,x)\frac{d}{dt}p(t,y(t,x)) + p(t,y(t,x))\frac{d}{dt}J(t,x)\\
&=~ J\left(\frac{\partial p}{\partial t} + (\nabla p)\cdot\mathbf{g}\right) + pJ~\textrm{div}(\mathbf{g})\\
&=~ J\left(\frac{\partial p}{\partial t} + (\nabla p)\cdot\mathbf{g} + p~\textrm{div}(\mathbf{g})\right)\\
&=~ J\left(\frac{\partial p}{\partial t} + \textrm{div}\left(p\mathbf{g}\right)\right).
\end{split}
\end{equation}

In summary,
\begin{equation}
\begin{split}
\frac{d}{dt}\int_{\phi_t(A)}p(t,\tilde{x})dV(\tilde{x}) &=~ \frac{d}{dt}\int_{A}p(t,\phi_t(x))J(t,x)dV(x)\\
&=~ \int_{A}\left(\frac{\partial p}{\partial t}(t,\phi_t(x)) + \textrm{div}\left(p(t,\phi_t(x))\mathbf{g}(\phi_t(x))\right)\right)J(t,x)dV(x)\\
&=~ \int_{\phi_t(A)}\left(\frac{\partial p}{\partial t}(t,\tilde{x}) + \textrm{div}\left(p(t,\tilde{x})\mathbf{g}(\tilde{x})\right)\right)dV(\tilde{x})
\end{split}
\end{equation}
