Chapter 3
Linear Block Codes
3.1 (n, k) Linear Block Codes over GF(q)
Let the message m = ( m0 , m1 ,L , m k - 1 ) be an arbitrary k-tuple
from GF(q).
k
The linear (n, k) code over GF(q) is the set of q codeword of
row-vector form c = ( c0 , c 1 ,L , c n- 1 ) , where c j ∈ GF(q)
By linear transformation
k −1
c = m ⋅ G = ∑ mi ⋅ g i =m0 g0 + m1 g0 + L + mk - 1 g k - 1
i =0
Here G is a k × n matrix of rank k of elements from GF(q),
g i is the i-th row vector of G.
G is called a generator matrix of the code.
The rows of G are linearly independent since G is assumed to
have rank k.
The code C is called a k-dimensional subspace of the set of all
n-tuples.
Example:
(7, 4) Hamming code over GF(2)
The encoding equation for this code is given by
c0 = m0
c1 = m1
c2 = m2
c3 = m3
c4 = m0 + m 1 + m 2
c5 = m1 + m 2 + m 3
c6 = m0 + m 1 + m 3
that is,
1 0 0 0 1 0 1
0 1 0 0 1 1 1
G=
0 0 1 0 1 1 0
0 0 0 1 0 1 1
An (n, k) block code is said to be linear if the vector sum of two
codeword is a codeword.
Linear Systematic Block Code:
In systematic from the codeword C is comprised of an
information segment and a set of n-k symbols that are linear
combinations of certain information symbols, determined by the
P matrix. That is
c i = mi ; for 0 ≤ i < k
k −1
c i = ∑ m j p j, n- k - i ; for k ≤ i < n
j =0
message codeword
( m0 , m1 ,L , mk - 1 ) ↔ ( m0 , m1 ,L , mk -1 , c k , c k + 1 ,L , c n-1 )
The second set of equations, given above, is called the set of
parity-check equations.
An (n, k) linear systematic code is completely specified by a k × n
generator matrix of the following form
g0
g
G = 1 = [I k P ]
M
g k -1
where I k is the k × k identity matrix
p0, ( n- k - 1) p0, ( n- k - 2 ) L p0, 0
p p1, ( n- k - 2 ) L p1, 0
P=
1, ( n - k - 1 )
M M O M
p( k - 1 ) , ( n - k - 1 ) p( k - 1 ) , ( n - k - 2 ) L p( k - 1 ) , 0
P -matrix is a k × ( n - k ) matrix.
Parity-check matrix
An (n, k) linear code can also be specified by an ( n - k ) × k
matrix H.
Let c = ( c0 , c 1 ,L , c n- 1 ) be an n-tuple
then c is a codeword if and only if
c ⋅ H T = (0,0,L ,0 )
14243
n− k
i.e. the inner product of c and each row of H is zero.
The matrix H is called a parity-check matrix.
Since G = [I k P ]
[
we can see that H = P I n- k
T
]
where P T is the transpose of P
and G ⋅ H T = 0 .
Note: For any given generator matrix G, many solution for H are
possible.
Example:
A (6, 3) code is generated by
1 0 0 1 1 1
G = 0 1 0 1 0 1
0 0 1 0 1 1
The parity-check matrix is given by
1 1 0 1 0 0
H = 1 0 1 0 1 0
1 1 1 0 0 1
A code generated by H is called the dual code of the code
generated by G.
A dual code is denoted as C ⊥ .
3.2 Hamming Distance of Linear Block Code and
Error Protection Properties
Distance between two n-symbol vectors
u = ( u0 , u1 ,L , un- 1 )
v = ( v0 , v 1 ,L , v n- 1 )
(a) Euclidean distance
n-1
d E (u , v ) = ∑(u
i =0
i - vi ) 2
(b) Hamming distance
d H ( u , v ) = { i | ui ≠ v i , i = 0,1,L , n - 1 }
i.e. the number of places where u and v differ.
Hamming weight and Hamming distance of codewords
(a) For a linear code C, the Hamming distance between any two
codewords is simply described by
d H ( c 1 , c 2 ) = wt ( c 1 - c 2 ) = wt ( c 3 )
where c 3 is the difference between c 1 and c 2 .
wt ( c 3 ) is the Hamming weights of c 3 , or the number of
nonzero positions of c 3 .
(b) Triangle inequality
For codeword a , b and c
d H (a , c ) + d H (c , b ) ≥ d H (a , b )
a b
(c) d H ( a , b ) = wt ( a + b )
3.3 Minimum distance of a Block code
Let C be a linear block code. The minimum distance of C,
denoted as d min , is defined as follows:
d min ≡ min {d ( v , u ) : v , u ∈ C, v ≠ u }
The minimum weight of C, denoted as wmin , is defined as
follows:
wmin ≡ min { w( v ) : v ∈ C, v ≠ 0 }
Exercise:
Show that d min = wmin
Proof:
d min ≡ min {d ( v , u ) : v , u ∈ C, v ≠ u }
= min { d ( v + u ) : v , u ∈ C, v ≠ u }
= min { w( x ) : x ∈ C, x ≠ 0 }
= wmin
3.4 maximum Error-Correction Capability of a Block
Code
Suppose that c0 is selected for transmission and that the closest
codeword is d min in Hamming distance, as shown below (Fig. 3.5
page 87)
c1
c0
c0
c2
c1
c r =c +e
e = ( e0 , e 1 ,L , e n- 1 ) : error pattern.
c = ( c0 , c 1 ,L , c n- 1 ) : codeword transmitted.
r = ( r0 , r1 ,L , rn- 1 ) : received word.
d min − 1
If the channel-error pattern e has t = or fewer errors,
2
one is guaranteed that r = c0 + e remains closer in Hamming
distance to c0 than to any other codeword and thus is decoded
correctly.
d − 1
As a consequence, t = min is called the maximum
2
error-correction capability of the code.
Error-detection Capability
Suppose that the decoder’s task is only to detect the presence of
errors, and if errors are detected, to label the codeword (received
word) is unreliable.
The detector’s function can fail only if e takes the transmitted
codeword c0 into another codeword c 1 , that is c0 + e = c 1 .
This cannot occur if there are d min − 1 or fewer errors in the n
positions of the code.
That is, d min − 1 is the guaranteed error detection capability of
the code.
Hybrid modes of error control
One can correct t errors and still detect up to t d errors provided
that t + t d < d min .
3.5 Weight Distribution
Let C be an (n, k) linear block code and wmin denotes the
number of codewords in C with Hamming weight i .
Define W ( z ) = ∑ wi z as the weight enumerator polynomial.
i
i =0
Clearly, w0 = 1
w0 + w1 + L + wn = 2 k
Exercise:
Find the weight enumerator polynomial of the (7, 4) Hamming
code generated by
1 0 0 0 1 0 1
0 1 0 0 1 1 1
G=
0 0 1 0 1 1 0
0 0 0 1 0 1 1
Answer: W ( z ) = 1 + 7z 3 + 7z 4 + z 7
3.6 Some Commonly-used Modifications of Linear
Codes
Shortened code
A code is shortened by deleting some message symbols (bits) from
the encoding process.
For example, by deleting one message symbol (or bit), an (n, k)
code becomes an (n-1, k-1) code.
Extended code
A code is extended by adding some additional redundant symbols
(or bits).
For example, by adding one parity symbol, a (n, k) code becomes
a (n+1, k) code.
In general, the error-control capability of the extended code can
be increased.
Punctured Code
A code is punctured by deleting some of its parity symbols (or
bits).
For example, by deleting one parity symbol, a (n, k) code
becomes (n-1, k) code.
In general, the error-control capability is reduced, but the code
rate is increased.