A hypothetical intelligent being (or a functionally equivalent device) capable of detecting and reacting to the motions of individual molecules. It was imagined by James Clerk Maxwell in 1871, to illustrate the possibility of violating the second law of thermodynamics. Essentially, this law states that heat does not naturally flow from a cool body to a warmer; work must be expended to make it do so. Maxwell envisioned two vessels containing gas at equal temperatures and joined by a small hole. The hole could be opened or closed at will by "a being" to allow individual molecules of gas to pass through. By passing only fast-moving molecules from vessel A to vessel B and only slow-moving ones from B to A, the demon would bring about an effective flow from A to B of molecular kinetic energy. This excess energy in B would be usable to perform work (e.g., by generating steam), and the system could be a working perpetual motion machine. By allowing all molecules to pass only from A to B, an even more readily useful difference in pressure would be created between the two vessels. About 1950 the French physicist Lon Brillouin exorcised the demon by demonstrating that the decrease in entropy resulting from the demon's actions would be exceeded by the increase in entropy in choosing between the fast and slow molecules.
Excerpt from the Encyclopedia Britannica without permission.