PE 2S (7 oda
= 291 — (1 = py)
Since [1 — (1 — p)"] <1, it is clear that P(E) < 2-0-8.
The result above says that there exist (n, k) linear codes with probability of an
undetected error, P,(E), upper bounded by 2°". In other words, there exist (n, k)
linear codes with P,(E) decreasing exponentially with the number of parity-check digits,
n—k. Even for moderate n — k, these codes have a very small probability of an
undetected error. For example, let 1 — k = 30. There exist (n, k) linear codes for
which P,(E) is upper bounded by 2">° ~ 10-®, Many classes of linear codes have been
constructed for the past three decades. However, only a few small classes of linear
codes have been proved to have P,(£) satisfying the upper bound 2-"*-". It is still
not known whether the other known linear codes satisfy this upper bound. A class of
linear codes that satisfies this upper bound is presented in the next section. Other
codes with probability of an undetected error decreasing exponentially with n — k
are presented in subsequent chapters.
(3.42)
3.7 HAMMING CODES
Hamming codes are the first class of linear codes devised for error correction [6].
These codes and their variations have been widely used for error control in digital
communication and data storage systems.
For any positive integer m > 3, there exists a Hamming code with the following
parameters:
Code length: a=2-1
Number of information symbols: k = 2" —m —1
Number of parity-check symbols: — k =m
Error-correcting capability 1 = dain = 3).
The parity-check matrix H of this code consists of all the nonzero m-tuples as its
columns, In systematic form, the columns of H are arranged in the following form:
H=[, Qh
where I,, is an m x m identity matrix and the submatrix Q consists of 2"—m—1
columns which are the m-tuples of weight 2 or more. For example, let m = 3. The
parity-check matrix of a Hamming code of length 7 can be put in the form
1oo1r01 7
H=|0 10111 0}
joo1o1id
which is the parity-check matrix of the (7,4) linear code given in Table 3.1 (see
Example 3.3). Hence, the code given in Table 3.1 is a Hamming code. The columns of
Q may be arranged in any order witaout affecting the distance property and weight
Sec. 3.7 Hamming Codes 79distribution of the code. In systematic form, the generator matrix of the code is,
GHIM Leenks
where QF is the transpose of Q and Inq; is an (2"
identity matrix.
Since the columns of H are nonzero and distinct, no two columns add to zero.
It follows from Corollary 3.2.1 that the minimum distance of a Hamming code is at
least 3. Since H consists of all the nonzero m-tuples as its columns, the vector sum of
any two columns, say h, and h,, must also be a column in H, say hy, Thus,
hy +h, +h, =0.
It follows from Corollary 3.2.2 that the minimum distance of a Hamming code is
exactly 3. Hence, the code is capable of correcting all the error patterns with a single
error or of detecting all the error patterns of two or fewer errors.
If we form the standard array for the Hamming code of length 2" — 1, all the
(2" — I}tuples of weight 1 can be used as coset leaders (Theorem 3.5). The number
of (2" — 1)-tuples of weight 1 is 2" — 1. Since n — k = m, the code has 2" cosets.
Thus, the zero vector 0 and the (2" — 1)-tuples of weight 1 form all the coset leaders
of the standard array. This says that a Hamming code corrects only the error patterns
of single error and no others. This is a very interesting structure. A t-error-correcting
code is called a perfect code if its standard array has all the error patterns of ¢ or fewer
errors and no others as coset leaders. Thus, Hamming codes form a class of single-
error-correcting perfect codes. Perfect codes are rare [3]. Besides the Hamming codes,
the only other nontrivial binary perfect code is the (23, 12) Golay code (see Section
5.3).
m—1) x Qm—
-1
Decoding of Hamming codes can be accomplished easily with the table-lookup
scheme described in Section 3.5. The decoder for a Hamming code of length 2” ~ 1
can be implemented in the same manner as that for the (7,4) Hamming code given in
Example 3.9.
We may delete any / columns from the parity-check matrix Hof a Hamming
code. This deletion results in an m x (2" ~ J — 1) matrix H’, Using H’ as a parity-
check matrix, we obtain a shortened Hamming code with the following parameters:
Code length: n=2"~[-1
Number of information symbols: k = 2" —m—I—1
‘Number of parity-check symbols: — k= m
Minimum distance: dain > 3.
If we delete columns from H properly, we may obtain a shortened Hamming code
with minimum distance 4. For example, if we delete from the submatrix Q all the
columns of even weight, we obtain an m x 2"-! matrix
H=[L, Q)
where Q’ consists of 2"-! ~ m columns of odd weight. Since all the columns of H’
have odd weight, no three columns add to zero. However, for a column h, of weight
3 in Q’, there exists three columns h,, hy, and h, in I,, such that by -+ h, + b, 0.
80 Linear Block Codes Chap. 3‘Thus, the shortened Hamming code with H’ as a parity-check matrix has minimum
distance exactly 4.
‘The distance 4 shortened Hamming code can be used for correcting all error
patterns of single error and simultaneously detecting all error patterns of double
errors. When a single error occurs during the transmission of a code vector, the
resultant syndrome is nonzero and it contains an odd number of I’s. However, when
double errors occur, the syndrome is also nonzero, but it contains even number of
1’s, Based on these facts, decoding can be accomplished in the following manner
1. If the syndrome s is zero, we assume that no error occurred.
2. If'sis nonzero and it contains odd number of 1's, we assume that a single error
occurred. The error pattern of a single error that corresponds to s is added to
the received vector for error correction.
3, If'sis nonzero and it contains even number of I’s, an uncorrectable error pattern
has been detected.
A class of single-error-correcting and double-error-detecting shortened Ham-
ming codes which is widely used for error control in computer main/or control storages
is presented in Chapter 16.
The weight distribution of a Hamming code of length n = 2" — 1 is known
[1-4], The number of code vectors of weight i, 4,, is simply the coefficient of 2‘ in the
expansion of the following polynomial:
A@) wart +29 tal — 2 — 2}, (3.43)
‘This polynomial is the weight enumerator for the Hamming codes.
Example 3.11
Let m = 3. Then n = 2° — 1 = 7 and the weight enumerator for the (7, 4) Hamming
code is
Az) = HC + 2)? + 11 = 2) — 22)9} = A + 729 + Tz8 + 27
Hence, the weight distribution for the (7, 4) Hamming code is 4g = 1, 4s = Aa
and Ay
The dual code of a (2" — 1,2" — m — 1) Hamming code is a (2" — 1, m) linear code.
This code has a very simple weight distribution; it consists of the all-zero code word
and 2" — 1 code words of weight 2"-'. Thus, weight enumerator is
BQ) = 1+ @"— De. G44)
‘The duals of Hamming codes are discussed further in Chapter a
Ifa Hamming code is used for error detection over a BSC, its probability of an
‘undetected error, P,(E), can be computed either from (3.35) and (3.43) or from (3.36)
and (3.44). Computing P,(E) from (3.36) and (3.44) is easier, Combining (3.36) and
(3.44), we obtain
PAE) = 2" + 2" — YU = 2p} — A — PP
3.45)
Sec. 3.7 Hamming Codes at