A demon that breaks the law and inverts how heat flows? An ancient paradox, indeed.
A demon controls a valve that separates two gas tanks. Whenever a fast particle comes from the tank on the right, or a slow particle comes from the left, the demon lets it through. In this way, the demon can separate all fast particles from the slow ones. When the task is completed, the demon has transformed the initial state of the gas into a new one that is much less probable. This means that the entropy of the gas has decreased, which violates the second law of thermodynamics. Can such a demon ever exist?
James C. Maxwell challenged the scientific community with this fantastic paradox. Its solution is surprisingly simple, involving cool concepts such as the entropy of information, and yet it kept scientists engaged for almost a century!
Check this explanation with a variation of Maxwell’s original gedanken experiment.
Check this video for a more advanced understanding of Maxwell’s demon.