# Density of states misunderstanding in Statistical Mechanics

In the simple model of a box filled with an ideal gas, one may write the total energy as the sum of kinetic energies of all particles

$$E = \sum_{i=1}^N\frac{\vec{p}_i^2}{2m}$$

and so if you construct the partition function $$Z(\beta) = \sum_se^{-\beta E_s}$$ in the continuum, I have seen this written as

$$Z = \frac{1}{N!}\frac{1}{h^{3N}}\prod_{i=1}^N\int d^3x_id^3p_i\exp{\left(-\beta\sum_{i=1}^N\frac{\vec{p}_i^2}{2m}\right)}$$

Should there not be a density of states attached in the integrand? I thought whenever one goes from a discrete sum to an integral, there is always a density of states attached, ala

$$\sum_i \rightarrow\int D(\epsilon)d\epsilon$$

Is that where this prefactor of $$\frac{1}{N!}\frac{1}{h^{3N}}$$ comes from? What exactly is going on here?

The energy levels for a particle in a box are $$E_n = \frac{\hbar^2 \pi^2 |n|^2}{2 m L^2}$$ where $$n \in \mathbb N^3$$. So what we're doing is \begin{align*} Z &= \prod_{i=1}^N\left[\sum_{n^{(i)} \in \mathbb N^3}\right] \exp\left(-\beta \sum_{j=1}^N E_{n^{(j)}} \right)\\ &\approx \prod_{i=1}^N\left[ \int_{\mathbb R_{>0}^3} d^3n^{(i)}\right] \exp\left(-\beta \sum_{j=1}^N E_{n^{(j)}} \right)\\ &= \prod_{i=1}^N\left[ \frac{L^3}{8\pi^3}\int_{\mathbb R^3} d^3k^{(i)}\right] \exp\left(-\beta \sum_{j=1}^N \frac{\hbar^2 |k^{(j)}|^2}{2m} \right)\\ &= \prod_{i=1}^N\left[\frac{1}{8\pi^3}\int d^3 x^{(i)}d^3k^{(i)} \right] \exp\left(-\beta \sum_{j=1}^N \frac{\hbar^2 |k^{(j)}|^2}{2m} \right)\\ &= \prod_{i=1}^N\left[ \frac{1}{8\hbar^3 \pi^3}\int d^3 x^{(i)}d^3p^{(i)} \right] \exp\left(-\beta \sum_{j=1}^N \frac{|p^{(j)}|^2}{2m} \right)\\ &= \prod_{i=1}^N\left[\frac{1}{h^3}\int d^3 x^{(i)}d^3p^{(i)} \right] \exp\left(-\beta \sum_{j=1}^N \frac{|p^{(j)}|^2}{2m} \right)\\ &= \frac{1}{h^{3N}} \prod_{i=1}^N\left[\int d^3 x^{(i)}d^3p^{(i)}\right] \exp\left(-\beta \sum_{j=1}^N \frac{|p^{(j)}|^2}{2m} \right). \end{align*}

Note that the factor of $$8$$ comes from the following fact. When we integrate over $$n$$, we are integrating over all $$n \in \mathbb R_{> 0}^3$$. When we integrate over $$k$$, we are integrating over all $$k \in \mathbb R^3$$. Thus we must divide by $$8$$ to represent the fact that we are only interested in the all-positive octant.

In the second line, we are simply saying that $$N$$ is large enough that the sum can be approximated by the integral. In the third line, we change variables to $$k_x = \pi n_x / L$$, and similar for $$y$$ and $$z$$. In the fourth line, we use that $$L^3$$ is the volume of the box. In the fifth line, we change variables from $$k_x \to p_x = \hbar k_x$$, and similarly for $$y,z$$.

The $$1/N!$$ comes from the fact that we say particles are indistinguishable, but the way we've done the integral suggests that they are distinguishable (i.e. we've kept track of the $$i^{\rm th}$$ particle throughout). Since particles are indistinguishable, we divide by the total number of permutations of the $$N$$ particles, $$N!$$, to get the correct result.

