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

Current time:0:00Total duration:16:59

ten of us have been abducted by aliens because they view us as being representative of the human race and what they're going to do is they're going to test us to see if the human race is worthy of joining the intergalactic Council of planets and if we're not they're going to kill us all and and turn earth into a a mushroom farm because that's their oil so they take us together in their spaceship and they say you ten represent all of humanity and the red and the fate of humanity rests in your hands we will give you a test and the test is tomorrow we're going to put 24 hours from right now we're going to put you all in a completely dark room and line y'all up one behind the other so if this is one guy let me see if I can draw so this is guy in the front he's I don't know he's looking a little worried someone described me as the Bob Ross of mathematics so I'll attempt to do a little Bob Ross work right here so this would be the first of us he has business tie on and whatever he's facing this in this direction and then there's ten more of them so instead of redrawing that let me just copy and paste it we all look mysteriously similar to each other that's the second one and the third one there's ten of us like this I'll do one more like that you could kind of say oh that's good enough there's ten of us and we're essentially lined front lined up front to back so that you know this guy all he sees is the back of this guy's head and he can also see the back of this guy's head maybe there's a slight incline so that they're you know maybe the floor is like this let me see if I could draw it the floor the floor is at a slight tilt so one guy is standing right here another guy is standing right here another guy standing right here there's ten of us in a line we're all facing in that direction all this guy can see is all this guy right here can see is the wall this guy can see the two guys in front of him this guy can see the one guy in front of him and there's ten of them it goes all the way back to ten so what they tell us is we're gonna line you up like this they even draw a nice diagram like this because they they want us to give us a they want to give us a fair chance of preventing Earth from turning into a mushroom farm and they say while the room is completely pitch dark we're going to place a hat on each of your heads and the Hat will either be I don't know move move move so this would be a move hat or they'll be mature no it'll be green so you either get a move or a green hat on your on the back of your head and the hat will be designed in such a way we won't have a big rim so that you can't look up and see your hat adjust you know this is alien technology so it's completely impossible to see the hat on your own head and the distribution of the hats will be random it could be all green hats it could be all while say purple because I'm not quite sure how to pronounce move move so it could be all purple hats it could be half purple half green it could be nine green and one purple they don't know it could be any combination of hats and what they're going to do and they tell us all of this is that they're going to start with the person in the back so they're going to start with let me so if these are the you know this is the front wall this is the floor this is the first guy right here second guy third guy fourth guy fifth guy six guys seven eight nine so this is a tenth guy they're all faced in that direction they're going to start with this guy right here this guy right here and say what color is the hat on your head and if and he'll answer either move or purple I mean either say purple or green and I guess move isn't well know he can only say purple or gray and have to be split have to be exact here he could okay he can only be say purple or green and he has to say it well he could say it as loud as he wants but he has to say to edit a an even tone so that not not more information can be conveyed other than the fact that he thinks has had as purple or green although this guy is close enough that he can hear it everyone's going to hear what everyone's going to say but there's no intonation you could say and if you're right if you say my hat is purple and you are wearing a purple hat you will live and the 600 million people that you represent will also live and where they live will not be turned into a mushroom farm now if you're wrong then they will immediately even you know what is that Star Trek weapon displace you and they'll also turn all the people where all the land they'll do it to all of the people you represent and turn all of their land into mushroom farms so there's a huge incentive to try to get this right so say we're going to do this tomorrow and your goal obviously is to try to save as many lives as you can and so we're going to put you in a room and you guys can discuss this for the next 24 hours to come up with a system so that when we put you in the dark room and we put the hats on each of your heads well put I shouldn't be drawing Brown hats see they're going to be we put the hats on your head and then turn on the light so I have to forgot to tell you that they're going to put us in the dark room you can't see anything we're all lined up then they're going to turn on the lights and so then this then they're going to sky what colors I had on your head he obviously can't look at his own head but he'll see everyone else's hats and likewise this guy he can't see his own hat and he can't see the guy behind him but he'll hear what this guy says and he can see all of the hats in front of him so it'll turn on the lights and then after this guy if he's right he lives if he's wrong he'll be displaced and then they'll go to the guy up the next guy and then ask him if he's right he lives and all the people he represent live if he's wrong he also will get displaced and they'll keep going all the way up to the first guy so our goal to essentially save civilization or at least human civilization is to come up with a system to save as many of us as possible to and and so that's the first take of the brain teaser so if you want to kind of pause it right here and not actually before you pause it let me just clarify it you know you can't all you can say is either purple or green no intonations you can't say purple or purple to kind of convey any type of information all you can say is purple or green or pronounce it in some weird way and and there's no you know weird trick where you can kind of look with the side of your eyes or anything like this this is you have to do it completely based on what you hear and what you say and if the aliens catch any hint of you guys trying to kind of cheat or all of us I'm one of us to cheat this they'll just evaporate everything and turn everything into into mushroom farms so that's the problem statement how do you save as many people as possible and if you want to pause now feel free to do so and now I'll give you kind of a small hint because this doesn't help you it's easy to think of a lot of solutions that might save a couple of people but there's actually a solution that will guarantee saving nine people so that's the solution that you cut you have to come with up with and feel free to I'm for the rest of this video I'm essentially just going to keep giving hints and then eventually give you the solution so the goal is actually really to save nine people and you can imagine which nine people it's going to be and for once again pause it if you don't want any more hits it's going to be these nine people these nine people are guaranteed to be safe saved and this guy obviously is just going to be guessing he's the first guy to be asked what color his hat is he has no information he can see the people in front of but he has absolutely no information as to what color this had it so he just guesses so there's a 50% chance that he's right assuming you know without any other information we assume that there's a 50/50 chance that you're at the hat on the top of your head is a purple or a green one so you know your expected number of people you're going to save is nine and a half with with the system and so these people you have to come with it where these people are guaranteed guaranteed to be saved and so you know there's a couple of things that are more probabilistic that don't quite get you there that might come to mind immediately and once again stop this video because it's fun to kind of think of these yourself but you know this guy might this guy might just look at the number of this guy might just see okay how many green hats are there and how many purple hats are there and then whichever there are more of he might say oh my hat is let's say there's six purple and three green in front of him he might say my hat is purple and just you know he's either right or wrong and he might get displaced but at least he'll have conveyed that information to the rest of the group that hey the majority of the hats are purple so you're better off guessing purple than green and it'll save at least six of these people because they'll all guess purple and that's okay and in this situation you're guaranteed to save more than half of these nine people so you're guaranteed to save at least five of these nine people and then probabilistically maybe you can get up to seven or or eight then there's the other method is for every well there's there's a ton of I don't to go into except realize amount of time so here is the real the real deal solution so really pause it and wait and watch it tomorrow unless you don't want the solution the guy in front or the guy in the back what he does so there are a bunch of people into three or five six seven eight nine ten people and they're all wearing hats what he does and remember we have 24 hours to come up with a system so everyone is in the system and and we don't know who's going to be in what order also that's the other thing but that actually doesn't help or hurt you much anyway so the guy in the back what he does is he counts he counts the number of of green or purple hats right so he counts this is the system we come up with and so this is true of whoever's in the back whoever is in the back has to do this right so if he counts that the number of if he if he counts at the number of green let's say this is our system he said he counts the green actually only so count the green and he determines that the number of green is an odd number if he determines that the number of green that he sees in front of him is an odd number then he is going to say green for the guess on hit the top of his head if the number of green is an even number is an even number he's going to say purple and of course he doesn't know what his hat color is but at least well one he has a 50-50 chance of saving himself but now what happens now by giving this information to the rest of the group-by screaming green or purple if he screams green if this guy screams green right my hat is green then this guy who's the next guy in line the next guy to be quizzed knows that the person behind him saw an odd number of green hats this guy saw an odd number of green hats now this is interesting if he counts the number of green in front of him and he also sees an odd number of green hats then that means that he was not one of the green hats that this guy saw so he must be a purple hat right so he'll just say I have a purple hat and he will live right and then you'll go to this guy you'll go to this guy no let's go the other situation let's say that you know this guy he screamed green which means that he saw an odd number of green hats in front of him if this guy counts the green hats in front of him and of the eight people in front of him and he says Wow there's only an even number of green hats he could say Wow I must have a green hat and so then he'll say green and then he'll be right likewise this guy this guy will say the situation where this the first situation that I said this guy has a purple hat on right so this guy saw an odd number of green hats he screamed green and so this guy he also sees an odd number of green hats because he's not one of the green hats so he says purple he lives this guy this guy all of a sudden and because this guy said purple and he lived I mean you didn't hear any buzzer but actually you know he's going to live because the system will work right he knows that the odd that there must be an odd number of green hats from him down forward right because this guy didn't say green so if he knows that there's an odd number of green hats from him down forward and if he sees an even number of green hats right he knows that he must be one of the green hats so he'll say green and in that situation this guy if this guy screamed green then that means that if this guy saw an odd number of green hats from here on down and one of these guys behind them or every time someone behind you says green after that then the number of green hats that are that are that are odd or even in front of that person will change and so they cannot keep having to keep track of that in their minds to figure out if the hats in front of them are going to be green or purple actually let me give an example because that's probably the easiest way so there's one two actually let me just do it with a neutral color so I don't waste time so let's say the hats are green purple purple green green purple green green how many is that one two three four five six seven eight nine ten so we said if so this guy you go to the first guy right here and you say and so he counts he says okay how many greens are that there's one two three four five there are five greens so the greens are odd the greens are odd which says that he is going to say green that's the system we come up with so when they go up to this guy he says green and he's wrong so he actually gets eliminated and maybe the aliens were willing to give us a pass on the first guy but let's say he gets eliminated but he said green so now all of so then this guy Don down knows that in front of that guy there was an odd number of green hats now this guy he looks he looks forward he counts one two three four five green hats so he also sees an odd number of green hats so he knows that he must not have a green hat because if he had a green hat then it would turn the number of green hats that he saw into an even so he doesn't have a green hat he says I have a purple hat and he lives he lives now this guy he counts the number of green hats in front of him one two three four green hats he says gee I only see an even number of green hats up until this guy he saw an odd number of green hats I must be a green hat so he says green check now this guy's turn so first of all hum he knows how many green hats this guy saw he knows that this guy saw exactly four green hats because if this guy had seen five green hats he would have said purple so this guy knows that this guy saw four green hats but he saw he sees only one two three green hats right so he knows that he must be one of the green hats so every so he he screams green so check so then this guy knows wow there must be only three green hats from him on down because this guy must have seen three green hats if you saw four he would have said purple so that guy uses that same logic to say okay there must be three green hats from me on down I see three green hats so I must not have one of them I must be purple and you just keep on going down all the way until everyone answers correctly and you save at least nine people and the bulk of humanity and if you give a pass on on the first guy you save all of humanity anyway I hope you found that one enjoyable this is one of my favorite brain teasers and I I apologize because I realized when I was trying to explain it without the example maybe you've gotten loot might have got a little confusing but hopefully this example explains things a little bit better although it might see be confusing to see green and purple written in blue see in the next video