# Classic hat problem with a twist

1. Jan 8, 2013

### sorax123

Three logical individuals, Amy, Bob and Carol, sit in a circle wearing Christmas hats. Each hat has a number on it so all three can see the others� numbers but not their own. They are told that the numbers are three different positive digits. They are each to make a statement in turn and are told to raise their hands when they know their own number.

Amy says: "Carol's number is greater than Bob's". No one raises their hand.
Bob then says: "The sum of Amy's and Carol's numbers is even.�
On hearing this, Carol raises her hand. Even then Amy and Bob do not raise theirs.
But, after a pause, and once it has become clear that Amy isn't going to raise her hand, Bob raises his and then Amy raises hers.

What are Amy's, Bob's and Carol's numbers?

A very interesting problem. I thought it would be good to post it on here to see what you guys think the answer is, and the assumptions made to get there.
Have fun :)

2. Jan 9, 2013

### MarneMath

A = 6, B = 7, C = 8

I wrote a huge reply that got lost by a stupid backspace -_-. I suppose if I were to keep it simple, I would boil down the idea behind my solution to just realizng the key fact is figuring out what kind of number it's going to be (ie even and or odd) and thus determine how many of such number can be greater than Bob's. From there you have to figure out what happens within each case.

3. Jan 9, 2013

### Staff: Mentor

I have a problem with Bob/Amy.

Edit: Found it, fixed. Analysis:
Amy: "Carol's number is greater than Bob's". No one raises their hand.
=> This is not possible with B=9. If B=8, Carol would have 9 and know it, so B<8 is known to Bob (and us).

Bob: "The sum of Amy's and Carol's numbers is even."
This is sufficient for Carol to figure out her number. This is possible in some cases only:
B=7 and 2, 4 or 6 for A (leaving C=8)
B=6 and 2 or 4 for A (leaving C=8)
B=7 and 1, 3 or 5 for A (leaving C=9)
B=5, A=6 (leaving C=8)
B=5, A=8 (leaving C=6)
B=6, A=7 (leaving C=9)
B=6, A=9 (leaving C=7)

C=6 and C=7 would allow Bob to find out his number after Carol raises her hand. This is not true, so we have one of two cases:
C=9: If Bob is unsure, this would allow Alice to know A=7, which does not happen -> ruled out.
This leaves C=8.

If B=5, Alice would know A=6. This does not happen.
Therefore, we have one of the first two cases. There is just one way for Bob how he can distinguish them: A=6. This allows him to know B=7, and Alice knows A=6 afterwards.

Last edited: Jan 9, 2013
4. Jan 10, 2013

### oli4

Hi mfb
you miss B=4 and either A=6 (and C=8) or A=8 (and C=6) that allows C to find about her number. But in this case A would also know her number while B couldn't know if he is 4 or 5

5. Jan 10, 2013

### Staff: Mentor

Oh, right.

By the way: Bob could not know that his statement is sufficient for Carol. For every possible number of Bob, is there a way Carol could find her own number based on her own statement (not used here) and the reactions of the other two?

6. Jan 10, 2013

### oli4

Sorry mfb I didn't understand your question.
I did crack the problem though (or I deluded myself into thinking I did so I can give you some hints if you wish

7. Jan 10, 2013

### Staff: Mentor

Hints for what? The full analysis of the original problem is in post 3 with two missing cases added in your post.

My question is a different one: If they wanted to be sure that all 3 know their number after the 3 possible statements, did Bob make a mistake?

Is there a combination where Bob would have ruined the possibility for Carol to find out her number?
Carol's statement was not necessary here, she could have told Amy and Bob their numbers, of course: "10*A+B=...". But: if Carol was not able to figure out her number based on the first two statements, she would have no way to do it afterwards with that statement.

8. Jan 10, 2013

### oli4

Ah sorry mfb, I got to the same answer than you but in a slightly different way, so after telling you you were missing a case I thought it could be relevant to how you eliminated possibilities so I thought with your next question you were rethinking your solution.
I still don't understand your different question though :).
Anyway, this is how I solved the riddle:
After A's statement, we know B<8 or C would know she is 9
After B's statement we know B>5 because C could know but A couldn't and if B<=5 there are always 2 odds or even possibilities that would only let C know the answer because A would eliminate one of them, but A would also know
So B can only be 6 or 7 and for B=6 A won't know only if C=8 (A can be 2 or 4)
for B=7 the only way for A to know is if C=8 and A=6, if C is 9 B will know but A won't because she could be 1,3 or 5, but with C=8 the only way for B to know is if A=6 (instead of 2 or 4 which wouldn't allow B to make a difference between B=6 or B=7 for C=8)

