1.67k likes | 1.84k Views
Playing with cards and hats - data transmission and coding theory. Michel Waldschmidt Université P. et M. Curie - Paris VI Centre International de Mathématiques Pures et Appliquées - CIMPA. Institute Lecture IIT Bombay, January 4, 2008. http://www.math.jussieu.fr/~miw/.
E N D
Playing with cards and hats - data transmission and coding theory Michel Waldschmidt Université P. et M. Curie - Paris VI Centre International de Mathématiques Pures et Appliquées - CIMPA Institute Lecture IIT Bombay, January 4, 2008 http://www.math.jussieu.fr/~miw/
Given 16 playing cards, if you select one of them, then with 4 questions I can deduce from your answers of yes/no type which card you choose. With one more question I shall detect if one of your answer is not compatible with the others, but I shall not be able to correct it. The earliest error correcting code, due to Richard Hamming (1950), shows that 7 questions suffice (and this is optimal). Seven people are in a room, each has a hat on his head, the color of which is black or white. Hat colors are chosen randomly. Everybody sees the color of the hat on everyone's head, but not on their own. People do not communicate with each other. Everyone gets to guess (by writing on a piece of paper) the color of their hat. They may write: Black/White/Abstain. The people in the room win together or lose together. The team wins if at least one of the three people did not abstain, and everyone who did not abstain guessed the color of their hat correctly. How will this team decide a good strategy with a high probability of winning? Again the answer is given by Hammings code, and the probability of winning for the team is 7/8. Before tossing a coin 7 consecutive time, you want to make a limited number of bets and be sure that one of them will have at most one wrong answer. How many bets are required? Once more the answer is given by Hamming and it is 16. After a discussion of these three examples we shall give a brief survey of coding theory, up to the more recent codes involving algebraic geometry.
The best card trick Michael Kleber, Mathematical Intelligencer 24 (2002)
Rules of the card trick • Among 52 cards, select 5 of them, do not show them to me, but give them to my assistant. • After looking at these 5 cards, my assistant gives me four of them, one at a time, and hides the fifth one which is known to you and to my assistant. • I am able to tell you which one it is.
Which information do I receive? • I received 4 cards, one at a time. With my assistant we agreed beforehand with an ordering. • I receive these 4 cards in one of 24 possible arrangements. • There are 4 choices for the first card, once the first card is selected there are 3 choices for the second card, and then 2 choices for the third one. And finally no choice for the last one. 24 = 4 3 2 1
24 possible arrangements for 4 cards • I receive these 4 cards in one of the 24 following arrangements 1234, 1243, 1324, 1342, 1423, 1432, 2134, 2143, 2314, 2341, 2413, 2431, 3124, 3142, 3214, 3241, 3412, 3421, 4123, 4132, 4213, 4231, 4312, 4321. • So the information I receive can be converted into a number between 1 and 24
But there are 52 cards! • I received 4 cards, there are 48 unknown cards. • Therefore this idea is not sufficient: with a number between 1 and 24, I am only half way to a correct guess.
There are 4 suits only! Spade, Hart, Diamond, Club My assistant received 5 cards.
Pigeonhole Principle • If there are more pigeons than holes, one at least of the holes hosts at least two pigeons. • If there are more holes than pigeons, one at least of the holes is empty. Dirichlet’s box principle (Schubfachprinzip) 1834
My assistant received 5 cards, there are 4 suits So one at least of the suits occurs twice. We agree that the first card I receive will tell me the suit of the hidden card.
Information I receive from the next 3 cards • I need to find out which one it is among the 12 other cards of the same suit. • Next, I receive 3 cards in one of the 6 possible orders. I convert this information into a number from 1 to 6.
Last step • I receive a number from 1 to 6, there are 12 possible cards, so again we are half way (but we made progress by reducing the total number of possibilities by a coefficient 4, namely from 48 to 12). • My assistant had the choice between two cards for the first I received.
Count from 1 to 6
The Hat Problem • Three people are in a room, each has a hat on his head, the colour of which is black or white. Hat colours are chosen randomly. Everybody sees the colour of the hat on everyone’s head, but not on their own. People do not communicate with each other. • Everyone tries to guess (by writing on a piece of paper) the colour of their hat. They may write: Black/White/Abstention.
Rules of the game • The people in the room win together or lose together as a team. • The team wins if at least one of the three persons do not abstain, and everyone who did not abstain guessed the colour of their hat correctly. • What could be the strategy of the team to get the highest probability of winning?
Strategy • A weak strategy: anyone guesses randomly. • Probability of winning: 1/23 =1/8. • Slightly better strategy: they agree that two of them abstain and the other guesses randomly. • Probability of winning: 1/2. • Is it possible to do better?
Information is the key • Hint: Improve the odds by using the available information: everybody sees the colour of the hat on everyone’s head except on his own head.
Solution of the Hat Problem • Better strategy: if a member sees two different colours, he abstains. If he sees the same colour twice, he guesses that his hat has the other colour.
The two people with white hats see one white hat and one black hat, so they abstain. The one with a black hat sees two white hats, so he writes black. The team wins!
The two people with black hats see one white hat and one black hat, so they abstain. The one with a white hat sees two black hats, so he writes white. The team wins!
Everybody sees two white hats, and therefore writes black on the paper. The team looses!
Everybody sees two black hats, and therefore writes white on the paper. The team looses!
Winning team: two whites or two blacks
Loosing team: three whites or three blacks Probability of winning: 3/4.
Playing cards: easy game
I know which card you selected • Among a collection of playing cards, you select one without telling me which one it is. • I ask you some questions and you answer yes or no. • Then I am able to tell you which card you selected.
2 cards • You select one of these two cards • I ask you one question and you answer yes or no. • I am able to tell you which card you selected.
2 cards: one question suffices • Question: is it this one?
4 cards: 2 questions suffice Y Y Y N N Y N N
8 Cards: 3 questions YYY YYN YNY YNN NYY NYN NNY NNN
Yes / No • 0 / 1 • Yin — / Yang - - • True / False • White / Black • + / - • Heads / Tails (tossing or flipping a coin)
8 Cards: 3 questions YYY YYN YNY YNN NYY NYN NNY NNN Replace Y by 0 and N by 1
0 0 0 0 0 0 1 1 0 1 0 2 0 1 1 3 1 0 0 4 1 0 1 5 1 1 0 6 1 1 1 7 3 questions, 8 solutions
8 = 2 2 2 = 23 One could also display the eight cards on the corners of a cube rather than in two rows of four entries.
Exponential law n questions for 2ncards Add one question = multiply the number of cards by2 Economy: Growth rate of 4% for 25 years = multiply by 2.7
Complexity An integer between 0 and 2n -1is given by its binary expansion involving n digits. Binary notation m=an-1an-2 …a1a0 means m=2n-1an-1 + 2n-2an-2 + … + 2a1+ a0. The complexity of m is its number of digits : n = 1+ [log2 m]if an-1 ≠ 0.
12 0 4 8 13 1 5 9 10 14 6 2 11 15 7 3 Label the 16 cards
0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 0 0 0 0 1 1 1 0 1 0 1 0 1 1 0 0 1 0 0 1 0 1 1 1 0 0 1 1 0 1 0 1 0 1 1 1 1 1 0 1 1 0 1 1 1 0 0 1 1 Binary representation:
Y Y Y Y N N Y Y Y N Y Y N Y Y Y Y Y Y N N N Y N Y N Y N N Y Y N Y Y N Y N N N Y Y N N Y N Y N Y N N N N N Y N N Y N N N Y Y N N Ask the questions so that the answers are: