By Maria Violaris, PhD student at the University of Oxford
Happy Halloween! You’re throwing a quantum-themed costume party where Sally is dressed as Schrödinger’s cat, Alice and Bob are a spookily entangled pair, and mischievous Eve is a quantum Maxwell’s Demon. But why is Eve acting so strangely? She stands by the door to the next room, repeatedly opening and shutting it. After a while, your room becomes very cold. Shivering, you walk past Eve through the door to the next room, which is now boiling hot. What is happening?!
Maxwell’s Demon has puzzled scientists since 1867, when the thought experiment was first proposed by scientist James Clerk Maxwell. Imagine a demon that can seemingly extract useful energy from heat, meaning it can charge your phone from the random motion of the air around you. This ability would violate the second law of thermodynamics, which states that the irreversible arrow of time flows from order (usefulness) to disorder (randomness). For the latest entry in our Quantum Paradoxes content series, we’re looking at what happens when we encode this thought experiment into a quantum circuit using Qiskit. Along the way, we’ll find out why Maxwell’s Demon remains so creepily controversial. Muahaha!
Classical Maxwell’s Demon
In the classical Maxwell’s Demon thought experiment, we have a demon, a box, and a bunch of air particles. The box is divided into two halves separated by a trap door, and the demon can control the trap door. The demon uses this ability to sort fast-moving air particles into one side of the box, and slow particles into the other, ultimately creating a temperature difference between the two compartments.
If we wanted to, we could extract some useful energy from this temperature difference. For example, we could put a turbine between the two sides of the box, such that the flow of energy from the hot side to the cold side causes its blades to spin. This, in turn, could drive an electrical generator and give your dying phone a much-needed boost.
Entropy and time’s arrow
The problem is, extracting useful energy from randomness is forbidden by the second law of thermodynamics, which we can think about in terms of a quantity called entropy. Entropy is a measure of disorder — a system has high entropy if there are many states it can be in, and low entropy if there are only a few possible states. This means 6-sided dice have higher entropy than 2-sided coins.
The second law of thermodynamics states that the entropy of an isolated system is very unlikely to decrease. For example, if you scramble an egg, it is very unlikely for the egg to spontaneously return to being a yolk and an egg white. This is what gives time its irreversible, forward-moving direction — from order to disorder.
Resolving the paradox
One erroneous solution to the paradox was proposed in 1929 by physicist Leo Szilard. He posited that the demon can only sort the particles if it measures their speed, and suggested that this measurement act incurs a minimum entropy cost that balances the decreasing entropy of the box.
Decades later, IBM research fellow and recent Breakthrough Prize recipient Charles Bennett would prove Szilard wrong by showing it was possible to perform measurements without entropy cost. But Bennett also proposed a different resolution, taking inspiration from the work of another IBM scientist, Rolf Landauer. To understand Bennett’s approach, let’s think about how the demon stores information in its memory.
Imagine the demon’s memory is a handful of coins, which all start off as Heads. If the demon measures a fast particle, the corresponding memory coin stays on Heads. If the next particle is slow, the next memory coin flips to Tails. Eventually the demon runs out of memory coins, and it needs to start erasing information. In other words, the coins are in a mix of Heads and Tails, and the demon must flip them all back to Heads.
In 1961, Landauer had shown that erasing information in this way has a minimum entropy cost to the environment, known as Landauer’s principle. Every time you erase information in your laptop, the entropy cost will increase the temperature of the room by a tiny amount — so tiny that it is only discernible in very carefully controlled experiments.
Bennett reasoned that a demon with a finite memory must at some point erase the information it collects. The entropy cost of memory erasure offsets the decreasing entropy caused by the Demon’s sorting, meaning the second law is safe.
Maxwell’s Demon concerns a fundamentally macroscopic system — since our box contains many particles. This means it follows the laws of classical physics. However, our fundamental laws of physics are quantum, not classical. So, what happens when we apply the laws of quantum mechanics to the Maxwell’s Demon thought experiment?
Well, before we can do that, we have to see what Maxwell’s Demon looks like when we shrink it down from the macroscopic to the microscopic scale. Fortunately, our good friend Leo Szilard has already done some of this legwork for us by creating another thought experiment, a single-particle realization of the Maxwell’s Demon thought experiment called “Szilard’s engine.”
Szilard’s Engine
Szilard’s Engine presents us with a box containing a single particle moving randomly. Our demon once again inserts a partition in the middle of the box, but this time, the partition acts like a moving wall. Its resting place is in the centre of the box, but if you push on its left side, it will move to the right, making the right side of the box smaller — and vice versa. As we’ll soon see, this small adjustment is important since we’re only working with a single particle.
After the demon inserts the partition, it measures whether the particle is on the left or right, storing this information in its memory. If the particle is on the left, for example, the demon attaches a weight to the left side of the partition. It helps to imagine that this weight hangs on a string, and the string is attached to the partition wall by a pulley system, such that if you push the partition to the right, the weight will move up in the air.
Neither the weight nor the partition is terribly heavy, so the single particle can push the partition and lift the weight with only the force of its random movements. Once the movement of the particle causes the weight to lift, we can say the demon has effectively used information about the particle to extract useful energy from the particle’s random behavior. The movement of the weight shows us how much energy we were able to extract.
But is this a violation of the second law of thermodynamics?
Well, not quite. To repeat this energy extraction, the demon must erase its memory. Landauer’s principle tells us that memory erasure has a minimum entropy cost to the environment, which compensates for the decrease in entropy that the demon gained from using information about the particle’s position. With a blank memory and a randomly moving particle once more, the cycle can repeat.
Note the importance of the demon’s memory. If it is faulty, the demon may attach the weight to the wrong side of the partition, and then the particle expanding into the box would lower the weight instead of lifting it, meaning the demon loses useful energy instead of gaining it. If the demon’s memory was not erased, then it would be correct half the time (lift the weight) and wrong half the time (lower the weight), so on average no useful energy could be extracted from the box.
Quantum Szilard’s engine
The original Szilard’s engine shows us what happens when we convert Maxwell’s Demon to a microscopic system, that doesn’t make it quantum. Szilard assumed his single particle behaves classically, so the original Szilard’s engine doesn’t tell us if the paradox still holds when we apply the laws of quantum mechanics.
To build a quantum Szilard’s engine, we need to create a set-up where every element of the system we’re looking at obeys the laws of quantum mechanics. In other words, we need to make it so that all interactions between the demon, the particle, the weight, and the environment are unitary, meaning the interactions must all be reversible (although our quantum circuit version will make use of some convenient non-unitary operations in Qiskit).
Fortunately, thanks to quantum computers, we don’t have to dream up an entirely new demonic thought experiment to do this. We’ll just encode Szilard’s engine as a quantum circuit.
We construct our Szilard’s engine quantum circuit by using qubits to model the particle in the box, the demon’s memory, and the weight. To learn more about how this works, and to try it for yourself, visit our Jupyter Notebook.
Creepily controversial
The Maxwell’s Demon paradox is like a candle that never blows out: throughout history it has been extinguished by various resolutions, then lit up again as those theories were shown to be incorrect or insufficient.
When Bennett’s solution replaced Szilard’s, did it really put the demon’s fire out for good? Some scientists argue that the derivation of Landauer’s principle relies on the veracity of second law of thermodynamics. Hence, using it to save the second law is circular and insufficient to exorcise the demon. Others are researching whether the principle goes far enough — and finding additional costs to erasing information in classical and quantum settings.
Party’s over
Now that you understand the science behind Eve’s Halloween party Trick, and she’s even shared a Jupyter Notebook so you can try it yourself, it’s well past time for a Treat. You gather up Sally, Alice, Bob and Eve in the freezing room with lots of blankets, chocolate coins and pumpkins. Together, you all settle in for a spooky Halloween quantum movie night. Your film of choice? The latest Qiskit video of course!