how were the first error correcting codes constructed? a historical introduction to coding theory...

84
How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming’s work H. Gopalakrishna Gadiyar and R. Padma V. I. T. University, Vellore IIT Madras 6 February 2015 Gadiyar & Padma VIT A Historical Introduction to Coding Theory

Upload: padmagadiyar

Post on 22-Jul-2015

168 views

Category:

Engineering


3 download

TRANSCRIPT

Page 1: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

How were the first error correcting codesconstructed?

A historical introduction to coding theorythrough Hamming’s work

H. Gopalakrishna Gadiyar and R. Padma

V. I. T. University, Vellore

IIT Madras6 February 2015

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 2: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

One of the principal objects of theoretical research is tofind the point of view from which the subject appears inthe greatest simplicity.—–Josiah Willard Gibbs (1839-1903)

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 3: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Hamming’s Original Paper Rewritten in Symbolic Form:A Preamble to Coding Theory—-H. Gopalakrishna Gadiyar and R.PadmaarXiv:1401.5919v1http:

//web.mit.edu/redingtn/www/netadv/Xinformati.html

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 4: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Introduction

To introduce error correction coding we have to first convincethe audience

Why digital?

The answer is in Shannon’s Information Theory

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 5: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Using speakers, cameras etc. sound and light are convertedinto electrical signals.

The essential point that one should know is that electricalsignals are functions of time x(t).

The aim of communication engineering is to get this signalA) From here to there (communication)B) From now to later (data storage)

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 6: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

There are two choices1) Analog (Continuous)2) Digital (Discrete)

Digital wins for reasons partly mathematical and partlytechnological

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 7: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Mathematical

It is well known that numbers, text, images, audio and videocan be transformed into a sequence of 0’s and 1’s

This is a consequence of the sampling theorem whichconnects analog and digital signals

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 8: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Sampling theorem

In the field of digital signal processing, the sampling theoremis a fundamental bridge between continuous signals (analogdomain) and discrete signals (digital domain).

Let x(t) whose Fourier transform is X (jω) represent a band -limited signal, so that X (jω) = 0 for |ω| > ωm. If ωs > 2ωm,where ωs = 2π

Tsis the sampling frequency, then x(t) is uniquely

determined by its samples x(nTs), n = 0,±1,±2, · · · .Reconstruction Theorem

x(t) =n=∞∑n=−∞

x(nTs)sinc(ωs(t − nTs)

2π)

where sinc(u) = sinπuπu

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 9: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Sampling Theorem - Contd...

As the samples x(nTs) are numbers known to a certain degreeof accuracy (may be 5 decimal places), these can be writtenin binary form

These numbers x(nTs) are transmitted across and x(t) can bereconstructed using the formula

Hence whether it is text, pictures, etc., we finally deal withstrings of 1’s and 0’s.

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 10: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

All this mathematics is hidden from public view because all weneed are what are called Analog - to - Digital converters andDigital - to - Analog converters

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 11: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Technological

Making devices is easier because digital essentially deals withbits 1’s and 0’s which are high or low

Analog requires great accuracy

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 12: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Digital also helps in data security (Encryption),

Data compression etc.

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 13: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

In this talk...

One of the important problems of communications is thereliable transmission through a noisy channelThis is achieved by the techniques of encoding and decodingThe Channel model

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 14: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Binary Symmetric Channel

0

1

0

1

1− ε

1− εε

ε

From this the probability of sending a string of 1’s and 0’swithout error can be easily constructed

We want to make the probability of error as low as possibleand also have a good rate of transmission

This involves a trade-off

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 15: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Origin of error correcting codes

Communication is imperfect

Even if the message is accurately stated, it may be garbledduring transmission

Consequences of a mistake in the interpretation offinancial/diplomatic/military information may be serious.

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 16: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

When a message travels from an information source to adestination both the sender and the receiver would want anassurance that the received message either is free of errors

or

if it contains errors, these errors should be detectable

Ideally when an error is detected the receiver would like to beable to correct it and recover the original message

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 17: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

How do we transmit strings of 0’s and 1’s of length n?

These strings are called binary n-blocks.

In this talk, a message is a sequence of binary n-blocks.

A message of six 3-blocks is

001 101 110 110 010 111

When there is no error in transmission, all such n-blocks maybe used to form messages without risk of misinterpretation.