9. Jan 11, 2013

### oli4

This problem reminded me of one that makes you think in about the same way to get to the answer.
It's a problem you probably already know, I suppose it has to be famous, but maybe not.
the story goes like this
Alice works as a doorkeeper and she knows everyone where she works.
In particular, she knows Bob and Carol, two fine mathematicians, she meets everyday and always have answers, arguments, to pretty much anything she cares to talk about, to the point it gets annoying
So this time Alice has decided to show her friends their limits, and there she goes.
First she meets Bob

A: Hi Bob, do you know I have two children ? well I have, and this is the product of their ages. can you tell me how old they are ?
B: no, sorry, I can't do that
A: Ah! I knew it, I'll go meet your friend Carol and give her the sum to see if she beats you.

she later meets Carol

A: Hi Carol, do you know I have two children ? well I have, and here is the sum of their ages, can you tell me how old they are ?
C: no, sorry, I can't
A: Ah! I knew it ! well you two fine mathematicians failed my simple riddle, I gave Bob the product of their ages and he couldn't find the answer either !
C: Yes I know he couldn't

Alice still victorious sort of felt this last "yeah I know he couldn't" as a desperate attempt from Carol to diminish her glory, but nevertheless, she had to tell Bob that victory was hers
So there she goes

A: Well I won, your friend wasn't able, given the sum of the ages to find how old my children are
B: Congratulations, I'm happy for you
A: Carol couldn't help telling me that she knew you failed by the way
B: Really ? well, in this case I know hold old your children are

Consternation, Alice later meets Carol and tells her about the incident, which, as you would guess leads Carol to conclude that as a matter of fact she also is able to know how old are their children.

So how old are they ?

10. Jan 11, 2013

### Staff: Mentor

I think that problem is quite well-known.

I analyzed Bob a bit.
As the post is lengthy, the conclusion first: Bob did not ruin the puzzle. For all possible number combinations, Carol has a way to allow the puzzle to be solved. She might need nested logic statements, however.

Given some hat distribution (here: A=6, B=7, C=8), the 3 have to make sure that they can find their number after the 3 possible statements are made.
This does not limit Amy's options - she can say anything, and Bob and Carol can reveal all hats in their statements.
Amy chooses "Carol's number is greater than Bob's".

This rules out C=1 and B=9, of course.
As Bob does not raise his hand, Carol knows that she does not have 2. At the same time, Bob cannot have 8 for the same reason. This is common knowledge now.

Bob sees the hats of Amy and Carol, therefore he knows A=6, C=8, and B<8.

In particular, let's look at the following case (possible according to Bob's knowledge):
A=6, C=8, and B=1

Bobs statement: "The sum of Amy's and Carol's numbers is even."

Consider their knowledge in that case:
Carol: A=6, B=1, C=4 or 8
Amy: B=1, C=8, A=2,4 or 6
Bob: A=6, C=8, B<8
"Even numbers for Carol and Amy" is common knowledge (as they all see at least one of the hats).

Carol's statement itself does not add knowledge to Carol, she needs some way to distinguish between 2,4 and 8 based on the reaction of Amy and Bob. As they are not allowed to communicate ("Your number is 6, raise your hand quickly if my number is 2 and slowly otherwise"), Carol's statement has to be quite tricky - and at the same time, it has to allow Amy and Bob to find their numbers. Oh, this is a problematic meta-analysis - not analyzing a specific puzzle, but the space of all possible puzzles.

Approach:
C: "A>5 and B=1"
This allows Bob to know his number, of course.
- case C=8: Amy would know A=6 and raise her hand, this allows Carol to know she has 8
- case C=4, Amy would be unsure, and Carol can use this to conclude C=4. This does not help Amy, however.

Fix:
C: "[[A=4 and B=1] or A=6] and [B=4 or B=1]"
Carol knows that Amy evaluates this as "A=4 or A=6".
Carol knows that Bob evaluates this as "B=4 or B=1".
Therefore:
- if C=4, Amy knows A=6, and Carol concludes C=4. Bob knows B=1, the puzzle is solved.
- if C=8:
--- Amy is unsure, which gives C=8 for Carol.
--- Bob is unsure.
----- Amy sees that Bob is unsure - if she would have 4, Bob would know B=1. Therefore, Amy knows A=6 after watching that Bob is unsure.
----- At the same time, Bob sees that Amy is unsure - if B=4, Amy would know A=6 immediately. Therefore, Bob can conclude B=1. Puzzle solved.

