coding theory, card tricks and hat problems

164
Coding Theory, Card Tricks and Hat Problems Michel Waldschmidt Université P. et M. Curie - Paris VI Centre International de Mathématiques Pures et Appliquées - CIMPA http://www.math.jussieu.fr/~miw/ coursHCMUNS2007.html Ho Chi Minh City, September 30, 2007

Upload: arden-joyce

Post on 03-Jan-2016

36 views

Category:

Documents


5 download

DESCRIPTION

Ho Chi Minh City, September 30, 2007. Coding Theory, Card Tricks and Hat Problems. Michel Waldschmidt Université P. et M. Curie - Paris VI Centre International de Mathématiques Pures et Appliquées - CIMPA. http://www.math.jussieu.fr/~miw/coursHCMUNS2007.html. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Coding Theory, Card Tricks and Hat Problems

Coding Theory, Card Tricks and Hat Problems

Michel Waldschmidt

Université P. et M. Curie - Paris VI

Centre International de Mathématiques Pures et Appliquées - CIMPA

http://www.math.jussieu.fr/~miw/coursHCMUNS2007.html

Ho Chi Minh City, September 30, 2007

Page 2: Coding Theory, Card Tricks and Hat Problems

2

Starting with card tricks, we show how mathematical tools are used to detect and to correct errors occuring in the transmission of data. These so-called "error-detecting codes" and "error-correcting codes" enable identification and correction of the errors caused by noise or other impairments during transmission from the transmitter to the receiver. They are used in compact disks to correct errors caused by scratches, in satellite broadcasting, in digital money transfers, in telephone connexions, they are useful for improving the reliability of data storage media as well as to correct errors cause when a hard drive fails. The National Aeronautics and Space Administration (NASA) has used many different error-correcting codes for deep-space telecommunications and orbital missions.

Ho Chi Minh City

http://www.math.jussieu.fr/~miw/

September 30, 2007

Coding Theory, Card Tricks and Hat Problems

Page 3: Coding Theory, Card Tricks and Hat Problems

3

Most of the theory arises from earlier developments of mathematics which were far removed from any concrete application. One of the main tools is the theory of finite fields, which was invented by Galois in the XIXth century, for solving polynomial equations by means of radicals. The first error-correcting code happened to occur in a sport newspaper in Finland in 1930. The mathematical theory of information was created half a century ago by Claude Shannon. The mathematics behind these technical devices are being developped in a number of scientific centers all around the world, including in Vietnam and in France.

Ho Chi Minh City

http://www.math.jussieu.fr/~miw/

September 30, 2007

Coding Theory, Card Tricks and Hat Problems

Page 4: Coding Theory, Card Tricks and Hat Problems

4

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 where you answer yes or no.

• Then I am able to tell you which card you selected.

Page 5: Coding Theory, Card Tricks and Hat Problems

5

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.

Page 6: Coding Theory, Card Tricks and Hat Problems

6

2 cards: one question suffices

• Question: is-it this one?

Page 7: Coding Theory, Card Tricks and Hat Problems

7

4 cards

Page 8: Coding Theory, Card Tricks and Hat Problems

8

First question: is-it one of these two?

Page 9: Coding Theory, Card Tricks and Hat Problems

9

Second question: is-it one of these two ?

Page 10: Coding Theory, Card Tricks and Hat Problems

10

4 cards: 2 questions suffice

Y Y Y N

N Y N N

Page 11: Coding Theory, Card Tricks and Hat Problems

11

8 Cards

Page 12: Coding Theory, Card Tricks and Hat Problems

12

First question: is-it one of these?

Page 13: Coding Theory, Card Tricks and Hat Problems

13

Second question: is-it one of these?

Page 14: Coding Theory, Card Tricks and Hat Problems

14

Third question: is-it one of these?

Page 15: Coding Theory, Card Tricks and Hat Problems

15

8 Cards: 3 questions

YYY YYN YNY YNN

NYY NYN NNY NNN

Page 16: Coding Theory, Card Tricks and Hat Problems

16

Yes / No

• 0 / 1

• Yin — / Yang - -

• True / False

• + / -

• Heads / Tails (tossing a coin)

Page 17: Coding Theory, Card Tricks and Hat Problems

17

3 questions, 8 solutions

0 0 0 0 0 1 0 1 0 0 1 1

1 0 0 1 0 1 1 1 0 1 1 1

Page 18: Coding Theory, Card Tricks and Hat Problems

18

16 Cards

• If you select one card among a set of 16, I shall know which one it is, once you answer my 4 questions by yes or no.

Page 19: Coding Theory, Card Tricks and Hat Problems

19

Page 20: Coding Theory, Card Tricks and Hat Problems

20

Label the 16 cards

0 1 32

4 5 76

8 9 1110

12 13 1514

Page 21: Coding Theory, Card Tricks and Hat Problems

21

In binary expansion:

0 0 0 0 0 0 0 1 0 0 1 10 0 1 0

0 1 0 0 0 1 0 1 0 1 1 10 1 1 0