But if errors can occur, the block received may differ from theone sent

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 18: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

One way to compensate this is to send only blocks that differfrom each other so much that one or two errors cannotchange one of the selected blocks into another.

This restriction requires the use of longer blocks in order tohave the same variety of messages possible with the 2n

n-blocks.

One disadvantage is that this will reduce the amount ofinformation sent per unit time.

However, the gain is in reliability of data

There is a trade-off between the rate of transmission andreliability

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 19: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Simplest code

A set of selected n-blocks called codewords will make up a(binary) code

The simplest code has just two codewords, 0 and 1

No errors in transmission can be detected as any errorchanges one codeword to another codeword

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 20: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Repetition code

Let us replace the code 0, 1 by 00, 11

We are repeating the digits of the old codewords.

This will allow us to detect any single error

For example, if 00 is sent and if the block 01 is received, thenwe know that an error has occurred

But two errors will go undetected as the received word is alsoa codeword

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 21: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Repetition code - Contd.

By repeating each of the binary symbols n − 1 times we formthe repetition code.

This code consists of two codewords of length n, the all-zeroword (00 · · · 0) and all-one word (11 · · · 1)

Up to n − 1 errors in transmission are detectable

The first digit of each word is the message digit while thefollowing n − 1 are the check digits

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 22: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Repetition code - Contd.

These repetition codes allow the sending of only two differentcodewords

We can use a block repetition code which is copies of a blockof bits

We can have s-copies of r binary blocks

n = rs

There are 2r words of length n = rs in this code

For example, let us take r = 4 and s = 2.

The 16 words of length 8 are those whose first 4 bits coincidewith their last 4 bits

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 23: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

In this case also all single errors are detectable.

For example, an error in the 6th digit of the codeword11001100 yields

11001000 which is not a codeword.

But two errors are not always detectable

For example

let us consider 11001100→ 11101110

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 24: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

(n, r) Code

An (n, r) binary block code is a binary block code of length nhaving r message digits.

We call this an (n, r) code

In repetition code the first r message digits occupy the first rpositions of a codeword

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 25: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Rate of Information

For an (n, r) code, the rate of information is rn

This rate gives you how much of information (in bits) iscarried on the average per symbol sent.

For example, for the (n, 1) repetition code, the rate is 1n

For the (rs, r) block repetition code, the rate is 1s

Increase in check digits will lower the rate of information

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 26: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

What is the goal of coding theory?

To send messages quickly and accurately

Accuracy over a noisier channel means more error detectionwhich means more check digits per codeword and thus longercodewords

This slows the flow of information

The repetition code is slow but reliable

Is there any other way?

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 27: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Parity Check

A block of n-bits has even parity if the number of 1’s is even

For example, 101011 is a 6-bit block having even parity

101010 is a 6- bit block having odd parity

The summing of the digits is called the parity check

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 28: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Error detection using parity check -(5, 4) code

Let us take all the 16 blocks of 4 bits.

We create a 5-block from each of the 4-block by appending a1 or 0 which will make the 5-block to have even parity

This process is called encoding

0000 00000 0100 01001 1000 10001 1100 110000001 00011 0101 01010 1001 10010 1101 110110010 00101 0110 01100 1010 10100 1110 111010011 00110 0111 01111 1011 10111 1111 11110

If there is a single error in the transmission of an encodedmessage, then the 5-block will have odd parity.

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 29: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

(5, 4) code - Contd.

For example 10001→ 10000 will indicate an error as thereceived word has odd parity

(5, 4) code detects single error

Rate is 45 = 0.8

Remember that the rate for the (8, 4) block repetition code is0.5

Any single error - detecting code must have at least one checkdigit

For the 4-block code, (5, 4) code has the highest rate possibleamong single error - detecting codes

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 30: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

In 1940’s....

The history of coding theory dates back to middle of 20th

century

Bell Telephone Laboratories used single parity check code intwo of its relay computers

It is similar to (5, 4) code

The 10 decimal digits were represented using 5 - block withexactly two 1’s

Each decimal digit was stored on a group of five relays byhaving exactly two of them switched on in the proper locations

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 31: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

2 Out of 5 Code

Decimal Codeword Decimal CodewordDigit Digit

1 11000 6 001102 10100 7 100013 01100 8 010014 10010 9 001015 01010 0 00011

