Lecture 8 Hamming Code
Lecture 8 Hamming Code
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:
Minimum Hamming
distance : d min =3
Error correction
capability : t=1
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
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
⌊
t=
d min −1
2 ⌋
Hamming code can be used for single error correction or double error detection.
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.
[ ]
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
[ ]
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
1000000 100
0100000 010
0010000 001
0001000 101
0000100 111
0000010 110
0000001 011
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.
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
()
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
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.