If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Maxwell's demon

Maxwell's Demon: A thought experiment that seems to defy the 2nd Law of Thermodynamics. Created by Sal Khan.

Want to join the conversation?

  • blobby green style avatar for user MaximSagan
    What if there is no "demon", ie. no outside interference? What if the reason that only the slower of the fast particles make it to the colder side (and vice-versa) is solely due to probability? (Continue to imagine a small passageway if it helps.) Obviously the chance is essentially zero, but (as with Sal's example of a ball suddenly flying up into the air after lying motionless, from the previous video) it should be theoretically possible, right?
    (50 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user paonessa.michael
    What if the membrane separating the two sides was composed of a material that allowed this to happen naturally without computation? Where fast particles could penetrate through it from the cold side and repelled on the hot side side and slow particles could pass through from the hot side and be repelled from the cold side?

    This video does not disprove "Maxwell's Demon" just by saying that humans' way of figuring out which particles can pass would generate too much heat from computation.
    (33 votes)
    Default Khan Academy avatar avatar for user
    • mr pink red style avatar for user Ben Eater
      A membrane would just be a surface with lots of little trap doors, each manned by its own demon. You can just think of what Sal (and Maxwell) described as being an individual "pore" in the membrane.

      Regardless of the form the demon takes, there are certain things it must do: It must first measure the speed of each particle that approaches, then use this information to decide whether to open or close the door. It simply won't work to operate the door without first measuring the speed of the particle.

      So the demon (in any form) MUST be an information processing system!

      The proof comes from information theory. Since the demon has to store the measurements of each particle long enough to decide whether to open or close the door, it must have some sort of memory. At some point the demon must erase its memory. Landauer's principle shows that erasing information necessarily creates a tiny amount of waste heat. It's this waste heat from erasing the demon's memory that saves the second law.
      (41 votes)
  • female robot grace style avatar for user M
    Dear Sal, I don't get the point of this thought experiment. If it is not even possible to create such a system why consider and debate about it? I can't see the significance of it. Maybe you could explain the usefulness of this thought experiment?
    (14 votes)
    Default Khan Academy avatar avatar for user
  • male robot hal style avatar for user rchakrjr
    Sal said that all the slow particles would be on one side and all the fast would be on another, but wouldn't some particles' kinetic energy be transferred to others as they bumped into each other, therefore making it impossible for all of the fast molecules to be on one side and all of the slow molecules to be on the other?
    (7 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user brunomendes
    Isn't evaporation a kind of Maxwell's Demon? When some particles of water are fast enough to escape the body of water and go into the atmosphere, you are basically taking energy away from that body, cooling it down, which is probably why evaporation is a cooling phenomenon. Am I missing something here?
    (6 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Casey
    What if you just randomly open the door, and by some chance keep reducing the entropy randomly? (If it can happen, it will happen)
    (6 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Elijah Mandeville
    that was confusing can someone help me?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • purple pi purple style avatar for user n4iiig
      Basically, this 'thought experiment' is saying that we can violate the 2nd Law of Thermodynamics in this way: we start with two containers filled with a gas at the same temperature and then visualize a creature (the demon) who helps the gas atoms to 'sort' themselves by opening a trap door between the containers when he sees an atom come whizzing towards him with a particularly high kinetic energy. Similarly, when he sees an atom with a low kinetic energy come moseying along, he opens the door and lets it pass into the other container. Remember, temperature is simply average kinetic energy, so after the demon has done this a great number of times the high kinetic energy atoms and the low kinetic energy atoms will be neatly separated, and the two containers will be at different temperatures. Well, now it certainly seems that our rule that entropy (the dispersal of energy) will always increase has been violated by showing that the heat from high energy atoms is not dispersing into the lower temperature container. Actually though, physicists say that we have to include the entropy of the demon himself as he does the computational work of separating the atoms, and therefore the overall entropy of the system has in fact increased.
      (8 votes)
  • male robot hal style avatar for user Jonathan Brassard
    I agree that this video can not get rid of the problem by saying that the mechanism needed would offset the loss in entropy. So instead of something hypothetical like a mysterious membrane let's use something simple, like chance. Say a study was conducted into this problem where his setup is replicated an extremely large number of times with the key difference being that the door opened randomly with no regard for the particles passing through. In nearly all of the tests this would not produce the end we are looking for, but this allows for the possibility of it happening even once. This means the principle stands and we still have what seems to be a problem.
    (3 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Jacob Murri
      The entropy created by that one particle would be offset by the work that it took to open the door, or the friction that was created by the door when it was opened or closed. Because it is impossible in this universe to create a frictionless or weightless door (which would create a reversible process) this would cause positive entropy, which would offset all the possible entropy losses from a single particle going through the door. So, the change in entropy will still be positive.
      (1 vote)
  • duskpin ultimate style avatar for user Wolfgang Amadeus Mozart
    Hey Sal. I'm assuming you know what the Heisenberg Uncertainty Principle is. Basically, it says you can't know both the momentum and position of a particle at the same time. Therefore, how would the demon know when to open and close the door if he does not know about the particles' characteristics? I might be wrong, just wanted to clarify.
    (3 votes)
    Default Khan Academy avatar avatar for user
  • male robot hal style avatar for user Daniel Rendall
    I just thought I had the answer.
    What if you had some kind of skin that is made of a substance that is kind of like jell-O, that would allow the fast particles to break the surface and pass through for an instant (without friction) , and then the surface would immediately close up afterward.
    Meanwhile the slower particles would not be able to penetrate the surface because they would not have enough force.
    Now say that on one side of the skin there is a box with one on the walls being the skin, and on the other side would be an infinite open space.
    Wouldn't that keep all the slow aka cold particles in the box.
    P.S.
    We are assuming that all this is possible.
    (2 votes)
    Default Khan Academy avatar avatar for user

Video transcript

The second law of thermodynamics tells us that the entropy of the universe is always increasing. So the change in entropy for the universe, when it undergoes any process, is always greater than or equal to 0. And we showed in the previous video that it has a lot of implications. Regardless of how you define your entropy, whether you define entropy as equal to some constant times the natural log of the number of states your system could take on, or whether you define change in entropy to be equal to the heat added to the system divided by the temperature at which it is added, either of these descriptions, combined with our second law of thermodynamics tell us things like, when you have a hot body next to a cold body-- so say this is T1, and then I have T2 over here-- that heat will flow from the hot body to the cold body. And we showed that mathematically in the last video. That heat will flow in this direction. Now, one of the commenters on the last video said, hey, could you cover Maxwell's demon? And I will. Because it's an interesting thought experiment that seems to defy this principle. It seems to defy the second law of thermodynamics. And it has a very tantalizing name, Maxwell's demon. Apparently, though, it was not Maxwell who called it a demon. It was Kelvin. All these guys, you know, they all meddle in everything. So Maxwell's demon. And this is the same Maxwell famous for Maxwell's equation, so he obviously dealt with a lot of things. He's actually also the first person to ever generate a color image. So this is in the mid-1800s. So all around a fairly sharp individual. But what's Maxwell's demon? So when we say something has a higher temperature than something else, what are we saying? We're saying that its average kinetic energy of its molecules bumping around here-- that the average kinetic energy of the molecules here-- is higher than the average kinetic energy of the molecules here. Now notice, I said its average kinetic energy. And we've talked about this multiple times. Temperature is a macro state. We know that at the micro level, all of these molecules have different velocities. They're bumping into each other, transferring momentum to each other. You know, this guy might be going super fast in that direction. This guy might actually be going quite slow. This guy might be going super fast like that. That guy might be going quite slow. It's just a hodgepodge of things. You could actually draw a distribution. If you knew the micro states of everything, you could actually draw a little histogram. We could say, for T1-- let's say this is on the Kelvin scale. So you could say, look, my average temperature is here, but I have a whole distribution of particles. So let's say this is number of particles. And I won't put a scale there. You'll get the idea. So I have a bunch of particles that are at T1, but I have some particles that could be really close to absolute 0. I mean, it'd be very few, but. And then you have a bunch that are maybe at T1, and then you have a bunch of particles that could have actually kinetic energy higher than T1. Higher than the average kinetic energy. Maybe that's this one here. Maybe the guy down here is this guy with barely any kinetic energy. It means there's some guy who's almost completely stationary, who's, you know, sitting right around there someplace. So there's a whole distribution of particles. Likewise, this T2 system right here, on average, these molecules have a lower kinetic energy. But you know, there might be one particle here that has a really high kinetic energy. But most of them on average are lower. So if I were to draw the distribution of T2, my average kinetic energy is lower, but my distribution might look something like this. It can't go backwards like that. It might look something like this. Oh, I don't know, maybe it looks something like that. Let me try it a little different. I'll make it go just as high. Maybe it looks something like that. right? So notice, there are some molecules in T1 that are below the average kinetic energy of T2. Right? There are these molecules here. These are these slow guys right there. And notice, there are some guys in T2 that have a higher kinetic energy than the average in T1. So these are these guys right here. And so the fast guys in T2-- so even though T2 is, quote unquote, colder, it has lower average kinetic energy, there's some molecules, if you look at the micro state, that are actually moving around quite rapidly, and there are some molecules here that are moving around quite slowly. So what Maxwell said is, hey, what if I had my-- and he actually didn't use the word demon, but we'll use the word demon, because it makes it seem very interesting and metaphysical on some level, but it really isn't-- what if I had some dude, let's call him the demon, with a little trapdoor here? Let me draw a little bit neater. So between those two systems, let's say that they're insulated. Let's say that they're separated from each other. So this is T1 where I have a bunch of particles, you know, with their different kinetic energies. And then, here is T2. And I'm making them separated, and maybe they're connected only by this little connection right here. T2. These guys have a slower kinetic energy. And what Maxwell, his little thought experiment was, hey, let me say that I have some dude in charge of a door-- maybe the door is right here-- and he has control over this door. And whenever a really fast particle in T2, one of these particles over here, come near the door-- so let's say this guy is flying-- let's say that guy right there. He's going super fast. He has super high kinetic energy, and he's just going perfectly for the door. So the demon says, hey. I see that guy. He's coming for the door. He's going to lift his hatch, and he's going to allow this particle to get into T1. So after he lifts the hatch, that particle will just keep going, and it'll be in T1. And then he closes the hatch again, because he just wants the fast particles to go from T2 to T1. And then when he sees a little slow, you know, pokey little particle coming here, one of these guys down here, he opens the trapdoor again, and he allows that one to go. So then that guy shows up in here. So if he just kept doing that, what's it going to look like at the end? Well, at the end, you're going to segregate-- and it could take a while. But you're going to segregate all the slow particles on-- let me draw it. I'll make the boundary in brown, because now it's not clear which one is-- well. We'll talk about it a little bit. So that's the boundary. That's his door. What's going to happen at the end? All the fast particles-- some of them are going to be the original fast particles that are in T1, right? There are some original fast particles in T1 are going to be still on the side of the barrier. Let me draw-- make sure you don't get these two confused. This is a separate picture. Now all of the fast particles from T2 are also going to be stuck there. Because eventually they're all going to get close to that door, if you wait long enough. So then this guy's also going to have a bunch of the, what would originally, in the T2 side of the barrier, they're also going to be there. So you're going to have a bunch of fast particles. Likewise, all the slow T2 particles are going to be remaining on the side of the barrier. So these are the slow guys. And he would have let all the slow T1-- I shouldn't even call them T1 anymore. I'll call them side 1. Side 1 particles here. Slow side 1 particles. So what just happened here? This was the hot body, this was the cold body. The second law of thermodynamics would have told us that heat would have gone from here to here. That their temperatures should have equalized to a certain degree. So the hot bodies should get colder, the cold bodies should get hotter. They should kind of average out a little bit. But using this little demonic figure, what did he do? He made the hot body hotter, right? Now the average kinetic energy here is even higher. He transferred all of these high kinetic energy particles to that distribution, so now that distribution is going to look-- the way you could think about it, if you transferred all of these guys to this guy over here, the distribution will now look something like-- let me see if I can do it. It will look something like that for T1, instead of the old one. And T2-- and he took all the hot ones away, all the cold ones away, from T1. So these guys are going to disappear. They're not going to be there anymore. And he added them to T2. So the distribution of T2 is going to look like that, and he erased, of course, these from T2. He took all of these guys out of T2. Let me erase this right here. That was the old distribution of T1. So the T2 distribution now looks something like this. So T2, the new average might be something like here. This is my new T2. And my new T1 is going to move to the right a little bit. The average is going to be higher. So this demon seems to have violated the second law of thermodynamics. Let me box off this right here. My little diagrams are overlapping. This example shows that the hot got hotter and the cold got colder. So Maxwell's thought experiment says, hey, we violated the second law of thermodynamics. And this actually was a conundrum for many, many years. Even in this century, people kind of, hey, you know, there's something fudgy about here, something not quite right. And the thing that's not quite right, and I'm not going to prove it to you mathematically, is-- and it's kind of analogous to the refrigerator example-- is, to have something here-- to have some dude, perhaps he's a demon, here, pulling this little door when it's convenient, when the fast particles are going from this side or the slow particles are going from that side-- in order for him to do it correctly, he's going to have to keep track of where all the particles are. He'll need to keep track of particles. I mean, these aren't balls, like, you know, macro balls. These are micro molecules or atoms. He's going to have to bounce light off of them, or he's going to have to bounce electrons, use an electron microscope. He's going to have to keep track of these gazillion particles that are there. And I mean, think about it. He might have to have a super duper-- if it doesn't occur in his head, he might have to have some kind of hardcore computer microchip that's churning away. And this would be, actually, for a computer to do this, this would be intensive computation power. And let your computer run for a little bit and feel the microchip-- this is generating a lot of heat. His bouncing off light, or whatever he's trying to bounce off of the different molecules to be able to measure how fast they're going, that's also going to generate heat. He's going to have to do work to do that. He's going to have to measure everything. There's a lot of stuff that's going on that he's going to have to do. So the current answer is-- and it's not easy to prove mathematically-- but the current answer is, if you actually wanted to build a demon like this-- and probably in our world today, you'd use some type of computer with some type of sensors-- to attempt to do this-- and there are people who have attempted to do this, on some level. This computer and this whole system is going to generate more entropy-- so the delta S here is going to generate more entropy than the entropy that's lost by making the cold side colder and the hot side hotter. So Maxwell's demon, and I didn't do anything rigorous here. I didn't prove it to you. But Maxwell's demon, it's an interesting thought experiment, because it gives you a little bit more intuition about the difference between macro states and micro states. And what happens at the molecular level in terms of temperature, and how you can make a cold body colder and a hot body hotter. But answer is, it really isn't a paradox or anything like that. When you think about the entropy of the entire system, you have to include the demon himself. And if you include the demon himself, he's generating more entropy every time he opens that door-- and maybe there's some energy required to open the door itself. But he generates more entropy when he does all of this than the entropy that might be lost, when say, for example, one of these slowpoke particles kind of just traverses onto that side of the barrier. Anyway, I thought I would just expose you to that, because it's a really neat thought experiment. So I'll see in the next video.