Groups and Coding AA Ch3
Groups and Coding AA Ch3
Solution: Hamming (7, 4) code denotes that the input message is of length 4 and it
has to be encoded with length 7 using the matrix G. Each input message consists of
4−tuples (4 components) in which each component will be either 0 or 1. Hence the
entries of each components can be viewed as the elements of Z2 , where Z2 = {0, 1}.
Since the message consists of 4 components and each component is either 0 or 1, there
are 16 possibilities, that is, 24 = 16, where 2 denotes the number of elements of Z2 and 4
denotes the number of components. So, these 16 elements are the elements of the group
Z2 ×Z2 ×Z2 ×Z2 = {0000, 0001, 0010, 0100, 1000, 1100, 1010, 1001, 0110, 0101, 0011, 1110,
1101, 1011, 0111, 1111}. Hence, A = Z2 × Z2 × Z2 × Z2 .
Now, we can encode each of the elements (messages) of A by multiplying each of the
messages with G on the right hand side. Each message in A can be considered as 1 × 4
matrix. All operations to be done modulo 2. The resulting 7−tuples are called code
3
words. For example the message 0000 is coded as follows:
1 0 0 0 1 1 0
0 1 0 0 1 0 1
[0 0 0 0] × = [0 0 0 0 0 0 0].
0 0 1 0 1 1 1
0 0 0 1 0 1 1
Hence, the message 0000 is encoded as 0000000. Thus 0000000 is the code word for the
message 0000. Similarly, do the above procedure for the remaining messages in A and
hence Table 1 is obtained.
Table 1
Message Encoder Code Word Message Encoder Code Word
0000 → 0000000 0110 → 0110010
0001 → 0001011 0101 → 0101110
0010 → 0010111 0011 → 0011100
0100 → 0100101 1110 → 1110100
1000 → 1000110 1101 → 1101000
1100 → 1100011 1011 → 1011010
1010 → 1010001 0111 → 0111001
1001 → 1001101 1111 → 1111111
Note
✠ The code is called binary if its entries are 0 or 1. Example, the set {0000000, 0010111,
0101011, 1001101, 1100110, 1011010, 0111100, 1110001} is a (7, 3) binary code.
✠ The set {0000, 0121, 0212, 1022, 1110, 1201, 2011, 2102, 2220} is a (4, 2) linear code
over Z3 . A linear code over Z3 is called a ternary code.
Definitions
Table 2
Message Encoder Code Word Message Encoder Code Word
000 → 000000 110 → 110011
001 → 001111 101 → 101001
010 → 010101 011 → 011010
100 → 100110 111 → 111100
✠ Problem 5 Let A = {00, 01, 02, 10, 11, 12, 20, 21, 22} be the message set con-
sisting of all possible 2-tuples of 0’s,1’s and 2’s. Construct a (4, 2) linear code
over Z3 with generator matrix given by
1 0 2 1
G= .
0 1 2 2
Problem 6: Consider the Hamming (7, 4) code with the generator matrix given by
1 0 0 0 1 1 0
0 1 0 0 1 0 1
G= .
0 0 1 0 1 1 1
0 0 0 1 0 1 1
7
Find the parity-check matrix for the Hamming (7, 4) code with the generator matrix G.
Also check whether the received vectors 0000110, 1011111 are error free.
h i
−A
Solution: The parity-check matrix H can be find by using the formula H = I(n−k)×(n−k) .
1 1 0
1 0 1
Here n = 7, k = 4, n − k = 3 and A = (obtained by deleting first 4 columns
1 1 1
0 1 1
of G). Hence,
−1 −1 0 1 1 0
−1 0 −1
1 0 1
−1 −1 −1
1 1 1
H=
0 −1 −1 =
0 1 1
(since value of −1 in Z2 is 1, because −1 + 2 = 1).
1 0 0 1 0 0
0 1 0 0 1 0
0 0 1 0 0 1
Now, if the received vector is v = 0000110, we find vH = 110. Since this is the first
row of H and no other row of H is 110, we can conclude that an error has been made in
the first position of v. Thus, the transmitted code word is assumed to be 1000110, and
the corresponding message is assumed to be 1000 (first four characters of 1000110.
Similarly, if w = 1011111 is the received word, then wH = 101, and we can conclude
that an error has been made in the second position. So, we assume that 1111111 was
sent and that 1111 was the intended message.
Note
Practice Problems
(1) Determine the (6, 3) binary linear code with generator matrix
1 0 0 0 1 1
G = 0 1 0 1 0 1 .
0 0 1 1 1 0
(2) Find all code words of the (7, 4) binary linear code whose generator matrix is
1 0 0 0 1 1 1
0 1 0 0 1 0 1
G= .
0 0 1 0 1 1 0
0 0 0 1 0 1 1
Find the parity-check matrix of this code. Will this code correct any single error?
⋆ ⋆ ⋆ ⋆ ⋆⋆