We consider a system 
 in contact with a heat reservoir 
, the whole forming an isolated system with energy
.  
Heat can be exchanged between the system and reservoir, and the likelihood of a particular partition
depends on the number of microstates of the whole system 
 corresponding to that partition.  (The equilibrium
partition will be the one which maximises the number of microstates, but that is not what we are interested in 
here.)   Since the system and reservoir are independent, the total number of microstates factorises: 
Now suppose we specify the microstate of 
 that we are interested in, say the 
th 
(with energy 
) and ask what the
probability 
 of finding the system in that microstate is.  It will be proportional to the number of microstates
 of the whole system 
. However 
 as we've specified the state of 
, so
Using the relation  between 
 and entropy, we can write
The normalisation constant 
 is found by saying that the probability that the system is in some
microstate is one: 
, so