TITLE: A proof of a theorem of Liouville
QUESTION [7 upvotes]: I need some reference for the proof of the following theorem attributed to Liouville:

Theorem. Let $f(x):\Omega\longrightarrow \mathbb R^n$ be a $C^2$ function where $\Omega$ is an open subset of $\mathbb R^n$ and assume that
$$
\textrm{div}\, f=\sum_{i=1}^n\frac{\partial f_i}{\partial x_i}=0.
$$
If $\varphi$ is the flow  of the differential equation $y'=f(y)$ and we consider the homeomorphism $\pi_t:\Omega\longrightarrow\Omega$, such that 
$$
x\,\longmapsto\, \pi_t(x):=\varphi(x,t),
$$ 
then the map $\pi_t$ preserves the Lebesgue measure of every measurable subset of $\Omega$.
To be more precise, for every $\mu$-measurable subset $D\subseteq \Omega$ we have that $\mu(D)=\mu\big(\pi_t(D)\big)$.

The above theorem is very famous and its simpler form applied to Hamiltonian systems is often cited in texts of mechanics. However I need a proof of the general statement.
Thanks in advance

REPLY [8 votes]: Idea of the proof.
Let $D_t=\pi_t(D)$. It suffices to show that
$$
\frac{d}{dt}m(D_t)=\int_{D_t}\nabla\cdot f\,dx.
$$
The Theorem of Change of Variables says that
$$
m(D_t)=\int_{D_t} 1\,dx=\int_{D}\det\left(\frac{\partial\pi_t}{\partial x}\right)\,dx.
$$
But
$$
\frac{\partial\pi_t}{\partial x}=I+\frac{\partial f}{\partial x}t+{\mathcal O}(t^2).
$$
This is due to the fact that the solution of 
$$
x'=f(x),\quad x(0)=x_0,
$$
after small time $t$ looks like $x(t)=x_0+tf(x_0)+{\mathcal O}(t^2)$.
Using standard  properties of the determinant one can show that
$$
\det (I+tA)=1+t\,\mathrm{Tr}\,A+{\mathcal O}(t^2).
$$
and hence
$$
\frac{d}{dt}\det\left(\frac{\partial\pi_t}{\partial x}\right)=\mathrm{Tr}\,\frac{\partial f}{\partial x}=\nabla\cdot f.
$$
Note. For a complete proof see Arnold, Mathematical Methods in Classical Mechanics.