A dad wants to play a game with his 3 children this Christmas. He has a bag with 5 hats; 1 white, 1 yellow, 1 red, 1 blue and 1 black in it. The hats are all equal except their colour. He will place one on each of their heads and if they can all guess correctly the colour on their head they all get presents this year, if they get a single one wrong they get nothing.

To make things harder the dad lines the children up so they all face the same direction. Child #1 can see #2 and #3. Child #2 can only see #3 and Child #3 cannot see anyone.

With total randomness and equal probability the dad places 1 hat on each of their heads. Child #1 has to guess first then #2 and finally #3.

Before playing the game the children come up with a strategy to optimise their chances of getting Christmas presents this year.

What is their strategy? What is the probability they get presents?

  • 1
    $\begingroup$ Do they only get presents if all of them get it right, or do the ones who get it right get a present? $\endgroup$
    – S. M.
    Commented Dec 21, 2018 at 16:03

2 Answers 2


I think they can get all the way to

one in three

probability of getting all three guesses right.

There's probably a possible explanation that utilises Galois fields, modular exponents and discrete logarithms, (well, more likely just modular subtraction and averages are enough) but let's instead give each kid one of these:

enter image description here.

Kid 1 then observes the other hat colours, and guesses a colour

that is as far (in the same direction) from kid 2's colour as kid 2's is from kid 3's.

For example, if kid 3 has black and kid 2 has yellow, then kid 1 guesses blue.

Then, kid 2 guesses the only colour that is

exactly halfway between 1's guess and 3's colour that can be seen.

In this example, kid 2 sees black, and hears the guess "blue", so 2 (correctly) guesses "yellow".

Kid 3, having heard two guesses, performs exactly the same operation as Kid 1.

In this example, 1 guessed "blue", and 2 guessed "yellow", so kid 3 (correctly) picks black, which is

two colours anticlockwise from yellow, just like yellow is two spots anticlockwise from blue.

This approach must be optimal, because

1. The first kid's guess can never be better than one in three, no matter what
2. The guess kid 1 makes with this system is always "possible" and never a duplicate of one of the other two colours, so its probability is one in three
3. After the first guess, the other kids always exactly know their colours.

So, yeah, that should just about do it.

  • $\begingroup$ This seems to be sadly correct. Poor kids. $\endgroup$
    – DonQuiKong
    Commented Dec 21, 2018 at 20:26
  • $\begingroup$ Nice, very clean solution. Here's a verification program $\endgroup$
    – benj2240
    Commented Dec 21, 2018 at 21:04
  • $\begingroup$ Yay, +1 for a plan that does not involve teaching finite fields to kids :-) An alternative way to use the diagram to get the same result is for kid 1 to rot13(ebgngr gur qvntenz fb gung gur ung bs xvq gjb vf ba gbc, gura thrff gur bgure pbybhe va gur fnzr ebj nf gur ung bs xvq guerr). $\endgroup$ Commented Dec 21, 2018 at 21:19
  • $\begingroup$ Yes you got the answer and a very nice way to express it. Sorry to those who were talking about saying things aloud I should have worded it to exclude that. $\endgroup$
    – Ben Franks
    Commented Dec 21, 2018 at 23:32

I'm pretty sure there's no way to get all 3 hats correct, but

I know a way to get 2 correct 100% of the time, and 3 correct exactly 20% of the time. (I don't know about you, but I wouldn't like this guy as my dad.)


The children assign a value from 0 to 4 to each hat color; say, white = 0, yellow = 1, red = 2, blue = 3, black = 4. Child #1's guess should be the sum of Child #2's hat and Child #3's hat mod 5, translated into a hat color. There is a 20% chance this will be correct, because there is a 9/25 chance that either child in front is wearing the 0 hat (which makes the guess 100% incorrect), and a 12/20 (4/5)(3/4) chance that neither is (which makes the guess 33% correct.) (12/20)(1/3) = 20%.


Child #2 knows the sum mod 5 of their hat and Child #3's hat, so they can subtract Child #3's color from the sum, and get their own color.


all Child #3 has to do is subtract Child #2's guess from Child #1's guess.

(This is assuming there isn't a solution like the children being able to look at their own hats.)

  • $\begingroup$ Where does the 20% come from? It doesn't seem all that obvious. $\endgroup$
    – Bass
    Commented Dec 21, 2018 at 16:58
  • $\begingroup$ @Bass i think your comment is incomplete, but I see what I did wrong lol $\endgroup$ Commented Dec 21, 2018 at 17:00
  • 1
    $\begingroup$ @benj2240 if you use any different method that doesn't include some signal that you are using a different system (which I'm assuming isn't allowed by the problem, and a guess carries no information because you're already using that for information), it starts to impede the effectiveness of the first system. $\endgroup$ Commented Dec 21, 2018 at 17:20
  • 2
    $\begingroup$ @S.M. rot13(gur frpbaq xvq pnag gryy gur guveq uvf ung vs ur unf gb thrff uvf bja.) $\endgroup$ Commented Dec 21, 2018 at 17:48
  • 1
    $\begingroup$ With the a 33% chance of getting them all right, and not explicitly forbidden by the problem, rot13(Puvyq bar pna fnl bhg ybhq, jryy V xabj vg'f abg erq (sbe vafgnapr) orpnhfr Puvyq gjb unf gung, naq V xabj vg'f abg oyhr orpnhfr Puvyq guerr unf gung, fb V'yy thrff vgf oynpx, jvgu n bar va guerr punapr bs orvat evtug!) $\endgroup$
    – SteveV
    Commented Dec 21, 2018 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.