Any single relay malfunction was immediately detectable

In this case either exactly one or exactly three relays will be on

In case of parity check failure, the checking circuitsautomatically and immediately halted the machine

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 32: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

3 Out of 5 Code

A later model relay computer used a three out of 5 code

This code also has 10 codewords

Mathematically, it is obtained by interchanging 0’s and 1’s inthe 2 out of 5 code

Decimal Codeword Decimal CodewordDigit Digit

1 00111 6 110012 01011 7 011103 10011 8 101104 01101 9 110105 10101 0 11100

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 33: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Bell Labs used this code in their relay computing machines

In case of parity check failure, the checking circuitsautomatically and immediately halted the machine

When such a parity check failed, two results were possible

If it is daytime, a check failure stopped failure and sounded analarm

In this case the check failure was located by operatingpersonnel, whose efforts were facilitated by an elaborate checklight panel

If it is night-time or weekend, a check failure switched themachine immediately to other work

In this case the problem simply had to be rerun

This inefficiency led Richard Hamming to investigate thepossibility of automatic error-correction

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 34: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Richard Hamming (1915 - 1998)

Hamming was a pure mathematician

He first worked in atomic bomb project in Los Alamos

In 1946 he left Los Alamos to join Bell Laboratories

He had interest in large scale computing machines

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 35: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Hamming did not have priority use of the Model V

He had only weekend access and that only when anotherdepartment was not using it

The weekend mode is the unattended mode and hence anyerrors caused the machine to go on to the next problem

This annoyed Hamming and led him to invent the first errorcorrecting code

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 36: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

In Hamming’s own words...

Two weeks in a row I came in and found that all my stuffhad been dumped and nothing was done. I was reallyaroused and annoyed because I wanted those answers andtwo weekends had been lost. And so I said,’Damn it, if the machine can detect an error, why can’t itlocate the position of the error and correct it?’

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 37: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

The first error correcting code

Very first solution appeared in the Memorandum dated July27, 1947

Later published a year later in a slightly modified form

It was based on the idea of parity checks

Here the code consists of codewords of length n = (t + 1)2,with r = t2 message digits and 2t + 1 check digits

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 38: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Encoding of ((t + 1)2, t2) Code

Place the t2 message digits in a square array

Adjoin the 2t + 1 check digits on two adjacent sides includingthe corner so that each row and column in the final squarearray has an even number of 1’s

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 39: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Example: (9, 4) Code

Take t = 2r = 22 = 4To encode the 4-block, say 1101

1101→1 10 1

1101→1 10 1 →

1 1 00 1

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 40: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Example: (9, 4) Code

Take t = 2r = 22 = 4To encode the 4-block, say 1101

1101→1 10 1

1101→1 10 1 →

1 1 00 1 1

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 41: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Example: (9, 4) Code

Take t = 2r = 22 = 4To encode the 4-block, say 1101

1101→1 10 1

1101→1 10 1 →

1 1 00 1 1

1

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 42: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Example: (9, 4) Code

Take t = 2r = 22 = 4To encode the 4-block, say 1101

1101→1 10 1

1101→1 10 1 →

1 1 00 1 1

1 0

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 43: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Example: (9, 4) Code

Take t = 2r = 22 = 4To encode the 4-block, say 1101

1101→1 10 1

1101→1 10 1 →

1 1 00 1 1

1 0 1

The resulting codeword is 110011101

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 44: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Decoding (9, 4) Code

Note that the 4 message digits are in positions 1, 2, 4 and 5

To decode, place the received codeword in the 3× 3 array andperform the row and column parity checks.

For t, we should place the codeword in the (t + 1)× (t + 1)array

This code can locate a single error in transmission

The parity checks of the row and column containing thatposition will fail.

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 45: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Example

Suppose 110011101 is received as 010011101

Place the word on a 3× 3 array as follows

0 1 00 1 1

1 0 1

Perform the parity check

Parity checks for the first row and the first column fail

The error has occurred at the first position

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 46: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Rate of ((t + 1)2, t2) Code

Information rate of this code is t2

(t+1)2

For t = 2, rate =49 = 0.44

Can we improve this code?

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 47: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

1948 Memorandum

Hamming noted that the corner check symbol could bedeleted without losing the error correction capability.An error in the message digit will cause two parity checks tofailAn error in the check digit causes only one parity check to failFor example, if 11001110→ 01001110, the checking array forthe received codeword is

0 1 00 1 1

1 0

Note that the first row and the first column parity checks failThe error therefore has occurred in the intersection of the firstrow and first column digit

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 48: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

If 11001110→ 11101110, the checking array is

1 1 10 1 1

1 0

Note that only the first row parity check fails.

The error is in the right hand 1 in the top row.

The rate of this code is 48 = 0.5

Note that this is better than the (8, 4) block repetition code

(8, 4) repetition code can detect a single error, whereas theabove (8, 4) code can also correct the single error.

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 49: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Can you find a code with better rate?

Hamming wanted an efficient code

That is a code with r message digits and as few check digitsas possible and yet could still correct single errors

He wanted each check digit to be a 0 or 1 so that it and themessage digits in certain positions would have even parity asunit, sort of partial parity checks

The sequence of 0’s and 1’s thus calculated when writtenfrom right to left, called the checking number or syndromewould give the position in binary of any single error

Here the all - zero word means there is no error

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 50: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Let us assume that k = n − r is the number of check digitsThese k digits should be able to describe ther + k + 1 = n + 1 possibilitiesAn error could occur in any one of the n positions or thecodeword has been transmitted without any errorNow note that the k check bits in binary will represent all the2k integers from 0 to 2k − 1Thus, 2k ≥ n + 1Now multiplying both sides by 2r we get

2k+r = 2n ≥ 2r (n + 1)

Dividing both sides by n + 1 will give the fundamentalinequality

2n

n + 1≥ 2r

This gives the minimum n for the given r

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 51: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Hamming’s construction

There was a conceptual leap in his construction

The key idea can be summarized in the phrase “interleavedpartial parity check equations”

At the encoding end, the check digits are determined usingthe partial parity check equations

At the decoding end, the same partial parity checks arecarried out to get the check digits.

These check digits when written from right to left give thebinary representation of the location of the error

If all check digits are 0, then there is no error

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 52: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Hamming’s construction - Encoding

Hamming places the k check digits in positionsx20 , x21 , · · · x2k−1

He places the r = n − k message digits at the remainingpositions

The k check digits are calculated as follows

x1 = x20 is determined by the partial parity check equation

x1 + x3 + x5 + x7 + · · · = 0

Notice that all these bits have their position numbers1, 3, 5, 7 · · ·When these are written in their binary representation theyhave the least significant bit equal to 1

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 53: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

1 13 115 1017 1119 1001

11 1011

and so on

Hence if the single error has occurred in any one of the oddpositions, then at the decoding end, the partial parity checkequation will give

x1 + x3 + x5 + x7 + · · · = 1

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 54: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Next, x2 is determined (at the encoding end) by the equation

x2 + x3 + x6 + x7 + · · · = 0

The binary representations

2 103 116 1107 111

10 101011 1011

and so on have 1 as their second bit from the right and 2 isthe smallest of these numbers.

Hence if the single error has occurred in a position whosesecond bit is 1, then at the decoding end, we would get

x2 + x3 + x6 + x7 + · · · = 1

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 55: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Similarly x22 , . . . x2k−1 are determined by the correspondingpartial parity check equations

Notice that 1, 2, 4, 8, · · · , 2k−1 (1, 10, 100, 1000, · · · 100 · · · 0)are the smallest numbers having 1 in the first, second, third,fourth, · · · kth positions in their binary representations andhence the check bits are independent of one another

Thus the position number of the error bit is determined bit bybit from right to left

Once the position of the error bit is found, the bit can becorrected as a bit can take only two values: 0 or 1

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 56: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Example: (7, 4) code

Let us take r = 4.

Let us find the smallest n satisfying the inequality2n

n+1 ≥ 24 = 16

n 2n

n+1 2r

5 25

5+1 = 5.333 16

6 26

6+1 = 9.143 16

7 27

7+1 = 16 16

n = 7 is the smallest number satisfying the fundamentalinequality

So, n = 7, r = 4 and k = 3.

The 3 check bits are in positions 1, 2 and 4

The four message bits are placed in the remaining positions3, 5, 6 and 7

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 57: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Let the encoded message be x1x2x3x4x5x6x7

The digit x1 is determined by the partial parity check equation

