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.

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.