section_path: Theoretical foundation/Definition from statistical mechanics
section_name: Definition from statistical mechanics
paragraph_text: Definition from statistical mechanics
  
  Statistical mechanics defines temperature based on a system's fundamental degrees of freedom. Eq.(10) is the defining relation of temperature, where the entropy S {\displaystyle S} is defined (up to a constant) by the logarithm of the number of microstates of the system in the given macrostate (as specified in the microcanonical ensemble):
  
  where k B {\displaystyle k_{\mathrm {B} }} is the Boltzmann constant and W is the number of microstates with the energy E of the system (degeneracy).
  
  When two systems with different temperatures are put into purely thermal connection, heat will flow from the higher temperature system to the lower temperature one; thermodynamically this is understood by the second law of thermodynamics: The total change in entropy following a transfer of energy Δ E {\displaystyle \Delta E} from system 1 to system 2 is:
  
  and is thus positive if T 1 > T 2 {\displaystyle T_{1}>T_{2}}
  
  From the point of view of statistical mechanics, the total number of microstates in the combined system 1 + system 2 is N 1 ⋅ N 2 {\displaystyle N_{1}\cdot N_{2}}, the logarithm of which (times the Boltzmann constant) is the sum of their entropies; thus a flow of heat from high to low temperature, which brings an increase in total entropy, is more likely than any other scenario (normally it is much more likely), as there are more microstates in the resulting macrostate.