x1 + x3 + x5 + x7 = 0

Next we determine the bit x2 from the equation

x2 + x3 + x6 + x7 = 0

Finally, x4 is determined by the equation

x4 + x5 + x6 + x7 = 0

At the decoding end you perform the same partial paritychecks

If all three bits are zero, then there is no error

Otherwise the three bits will give the location of the error bit

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 58: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Example

Let us take the 4-block 1010

We have x3 = 1, x5 = 0, x6 = 1, x7 = 0

x1 + x3 + x5 + x7 = 0 gives x1 = 1

x2 + x3 + x6 + x7 = 0 gives x2 = 0

x4 + x5 + x6 + x7 = 0 gives x4 = 1

Thus, 1010 is encoded as 1011010

Suppose at the decoding end, the message is received as1001010

The parity check equations give 1, 1 and 0

The error has occurred in the position 011 = 3

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 59: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Table for n, r and k

n r k = n − r(total) (message) (checks)

1 0 12 0 23 1 24 1 35 2 36 3 37 4 38 4 4

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 60: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Table for n, r and k

n r k = n − r(total) (message) (checks)

9 5 410 6 411 7 412 8 413 9 414 10 415 11 416 11 5

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 61: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Algebraic Structure of Hamming code

Consider the three equations

x4 + x5 + x6 + x7 = 0

x2 + x3 + x6 + x7 = 0

x1 + x3 + x5 + x7 = 0

This can be written as the matrix equation

HXT =

0 0 0 1 1 1 10 1 1 0 0 1 11 0 1 0 1 0 1

x1x2x3x4x5x6x7

=

000

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 62: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

H is the binary matrix whose columns are the binary numbersfrom 1 to 7

H determines a linear transformation from [GF (2)]7 to[GF (2)]3

If X is a codeword, then HXT = 0

In the language of Linear Algebra this means that thecodeword X belongs to the kernel of the linear transformationdefined by the matrix H and hence is a subspace of [GF (2)]7

In other words, X belongs to the null space of the matrix H

Since rank(H)=3, dim (Null space of H)=7-3=4

Hence the (7, 4) Hamming code is 4 dimensional subspace of[GF (2)]7

Thus there are 24 = 16 codewords in [GF (2)]7

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 63: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

If the received word X is not a codeword, then by theconstruction HXT gives the error position in binary, if there isa single error

The matrix H is called the parity check matrix

HXT is called the syndrome of X

If there is no more than single error then the syndrome = 0means that there is no error and the received word is acodeword

Otherwise the syndrome indicates the exact location of theerror in the received word

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 64: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Group Code, Linear Code

The sum of any two codewords is another codeword

Thus the codewords form a group

Hence the older name group codes

Recent books employ the fact that the codewords form alinear space (vector space)

Hence the new name linear codes

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 65: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Hamming’s construction was based on the idea that paritycheck equations would write out the binary stringcorresponding to the error location

Historically things developed in a different way

The fact that the codewords form a group led to the fact thatoccurrences of error would cause the codeword to become themember of the coset

Hence the subject transformed into more mathematical formfar removed from its engineering roots: Algebraic codingtheory

This is the starting point of most books, not Hamming’soriginal construction

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 66: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Geometric Model

Hamming introduced geometric point of view to study errorcorrection codes

Consider the unit cube in an n- dimensional space consistingof 2n n-tuples of 0’s and 1’s

A binary code with words of length n is a certain subset of thevertices of this cube

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 67: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

(3, 2) Code

The four darkened vertices are the codewords of length 3 formedby adding a parity check bit to each pair of binary digits00 → 000, 01 → 011, 10 → 101 and 11 → 110

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 68: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Here you see the three possible 3-blocks formed by a single error inthe transmission of the codeword 101

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 69: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Hamming Distance

The figure also shows why two errors in a codeword are notdetectable

A second error sends the result of the first error to anothercodeword

One error in a codeword changes one coordinate and twoerrors change two coordinates

For any integer e, e errors change e coordinates

This observation motivated Hamming to define the distance D

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 70: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Hamming Distance

The distance D between any two n- blocks of binary digits isthe number of coordinates in which the corresponding verticesdiffer

For example, D(101, 011) = 2 and D(101, 010) = 3

Geometrically, this is the number of edges in a shortest pathbetween the two vertices

