Let q = (q, q, q) and p = (p, p, p) denote the position vector and momentum vector of a particle of an ideal gas, respectively. Let F denote the net force on that particle. Then (two times) the time-averaged kinetic energy of the particle is:
where the first equality is Newtons second law, and the second line uses Hamiltons equations and the equipartition theorem. Summing over a system of N particles yields
By Newtons third law and the ideal gas assumption, the net force of the system is the force applied by the walls of the container, and this force is given by the pressure P' of the gas. Hence
where dS is the infinitesimal area element along the walls of the container. Since the divergence of the position vector q is
the divergence theorem implies that
where dV is an infinitesimal volume within the container and V is the total volume of the container.
Putting these equalities together yields
which immediately implies the ideal gas law for N particles:
where n = N/N is the number of moles of gas and R = Nk is the gas constant.