TITLE: How does a probability density function evolve with time?
QUESTION [6 upvotes]: Let $f(x,t)$ be a probability density function of stochastic process $X_t$, where $X_t$ evolves over time deterministically according to the following ODE
$$\dot x = g(x,t)$$
Then, how does $f(x)$ change with time? How to find  $\frac{df}{dt}$?
For example, say $X_t$ is the height of a tree at time $t$. Tree heights are distributed according to $f(x,t)$ at a given time. Each tree grows according to  $\frac{dX_t}{dt}=g(X_t,t)$. Then what is  $\frac{df}{dt}$?

REPLY [5 votes]: This is an extremely dirty derivation. It would be nice to have a rigorous one.

Here is one. For every $t$ and every regular function $u$ going to zero at infinity,  by definition of the PDF of $X_t$, 
$$E(u(X_t)) = \int_\mathbb R u(x)f(x,t)dx$$ 
Differentiating under the expectation sign, this yields 
$$\int_\mathbb R u(x)\partial_tf(x,t)dx=\frac{d}{dt}E(u(X_t)) = E(u'(X_t)g(X_t,t)) = \int_\mathbb R u'(x)g(x,t)f(x,t)dx$$
Now, integrating by parts and using the fact that $u$ is zero at infinity, the rightmost term is 
$$\int_\mathbb R u'(x)g(x,t)f(x,t)dx = -\int_\mathbb R u(x)\partial_x(g(x,t)f(x,t))dx$$
To sum up, the identity 
$$\int_\mathbb R u(x) \partial_t f(x,t) dx = -\int_\mathbb R u(x)\partial_x(g(x,t)f(x,t))dx$$
should hold for every admissible test function $u$ hence, by identification, $$\partial_t f(x,t) = -\partial_x(g(x,t)f(x,t))$$