(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 L. (II) A wall, depicted by a vertical bar, is isothermally inserted at location l. (III) Information on the number of molecules m on the left is acquired by quantum “measurement.” (IV) The wall shifts isothermally to reach its equilibrium location lm. The cycle is complete when the wall is removed isothermally to reach step (I).