Written on 04-Apr-2008 by
asquiHere is my solution to the Mr P and Mr Q Logic Puzzle I posted recently:
Assumptions:
- "number" refers to one of {2, 3, 4, 5, 6, 7, 8, J, Q, K, A} (ie. 'Picture cards' have a "number")
- "suit" refers to one of {H, S, C, D}
- Let U be the set of all (number,suit) card tuples.
U = {
(A,H), (Q,H), (4,H),
(J,S),
(8,C), (4,C), (2,C), (7,C), (3,C)
(A,D), (5,D)
} - Mr P knows the number.
- Mr Q knows the suit.
Phase 1:
- P cannot ascertain what card it is.
- Therefore it must be a card which is not uniquely identifiable by its number (which P already knows).
Let A be the set of cards in U which share a number.
A = {
(A,H),(Q,H),(4,H)
(A,D),(5,D),
}
- Q now knows that the soultion is in the set A.
Phase 2:- Q knew that P wouldn't be able to uniquely identify the card, based on knowing it's suit.
- Therefore the suit of the card must be one for which all numbers of that suit are duplicated (if a card is not one whose number is duplicated then P would have known what card it was, given that he already knows the number)
- So, the suit of the card must be a suit which appears in set A. Namely, hearts or diamonds.
Phase 3:
- Given Q's statement, P makes the deduction in Phase 2.
- P knows the number of the card, and knows that it is in set A, and from this he concludes the solution.
- Therefore the number of the card must be one which uinquely identifies a card from set A, namely, the number must be one of {Q, 4, 5}.
Let C be the set of cards in A for which this holds true.
C = {
(Q,H),(4,H)
(5,D),
}
Phase 4:
- Given P's statement, Q makes the deduction in Phase 3.
- Q knows the suit of the card, and now knows that it is in set C, and this allows him to discover the solution.
- So the solution is a card in set C which is uniquely identifiable by its number, namely (5,D).