To summarize:
Bob knows that, if A=6, C=8, and B=1, Carol can allow to solve the puzzle.

Now we have to check this for all other cases of B as well...
And we expect that Bob does everything in his head before he decides which statement to use :D.

Some easy cases:
A=6, C=8, and B=7
This is the setup of the initial puzzle, and it is solvable without an additional statement of Carol.

A=6, C=8, and B=6
Impossible

A=6, C=8, and B=5
Carol knows she has 8, and can reveal A=6, B=5 to solve the puzzle.

A=6, C=8, and B=4
Carol knows she has 8, and can reveal A=6, B=4 to solve the puzzle.

A=6, C=8, and B=3
Works in the same way as B=1:
Carol knows she has 4 or 8.
C: "[[A=4 and B=3] or A=6] and [B=4 or B=3]"
Carol knows that Amy evaluates this as "A=4 or A=6".
Carol knows that Bob evaluates this as "B=4 or B=3".
Therefore:
- if C=4, Amy knows A=6, and Carol concludes C=4. Bob knows B=3, the puzzle is solved.
- if C=8:
--- Amy is unsure, which gives C=8 for Carol.
--- Bob is unsure.
----- Amy sees that Bob is unsure - if she would have 4, Bob would know B=3. Therefore, Amy knows A=6 after watching that Bob is unsure.
----- At the same time, Bob sees that Amy is unsure - if B=4, Amy would know A=6 immediately. Therefore, Bob can conclude B=3. Puzzle solved.

A=6, C=8, and B=2:
Works in the same way as B=1:
Carol knows she has 4 or 8.
C: "[[A=4 and B=2] or A=6] and [B=4 or B=2]"
Carol knows that Amy evaluates this as "A=4 or A=6".
Carol knows that Bob evaluates this as "B=4 or B=2".
Therefore:
- if C=4, Amy knows A=6, and Carol concludes C=4. Bob knows B=2, the puzzle is solved.
- if C=8:
--- Amy is unsure, which gives C=8 for Carol.
--- Bob is unsure.
----- Amy sees that Bob is unsure - if she would have 4, Bob would know B=3. Therefore, Amy knows A=6 after watching that Bob is unsure.
----- At the same time, Bob sees that Amy is unsure - if B=4, Amy would know A=6 immediately. Therefore, Bob can conclude B=3. Puzzle solved.

11. Jan 11, 2013

### oli4

Hi again mfb
when you say "I think that problem is quite well-known." Are you talking about the riddle I just posted ? if yes, do you still want to solve it ?
For the rest of your post which is lengthy and I will probably have to look at it with more care tomorrow, I suppose I understand better now what you meant with 'a different problem'.
If I understand you correctly, you have A, B, and C playing a game in which they all want to make sure that given what they see, they are giving hints that will ensure that in the end 'the problem is solved' (everyone finds his number) this is quite a different problem indeed, and if this is it, I would think that the problem is that there is no limit on what anyone can say, so it would be very easy for anyone to make a statement that allow the other 2 players to find out their own values. (therefore I'm sure you are looking for something different but I still don't get what it is)
Cheers...

12. Jan 11, 2013

### Staff: Mentor

I did solve it so long ago that I forgot the answer, and I don't want search for it (or solve it again).

Right. The first post indicates that A B C are playing this game (or should do it).

Of course it is easy. But you can fail - and the question was if Bob ruined it. The answer is "no".

13. Jan 11, 2013

### oli4

Ah yes I also solved it a long ago, about 20 years ago :) I think I could put it myself to solve it again because it was very satisfying :)

Anyway, I guess we have a different take on the original problem, and it is interesting. to me, A,B abd C were not playing the game of 'I am going to give he minimum information that will let us all know how to find our numbers', I took it more like
A,B,C, happened to have those hats, and in turn they happen to make some innocent observations, and the only way those innocent observations would lead to the known scenario was the one we both found.