This distance is called the Hamming distance

Hamming distance satisfies all the axioms of a metric1. D(x , y) ≥ 0 and D(x , y) = 0 iff x = y2. D(x , y) = D(y , x)3. D(x , z) ≤ D(x , y) + D(y , z) for any y

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 71: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Minimum Distance of a Code

The minimum distance of a code is the minimum of all thedistances between two nonidentical codewords of the code

For the (3, 2) single parity check code whose codewords are{000, 011, 101, 110}, the minimum distance is 2

Single error detection is possible with a code whose minimumdistance is 2

Single error correction is possible with a code with minimumdistance at least 3

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 72: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Hamming distance of (3, 1) Repetition code

This figure shows the words that can be received if exactly oneerror is made in the transmission of the codeword 000. Each ofthese errors is still at a distance of 2 from (111)

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 73: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

If a maximum of single error occurs in the transmission of acodeword

then the error can be found and corrected

If two errors occur in the transmission, then the error can bedetected but cannot be corrected

For example if 000 is received as 110 with two errors

then the receiver cannot decide whether the codeword sent is111 or 000

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 74: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

(4, 1)RepetitionCode

The two codewords are 0000 and 1111

This code can correct any single error

Two errors can be detected but cannot be corrected as thereceived word will be at a distance of 2 from both thecodewords

In general, a code with minimum distance d will detect up to[d2 ] errors and simultaneously correct up to [d−12 ] errors.

Some of the correction capability can be sacrificed foradditional detection capability.

For example, a code with minimum distance d can detect upto d − 1 errors by scrapping all correction

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 75: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Perfect Codes

This geometrical model of Hamming suggests the notion of aperfect code

For non-negative integer l , Hamming defined a sphere ofradius l with a vertex of the unit cube En as

the set of all vertices of the cube at a Hamming distance lfrom the given vertex

This means that the sphere will contain(n0)

+(n

1)

+(n

2)

+ · · ·+(n

l)

vertices of the cube

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 76: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

1 - Spheres of the (3, 1) repetition code

The two 1- spheres centered at the two codewords (000) and (111)exhaust all the vertices of unit cube

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 77: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

A code of length n is called perfect if there is a nonnegativeinteger l such that1. The l− spheres centered on the codeword vertices arepairwise disjoint2. Each vertex of the n-cube is contained in some l-sphere

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 78: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Hamming’s (7, 4) code

Now let us go back to Hamming’s (7, 4) code

The minimum distance of this code is three

Hence the 1-spheres centered on the codewords are disjoint

Now the Hamming 1 sphere of any codeword must contain(70

)+

(71

)= 8 vertices

There are 16 codewords

Hence the 16 Hamming 1-spheres with center at each of the16 codewords must contain a total of 16× 8 = 128 = 27

vertices which is all the vertices of the unit 7-cube

Hence this code is perfect

More generally, (n, r) = (2k − 1, 2k − 1− k) Hamming codesare perfect

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 79: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

One cannot escape the feeling that these mathematicalformulae have an independent existence and anintelligence of their own, that they are wiser than we are,wiser even than their discoverers, that we get more out ofthem than we originally put in to them.

-Heinrich Hertz (1857-1894) German physicist

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 80: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Directions in Pure Mathematics

Algebraic coding

Sphere packing

Simple groups

A good starting point for these topics isT. M. Thompson, From error correcting codes through spherepackings to simple groups, Carus Monograph No. 21, Math.Assoc. Amer., Washington, D.C., 1983.

Quantum error correcting codes

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 81: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Directions in Engineering

Algebraic codes

Convolutional codes

Turbo codes

Space - Time codes

A good starting point for these topics isTodd K Moon, Error correction coding- Mathematicalmethods and algorithms, Wiley - India Edition

Quantum error correcting codes

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 82: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Representation of Hamming codes

Block codes

Cyclic codes

Trellises

Tanner graphs

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 83: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

There is nothing so practical as a good theory—Kurt Lewin

There are two ways to do great mathematics. The first isto be smarter than everybody else. The second way is tobe stupider than everybody else - but persistent.—Raoul Bott

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory

Page 84: How were the first error correcting codes constructed? A historical introduction to coding theory through Hamming's work

Thank You

Gadiyar & Padma VIT

A Historical Introduction to Coding Theory