The inner energy is defined as the weighted sum of the energy of all states of a system, while the entropy is a measure of how many microstates can form a certain microstate. When these states are not equal and have different probabilities, one must use the Gibbs formula and explicitly include the degeneration of each energy state (Eq. 20b