1 0 0 0 1 0 0 1 1 0 1 11 0 1 0

1 1 0 0 1 1 0 1 1 1 1 11 1 1 0

Page 22: Coding Theory, Card Tricks and Hat Problems

22

Ask the questions so that the answers are:

Y Y Y Y Y Y Y N Y Y N NY Y N Y

Y N Y Y Y N Y N Y N N NY N N Y

N Y Y Y N Y Y N N Y N NN Y N Y

N N Y Y N N Y N N N N NN N N Y

Page 23: Coding Theory, Card Tricks and Hat Problems

23

The 4 questions:

• Is the first digit 0 ?

• Is the second digit 0 ?

• Is the third digit 0 ?

• Is the fourth digit 0 ?

0000 0001 00110010

0100 0101 01110110

1000 1001 10111010

1100 1101 11111110

Page 24: Coding Theory, Card Tricks and Hat Problems

More difficult:

One answer may be wrong!

Page 25: Coding Theory, Card Tricks and Hat Problems

25

One answer may be wrong

• Consider the same problem, but you are allowed to give (at most) one wrong answer.

• How many questions are required so that I am able to know whether your answers are right or not? And if they are right, to know the card you selected?

Page 26: Coding Theory, Card Tricks and Hat Problems

26

Detecting one mistake

• If I ask one more question, I shall be able to detect if there is one of your answers which is not compatible with the others.

• And if you made no mistake, I shall tell you which is the card you selected.

Page 27: Coding Theory, Card Tricks and Hat Problems

27

Detecting one mistake with 2 cards

• With two cards I just repeat twice the same question.

• If both your answers are the same, you did not lie and I know which card you selected

• If your answers are not the same, I know that one is right and one is wrong (but I don’t know which one is correct!).

Page 28: Coding Theory, Card Tricks and Hat Problems

28

4 cards

Page 29: Coding Theory, Card Tricks and Hat Problems

29

First question: is-it one of these two?

Page 30: Coding Theory, Card Tricks and Hat Problems

30

Second question: is-it one of these two?

Page 31: Coding Theory, Card Tricks and Hat Problems

31

Third question: is-it one of these two?

Page 32: Coding Theory, Card Tricks and Hat Problems

32

4 cards: 3 questions

Y Y Y Y N N

N Y N N N Y

Page 33: Coding Theory, Card Tricks and Hat Problems

33

4 cards: 3 questions

0 0 0 0 1 1

1 0 1 1 1 0

Page 34: Coding Theory, Card Tricks and Hat Problems

34

Correct triple of answers:

0 0 0 0 1 1 1 0 1 1 1 0

Wrong triple of answers

0 0 1 0 1 0 1 0 0 1 1 1

One change in a correct triple of answers yields a wrong triple of answers

Page 35: Coding Theory, Card Tricks and Hat Problems

35

Boolean addition

• 0 + 0 = 0

• 0 + 1 = 1

• 1 + 0 = 1

• 1 + 1 = 0

Page 36: Coding Theory, Card Tricks and Hat Problems

36

Parity bit• Use one more bit which is the Boolean

sum of the previous ones.

• Now for a correct answer the sum of the bits should be 0.

• If there is exactly one error, the parity bit will detect it: the sum of the bits will be 1 instead of 0.

Page 37: Coding Theory, Card Tricks and Hat Problems

37

8 Cards

Page 38: Coding Theory, Card Tricks and Hat Problems

38

4 questions for 8 cards

0000 0011 0101 0110

1001 1010 1100 1111

YYYY YYNN YNYN YNNY

NYYN NYNY NNYY NNNN

Use the 3 previous questions plus the parity bit question

Page 39: Coding Theory, Card Tricks and Hat Problems

39

First question: is-it one of these?

Page 40: Coding Theory, Card Tricks and Hat Problems

40

Second question: is-it one of these?

Page 41: Coding Theory, Card Tricks and Hat Problems

41

Third question: is-it one of these?

Page 42: Coding Theory, Card Tricks and Hat Problems

42

Fourth question: is-it one of these?

Page 43: Coding Theory, Card Tricks and Hat Problems

43

16 cards, at most one wrong answer:

5 questions to detect the mistake

Page 44: Coding Theory, Card Tricks and Hat Problems

44

Ask the 5 questions so that the answers are:

YYYYY YYYNN YYNNYYYNYN

YNYYN YNYNY YNNNNYNNYY

NYYYN NYYNY NYNNNNYNYY

NNYYY NNYNN NNNNYNNNYN

Page 45: Coding Theory, Card Tricks and Hat Problems

45

Correcting one mistake

• Again I ask you questions where your answer is yes or no, again you are allowed to give at most one wrong answer, but now I want to be able to know which card you selected - and also to tell you whether and when you lied.

Page 46: Coding Theory, Card Tricks and Hat Problems

46

With 2 cards

• I repeat the same question three times.

• The most frequent answer is the right one: vote with the majority.

Page 47: Coding Theory, Card Tricks and Hat Problems

47

With 4 cards