• In my opinion, the point here is that $n_x$ is unitless, and is simply meant to run over the natural numbers. So mathematically we can approximate the sum via and integral when $N$ is large. Then we go from $n_x$ to $p_x$, where $p_x$ is momentum. Now when we integrate over $p_x$, scale very much matters! Because we can be working in any units that we like, so $p_x$ is more than just a number in some sense (whereas $n_x$ really is just a number). But fortunately the rules for changing variables of integration ensure that all the scale factors work out to make the result independent of units.
– Joe
Jul 26, 2021 at 21:43
• This is very helpful! Thank you. One question, in the second line when you convert from a discrete sum to an integral, is it not true that you need a density of states attached? Jul 26, 2021 at 22:11
• No I don’t think so, precisely because of what I wrote in the comment. In spirit, it’s just like approximating $\sum_{n=0}^N n$ by $\int_0^N n~dn$ as $N$ gets large, or something like that. Since $n$ is just a number independent of the physics, we just use math to approximate the sum as an integral, and you can show error bounds on how good the approximation is.
– Joe
Jul 26, 2021 at 23:01

The expression is correct as written, except I think you don't want to have your sum in the exponential since you already have a product over exponentials.

In general, once you sum over all possible states and turn that sum into an integral, you need to write it as

$$\sum_i \approx \int D(u) d u$$

where the number of points between $$u, u + du$$ is $$D(u) du$$, with generalization to numbers of points in hypercubes for vector-valued $$u$$.

So how do you get $$D(\cdot)$$? Clearly, it shouldn't be the same for $$D(x_i, p_i)$$ as for $$D(\epsilon)$$ (we shouldn't even be using the same symbol for them) since those don't have the same units. In the first case, it turns out that one position or momentum is as good as another, so we can just pick our constant density of states in phase space to be $$D(x_i, p_i) = h^{-3N}$$ so the units work out right. In the second case we'd actually have to work out the energy density of states. But when we integrate over phase space variables there's no need to put the density of states in energy space.

• Thanks for the answer! This is very helpful. So lets say I want to construct a partition function for a given Hamiltonian; Would a good strategy be to see if the Hamiltonian depends on $p$ and $x$, and if so, then the "sum" is probably better to be the integral over momentum and position, whereas if I was told the energy values take a range of $\epsilon$ values, then that could be an integral over energies, where the density of states $D(\epsilon)$ would be needed? Jul 26, 2021 at 22:17
• Thanks, glad it was helpful! If you're given energy as a function of position and momentum, then integrating over position and momentum is a natural strategy. If you're told the energy levels of different states, then constructing an energy density of states makes sense. But in research (as opposed to a homework problem) there's no guarantee that any strategy will yield an exact solution, which shouldn't surprise us since you can't integrate the exponential of a generic, non-quadratic function. Jul 27, 2021 at 5:21

The density-of-states appears when we pass from the integral over the phase space to the one over the energy: $$Z=\frac{1}{N!h^{3N}}\int \left(\prod_{i=1}^N d^3x_id^3p_i\right)e^{-\beta\sum_{i=1}^N\frac{p_i^2}{2m}} =\\ \frac{1}{N!h^{3N}}\int dE\int\left(\prod_{i=1}^N d^3x_id^3p_i\right)\delta\left(E-\sum_{i=1}^N\frac{p_i^2}{2m}\right)e^{-\beta E}=\\ \frac{1}{N!h^{3N}}\int dED(E)e^{-\beta E}= \frac{1}{N!h^{3N}}\int dEe^{-\beta [E-T\log D(E)]}= \frac{1}{N!h^{3N}}\int dEe^{-\beta [E-TS(E)]}$$ where the density-of-states is $$D(E)=\int\left(\prod_{i=1}^N d^3x_id^3p_i\right)\delta\left(E-\sum_{i=1}^N\frac{p_i^2}{2m}\right),$$ and the entropy is defined as $$S(E)=\log D(E)$$

Remark: one further evaluates this integral using the method of steepest descent and identifying that minimum free energy, $$F$$ as $$e^{-\beta F} = e^{-\beta[E^*-TS(E^*)]}$$