0% found this document useful (0 votes)
74 views

Lecture 8 Hamming Code

Hamming codes are single error correcting codes discovered by R.W. Hamming in 1950. A (7,4) Hamming code is constructed with 7 bits, 4 information bits, and 3 check bits. It can detect up to 2 errors and correct 1 error. The code works by calculating syndromes from the received codeword and comparing it to error patterns to determine the location of the error and recover the original information bits. Hamming codes demonstrate the relationship between syndromes and error patterns that is key to the design of error correcting codes.

Uploaded by

n4vrxcry
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views

Lecture 8 Hamming Code

Hamming codes are single error correcting codes discovered by R.W. Hamming in 1950. A (7,4) Hamming code is constructed with 7 bits, 4 information bits, and 3 check bits. It can detect up to 2 errors and correct 1 error. The code works by calculating syndromes from the received codeword and comparing it to error patterns to determine the location of the error and recover the original information bits. Hamming codes demonstrate the relationship between syndromes and error patterns that is key to the design of error correcting codes.

Uploaded by

n4vrxcry
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Coding Theory

Hamming Code

R.W Hamming found an optimum class of single error correcting codes in 1950. The
code was used for long distance telephony. For some integers c≥3 , the family of
binary Hamming codes has the following parameters:

Block length : n=2c−1

Message bits : k =2c−c−1

Number of check bits : c=n−k

Minimum Hamming
distance : d min =3

Error correction
capability : t=1

Consider a systematic Hamming code with c=3 , so,


3
n=2 −1=7
3
k =2 −3−1=4

This is a ( 7,4 ) code. The check bits are determined from the set of equations:

c 1=m1 ⊕ m2 ⊕ m3

c 2 =m 2 ⊕m3 ⊕ m 4

c 3 =m 1 ⊕m2 ⊕ m 4

Since this is a systematic linear block code, then the generator matrix is:

[ ]
1 0 1 1 0 0 0
1 1 1 0 1 0 0
G=
1 1 0 0 0 1 0
0 1 1 0 0 0 1

Lecture 8 : Hamming Code 1 EC401 Communication Systems


Coding Theory

Codewords for the ( 7,4 ) Hamming code.

Message bits Codeword

0000 0000000

0001 0110001

0010 1100010

0011 1010011

0100 1110100

0101 1000101

0110 0010110

0111 0100111

1000 1011000

1001 1101001

1010 0111010

1011 0001011

1100 0101100

1101 0011101

1110 1001110

1111 1111111

d min =3 , confirming that this is a Hamming code.


t=
d min −1
2 ⌋
Hamming code can be used for single error correction or double error detection.

Lecture 8 : Hamming Code 2 EC401 Communication Systems


Coding Theory

We now demonstrate how Hamming code can correct the single error.

Let the message bits be 1100 and the corresponding transmitted codeword is 0101100.
If the received codeword r=0101000 , show how the message bits can be recovered.

The generator matrix has a size of ( k×n ) ,

[ ]
1 0 1 1 0 0 0
1 1 1 0 1 0 0
G=
1 1 0 0 0 1 0
0 1 1 0 0 0 1

The parity check matrix is has a size of ( n−k )×n

[ ]
1 0 0 1 1 1 0
H= 0 1 0 0 1 1 1
0 0 1 1 1 0 1

Then,

[]
1 0 0
0 1 0
0 0 1
T
H =1 0 1
1 1 1
1 1 0
0 1 1

Lecture 8 : Hamming Code 3 EC401 Communication Systems


Coding Theory

From the syndrome decoding, we have


T T
S=rH =eH

Error pattern Syndrome

1000000 100

0100000 010

0010000 001

0001000 101

0000100 111

0000010 110

0000001 011

Given that r=0101000


T
s=rH =010 ⊕ 101=111

From the table above, we have

e=0000100

T =r +e=0101100

The message bit is 1100. So, even though there is a single error in the codeword, the
decoder has successfully decoded the message bits.

Lecture 8 : Hamming Code 4 EC401 Communication Systems


Coding Theory

The relationship between syndromes and error patterns also sheds some light on the
c
design of error-correcting codes, since each of the 2 −1 nonzero syndromes must

represent a specific error pattern. Now there are


(n1 )=n single error patterns for an n-

()
n
bit word, 2 double error patterns, and so forth.

The zero syndrome indicates that r is a codeword and is presumably correct with
syndrome decoding. An ( n,k ) linear block code can correct up to t errors per
codeword if n and k satisfy the following bound:
t
2 n−k
≥∑
i=0
(ni )
For t=1

23 ≥ (70 )+( 71)


3
2 =1+ 7=8

A block code for which the equality holds for the above equation is known as the
perfect code. Single error correcting perfect codes are called Hamming codes.

Hamming code is also a type of cyclic code.

Lecture 8 : Hamming Code 5 EC401 Communication Systems

You might also like