I repeat my two questions three times each, which makes 6 questions

Page 48: Coding Theory, Card Tricks and Hat Problems

48

With 8 Cards

I repeat 3 timesmy 3 questions,which makes 9 questions

Page 49: Coding Theory, Card Tricks and Hat Problems

49

With 16 cards, this process requires

34=12 questions

Page 50: Coding Theory, Card Tricks and Hat Problems

50

16 cards, 7 questions

• Recall: if you select one card among 16, only 3 questions are required if all answers are correct.

• With 4 questions, we detect one mistake.

• We shall see that 7 questions allow to recover the exact result if there is at most one wrong answer.

Page 51: Coding Theory, Card Tricks and Hat Problems

The Hat Problem

Page 52: Coding Theory, Card Tricks and Hat Problems

52

The Hat Problem

• Three 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.

Page 53: Coding Theory, Card Tricks and Hat Problems

53

• 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?

Page 54: Coding Theory, Card Tricks and Hat Problems

54

• Simple strategy: they agree that two of them abstain and the other guesses randomly.

• Probability of winning: 1/2.

• Is it possible to do better?

Page 55: Coding Theory, Card Tricks and Hat Problems

55

• Hint:

Improve the odds by using the available information: everybody sees the color of the hat on everyone’s head but himself.

Page 56: Coding Theory, Card Tricks and Hat Problems

56

• Better strategy: if a member sees two different colors, he abstains. If he sees the same color twice, he guesses that his hat has the other color.

Page 57: Coding Theory, Card Tricks and Hat Problems

57

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.

They win!

Page 58: Coding Theory, Card Tricks and Hat Problems

58

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.

They win!

Page 59: Coding Theory, Card Tricks and Hat Problems

59

They lose

Everybody sees two white hats, and therefore writes black on the paper.

Page 60: Coding Theory, Card Tricks and Hat Problems

60

They lose

Everybody sees two black hats, and therefore writes white on the paper.

Page 61: Coding Theory, Card Tricks and Hat Problems

61

Winning:

two whiteor

two black

Page 62: Coding Theory, Card Tricks and Hat Problems

62

Losing:

three whiteor

three black

Page 63: Coding Theory, Card Tricks and Hat Problems

63

• The team wins exactly when the three hats do not have all the same color, that is in 6 cases out of a total of 8

• Probability of winning: 3/4.

Page 64: Coding Theory, Card Tricks and Hat Problems

64

• Now if the hats are no more distributed randomly and if the master of the game knows the previous strategy, he may select often the three hats all of the same color.

• Is there another strategy giving the same probability 3/4, for randomly distributed colors?

Answer: YES!

Page 65: Coding Theory, Card Tricks and Hat Problems

65

The team selects one distribution of hats and bets that it will not be this one,

neither the opposite distribution where black is replaced by white and white by black:

Page 66: Coding Theory, Card Tricks and Hat Problems

66

• If the distribution of the colors is one of these, they will lose.

• If the distribution of the colors is one of the 6 other possibilities, exactly one of the three people will be able to guess correctly the color of his hat, and the two others will abstain, so the team will win.

Page 67: Coding Theory, Card Tricks and Hat Problems

67

Hat problem with 7 people

For 7 people in the room in place of 3,which is the best strategy

and its probability of winning?

Answer: the best strategy gives a

probability of winning of 7/8

Page 68: Coding Theory, Card Tricks and Hat Problems

Winning at the lottery

Page 69: Coding Theory, Card Tricks and Hat Problems

69

Tails and Ends

• Toss a coin 3 consecutive times

• There are 8 possible sequences of results:

(0,0,0), (0,0,1), (0,1,0), (0,1,1),

(1,0,0), (1,0,1), (1,1,0), (1,1,1).

Page 70: Coding Theory, Card Tricks and Hat Problems

70

If you bet (0,1,0), you have :

• All three correct results for (0,1,0).

• Exactly two correct results if the sequence is either (0,1,1), (0,0,0) or (1,1,0),

• Exactly one correct result if the sequence is either (0,0,1), (1,1,1) or (1,0,0),

• No correct result at all for (1,0,1).

Page 71: Coding Theory, Card Tricks and Hat Problems

71

Among 8 possibilities:

each bet

is winning in exactly 1 case

has exactly two correct results in 3 cases

has exactly one correct result in 3 cases

has no correct result at all in only 1 case

Page 72: Coding Theory, Card Tricks and Hat Problems

72

• Goal: To be sure of having at least 2 correct results

• Clearly, one bet is not sufficient

• Are two bets sufficient?

Recall that there are 8 possible results, and that each bet has at least 2 correct results in 4 cases.

Page 73: Coding Theory, Card Tricks and Hat Problems

73

Answer: YES, two bets suffice!

For instance bet

(0,0,0) and (1,1,1)

Whatever the result is, one of the two digits

0 and 1

occurs more than once.

Hence one (and only one) of the two bets

has at least two correct results.

Page 74: Coding Theory, Card Tricks and Hat Problems

74

