In 1867 the Scottish physicist James Clerk Maxwell formulated this thought experiment that seems to violate the second law of thermodynamics. The apparent violation was later explained by Leó Szilárd and Léon Brillouin. The experiment shows a gas-filled container that is divided into two compartments with a trapdoor in the wall that separates them. A "demon" supposedly has the power to select the molecules passing through the trapdoor according to their velocities; those with more kinetic energy than the mean energy of the molecules of the first compartment pass to the second, and vice versa. At the end, molecules with higher velocities finish in the second container and slower molecules are in the first, so that the temperature is greater in the second than the first, contrary to what the second law of thermodynamics states. Actually, the second law is not violated because no matter what method is used by the hypothetical demon, entropy is increased by the work done by the demon in monitoring the particles.