19.3: Using the Generator Matrix For Encoding
( \newcommand{\kernel}{\mathrm{null}\,}\)
Notation
It is convenient to represent the binary string x1x2...xn as a column vector:
[x1x2...xn].
This allows us to use matrix multiplication to append check bits to a string:
Example 19.3.1
Appending a parity check-bit to the string 010 yields 0101. The same result can be obtained by multiplying the column vector corresponding to 010 by the following generator matrix:
G=[100010001111]=[I3A]
where Ik is the k×k identity matrix, and A=[111].
Namely (calculating all arithmetic modulo 2), we have
[010]=[0101].
In fact, multiplying any 3-bit string by G yields the same string with its parity check-bit appended.
[x1x2x3]=[x1x2x3x1+x2+x3], and x1+x2+x3(mod 2)={0 if even # of 1s1 if odd # of 1s
General Method
For some k, r∈N+,
- choose an r×k matrix A of 0s and 1s, and
- let G=[IkA]
Multiplying a k-bit string by G yields the same string, with r check bits appended at the end. We let C be the set of all possible strings Gx, and we call G the generator matrix of this code.
Note
In the next section, we will see how to choose G so that the resulting code C can correct errors.
Although many important error-correcting codes are constructed by other methods, we will only discuss the ones that come from generator matrices (except in Section 19.5).
Definition: Binary Linear Code
Any code that comes from a generator matrix G (by the General Method described above) is said to be a binary linear code.
Example 19.3.2
Find all the codewords of the binary linear code C corresponding to the generator matrix
G=[I3A],with A=[101011].
Solution
We have
G=[I3A],with A=[100010001101011].
We use this matrix to encode each of the 23=8 binary strings of length 3:
G[000]=[00000],G[001]=[00111],G[010]=[01001],G[011]=[01110],G[100]=[10010],G[101]=[10101],G[110]=[11011],G[111]=[11100].
So C={00000,00111,01001,01110,10010,10101,11011,11100}.
Exercise 19.3.1
Encode each of the given words by using the generating matrix G=[IkA]. associated to the given matrix A.
1) A=[11001001]. Words to encode: 0101, 0010, 1110.
2) A=[110101011111]. Words to encode: 110, 011, 111, 000.
The generator matrix provides an easy way to encode messages for sending, but it is hard to use it to decode a message that has been received. For that, the next section will introduce a slightly different matrix. From this new matrix, it will be easy to determine whether the corresponding code can correct every single-bit error.