The 8 sequences of three digits 0 and 1 split into two groups: 4 having two or three 0’s

000, 001, 010, 100and 4 having two or three 1’s

111, 110, 101, 011

Page 75: Coding Theory, Card Tricks and Hat Problems

75

Other solutions:

• Select any two bets with all three different digits, say

1 0 1 and 0 1 0

The result either is one of these, or else has two common digits with one of these and just one common digit with the other.

Page 76: Coding Theory, Card Tricks and Hat Problems

76

Select 101 and 010The 8 sequences of three digits 0 and 1 split into two groups: 4 having two or three digits which are

the same as 101 :101, 100, 111, 001

and 4 having two or three digits which are

the same as 010 : 010, 011, 000, 110

Page 77: Coding Theory, Card Tricks and Hat Problems

77

Toss a coin 7 consecutive times

• There are 27 =128 possible sequences of results.

• How many bets are required in such a way that you are sure one at least of them has at most one wrong answer?

Page 78: Coding Theory, Card Tricks and Hat Problems

78

Tossing a coin 7 times

• Each bet has all correct answers once every 128 cases.

• It has just one wrong answer 7 times: either the first, second, … seventh guess is wrong.

• So it has at most one wrong answer 8 times among 128 possibilities.

Page 79: Coding Theory, Card Tricks and Hat Problems

79

Tossing a coin 7 times

• Now 128 = 8 16. Indeed 128 is 27, and 8 is 23. 27 = 23 24

• Therefore you cannot achieve your goal with less than 16 bets.

• Coding theory tells you how to select your 16 bets, exactly one of them will have at most one wrong answer.

Page 80: Coding Theory, Card Tricks and Hat Problems

80

SPORT TOTO• A match between two players (or teams)

may give three possible results: either player 1 wins, or player 2 wins, or else there is a draw.

• There is a lottery, and a winning ticket needs to have at least three correct bets. How many tickets should one buy to be sure to win?

Page 81: Coding Theory, Card Tricks and Hat Problems

81

4 matches, 3 correct forecasts

• For 4 matches, there are 34 = 81 possibilities. • A bet on 4 matches is a sequence of 4 symbols

{1, 2, x}. Each such ticket has exactly 3 correct answers 8 times. For instance the ticket (1, 2, x, 1) has 3 correct answers for the results (2, 2, x, 1), (1, 1, x, 1), (1, 2, 1, 1), (1, 2, x, 2)(x, 2, x, 1), (1, x, x, 1), (1, 2, 2, 1), (1, 2, x, x)

Page 82: Coding Theory, Card Tricks and Hat Problems

82

4 matches, 3 correct forecasts

• Each ticket has all correct answers once and 3 correct answers 8 times

• Hence it has at least 3 correct answers in 9 cases. • Altogether there are 81 = 9 9 possible results.• So at least 9 tickets are required to be sure to win. • How to select such 9 tickets?

Page 83: Coding Theory, Card Tricks and Hat Problems

83

9 tickets (in columns)

x x x 1 1 1 2 2 2

x 1 2 x 1 2 x 1 2

x 1 2 1 2 x 2 x 1

x 1 2 2 x 1 1 2 x

This is an error correcting code on the alphabet{1,2,x} with rate 1/2

Page 84: Coding Theory, Card Tricks and Hat Problems

Error correcting codes

Page 85: Coding Theory, Card Tricks and Hat Problems

85

Coding Theory

• Coding theory is the branch of mathematics concerned with transmitting data across noisy channels and recovering the message. Coding theory is about making messages easy to read: don't confuse it with cryptography which is the art of making messages hard to read!

Page 86: Coding Theory, Card Tricks and Hat Problems

86

Claude Shannon

• In 1948, Claude Shannon, working at Bell Laboratories in the USA, inaugurated the whole subject of coding theory by showing that it was possible to encode messages in such a way that the number of extra bits transmitted was as small as possible. Unfortunately his proof did not give any explicit recipes for these optimal codes.

Page 87: Coding Theory, Card Tricks and Hat Problems

87

Richard Hamming

Around the same time, Richard Hamming, also at Bell Labs, was using machines with lamps and relays having an error detecting code. The digits from 1 to 9 were send on ramps of 5 lamps with two on and three out. There were very frequent errors which were easy to detect and then one had to restart the process.

Page 88: Coding Theory, Card Tricks and Hat Problems

88

The first correcting codes

• For his researches, Hamming was allowed to have the machine working during the week-end only, and they were on the automatic mode. At each error the machine stopped until the next monday morning.

• "If it can detect the error," complained Hamming, "why can't it correct it! "

Page 89: Coding Theory, Card Tricks and Hat Problems

89

The origin of Hamming’s code

• He decided to find a device so that the machine would not only detect the errors but also correct them.

• In 1950, he published details of his work on explicit error-correcting codes with information transmission rates more efficient than simple repetition.

• His first attempt produced a code in which four data bits were followed by three check bits which allowed not only the detection but the correction of a single error.

Page 90: Coding Theory, Card Tricks and Hat Problems

90

