Boltzmann distribution derivation