1 Introduction To Linear Block Codes
1 Introduction To Linear Block Codes
mG = m0 g0 + m1 g1 + + mk1 gk1 .
We observe that the all-zero sequence must be a codeword. Therefore, the minimum
distance of the code C is the codeword of smallest weight.
Comment on circuits to implement encoding.
ECE 7670: Lecture 2 Linear block codes 2
cH T = 0.
That is, a codeword is orthogonal to each row of H. From this we observe that
GH T = 0.
There is also associated with each code a dual code that has H as its generator
matrix. The dual code is denoted as C . If G is the generator for an (n, k) code,
then H is the generator for an (n, n k) code.
Example 1 A (7, 4) Hamming code can be generated by
1 0 0 0 0 1 1
0 1 0 0 1 0 1
G= 0 0 1 0 1 1 0 .
0 0 0 1 1 1 1
The 16 codewords are
0 0 0 0 0 0 0
0 0 0 1 1 1 1
0 0 1 0 1 1 0
0 0 1 1 0 0 1
0 1 0 0 1 0 1
0 1 0 1 0 1 0
0 1 1 0 0 1 1
0 1 1 1 1 0 0
1 0 0 0 0 1 1
1 0 0 1 1 0 0
1 0 1 0 1 0 1
1 0 1 1 0 1 0
1 1 0 0 1 1 0
1 1 0 1 0 0 1
1 1 1 0 0 0 0
1 1 1 1 1 1 1
The parity check matrix is
0 1 1 1 1 0 0
H = 1 0 1 1 0 1 0
1 1 0 1 0 0 1
When regarded as a generator of an (7, 3) code, the codewords of this code, the
dual code has the codewords
0 0 0 0 0 0 0
1 1 0 1 0 0 1
1 0 1 1 0 1 0
0 1 1 0 0 1 1
0 1 1 1 1 0 0
1 0 1 0 1 0 1
1 1 0 0 1 1 0
0 0 0 1 1 1 1
ECE 7670: Lecture 2 Linear block codes 3
When we want to do the encoding, it is often convenient to have the original data
explicitly evident in the codeword. Coding of this sort is called systematic encoding.
For the codes that we are to talk about, it will always be possible to determine a
generator matrix in such a way the encoding is systematic: simply perform row
reductions and column reordering on G until an identity matrix is revealed. We can
thus write G as
G = [P |Ik ]
H = [Ink | P T ].
Note: in GF (2) (binary operations) the negative of a number is simply the number.
We could write (for binary codes)
H = [Ink P T ].
The parity check matrix (whether systematic or not) can be used to get some
useful information about the code.
Theorem 1 Let a linear block code C have a parity check matrix H. The minimum
distance of C is equal to the smallest positive number of columns of H which are
linearly dependent.
This concept should be distinguished from that of rank, which is the largest number
of columns of H which are linearly independent.
Proof Let the columns of H be designated as d0 , d1 , . . . , dn1 . Then since cH T =
0 for any codeword c, we have
0 = c0 d0 + c1 d1 + + cn1 dn1
Let c be the codeword of smallest weight, w = w(c) = dmin . Then the columns of
H corresponding to the elements of c are linearly dependent. 2
Based on this, we can determine a bound on the distance of a code:
This follows since H has n k linearly independent rows. (The row rank = the
column rank.) So any combination of n k + 1 columns of H must be linearly
dependent.
For a received vector r, the syndrome is
s = rH T .
s = (c + e)H T = eH T .
ECE 7670: Lecture 2 Linear block codes 4
Furthermore, if two error vectors e and e0 have the same syndrome, then the error
vectors must differ by a nonzero codeword. That is, if
eH T = e0 H T
then
(e e0 )H T = 0
P (c)P (r|c).
If we now assume that each codeword is chosen with equal probability, then maxi-
mizing P (c)P (r|c) is equivalent to maximizing
P (r|c).
Then
n
Y
P (r|c) = P (ri |ci ) = (1 p)#(pi =ci ) p#(pi 6=ci )
i=1
d(c,r)
p
= (1 p)n#(pi 6=ci ) p#(pi 6=ci ) = (1 p)n .
1p
Then if we want to maximize P (r|c), we should choose that c which is closest to
r, since 0 (p/(1 p)) 1. Thus, under our assumptions, the ML criterion is
the minimum distance criterion. In every case, we should choose the error vector of
lowest weight.
ECE 7670: Lecture 2 Linear block codes 5
r = c + e.
Assuming that error sequences with lower weight are more probable than error
sequences with higher weight (the maximum likelihood criterion), we want to de-
termine our decoded word c0 such that the error sequence e0 satisfying
r = c 0 + e0
1. There are 2k codewords (columns) and 2n possible vectors, so there are 2nk
rows in the standard array.
2. The sum of any two vectors in the same row of the standard array is a code
vector.
3. No two vectors in the same row of a standard array are identical. Because
otherwise we have
ei + ci = ei + cj , with i 6= j
el + c i = em + c j
em = el + c i c j = el + c k
for some k. This means that em is on the lth row of the array, which is a
contradiction.
Each row of the standard array is called a coset; we will encounter the term coset
in a more formal setting soon.
To decode with the standard array, we locate the received vector r in the stan-
dard array. Then the error sequence is the coset leader; the best guess of the
transmitted word is the codeword at the top of the column. For example, if
r = 0011011
then
c0 = 0011101.
Since we designed the standard array with the smallest error patterns as coset
leaders, this is the ML decision.
As observed before, there are 2nk coset leaders. These are called the correctable
error patterns. Fact: an (n, k) code is capable of correcting 2nk error patterns.
The standard array can be used to decode linear codes, but suffers from a major
problem: the memory requirements quickly become excessive. We want to look for
easier approaches.
A first step (which doesnt go far enough), is to use the syndrome in the decoding.
Based on the properties of the syndrome above, all elements in a row of the standard
array have the same syndrome. We therefore only need to store syndromes and their
associated error patterns.
For the code whose standard array was given before, we have
0 1 1 1 0 0 0
1 0 1 0 1 0 0
H= 1 1 0 0 0 1 0
1 1 1 0 0 0 1
ECE 7670: Lecture 2 Linear block codes 7
Steps to decoding
1. Compute the syndrome, s = rH T .
2. Look up the error pattern e using s.
3. Then c = r + e.
Example 2 We provide another example of the standard array, because it raises
some interesting issues. For the (5, 2) code with
1 0 1 1 1
G=
0 1 1 0 1
This code is capable of correcting all errors of one bit. In addition, there are
two other errors of two bits that can be corrected. Note that the minimum distance
of this code is 3. The parity check matrix is
1 1 1 0 0
H = 1 0 0 1 0 .
1 1 0 0 1
ECE 7670: Lecture 2 Linear block codes 8
4 Hamming codes
Hamming codes are the earliest and simples example of linear block codes. The
parameters are as follows, for m 2:
code length: n = 2m 1
Number of information symbols: k = 2m m 1
Number of parity symbols: nk =m
Error correcting capability: t=1
Examples are: (3, 1), (7, 4), (15, 11) and (31, 26) codes.
The parity check matrix of a Hamming code consists of all nonzero binary m-
tuples. The columns may be ordered to correspond to a systematic code. Syndrome
decoding of Hamming codes using the standard array is straightforward: the syn-
drome indicates which column of H corresponds to the error position.
A0 = 1 A1 = 0 A2 = 0 A3 = 7 A4 = 7 A7 = 1.
ECE 7670: Lecture 2 Linear block codes 9
2
If we want to use a code for error detection, we can determine the probability of an
undetected error using the weight distribution. The probability of an undetected
error is the probability that an error pattern is equal to a (nonzero) code vector.
Then
n
X
Pu (E) = Ai pi (1 p)ni ,
i=1
t = b(d 1)/2c
is called the random-error-correcting capability of the code. Based upon this number,
the probability of erroneous decoding is upper bounded by
n
X n i
P (E) p (1 p)ni
i=t+1
i
P (E) 21p2 (1 p)5 + 35p3 (1 p)4 + 35p4 (1 p)3 + 21p5 (1 p)2 + 7p6 (1 p) + p7 .
0 = 1 a1 = 7 2 = 7 3 = 1.
Then
A(z) = A0 + A1 z + + An z n .
ECE 7670: Lecture 2 Linear block codes 10
This polynomial is called the weight enumerator for C. (Think of the Z transform
of a finite series.) Let
B(z) = B0 + B1 z + + Bn z n .
From a decoding point of view, if a received vector r falls inside the Hamming sphere
of a codeword, then that codeword is selected.
The redundancy of a code is essentially the number of parity symbols in a
codeword. More precisely we have
r = n logq M
where M is the number of codewords. For the codewords we have seen to this point,
r = n k.
ECE 7670: Lecture 2 Linear block codes 11
r logq Vq (n, t)
Proof Each of M spheres in C has radius t. The spheres do not overlap. The total
number of points enclosed by the spheres must be q n . We must have
M Vq (n, t) q n
so
q n /M Vq (n, t)
Theorem 3 There exists a t-error correcting q-ary code of length n and redundancy
r that satisfies
= dmin /n.
We would hope that as n gets longer, dmin might grow correspondingly. In exploring
this behavior, let Aq (n, dmin ) be the maximum possible number of codewords for a
q-ary code of length n and minimum distance dmin . Then the number of codewords
is logq Aq (n, dmin ), and the rate is
t = b(n 1)/2c,
so that
Then
logq Aq (n, bnc)
a() = lim sup
n n n
1 q
lim logq Gilber bound
n n Vq (n, bnc)
logq Vq (n, bnc)
= lim 1
n n
= 1 Hq () previous lemma
2
We also can state a lower bound: