# Advanced Classical Mechanics/Liouville's theorem

This proof of Liouville's theorem in a three dimensional phase space uses the Divergence theorem theorem in a fashion familiar to most physics majors. This proof in N-dimensions is completely analogous, except that we need to carefully define an N-dimensional Flux density

## Liouville's theorem

Liouville's theorem applies only to Hamiltonian systems. The Hamiltonian is allowed to vary with time, and there are no restrictions regarding how strongly the degrees of freedom are coupled. Liouville's theorem states that:
    The density of states in an ensemble of many identical states with different initial conditions is constant along every trajectory in phase space.
It states that if one constructs an ensemble of paths, the probability density along the trajectory remains constant. To prove this we use the generalized Stokes' Theorem to equate the n-dimensional volume integral of the divergence of a vector field J over a region U to the (n-1)-dimensional surface integral of J over the boundary of U:
    $\int _{U}\nabla \cdot \mathbf {J} \,dV_{2N}=\oint _{\partial U}\mathbf {J} \cdot \mathbf {n} \,dS_{2N-1}$
Let $n=2N$ represent all the dimensions of phase space, and let the $2N$ dimensional vector field. Define $\mathbf {J}$ as the 'current' of particles in phase space, and $\rho$ is the density (number of particles per unit 2N-dimensional hypersphere. (The dots represent differentiation with respect to time.)
    $\mathbf {J} =[{\dot {q}}_{1},{\dot {p}}_{1},{\dot {q}}_{2},{\dot {p}}_{2},...{\dot {q}}_{N},{\dot {p}}_{N}]\,\rho$  $\mathrm {where} \;\rho =\rho (q_{1},p_{1},...q_{N},p_{N})$
Apply this divergence theorem to a 2N dimensional hypercube of length, L, with one corner at the origin. The volume inside this hypercube are the inequalities, 0<x$_n$<L, where x$_n$ represent the q variables and the p variables.
The hypercube is bounded by 2N-1 hypersurfaces at x$_n$=0, and 2N-1 'surfaces' at x$_n$=L, that can be viewed as making up one hypersurface. (In this context, each hypersurface is actually a 2N-1 dimensional hypercube.) A particle in each hypersurface is on the verge of entering the 2N-dimensional hypercube, and is inside a differential $dS_{2N-1}$, of the hypersurface. This implies that (almost always) 2N-1 of the variables obey the inequality, 0<x$_n$<L, while one variable is either at x=0, or on the 'other surface' at x=L. The rate at which particles cross this hypersurface is proportional to ${\dot {x}}_{j}$, where j represents the coordinate or momentum variable that is on the boundary (i.e. equal to either 0 or L). In other words,
    ${\frac {dQ}{dt}}=-\int _{U}\nabla \cdot \mathbf {J} \,dV_{2N}=\oint _{\partial U}\mathbf {J} \cdot \mathbf {n} \,dS_{2N-1}$
is the rate at which particles leave the hypersphere. (We take the sign convention from the well known case of continuity of charge or particles in three dimensions) Taking the limit that the length, L, of the hypercube vanishes, we have the 2N dimensional continuity equation,
    $0={\frac {\partial \rho }{\partial t}}+\nabla \cdot \mathbf {J} \;\mathrm {where} \;\nabla \cdot \mathbf {J} =\sum _{n=1}^{N}\left({\frac {\partial (\rho {\dot {q}}_{n})}{\partial q_{n}}}+{\frac {\partial (\rho {\dot {p}}_{n})}{\partial p_{n}}}\right)$
The partial derivative reflects the fact that the hypercube remains stationary and does not move with the flow of particles in phase space. The divergence of the flow can be calculated as follows:
    $\nabla \cdot \mathbf {J} =\sum _{n=1}^{N}\left({\dot {q}}_{n}{\frac {\partial \rho }{\partial q_{n}}}+{\dot {p}}_{n}{\frac {\partial \rho }{\partial p_{n}}}\right)+\rho \sum _{n=1}^{N}\left({\frac {\partial {\dot {q}}_{n}}{\partial q_{n}}}+{\frac {\partial {\dot {p}}_{n}}{\partial p_{n}}}\right)$
The second term on the RHS vanishes because our variables obey Hamilton's equations of motion:
    $\sum _{n=1}^{N}\left({\frac {\partial {\dot {q}}_{n}}{\partial q_{n}}}+{\frac {\partial {\dot {p}}_{n}}{\partial p_{n}}}\right)=\sum _{n=1}^{N}\left({\frac {\partial ^{2}H}{\partial q_{n}\,\partial p_{n}}}-{\frac {\partial ^{2}H}{\partial p_{n}\partial q_{n}}}\right)=0,$
The other term is a convective term of the form $\mathbf {v} \cdot \nabla \rho$, where $\mathbf {v} =dx_{i}/dt$. Liouville's equation is a statement about for the derivative of density in the reference frame of the points moving through phase space:
    ${\frac {d\rho }{dt}}={\frac {\partial \rho }{\partial t}}+\sum _{i}{\frac {\partial \rho }{\partial x_{i}}}{\frac {dx_{i}}{dt}}=0$
Never in the proof have we demanded that $\partial H/\partial t$ must vanish. Liouville's theorem is true even if the Hamiltonian is time dependent.
An alternative proof of Liouville's theorem is based on the time evolution of a volume element.

## What Liouville's theorem does NOT imply

* Liouville's theorem does not imply that the density is uniform throughout phase space. In particular, if the Hamiltonian preserves energy, then one trajectory cannot visit two parts of phase space with different energy. By the Boltzmann equation, if an ensemble has a property called 'temperature', then regions of phase space with more energy are less populated.
* Liouville's theorem does not imply that every point along a given path has the same density. In other words, suppose that two particles, A and B, follow the same trajectory, except that particle A leads particle B by a finite time (or equivalently, there is a finite distance in xp space between the two particles). Particle A could be in a region of different density than particle B.
* Liouville's theorem only holds in the limit that the particles are infinitely close together. Equivalently, Liouville's theorem does not hold for any ensemble that consists of a finite number of particles; instead the theorem describes the probability density in phase space of an ensemble consisting of an infinite number of possible states.
* Liouville's theorem does not imply that entropy cannot change as system evolves. The statistical entropy defined for macrostates cannot in general, be equated to informational entropy related to microstates in phase space.