Page 91: Coding Theory, Card Tricks and Hat Problems

91

Codes and Geometry

• 1949: Marcel Golay (specialist of radars): produced two remarkably efficient codes.

• Eruptions on Io (Jupiter’s volcanic moon)• 1963 John Leech: uses Golay’s ideas for

sphere packing in dimension 24 - classification of finite simple groups

• 1971: no other perfect code than the two found by Golay.

Page 92: Coding Theory, Card Tricks and Hat Problems

92

Error Correcting Codes Data Transmission

• Telephone

• CD or DVD

• Image transmission

• Sending information through the Internet

• Radio control of satellites

Page 93: Coding Theory, Card Tricks and Hat Problems

93

Applications of error correcting codes

• Transmitions by satellites

• Compact discs

• Cellular phones

Page 94: Coding Theory, Card Tricks and Hat Problems

94

Olympus Mons on Mars Planet

Image from Mariner 2 in 1971.

Page 95: Coding Theory, Card Tricks and Hat Problems

95

Information was sent to the earth using an error correcting code which corrected 7 bits among 32.

In each group of 32 bits, 26 are control bits and the 6 others contain the information.

Page 96: Coding Theory, Card Tricks and Hat Problems

96

• Between 1969 and 1973 the NASA Mariner probes used a powerful Reed--Muller code capable of correcting 7 errors out of 32 bits transmitted, consisting now of 6 data bits and 26 check bits! Over 16,000 bits per second were relayed back to Earth.

QuickTime™ et undécompresseur TIFF (non compressé)

sont requis pour visionner cette image.The North polar cap of Mars, taken by Mariner 9 in 1972.

Page 97: Coding Theory, Card Tricks and Hat Problems

97

Voyager 1 and 2 (1977)

• Journey: Cape Canaveral, Jupiter, Saturn, Uranus, Neptune.

• Sent information by means of a binary code which corrected 3 errors on words of length 24.

Page 98: Coding Theory, Card Tricks and Hat Problems

98

Mariner spacecraft 9 (1979)

• Sent black and white photographs of Mars

• Grid of 600 by 600, each pixel being assigned one of 64 brightness levels

• Reed-Muller code with 64 words of 32 letters, minimal distance 16, correcting 7 errors, rate 3/16

Page 99: Coding Theory, Card Tricks and Hat Problems

99

Voyager (1979-81)

• Color photos of Jupiter and Saturn• Golay code with 4096=212 words of 24

letters, minimal distance 8, corrects 3 errors, rate 1/2.

• 1998: lost of control of Soho satellite recovered thanks to double correction by turbo code.

Page 100: Coding Theory, Card Tricks and Hat Problems

100

NASA's Pathfinder mission on Mars

• The power of the radio transmitters on these craft is only a few watts, yet this information is reliably transmitted across hundreds of millions of miles without being completely swamped by noise.

QuickTime™ et undécompresseur TIFF (non compressé)

sont requis pour visionner cette image.

QuickTime™ et undécompresseur TIFF (non compressé)

sont requis pour visionner cette image.

Sojourner rover and Mars Pathfinder lander

Page 101: Coding Theory, Card Tricks and Hat Problems

101

Listening to a CD• On a CD as well as on a computer, each

sound is coded by a sequence of 0’s and 1’s, grouped in octets

• Further octets are added which detect and correct small mistakes.

• In a CD, two codes join forces and manage to handle situations with vast number of errors.

Page 102: Coding Theory, Card Tricks and Hat Problems

102

Coding the sound on a CD

Using a finite field with 256 elements, it is possible to correct 2 errors in each word of 32 octets with 4 control octets for 28 information octets.

On CDs the signal in encoded digitally. To guard against scratches, cracks and similar damage, two "interleaved" codes which can correct up to 4,000 consecutive errors (about 2.5 mm of track) are used.

Page 103: Coding Theory, Card Tricks and Hat Problems

103

A CD of high quality may have more than 500 000 errors!

• After processing of the signal in the CD player, these errors do not lead to any disturbing noise.

• Without error-correcting codes, there would be no CD.

Page 104: Coding Theory, Card Tricks and Hat Problems

104

1 second of radio signal = 1 411 200 bits

• The mathematical theory of error correcting codes provides more reliability and at the same time decreases the cost. It is used also for data transmission via the internet or satellites

Page 105: Coding Theory, Card Tricks and Hat Problems

105

Codes and Mathematics

• Algebra (discrete mathematics

finite fields, linear algebra,…)

• Geometry

• Probability and statistics

Page 106: Coding Theory, Card Tricks and Hat Problems

106

Finite fields and coding theory

• Solving algebraic equations with radicals: Finite fields theory Evariste Galois (1811-1832)

• Construction of regular polygons with rule and compass

• Group theory

Page 107: Coding Theory, Card Tricks and Hat Problems

107

Coding Theory

transmission

Source Coded Text

Coded Text

Receiver

Page 108: Coding Theory, Card Tricks and Hat Problems

108

Error correcting codes

Transmission

with noise

Source Coded Text

