# Temperature of system in canonical ensemble

Upon reading Reif's explanations relating to systems exchanging energy and the canonical ensemble (Reif, Fundamentals of statistical and thermal physics, p. 95ff and p. 202ff), I am led to conclude that a small system $S$ in contact with a large heat reservoir $R$ is not necessarily at the same temperature as the reservoir. This is because the condition for the two systems (system $S$ and reservoir $R$) to be at the same temperature is $\frac{\partial S_S}{\partial E_S} = \frac{\partial S_R}{\partial E_R}$, which leads to an equation for the energy $E^0_S$ (and thus $E^0_R =E_{tot} - E^0_S$) contained in the system at temperature $T$.
However, in the canonical ensemble the small system $S$ does not have a fixed energy, which means that its temperature is not fixed (since $T=T(E,V,N)$ if we assume $S=S(E,V,N)$). This means its energy is not necessarily $E^0_S$, which means that it is not necessarily at the same temperature as the reservoir (the $T$ of which is assumed fixed). Therefore, when we say, for example, that the energy of the ideal gas at temperature $T$ is $E=\frac{3}{2}Nk_BT$, we should really be saying "the energy of the ideal gas immersed in a heat bath at temperature $T$"? Is this reasoning valid?

In fact, the equation $\frac{\partial S_S}{\partial E_S}= \frac{\partial S_R}{\partial E_R}$ is also for averages $E_S$ and $E_R$. This is not explicit, but it is so because in order to derive that, you assume that the system is in the (thermodynamic) state where the total entropy $S_S+S_R$ is maximised. This is a statistical assumption: lower entropy state with $E \ne E_0$ can happen with small probability. Normally no one worries about this because one always assumes that the small system and the big system are both macroscopic and the probability of deviation is extremely small.