(a) The Maxwell demon purportedly violates the second law of thermodynamics by directing hot molecules in a gas to perform work without a heat gradient. The classical Szilard engine, made up of a single molecule coupled to a thermal bath, illustrates how the second law survives because the demon must generate a compensating entropy. (b) Steps in the operation of a quantum Szilard engine. (I) Three molecules are prepared in a closed box with size . (II) A wall, depicted by a vertical bar, is isothermally inserted at location . (III) Information on the number of molecules on the left is acquired by quantum “measurement.” (IV) The wall shifts isothermally to reach its equilibrium location . The cycle is complete when the wall is removed isothermally to reach step (I).