Coded Text

Receiver

Page 109: Coding Theory, Card Tricks and Hat Problems

109

Principle of coding theory

Only certain words are allowed (code = dictionary of valid words).

The « useful » letters carry the information, the other ones (control bits) allow detecting or correcting errors.

Page 110: Coding Theory, Card Tricks and Hat Problems

110

Detecting one error by sending twice the message

• Send twice each bit

2 code words among 4=22 possible words

(1 useful letter among 2)

Code words

(two letters)

0 0

and

1 1

Rate: 1/2

Page 111: Coding Theory, Card Tricks and Hat Problems

111

Principle of codes detecting one error:

Two distinct code words have at least two distinct letters

Page 112: Coding Theory, Card Tricks and Hat Problems

112

Detecting one error with the parity bit

Code words (three letters):

0 0 0

0 1 1

1 0 1

1 1 0

Parity bit : (x y z) with z=x+y.

4 code words (among 8 words with 3 letters),

2 useful letters (among 3).

Rate: 2/3

2

Page 113: Coding Theory, Card Tricks and Hat Problems

113

Code Words Non Code Words

0 0 0 0 0 10 1 1 0 1 01 0 1 1 0 0

1 1 0 1 1 1

Two distinct code words have at least two distinct letters.

2

Page 114: Coding Theory, Card Tricks and Hat Problems

114

Check bit

• In the International Standard Book Number (ISBN) system used to identify books, the last of the ten-digit number is a check bit.

• The Chemical Abstracts Service (CAS) method of identifying chemical compounds, the United States Postal Service (USPS) use check digits.

• Modems, computer memory chips compute checksums.

• One or more check digits are commonly embedded in credit card numbers.

Page 115: Coding Theory, Card Tricks and Hat Problems

115

Correcting one errorby repeating three times

• Send each bit three times

2 code words

among 8 possible ones

(1 useful letter among 3)

Code words

(three letters)

0 0 0

1 1 1

Rate: 1/3

Page 116: Coding Theory, Card Tricks and Hat Problems

116

• Correct 0 0 1 as 0 0 0

• 0 1 0 as 0 0 0

• 1 0 0 as 0 0 0

and

• 1 1 0 as 1 1 1

• 1 0 1 as 1 1 1

• 0 1 1 as 1 1 1

Page 117: Coding Theory, Card Tricks and Hat Problems

117

Principle of codes correcting one error: Two distinct code words have at least

three distinct letters

Page 118: Coding Theory, Card Tricks and Hat Problems

118

Hamming Distance between two words:

= number of places in which the two words

differ

Examples:

(0,0,1) and (0,0,0) have distance 1

(1,0,1) and (1,1,0) have distance 2

(0,0,1) and (1,1,0) have distance 3

Richard W. Hamming (1915-1998)

Page 119: Coding Theory, Card Tricks and Hat Problems

119

Hamming distance 1

QuickTime™ et undécompresseur TIFF (non compressé)

sont requis pour visionner cette image.

Page 120: Coding Theory, Card Tricks and Hat Problems

120

Hamming’s unit sphere

• The unit sphere around a word includes the words at distance at most 1

Page 121: Coding Theory, Card Tricks and Hat Problems

121

At most one error

QuickTime™ et undécompresseur TIFF (non compressé)

sont requis pour visionner cette image.

Page 122: Coding Theory, Card Tricks and Hat Problems

122

Words at distance at least 3

Page 123: Coding Theory, Card Tricks and Hat Problems

123

Decoding

Page 124: Coding Theory, Card Tricks and Hat Problems

124

Hamming Distance

• The Hamming distance between two words is the number of places where letters differ.

• A code detects n errors iff the Hamming distance between two distinct code words is at least 2n.

• It corrects n errors iff the Hamming distance between two distinct code words is at least 2n+1.

Page 125: Coding Theory, Card Tricks and Hat Problems

125

• The set of words with three letters (eight elements) splits into two balls

• The centers are (0,0,0) and (1,1,1)

• Each of the two balls consists of elements at distance at most 1 from the center

The code (0 0 0) (1 1 1)

Page 126: Coding Theory, Card Tricks and Hat Problems

126

(0,0,1)

(0,0,0) (0,1,0)

(1,0,0)

(1,1,0)

(1,1,1) (1,0,1)

(0,1,1)

Two or three 0 Two or three 1

Page 127: Coding Theory, Card Tricks and Hat Problems

127

Another error correcting code on 3 letters:

• Select two words with mutual distance 3 = two words with three distinct letters, say (0,0,1) and (1,1,0)

• For each of them, consider the ball of elements at distance at most 1

Page 128: Coding Theory, Card Tricks and Hat Problems

128

(0,0,0)

(0,0,1) (0,1,1)

(1,0,1)

(1,1,1)

(1,1,0) (1,0,0)

(0,1,0)

Page 129: Coding Theory, Card Tricks and Hat Problems

129

Back to the Hat Problem

• Replace white by 0 and black by 1 hence the distribution of colors becomes a

