Statistical mechanics definition of temperature as the average kinetic energy In most text books of statistical physics, temperature is defined as :
$$T=\left(\frac{\partial E}{\partial S}\right)_V$$
where $V$ stands for any external variable(s) the system's Hamiltonian depends on.
However, it is often suggested that the temperature is also the average kinetic energy per degree of freedom as in the Generalized Helmotz theorem. Is this second definition always valid? If so, how can you prove or explain they are the same? Are there some condition for it? How do you relate it to the definition above?
 A: No, they're not always the same. Temperature is not a measure of energy but of uncertainty. This is made clear by a two level system with possible energies $0,\epsilon$. The mean energy $\langle E \rangle := U \in [0,\epsilon]$ is confined to a bounded set whereas the temperature can be anything you like (including negative values, corresponding to $U > \epsilon/2$).
In this setup, the temperature is a measure of how uncertain we are about which of the two states the system is in. The probabilities of the two states are:
$$ p_\alpha = \frac{e^{-E_\alpha/T}}{1+e^{-\epsilon/T}}$$
Perfect uncertainty ($p_\alpha=1/2$) corresponds to $T=\infty$. Meanwhile perfect certainty corresponds to $T=0$ - you know exactly what state the system is in.
(Note: there are two cases of 'perfect certainty' - either its definitely in the ground state or definitely excited. These both correspond to $T=0$ but from different directions. Taking a positive temperature and lowering it to $T=0^+$, you reach $U=0$ and taking a negative temperature and raising to $T=0^-$ you reach $U=\epsilon$.)
A: You ask when it is true that
$$ \left\langle \frac{{p}_i^2}{2m_i} \right\rangle_{t} = \frac{1}{2}k_B \left(\frac{\partial S}{\partial E}\right)^{-1} \tag{1}$$
for a Hamiltonian system.
If the Hamiltonian can be written as
$$\mathcal{H} = U(\mathbf{q}) + \sum_i \frac{p_i^2}{2m_i} \tag{2} $$
the equipartition theorem implies that
$$ \left\langle \frac{{p}_i^2}{2m_i} \right\rangle_{eq} = \frac{1}{2}k_B \left(\frac{\partial S}{\partial E}\right)^{-1} \tag{3}$$
where the average is taken for a microcanonical ensemble. There are thus two reasons that (1) might fail to hold:

*

*We might have a Hamiltonian which cannot be written in the form of (2)

*We might find that $ \left\langle \cdot\right\rangle_{eq} \ne \left\langle \cdot\right\rangle_{t} $
One can show that $ \left\langle \cdot\right\rangle_{eq} = \left\langle \cdot\right\rangle_{t} $ whenever both averages are well-defined and all conserved quantities can be written as functions of the energy. The latter is related to the requirement in the generalized Helmholtz theorem that certain hypersurfaces be metrically indecomposable.
Examples:
To see an example of the first reason (1) might not hold, consider a charged particle in an electromagnetic field. We have
$$ \mathcal{H} = q\phi(\mathbf{r}) + \frac{1}{2m}\sum_i (p_i - qA_i(\mathbf{r}))^2  $$
This has terms linear in $\mathbf{p}$, so instead of something like (3) the equipartition theorem leaves us with
$$ \left\langle p_i \cdot \frac{1}{m}(p_i - qA_i(t,\mathbf{r}))\right\rangle_{eq} = k_B T $$
or
$$ \left\langle \frac{p_i^2}{2m} \right\rangle_{eq} = \frac{1}{2} k_B T + \left\langle \frac{p_i \cdot qA_i(\mathbf{r})}{2m} \right\rangle_{eq}$$
To see the second reason in action, consider the case of a particle in a one-dimensional potential $U(q)$ with two local minima $U_1 \gg U_2$ separated by a barrier of height $U_3$ at $q = 0$. Consider a particle with energy $E$ such that $U_1 < E < U_3 $. The canonical ensemble is mostly concentrated in well 2, so
$$\left\langle \frac{p^2}{2m}\right\rangle_{eq} \approx E - U_2 $$
The equipartition theorem does apply here, so this tells us $$ \frac{1}{2}k_B \left(\frac{\partial S}{\partial E}\right)^{-1} \approx E - U_2 $$
If the particle is initially located in well 1 it will stay there for all time, and so
$$\left\langle \frac{p^2}{2m}\right\rangle_{t} \approx E - U_1 $$
and thus (1) does not hold. This observation corresponds to the fact that we can define a conserved quantity like
$$ 
C(q,p) = 
\begin{cases}
1 & \frac{p^2}{2m} + U(q) < U_3 \wedge q < 0 \\
2 & \frac{p^2}{2m} + U(q) < U_3 \wedge q > 0 \\
3 & \frac{p^2}{2m} + U(q) \geq U_3 
\end{cases}
$$
which cannot be written as a function of energy alone.
This conserved quantity is rather strange. Another, more natural example is that of two noninteracting particles in a one-dimensional box. $p_1^2$ and $p_2^2$ are each conserved separately, and so it turns out that $\langle p_1^2 \rangle_{eq} \ne \langle p_1^2 \rangle_t $.
A: Let $\Omega(E,N,V)$ be the number of microstates with energy $E$, $N$ particles and volume $V$. Recall that $S=k \ln \Omega$. It is actually more convenient to define temperature as $\frac{1}{T}=(\frac{\partial S}{\partial E})_{V,N}$.
Let $\Phi(E)$ denote the total number of possible quantum states of a system which are characterised by energies less then $E$. Assume that we have now a system described by $f$ quantum numbers, then the energy per degree of freedom $\epsilon$ is roughly $\epsilon \approx E/f$.
Let now, $\Phi_1(\epsilon)$ be the total number of possible values which can be assumed by one particular quantum number when it contributes an amount $\epsilon$ or less to a system. It can be shown $\Phi_1(\epsilon)$ that is roughly propositional to $\epsilon$, and $\Phi(E) \approx \Phi_1(\epsilon)^f$.
Moreover in the range of energies between $E$ and $E+\delta E$, we have $\Omega(E)\approx \Phi(E)-\Phi(E+\delta E)\approx \frac{\partial \Phi}{\partial E} \delta E \approx \Phi_1^{f-1}\frac{\partial \Phi_1}{\partial \epsilon} \delta E$. Since $f$ is usually very large number (about $10^{24}$), we get $\ln \Omega \approx f \ln \Phi_1$, it follows that $\Omega \approx \Phi_1^f$ which is propositional to $E^f$. Thus $\ln \Omega \approx f\ln E + constant$. Thus when $E\approx \overline{E}$ (the average energy), we get $1/T = kf /\overline{E}$. So the temperature is indeed proportional to the average energy per degree of freedom. If the system has negligible interactions then $\overline{E}$ is the average kinetic energy.
It is important to keep in mind that in the derivation above we assumed that our system has no upper bound on the possible energy. In fact this is the case for the systems where one takes kinetic energy of particles into account. However if one focuses instead only on spin degrees of freedom, then when all the spins are lined up anti-parallel to the field a maximum of energy is reached.
A good exercise would be to consider the case of an ideal gas. In this case you get very simple analytic expressions. If you are interested you to learn more you may take a look at "Fundamentals of statistical and thermal physics" by Reif and also "Statistical Mechanics" by Pathria and Beale.
