Entropy of Mixing — Why Do Gases Mix Spontaneously When a Partition Is Removed?

A box is divided by a partition, with gas A on the left and gas B on the right. When the partition is removed, without anyone doing anything, the two gases mix by themselves, and they never return to the way they were. In ① you watch the molecules mix while measuring the entropy actually increasing by counting molecules. In ② you confirm that this “spontaneous” direction is the same as the direction in which the Helmholtz free energy F decreases at constant volume, or the Gibbs free energy G decreases at constant pressure.

The gases are treated as ideal gases, and their internal energy and entropy are built up from the translational, rotational, and vibrational partition functions (the same formulas as in the Carnot cycle simulator). The molecules in the picture undergo elastic collisions as hard spheres, conserving momentum and energy exactly.