word of three letters on the alphabet {0 , 1}• Consider the centers of the balls (0,0,0) and

(1,1,1).• The team bets that the distribution of colors

is not one of the two centers.

Page 130: Coding Theory, Card Tricks and Hat Problems

130

Assume the distribution of hats does not correspond to one of the centers (0, 0, 0) and (1, 1, 1). Then:

• One color occurs exactly twice (the word has both digits 0 and 1).

• Exactly one member of the team sees twice the same color: this corresponds to 0 0 in case he sees two white hats, 1 1 in case he sees two black hats.

• Hence he knows the center of the ball: (0 , 0 , 0) in the first case, (1, 1, 1) in the second case.

• He bets the missing digit does not yield the center.

Page 131: Coding Theory, Card Tricks and Hat Problems

131

• The two others see two different colors, hence they do not know the center of the ball. They abstain.

• Therefore the team wins when the distribution of colors does not correspond to one of the centers of the balls.

• This is why the team wins in 6 cases.

Page 132: Coding Theory, Card Tricks and Hat Problems

132

• Now if the word corresponding to the distribution of the hats is one of the centers, all members of the team bet the wrong answer!

• They lose in 2 cases.

Page 133: Coding Theory, Card Tricks and Hat Problems

133

Another strategy:

• Select two words with mutual distance 3 = two words with three distinct letters, say (0,0,1) and (1,1,0)

• For each of them, consider the ball of elements at distance at most 1

Page 134: Coding Theory, Card Tricks and Hat Problems

134

• The team bets that the distribution of colors is not one of the two centers (0,0,1), (1,1,0).

• A word not in the center has exactly one letter distinct from the center of its ball, and two letters different from the other center.

Page 135: Coding Theory, Card Tricks and Hat Problems

135

Assume the word corresponding to the distribution of the hats is not a center.

Then:

• Exactly one member of the team knows the center of the ball. He bets the distribution does not correspond to the center.

• The others do not know the center of the ball. They abstain.

• Hence the team wins.

Page 136: Coding Theory, Card Tricks and Hat Problems

136

The binary code of Hamming (1950)

It is a linear code (the sum of two code words is a code word) and the 16 balls of radius 1 with centers in the code words cover all the space of the 128 binary words of length 7

(each word has 7 neighbors (7+1)16= 256).

Page 137: Coding Theory, Card Tricks and Hat Problems

137

Hamming code

Words of 7 letters Code words: (16=24 among 128=27)

(a b c d e f g)with

e=a+b+d f=a+c+d g=a+b+c

Rate: 4/7

Page 138: Coding Theory, Card Tricks and Hat Problems

138

Hamming’s code

Page 139: Coding Theory, Card Tricks and Hat Problems

139

ab

d

c

e=a+b+d

g=a+b+c

f=a+c+d

How to compute e , f , g from a , b , c , d.

Page 140: Coding Theory, Card Tricks and Hat Problems

140

16 code words of 7 letters

0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 0 1 1 0 0 1 1 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 1 0 1 1 0 1 1 0 0 1 1 1 0 0 0

1 0 0 0 1 1 1 1 0 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1 1 0 1 0 1 1 0 0 0 1 0 1 1 0 1 1 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1

Two distinct code words have at least three distinct letters

Page 141: Coding Theory, Card Tricks and Hat Problems

141

The Hat Problem with 7 people

• The team bets that the distribution of the hats does not correspond to the 16 elements of the Hamming code

• Loses in 16 cases (they all fail)

• Wins in 128-16=112 cases (one bets correctly, the 6 others abstain)

• Probability of winning: 112/128=7/8

Page 142: Coding Theory, Card Tricks and Hat Problems

142

Tossing a coin 7 times

• There are 128 possible results

• Each bet is a word of 7 letters on the alphabet {0, 1}

• How many bets do you need if you want to guarantee at least 6 correct results?

Page 143: Coding Theory, Card Tricks and Hat Problems

143

• Each of the 16 code words has 7 neighbors (at distance 1), hence the ball of which it is the center has 8 elements.

• Each of the 128 words is in exactly one of these balls.

Page 144: Coding Theory, Card Tricks and Hat Problems

144

• Make 16 bets corresponding to the 16 code words: then, whatever the final result is, exactly one of your bets will have at least 6 correct answers.

• Notice that 16/128=1/8. This is the probability of losing for the hat problem with 7 people using the Hamming code.

Page 145: Coding Theory, Card Tricks and Hat Problems

145

7 questions to find the selected card among 16, with one possible wrong answer

Replace the cards by labels from 0 to 15 and write the binary expansions of these:

0000, 0001, 0010, 0011

0100, 0101, 0110, 0111

1000, 1001, 1010, 1011

1100, 1101, 1110, 1111

Page 146: Coding Theory, Card Tricks and Hat Problems

146

7 questions to find the selected number in {0,1,2,…,15} with one possible wrong answer

• Is the first binary digit 1?

• Is the second binary digit 1?

• Is the third binary digit 1?

• Is the fourth binary digit 1?