If we want A B and C to be play with the mindset 'I will give enough information so that I'm sure we will all discover what is our hat number', then additional rules are needed.
what prevents A to say, instead of C>B just C=8 and B=7 ? if (unspoken) rules prevent to be so blunt, then A could give much richer informations encoding C and B, as far as the problem is set, there is no limit to what anyone could say.
I can see them playing this game if this is the game where someone wins over the others, instead of, 'the problem must be solved by all of us' and in this case anyone would give as much/little information as needed so as to be the first one to know his hat number, but this is clearly not what happens, at the very least, you should first let it clear that some random event makes sure that A or B or C was chosen to speak first etc.

Therefore, as interesting as it must be, I don't think that there is much to look for in this 'game in the game' where A, B, and C, when they speak, (why in this order ?) will give minimalistic yet unbounded hints as to make sure that the game ends with everyone winning.

I stand by my original understanding of it
A, B and C are smart enough to analyse whatever anyone said which is true, but what they they said, when they said it, was 'candid'.

Anyway I'm sure you have a more precise intermediate interpretation of it, maybe I'll figure it out by analysing what your analysis reveals given the (unknown yet to me) rules you assume in this other game, or, better, you can just tell me more explicitly what it is :)

One thing is sure: you know that this game in the game, is, well, just a game (as you said this is a different question), and, disregarding this game in the game, you got to the same answer as I did without at any moment considering that 'not only did A or B said what (s)he said, but it was said so as to make sure the game would be won at the end', the only required information was that they said what they said (and that it was true).

14. Jan 11, 2013

### Staff: Mentor

Nothing.

Consider two different cases:

Case 1:
Amy: "Bob does not have 1"
Bob: "Carol does not have 1"
Carol: "Amy does not have 1"
That way, they have no chance to find their numbers. Bob was the first to ruin the game, as Carol had no chance to find her number afterwards.

Case 2:
Amy: "Bob has 7"
Bob: "Carol has 8"
Carol: "Amy has 6"
That way, they all found their number. It is trivial to do so, but you can still fail if you do not reveal enough information (see case 1).

Any order would lead to the same result, just rename Amy, Bob and Carol (probably a bad idea in real life ;)).

15. Jan 11, 2013

### oli4

I'm still failing to see your point
But before you get mad at me, let me tell you that I fully consider this as being my failure, I don't mean you don't have a valid point.

So A,B, and C, play together, in whichever order
A can say 'B=x and C=y'
then either B or C can say directly 'A=z' and the game is 'won'
That was not a very interesting game

So, if we don't have limiting rules to whatever A,B and C can say, how is this a game at all ? I can only see it as being a game if everyone tries to make sure they give as little, yet enough information so that they will be the first to guess their number (in which case order matters, but yes, A could be called B, B called C etc. I was just talking about the fact that if that was the end game it would not be acceptable to have anyone start without specifically stating that it was a random choice)

As I see it, A,B and C have their hats, it just so happen that they make in the order we know their observations, which are candid, in the sense that none of them tried to make an observation that would let them be sure that it would allow them to find out their own number, they talked one after another in a happy sequence with a happy configuration that was unique enough that otherwise we could not solve it

16. Jan 11, 2013

### Staff: Mentor

Right. But we have some set of rules and actions the players can take, so it is a game.
That would be an attempt to make the game interesting in some way, which was not indended by me.

17. Jan 12, 2013

### oli4

This is precisely what I am missing. What is this set of rules ?
What are they allowed to say, or not allowed to say ?
Is the game won only if everyone finds his number or can some win the game by finding their number and the other ones lose ?
Do those who win get more points if some others don't find their number ? (you get 2 points for finding your own number, plus 1 point for every player that didn't find his number, those who don't find their number get 0 and those who think they find it but are wrong get -1 point (something like that

18. Jan 12, 2013

### Staff: Mentor

See first post:
Everything, when it is their turn.

Exactly.

There are no points, they can just win together or lose together.

19. Jan 12, 2013

### oli4

As we said before, Amy, Bob and Carol could just tell the others' numbers and that wouldn't make for a very fun game.
Since they do play it and take immense risks by not playing the obvious way to win the game, it is because there must be one more rule to the game and I think I guessed what it is.
It is compatible with what happened, it was just not stated.
So add the rule that whoever raises his hand can't talk any more (and of course cheating (as in not raising the hand although the number is known/knowable) is not allowed).
In this case, Amy can't say something like B+C=15 because then both B and C would raise their hands and A couldn't get any hint for herself and the game is lost.

20. Jan 13, 2013

### Staff: Mentor

That is a nice idea, and probably compatible with the statements they made.
But, as I posted, it is not relevant for the problem I solved.

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook