Maxwell’s Demon
Play as the demon in Maxwell’s famous thought experiment. Open and close a door between two chambers to sort fast particles from slow ones—creating a temperature difference that seems to violate the second law of thermodynamics.
Click the canvas near the door or press Space to toggle the door. Turn on Auto-Sort to let the demon work automatically. The demon allows fast particles to pass left→right and slow particles right→left, sorting by kinetic energy.
The Second Law of Thermodynamics
The second law of thermodynamics states that the total entropy of an isolated system can only increase over time. Heat flows spontaneously from hot to cold, never the reverse. Two chambers of gas at the same temperature will stay at the same temperature. If you could sort particles by speed without expending energy, you could create a temperature difference from nothing—extracting useful work from a single heat reservoir, violating the second law.
Maxwell’s thought experiment
In 1867, James Clerk Maxwell imagined a tiny intelligent being—later called a demon by Lord Kelvin—who could observe individual gas molecules and open or close a frictionless door between two chambers. By letting only fast molecules pass one way and slow molecules the other, the demon could create a temperature gradient without doing any work, seemingly violating the second law.
Landauer’s Principle
The resolution came over a century later through the work of Rolf Landauer (1961) and
Charles Bennett (1982). Landauer’s principle states that erasing one bit
of information necessarily dissipates at least kT ln 2 of energy as heat,
where k is Boltzmann’s constant and T is the temperature.
The demon must measure each particle’s speed, store that information, and eventually erase it (its memory is finite). This erasure generates enough entropy to compensate for the sorting. The total entropy of the system (gas + demon) never decreases. Information is physical, and computation has a thermodynamic cost.
Information Is Physical
Maxwell’s demon reveals a profound connection between information theory and thermodynamics. Shannon entropy (measuring information) and Boltzmann entropy (measuring disorder) are mathematically identical up to a constant. This equivalence is not a coincidence—it reflects the fact that information is always encoded in physical systems and subject to physical laws.
Modern researchers have built real nanoscale devices that act as Maxwell’s demons, confirming that the entropy cost of information processing exactly compensates for any apparent violation. The second law survives, but our understanding of why has deepened enormously.