• Is the number in {1,2,4,7,9,10,12,15}?

• Is the number in {1,2,5,6,8,11,12,15}?

• Is the number in {1,3,4,6,8,10,13,15}?

Page 147: Coding Theory, Card Tricks and Hat Problems

147

Sphere Packing

• While Shannon and Hamming were working on information transmission in the States, John Leech invented similar codes while working on Group Theory at Cambridge. This research included work on the sphere packing problem and culminated in the remarkable, 24-dimensional Leech lattice, the study of which was a key element in the programme to understand and classify finite symmetry groups.

Page 148: Coding Theory, Card Tricks and Hat Problems

148

Sphere packing

The kissing number is 12

Page 149: Coding Theory, Card Tricks and Hat Problems

149

Sphere Packing

• Kepler Problem: maximal density of a packing of identical sphères :

  / 18= 0.740 480 49…

Conjectured in 1611.

Proved in 1999 by Thomas Hales.

• Connections with crystallography.

Page 150: Coding Theory, Card Tricks and Hat Problems

150

Current trends• In the past two years the goal of finding explicit codes

which reach the limits predicted by Shannon's original work has been achieved. The constructions require techniques from a surprisingly wide range of pure mathematics: linear algebra, the theory of fields and algebraic geometry all play a vital role. Not only has coding theory helped to solve problems of vital importance in the world outside mathematics, it has enriched other branches of mathematics, with new problems as well as new solutions.

Page 151: Coding Theory, Card Tricks and Hat Problems

151

Research going on in France

• INRIA Rocquencourt, Projet Codes http://www-rocq.inria.fr/codes/

• Marseille, Institut de Mathématiques de Luminy iml.univ-mrs.fr

• Limoges http://www.xlim.fr

• Toulon : Groupe de Recherche en Informatique et Mathématiques GRIM http://grim.univ-tln.fr

Page 152: Coding Theory, Card Tricks and Hat Problems

152

Research going on in France

• Bordeaux Institut de Mathématiques de Bordeaux A2X Théorie des nombres et Algorithmique Arithmétique

Equipe Codes et Réseaux

http://www.math.u-bordeaux1.fr/maths/ spip.php?

article9

Page 153: Coding Theory, Card Tricks and Hat Problems

153

Research going on in France• Toulouse Groupe de Recherche en Informatique et

Mathématiques du Mirail (GRIMM)http://www.univ-tlse2.fr/LB028/0/

fiche___laboratoire/&RH=02Equipes

• ENST (Télécom) Bretagnehttp://departements.enst-bretagne.fr/sc/recherche/turbo/

Page 154: Coding Theory, Card Tricks and Hat Problems

154

GDR IM ''Informatique Mathématique''

• Groupe de travail C2 Cryptographie et Codage

http://www.gdr-im.fr/

http://www-rocq.inria.fr/codes/Claude.Carlet/comp.html

Page 155: Coding Theory, Card Tricks and Hat Problems

155

Directions of research

• Theoretical questions of existence of specific codes

• connection with cryptography

• lattices and combinatoric designs

• algebraic geometry over finite fields

• equations over finite fields

Page 156: Coding Theory, Card Tricks and Hat Problems

A last card trick

The best card trick

Michael Kleber, Mathematical Intelligencer 24 (2002)

Page 157: Coding Theory, Card Tricks and Hat Problems

157

A 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.

• There is one card left which is known to you and to my assistant.

• I am able to tell you which one it is.

Page 158: Coding Theory, Card Tricks and Hat Problems

158

Which information did 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 orders.

• 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

Page 159: Coding Theory, Card Tricks and Hat Problems

159

24 possible orders for 4 cards

• I receive these 4 cards in one of the 24 following orders

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 from 1 to 24

Page 160: Coding Theory, Card Tricks and Hat Problems

160

But there are 52 cards!

• Therefore this idea is not sufficient. • There are four colors:

Spade, Hart, Diamond, Club

My assistant received 5 cards.

Page 161: Coding Theory, Card Tricks and Hat Problems

161

Pigeonhole or Box 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.

My assistant received 5 cards, there are 4 coloursSo one at least of the colors occurs twice.

We agree that the first card I receive will tell me the colour of the hidden card.

Page 162: Coding Theory, Card Tricks and Hat Problems

162

Information I receive from the next 3 cards

• Once I receive the first card, I know the color of the hidden card. I need to find out which one it is among the 12 others of the same color.

• Next I receive 3 cards in one of the 6 possible orders. I convert this information into a number from 1 to 6.

• My assistant had the choice between two cards for the first I received.

Page 163: Coding Theory, Card Tricks and Hat Problems

163

Count from1 to 6

Page 164: Coding Theory, Card Tricks and Hat Problems

Coding Theory, Card Tricks and Hat Problems

Michel Waldschmidt

Université P. et M. Curie - Paris VI

Centre International de Mathématiques Pures et Appliquées - CIMPA

http://www.math.jussieu.fr/~miw/coursHCMUNS2007.html

Ho Chi Minh City, September 30, 2007