Since from second law,.
d S ≥ O d S = change in entropy
During the expansion of gas, the thermodynamic probability of gas is larger and hence its entropy is also very large. Since form second law, entropy cannot decrease
∴ following the second law, gas molecules move from one partition to another.