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

Blue forehead room solution

Do not watch before Blue Forehead Room. THIS IS THE SOLUTION! Created by Sal Khan.

Want to join the conversation?

Video transcript

So we had the hundred logicians. All of their foreheads were painted blue. And before they entered the room, they were told that at least one of you hundred logicians has your forehead painted blue. And then every time that they turned on the lights, so that they could see each other, they said OK, once you've determined that you have a blue forehead, when the lights get turned off again, we want you to leave the room. And then once that's kind of settled down, they'll turn the lights on again. And people will look at each other again. And then they'll turn them off again. And maybe people will leave the room. And so forth and so on. And they're also all told that everyone in the room is a perfect logician. They have infallible logic. So the question was, what happens? And actually maybe an even more interesting question is why does it happen? So I'll answer the first, what happens? And if just take the answer, and you don't know why, it almost seems mystical. That essentially the light gets turned on and off 100 times, and then after the hundredth time that the light gets turned on, and the lights get turned off again, all of them leave. They all leave. So I mean, it's kind of weird, right? Let's say I'm one of them. Or you're one of them. I go into this room. The lights get turned on. And I see 99 people with blue foreheads. And I can't see my own forehead. They see my forehead, of course. But to any other person, I'm one of the 99, right? But I see 99 blue foreheads. So essentially what happens if we were to watch the show is, the lights get turned on. You see 99 blue foreheads. Then the lights get turned off again. And then the lights get turned on again. And everyone's still sitting there. And I still see 99 blue foreheads. And that happens 100 times. And after the hundredth time the light gets turned on, everyone leaves the room. And at first glance, that seems crazy, because nothing changes. Nothing changes between every time we turn on the light. But the way you need to think about this-- and this is what makes it interesting-- is what happens instead of 100, let's say there was one person in the room. So before the show starts-- they never told me that there were going to be 100 people in the room. They just said, at least one of you, at least one of the people in the room, has your forehead painted blue. And as soon as you know that your forehead is painted blue, you leave the room. And that everyone's a perfect logician. So imagine the situation where instead of 100 there's only one perfect logician. Let's say it's me. So that's the room. I walk in. And I sit down. And maybe I should do it with blue. And then they turn the lights on, and say, look around the room. And I look around the room, and I see nobody else, right? And remember, even in the case of one, we've painted everyone's forehead blue. So in this case, this one dude, or me or whoever you want to call him. His forehead is painted blue. So he looks around and he sees no one in the room. But he remembers the statement, and maybe it's even written down on a card for him in case he forgets. That at least one of you has your forehead painted blue. So if he looks around the room and he says, well I'm the only dude in the room. And they told me that at least one of the dudes in the room is going to have their foreheads blue. Well, I'm the only dude in the room. So I must have a blue forehead. So as soon as they turn the lights off, he's going to leave. Fair enough. That's almost trivially simple. And you might say, so how does this apply to 100? Well what happens when there are two people. And once again, both of them have their foreheads painted blue. So let me draw another. I don't want to keep drawing the blue forehead room. Let's say there's two people now. So let's put ourselves in the head of this guy. Right behind the blue forehead. That's where we're sitting. OK. So when he enters the room. He says, I either have a blue forehead. I either have a blue forehead, or I don't have a blue forehead. No blue. Right? This is what this guy's thinking. Let me draw him. And he has a blue forehead. But he doesn't know it. He can't see it. That's the whole point about painting the forehead blue, as opposed to another part of the body. So he says, I either have a blue forehead or I don't have a blue forehead. He walks in. Let's say this is this guy. He walks in. The first time the lights get turned on, he sees this other dude there who has a blue forehead. And he says OK, now let me think about it. How will this guy respond depending on each of these states? So let's say that I don't have a blue forehead. Let's go into this reality. If I don't have a blue forehead, what is this guy going to see? When the lights get turned on, he's going to see that I don't have a blue forehead. And we were both told that at least one of us has a blue forehead. So this guy, because he's a perfect logician, will deduce that he has to have a blue forehead. Remember, this is in a situation, if I assume that I don't have a blue forehead. We're in this world. I'm a perfect logician, so if I can assume, if I'm simulating the reality where I don't have a blue forehead, then this guy will see, I don't have a blue forehead. And then he'll say, I must have a blue forehead. And so when the lights get turned off, this guy will leave. He'll exit the room. And vice versa. The other guy will make the same logic. But since both of them have blue foreheads, what happens? The lights get turned off, then the lights get turned back on. When the light gets turned back on, this guy's still sitting here. And I just determined that if I didn't have a blue forehead-- and this is me-- this guy would have left. Because he could've said, oh I must be the only guy with a blue forehead. So he would have left. But since he didn't leave, I now know that I have a blue forehead. So then the second time that the lights get turned on, I can deduce that I have a blue forehead. And then when the lights get turned off again, I'll leave. And this guy, he's a perfect logician, so he makes the exact same conclusion. Because he also simulated in his head, OK if I didn't have a blue forehead, then this guy will leave as soon as the lights get turned off the first time. If this guy doesn't have a blue forehead, then this guy will say, well I see no-one else in the room with a blue forehead, and since I know that there's at least one with a blue forehead, I'll have to leave. But since he didn't leave, this guy will also know that he must have a blue forehead as well, so they'll actually leave together. Maybe they'll bump into each other on the way out. Fair enough. Now what happens if you extend it to three people? So we already said, if you have one person in the room, he'll come to the conclusion the first time that the lights are turned on. And then he'll leave right when they're turned off. If you have two people, it takes them essentially two times for the light to get turned on to reach that conclusion. Now if you have three people, and I think you see where this is going. One, two and three. Now remember, no one knows if their foreheads are painted blue, but the producers of the show actually did paint everyone's forehead blue. So so once again, let's get into this guy's head. So this guy says, he's either blue or he's not blue. So in the reality when he's not blue, what's going to happen? Well, this guy-- and this gets a little bit confusing, but if you think about it from the previous example, it makes a lot of sense. A person who has a not-blue forehead actually shouldn't affect the outcome of what the blue people do. Because let's say that this guy says, well what's going to happen if I'm not blue? Well, this guy's going to look at that guy, and say, oh he has a blue forehead. He doesn't have a blue forehead. So if I don't have a blue forehead, this guy's going to see two people without blue foreheads. And he's going to leave the room the first time that the lights are turned on. He'll come to the conclusion. Now the second time that the light's turned on, this guy will say, gee, this guy didn't leave the room. That guy doesn't have a blue forehead. And this guy didn't leave the room because he must have seen someone with a blue forehead. Therefore I must have a blue forehead. And so, if this guy doesn't have a blue forehead, both of these guys would leave the room the second time that the light gets turned on. Now what happens if they don't leave the room the second time that the lights are turned on? Well if I was not blue, they would have left. So if they haven't left by the third showing of the light, then I know that I'm blue. So when you have three people, they're all perfect logicians, they all have their foreheads painted blue. The light will be shown three times. Or the light will be turned on three times. And then when the light gets turned off, they'll all leave together. And so this logic applies for any. You could have 1,000 people. You can keep extending it. The fourth person will have the exact same logic. If he's not blue, then these guys are going to leave after three turnings on of the light. But if they don't leave after three turnings on of the light, then he must be blue. And so they're all going to leave together. All four of them on the fourth showing of everyone's foreheads. Anyway, and you can keep extending this all the way to 100. And 100 is arbitrary. You could do this with a million people, and they would just keep looking at each other a million times. And then on the millionth showing, they would all reach the conclusion that they all have blue foreheads, and they would leave the room. And if you think about it, it's fairly straightforward logic. But it leads to kind of a very almost eerie result. Hopefully that satisfies you. See you in the next video.