# Internal energy of ideal gas from statistical mechanics

I'm following this derivation of the equipartition theorem:

http://vallance.chem.ox.ac.uk/pdfs/Equipartition.pdf

On the second page, it is said that a standard result from statistical mechanics is this:

$$U = kT ^{2} \frac{d(ln(q))}{dT}$$

That is, the internal energy is proportional to the derivative of the logarithm of the number of states.

How is this expression obtained from statistical mechanics? I'm aware of the Maxwell-Boltzmann statistics, but I haven't been able to derive this relationship nor have I found a derivation online.

• You can find this at en.m.wikipedia.org/wiki/… if you scroll down to the section titled Calculating the thermodynamic total energy. – user197851 Nov 2 '18 at 20:02

The (canonical) partition function is: $$\mathcal Z = \sum_n g_ne^{-\beta E_n}$$ where $$\beta \equiv \frac 1{k_B T}$$ is the inverse temperature, and the sum runs over different energy levels of the system, with $$g_n$$ being the degenery of the $$n^\mathrm{th}$$ eigenenergy. Taking a derivative with respect to $$\beta$$ from both sides, we get: $$\frac{\partial}{\partial \beta} \mathcal Z = -\sum_n g_n E_n e^{-\beta E_n} = - \mathcal Z \sum_n g_n\frac{e^{-\beta E_n}}{\mathcal Z}E_n$$ But $$\mathrm{Pr}(E = E_n)=g_n{e^{-\beta E_n}}/{\mathcal Z}$$ is simply the probability of the system being in the $$n^\mathrm{th}$$ energy level. Thus: $$-\frac{1}{\mathcal Z}\frac{\partial}{\partial \beta} \mathcal Z = \sum_n E_n \mathrm{Pr}(E=E_n) = \langle E \rangle \equiv U$$ Writing this in a slightly different way, we have: $$-\frac{\partial}{\partial \beta} \ln \mathcal Z = U$$ And rewriting it in terms of $$T = \frac{1}{k_B \beta}$$ gives the final result: $$U = k_B T^2 \frac{\partial}{\partial T} \ln(\mathcal Z)$$