A box of gas is split into two chambers by a wall with a tiny trapdoor. A "demon" watches each molecule and opens the door only to let fast molecules pass one way and slow ones the other. The gas sorts into a hot side and a cold side — apparently creating order and a temperature gradient for free, in violation of the second law. The trick is that the demon must store the information it gathers, and erasing that memory carries an unavoidable entropy cost (Landauer's principle) that always balances the books.
kT·ln(2) of heat per bit — raising total entropy so the net never falls.
ΔS_erase ≥ k·ln(2) per bit erased (Landauer)
E_min = kT·ln(2) minimum heat per bit erased
S_gas = −k·Σ p·ln(p) Gibbs/Shannon entropy of the partition
S_net = S_gas + S_memory ≥ 0 (never decreases)
For over 80 years physicists thought measurement was the costly step. In 1961 Rolf Landauer, and later Charles Bennett, showed the opposite: measurement can be thermodynamically free, but forgetting cannot. Erasing information is the truly irreversible act — and that single insight unified information theory with thermodynamics.
What is Maxwell's demon?Maxwell's demon is a thought experiment in which a tiny intelligent being operates a trapdoor between two gas chambers, letting fast molecules into one side and slow molecules into the other. This sorts the gas into hot and cold halves without doing apparent work, seemingly creating a temperature difference from nothing and violating the second law of thermodynamics.
Does the demon really violate the second law?No. The apparent violation is resolved once you account for the demon itself. To decide which molecules to pass, the demon must measure and remember information. Its memory is a physical system whose entropy must be counted. When the full system — gas plus demon's memory — is considered, total entropy never decreases.
What is Landauer's principle?Landauer's principle states that erasing one bit of information in a system at temperature T dissipates at least kT·ln(2) joules of heat to the environment, increasing entropy by at least k·ln(2). Erasing information is the irreversible, entropy-producing step that rescues the second law.
The demon's memory has finite capacity. To keep sorting, it must eventually erase old measurement bits. Bennett showed that measurement can be done reversibly, but erasure cannot: each erased bit dumps kT·ln(2) of heat. This entropy increase always equals or exceeds the entropy the demon removed from the gas.
The simulation tracks three quantities: the gas entropy (which falls as the gas is sorted), the demon's memory entropy (which rises as bits are recorded and erased), and the net total. The net total — gas plus memory — never decreases, demonstrating the second law holds for the complete system.
The demon opens the trapdoor only when a fast molecule approaches from the left or a slow molecule approaches from the right. Over time this funnels high-speed (hot) molecules to the right chamber and low-speed (cold) molecules to the left chamber, building a temperature gradient.
Information is physical. The Szilard engine and Landauer's principle show that one bit of information is worth kT·ln(2) of free energy. Knowing which side a molecule is on lets you extract work, but acquiring and later erasing that knowledge costs at least as much entropy as you gained.
kT·ln(2) is the minimum energy cost of erasing one bit at temperature T, where k is Boltzmann's constant. The ln(2) factor comes from collapsing two possible memory states into one, halving the phase-space volume, which corresponds to an entropy drop of k·ln(2) in the memory that must be paid as heat.
Yes, in a limited sense. Researchers have built information-to-energy conversion devices using single electrons, colloidal particles and tiny systems that extract work by exploiting measured fluctuations. All of them confirm Landauer's bound: the energy gained never exceeds the cost of measurement and erasure.
Toggle the demon on to start sorting molecules and watch the temperature gradient and gas entropy change. Adjust the molecule count, speed threshold and memory size with the sliders. Watch the entropy budget bars: gas entropy drops, memory entropy climbs, and the net total stays flat or rises, never falling below zero.