← Iris

Entropy vs Time (S = kB ln W)
Particle Distribution
Particles (each side) 40
Temperature 1.0
Speed 1.0x

The second law of thermodynamics

The second law states that the total entropy of an isolated system never decreases over time. Entropy, S = kB ln W, measures the number of microstates (W) compatible with the observed macroscopic state. When the divider is removed, the particles can access far more arrangements — the number of microstates explodes combinatorially, and entropy climbs toward its maximum.

Boltzmann’s formula

Ludwig Boltzmann’s formula S = kB ln W connects the macroscopic concept of entropy to the microscopic count of possible configurations. For N particles in a box divided into two halves, the number of ways to distribute them with n₁ on the left and n₂ = N − n₁ on the right is W = N! / (n₁! n₂!). This is maximized when the particles are evenly split: n₁ = n₂ = N/2.

Loschmidt’s paradox

Josef Loschmidt raised a famous objection to Boltzmann: if you reverse all particle velocities, the laws of motion (which are time-reversible) should cause the system to retrace its steps and unmix. This is exactly what happens in the simulation when you press “Reverse.” The particles briefly return to their separated state. But any tiny perturbation — numerical noise, rounding errors — causes the unmixing to fail after a short time, and entropy resumes its climb. This illustrates that the second law is statistical, not absolute.

Maxwell’s demon

The demon selectively opens a gate to let red particles pass right-to-left and blue left-to-right, sorting them without apparently doing work. This seems to decrease entropy for free. The resolution, via Landauer’s principle, is that the demon must erase information from its memory, which dissipates at least kT ln 2 of energy per bit — enough to ensure the total entropy of the universe never decreases.

Why entropy always wins

The fundamental reason entropy increases is combinatorics. There are astronomically more disordered configurations than ordered ones. A system that evolves by random collisions will almost certainly end up in one of the overwhelmingly numerous disordered states. Loschmidt reversal works briefly because it follows the one special trajectory back to order — but any perturbation sends it into the vast ocean of disordered states.