Open In App
Related Articles

Puzzle 47 | Red Hat vs Blue Hat

Improve Article
Save Article
Like Article

A team of three people decide on a strategy for playing the following game. Each player walks into a room. On the way in, a fair coin is tossed for each player, deciding that player’s hat color, either red or blue. Each player can see the hat colors of the other two players, but cannot see her own hat color. After inspecting each other’s hat colors, each player decides on a response which are one of the following :

             “I have a red hat”, or “I had a blue hat”, or “I pass”

The player’s responses are recorded, but the responses are not shared until every player has recorded her response. The team wins if at least one player responds with a color and every color response correctly describes the hat color of the player making the response. In other words, the team loses if either everyone responds with “I pass” or someone responds with a color that is different from her hat color. What strategy should one use to maximize the team’s expected chance of winning?

For example, one possible strategy is to single out one of the three players. This player will respond “I have a red hat” and the others will respond “I pass”. The expected chance of winning with this strategy is 50%. Can you do better?

Answer : A better solution exists for 75% chance of winning.

Solution : With three players and two hat colors, there are a total of eight equally likely outcomes :

One special feature about the distribution is that most outcomes–six of them–include at least one hat of both colors. Only two extreme outcomes don’t–the ones with all red hats or all blue hats. We can analyze further. Among outcomes with both hat colors, there logically has to be two hats of one color (the “majority” color) and one hat of another color (the “minority” color). See pic below

Now, by looking at the other hats, players can identify whether they are wearing a majority color or a minority color. For instance, if a player sees both a red and blue hat, then the player must be wearing the majority color (which could be red or blue). If a player sees two blue or two red hats, then the player must be wearing the minority color, which will be the opposite color of what the player sees. Here is what players can reason among the six choices:

Now the idea is to get the player with the minority hat color to guess and force the other people to pass.
So here is the strategy :
If you see both a red and a blue hat, then “pass”
If you see two red hats, then guess “blue”
If you see two blue hats, then guess “red”

This strategy wins in all six cases with at least one hat of each color. It only loses in the two cases of all-red or all-blue, in which all players guess incorrectly. Here is how players would guess:

So the group wins in six of eight possible outcomes– a whopping 75 percent chance.


This puzzle is contributed by Feroz Baig. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 18 Jan, 2023
Like Article
Save Article
Similar Reads