Coding Theory
Coding Theory
Problem Set 1
These questions are based on the material in Section 1: Introduction to coding theory. You
do not need to submit your answers to any of these questions.
1. The following ISBN was received with a smudge. What is the missing digit?
0 13 1x9139 9
2. Show that the following word is not a valid ISBN.
0 19 853803 2
Find a transposition error of adjacent digits that could have given this word.
3. Let C be a code of length 5, and suppose that we are transmitting codewords over a
BSC with reliability p = 0.997 and with randomly scattered noise.
(a) For any codeword v C, what is the probability that v is received correctly?
(b) Let v = 01100 C and x = 11100. What is p (v, x)?
(c) Let v = 01100 C and w = 10101. What is p (v, w)?
(d) For any codeword v C, if v is transmitted, what is the probability that a word
is received which differs from v in one position (so one error has occurred)?
4. Explain why a channel with reliability p = 0 is uninteresting.
5. What can be said about a channel with p = 0.5?
6. What is the information rate of each of the following codes.
(a) C = {0000, 0101, 1010, 1111}
(b) C = {0000, 1110, 1111, 0101, 1010}
(c) C = {0000, 0011, 0101, 0110, 1001, 1010, 1100, 1111}
(d) C is a code of length 7 with 16 codewords.
7. Let C be the code whose codewords are all the words of length 3. Can C detect any
errors? How many?
8. Let D be the code formed by adding a parity check digit to each codeword in the code
C of Question 7, so that the number of ones in each codeword of D is even.
(a) Write down the codewords in D.
(b) Can D detect any errors? How many?
(c) Suppose that the word 1101 is received. List the codeword(s) that were most
likely to have been transmitted.
Problem Set 1
9. Let E be the 3-fold repetition code of length 9 formed by repeating each codeword in
the code C of Question 7 three times.
(a) Can E detect any errors? How many?
(b) Suppose that the word 001000001 is received. List the codeword(s) that were
most likely to have been transmitted.
(c) Suppose that the word 101100001 is received. List the codeword(s) that were
most likely to have been transmitted.
10. Find the information rate for each of the codes C, D and E from Questions 79.
11. Let C be a block code that can detect any single error.
(a) If C has length 4, what is the maximum number of codewords in C?
(b) If C has length 5, what is the maximum number of codewords in C?
(c) If C has length n, what is the maximum number of codewords in C?
12. If C = {010101, 110110, 101101, 100110, 011001} and a word w = 101010 is received,
which codeword is most likely to have been sent?
13. Write down d(x, y) in each of the following cases:
(a) x = 1111, y = 0101
(b) x = 0110, y = 1001
(c) x = y = 1001
(d) x = 11000, y = 10101
(e) x = 1100101, y = 0111011
14. From first principles, prove that Hamming distance is a metric (the properties of a
metric are given on page 9 of the lecture notes).
15. Prove that wt(v + w) wt(v) + wt(w).
16. Consider the code C = {001, 101} and suppose that the codewords in C are sent across
a BSC with reliability p = 0.9.
(a) Construct an IMLD table for C.
(b) For which received words will IMLD conclude that v = 001 was transmitted?
(c) For which received words will IMLD conclude that v = 101 was transmitted?
(d) If v = 001 is transmitted, find the probability that IMLD will correctly conclude
this after one transmission.
(e) If v = 101 is transmitted, find the probability that IMLD will correctly conclude
this after one transmission.
2
Problem Set 1
17. Consider the code C = {000, 001, 110} and suppose that the codewords in C are sent
across a BSC with reliability p = 0.9.
(a) For each word w K 3 that could be received, find the word v C which IMLD
will conclude was transmitted.
(b) For which received words will retransmission be requested?
(c) If v = 110 is sent, find the probability that IMLD will correctly conclude this
after one transmission.
(d) If v = 110 is sent, find the probability that IMLD will conclude that 000 was sent.
18. Let C = {001, 101, 110}. Which of the error patterns 011 and 001 will C detect?
19. Let C = {00000, 10101, 00111, 11100}. Which of the error patterns 10101, 01010 and
11011 will C detect?
20. Let C = {1101, 0110, 1100}. Find all error patterns which can be detected by C.
21. Let C = {1000, 0100, 0010, 0001}. Find all error patterns which can be detected by C.
22. Find the distance of each of the following codes:
(a) C = {101, 111, 011}.
(b) C = {0000, 1001, 0110, 1111}.
(c) C = {00000, 11111}.
(d) C = {00000, 11100, 00111, 11011}.
(e) C = {00000, 11110, 01111, 10001}.
(f) C = {000000, 101010, 010101, 111111}.
23. For each code in Question 22, if C is x error detecting, find x. In each case, find an
error pattern of weight x + 1 which C does not detect.
24. For each code in Question 22, if C is x error correcting, find x. In each case, find an
error pattern of weight x + 1 that C does not correct.
1
2
(b)
1
log2 5 = 0.58
4
(c)
3
4
(d)
4
7
(b) d(x, y) = 4
(c) d(x, y) = 0
(d) d(x, y) = 3
(e) d(x, y) = 5
14. The four properties of a metric are given on page 9 of the lecture notes.
(1) If x, y K n , then by definition d(x, y) is non-negative.
(2) If d(x, y) = 0 then each corresponding pair of bits of x and y are the same, thus
x = y. If x = y then clearly d(x, y) = 0.
(3) Clearly the number of positions in which x differs from y is the same as the
number of positions in which y differs from x.
decode
as
001
101
001
001
101
101
001
101
(b) IMLD will conclude that v = 001 was transmitted for the received words 000,
010, 001 and 011.
(c) IMLD will conclude that v = 101 was transmitted for the received words 100,
110, 101 and 111.
(d) L(001) = {000, 010, 001, 011} so
p (001, C) =
=
=
=
decode
as
000
001
110
001
001
110
(b) Retransmission will be requested for the received words 100 and 010.
(c) L(110) = {110, 111} so
p (110, C) =
=
=
=
(d) IMLD only concludes that 000 was sent if 000 is received. Therefore we have to
calculate the probability that 000 is received when v = 110 is sent. So
p (110, 000) = p(1 p)2 = (0.9)(0.1)2 = 0.009.
18. For each error pattern u, we need to check if v + u is a codeword for any v C. If
there is a v C for which v + u C, then C does not detect u.
001 + 011 = 010 6 C
19. Since 00000 + 10101 = 10101 C, the code C does not detect 10101.
00000 + 01010 = 01010 6 C
(b) = 2
(c) = 5
(d) = 3
(e) = 2
(f) = 3
23. (a) C is 0 error-detecting. It cannot detect the error pattern 010 of weight 1.
(b) C is 1 error-detecting. It cannot detect the error pattern 1001 of weight 2.
(c) C is 4 error-detecting. It cannot detect the error pattern 11111 of weight 5.
(d) C is 2 error-detecting. It cannot detect the error pattern 11100 of weight 3.
(e) C is 1 error-detecting. It cannot detect the error pattern 10001 of weight 2.
(f) C is 2 error-detecting. It cannot detect the error pattern 101010 of weight 3.
24. (a) C is 0 error-correcting. It cannot correct the error pattern 010 of weight 1.
(b) C is 0 error-correcting. It cannot correct the error pattern 1000 of weight 1.
(c) C is 2 error-correcting. It cannot correct the error pattern 11100 of weight 3.
(d) C is 1 error-correcting. It cannot correct the error pattern 11000 of weight 2.
(e) C is 0 error-correcting. It cannot correct the error pattern 10000 of weight 1.
(f) C is 1 error-correcting. It cannot correct the error pattern 101000 of weight 2.
Problem Set 2
These questions are based on the material in Section 2: Linear Codes I. You do not need to
submit your answers to any of these questions.
1. Determine whether the following code is linear.
C = {0000, 1001, 1010, 0011, 1111}
2. For each of the following sets S, list the elements of the linear code hSi.
(a) S = {010, 011, 111}
(b) S = {0101, 1010, 1100}
(c) S = {11000, 01111, 11110, 01010}
(d) S = {10101, 01010, 11111, 00011, 10110}
(e) S = {0001111, 0110101, 1010011, 1011100, 1100110}
3. For each of the linear codes hSi in Question 2, state the distance of the linear code,
and how many errors it can detect and correct.
4. Let S = {0101, 1010, 1100}. From first principles, find the dual code C = S .
5. For each set S in Question 2, use Algorithm 2.13 to find a basis B for the code C = hSi
and to find a basis B for the code C = S .
6. For each set S in Question 2, find the dimension of each code C = hSi and each dual
code C .
7. Verify that the following matrix is a generating matrix for the linear code
C = {0000, 1110, 1011, 0101}.
1 1 1 0
G=
1 0 1 1
Give two other generating matrices for the code C.
8. Verify that the following matrix is a parity check matrix for the linear code
C = {0000, 1110, 1011, 0101}.
1 0
1 1
H=
0 1
1 1
Problem Set 2
10
Problem Set 2
0
(a) Let C1 be the code with generating matrix G1 =
0
1 1 0 1 1 1
(b) Let C2 be the code with generating matrix G2 = 0 1 1 0 1 0 .
0 0 1 1 0 1
Let u be a message word of length 3, encoded using G2 , and corresponding to the
codeword v = uG2 . If you received the codeword v, how would you recover the
message word u?
13. The following matrix H is a parity check matrix for a linear code C.
1 1 1
1 0 1
0 1 0
H=
1 0 0
0 1 0
0 0 1
(a) Determine the distance of C.
(b) Find a nonzero codeword of minimum weight in C.
1 0 0 0 1
14. Let C be the linear code with generating matrix G = 0 1 0 1 1 .
0 0 1 0 1
(a)
(b)
(c)
(d)
100
A
010
E
001
I
110
C
101
D
011
H
111
M
1. The code C is not linear since 0011 C and 1111 C but 0011 + 1111 = 1100 6 C.
2. (a) hSi = {000, 010, 011, 111, 100, 001, 101, 110} = K 3
(b) hSi = {0000, 0101, 1010, 1100, 1111, 1001, 0110, 0011}
(c) hSi = {00000, 11000, 01111, 11110, 01010, 10111, 00110, 10010,
10001, 00101, 10100, 01001, 11101, 01100, 11011, 00011}
(d) hSi = {00000, 10101, 01010, 11111, 00011, 10110, 01001, 11100}
(e) hSi = {0000000, 0001111, 0110101, 1010011, 1011100, 1100110, 0111010, 1101001}
3. (a) = 1, no errors detected or corrected.
(b) = 2, 1-error detecting, 0-error correcting.
(c) = 2, 1-error detecting, 0-error correcting.
(d) = 2, 1-error detecting, 0-error correcting.
(e) = 4, 3-error detecting, 1-error correcting.
4. Let x1 x2 x3 x4 C . Then by the definition of C we have
(x1 x2 x3 x4 ) (0101) = 0
(x1 x2 x3 x4 ) (1010) = 0
(x1 x2 x3 x4 ) (1100) = 0
so x2 + x4 = 0
so x1 + x3 = 0
so x1 + x2 = 0
0 1 0
1 1 1
1 1 1
1 0 0
A= 0 1 1 0 1 0 0 1 0 0 1 0
1 1 1
0 1 1
0 0 1
0 0 1
which is in RREF. So a basis for C is {100, 010, 001}. Note that this agrees with the
fact that C = K 3 as calculated in Question 2.
Since G = I3 , there is no matrix X from which to create a parity check matrix. Note
that k = 3, n = 3 and the number of columns of a parity check matrix is n k = 0.
Thus the dual code is C = {000} and so a basis for C is B = .
12
0 1 0 1
1 0 1 0
1 0 1 0
1 0 0 1
A= 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1
1 1 0 0
0 1 1 0
0 0 1 1
0 0 1 1
which is in RREF. So a basis for C is {1001, 0101, 0011}.
Now G =
I3 X
so H =
X
I1
1
1
=
1 .
1
Thus a basis for C is {1111}. Note that this agrees with the code C whose codewords
were calculated in Question 4.
(c) We apply Algorithm 2.13.
1 1 0 0 0
1 1 0 0 0
1 1 0 0 0
0 1 1 1 1
0 1 1 1 1 0 1 1 1 1
A=
1 1 1 1 0
0 0 1 1 0
0 0 1 1 0
0 1 0 1 0
0 1 0 1 0
0 0 1 0 1
1 1 0 0 0
1 0 1 1 1
1 0 0 0 1
0 1 1 1 1
0 1 0 0 1
0 1 0 0 1
0 0 1 1 0 0 0 1 0 1 0 0 1 0 1 ,
0 0 0 1 1
0 0 0 1 1
0 0 0 1 1
which is in RREF. So a basis for C is {10001, 01001, 00101, 00011}.
Now G =
I4 X
so H =
X
I1
1
1
1
1
1
1 0 1 0 1
0 1 0 1 0
A= 1 1 1 1 1
0 0 0 1 1
1 0 1 1 0
1
0
0
0
0
0
1
1
0
0
1
0
0
0
0
0
1
1
1
1
1
0
0
1
1
13
1
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
1
0
0
1
1
1
0
0
1
1 0 1 0 1
1
5. (d) Now G = 0 1 0 0 1 , so G0 =
0
0 0 0 1 1
0
2
0
1
0
Thus H =
X
I2
1
0
0
1
0
1
1
1
0
1
1
2
4 ,
3
5
4
0
0
1
3
1
0
0
5
1
=
1
1
1
0
1
0
0
1
1
0
1
1
H=
and so
I3 X .
0 0
0 1
A=
1 0
1 0
1 1
Algorithm 2.13.
0 1 1 1 1
1 0 1 0 1
1 0 0 1 1
1 1 1 0 0
0 0 1 1 0
1
0
0
0
0
0
1
0
0
1
1
1
0
0
1
0
0
1
1
0
0
1
1
1
1
1
0
1
1
0
1
1
1
1
1
1
0
0
0
0
0
1
0
0
0
1
1
0
0
0
0
0
1
0
0
0
1
1
0
0
1
0
1
0
0
1
1
1
0
0
1
1 0 1 0 0 1 1
1
Now G = 0 1 1 0 1 0 1 , so G0 =
0
0 0 0 1 1 1 1
0
X
Thus H0 =
=
I4
1
1
0
1
0
0
0
0
1
1
0
1
0
0
1
0
1
0
0
1
0
1
1
1
0
0
0
1
1
2
4
3 ,
5
6
7
2
0
1
0
4
0
0
1
3
1
1
0
5
0
1
1
and so
H=
dimC
dimC
(a)
3
0
(b)
3
1
14
(c)
4
1
(d)
3
2
(e)
3
4
6
1
0
1
1
1
1
0
0
0
0
7
1
=
1
1
0
1
0
1
1
0
0
1
0
0
1
0
1
0
1
1
0
1
0
0
1
I3 X .
7. Each of the four codewords occurs as a linear combination of the rows of the matrix
G.
0000 = 0(1110) + 0(1011) 1110 = 1(1110) + 0(1011)
1011 = 0(1110) + 1(1011) 0101 = 1(1110) + 1(1011)
Thus G is a generating matrix for C.
Two other generating matrices for C are
1 0 1 1
0 1 0 1
and
1 1 1 0
0 1 0 1
.
1 0
1 1
= 0 0 ,
x1 x2 x3 x4
0 1
1 1
then
x1 + x2 + x4 = 0 and x2 + x3 + x4 = 0.
These equations imply that x1 = x3 . If x1 = x3 = 0 then x2 = x4 and these could be
0 or 1. If x1 = x3 = 1 then exactly one of x2 or x4 is 1. Thus the words which satisfy
vH = 0 are precisely the words of C
{0000, 0101, 1110, 1011}.
Thus H is a parity check matrix of C.
1
1
1
0
1
0
0
0
0 1 1 0
1 1 0 1
0 1 0 0
0 1 0 1
0 1 1 1
1 0 1 1
1 1 1 0
0 0 1 1
1 0
1 1 0 1
0 1 0 0
1 1
0 0 1 1
0 1
1 0
0 0 1 1
1
1
1
1
0
1 0
0 1
1
0 0
0
0
0 0
0
0
1
0
1
0
1
0
0
1
1
0
1
1
0
0
1 0 0 1 0 1
G = 0 1 0 0 1 1 .
0 0 1 1 1 0
(b) Let u K 3 . Then u is encoded as uG.
S
111
111000
E
010
010011
N
101
101011
D
100
100101
000
000000
H
001
001110
E
010
010011
L
110
110110
P
011
011101
So the encoded message would be the bits (one after another and in order) that
appear in the bottom row of the table.
15
1 0 1
0 1 1
1 1 0
H=
1
0
0
0 1 0
0 0 1
is a parity check matrix for C.
(e) Given a received word w, if wH = 0 then w is a codeword. Otherwise, an error
has occurred.
1 1 1 1 0 1 H= 1 0 1
0 1 0 0 1 0 H= 0 0 1
1 0 1 0 1 1 H= 0 0 0
Thus errors have occurred in the received words 111101 and 010010 but 101011
is a codeword, so it is likely that no errors occurred in its transmission.
(f) The received word 111101 is closest to the codeword 011101, corresponding to the
letter P.
The received word 010010 is closest to the codeword 010011, corresponding to the
letter E.
The received word 101011 is the codeword corresponding to the letter N.
Thus it is likely that the intended mesage was PEN.
10. (a) The dimension of C is k = 3, so a generating matrix will have three rows. Choose
any three linearly independent codewords, place them in the rows of a matrix and put
this matrix into RREF.
1 0 1 1 0 0
1 0 1 1 0 0
1 0 0 0 1 1
1 1 1 0 1 0 0 1 0 1 1 0 0 1 0 1 1 0
0 1 1 0 0 1
0 0 1 1 1 1
0 0 1 1 1 1
1 0 0 0 1 1
Thus GC = 0 1 0 1 1 0 is a generating matrix for C in RREF.
0 0 1 1 1 1
(b) We use Algorithm 2.13 to find
0
GC =
0
0 0 0 1 1
1 0 1 1 0 = I3 X
0 1 1 1 1
16
0 1 1
1 1 0
1 1 1
HC =
1
0
0
0 1 0
0 0 1
Let v = 100011 and check that vHC = 0.
vHC =
1 0 0 0 1 1
0
1
1
1
0
0
1
1
1
0
1
0
1
0
1
0
0
1
0 0 0
(c) A generating matrix for C is the transpose of a parity check matrix for C. Thus
0 1 1 1 0 0
GC = HTC = 1 1 1 0 1 0
1 0 1 0 0 1
(d) A parity check matrix for C can be found either by applying Algorithm 2.13
to the generating matrix GC from part (c), or by taking the transpose of the
generating matrix GC from part (a). Here well take the transpose of GC .
1 0 0
0 1 0
0 0 1
HC =
0 1 1
1 1 1
1 0 1
Now we verify that GC HC = 0.
0 1 1 1 0 0
= 1 1 1 0 1 0
1 0 1 0 0 1
GC HC
17
1
0
0
0
1
1
0
1
0
1
1
0
0
0
1
1
1
1
0 0 0
= 0 0 0
0 0 0
11. (a) The code C is not systematic. The RREF of a generating matrix for a linear code
is unique and the RREF generating matrix for C is
1 0 0 1 0
G=
.
0 0 1 1 0
This matrix does not contain the 2 2 identity matrix in its first two columns, and
hence C is not systematic.
(b) If we swap columns 2 and 3 in the generating matrix above we obtain a generating
matrix
1 0 0 1 0
0
G =
.
0 1 0 1 0
This gives the equivalent code C 0 = {00000, 10010, 01010, 11000}, which is systematic.
12. (a) Since G1 is in RREF, the bits of the message word u will appear in the positions
corresponding to the leading columns in the codeword v. Let u = x1 x2 x3 be a message
word. Then
1 0 1 0 1 1
uG1 = (x1 x2 x3 ) 0 1 1 0 0 1 = x1 x2 x1 + x2 x3 x1 + x3 x1 + x2 .
0 0 0 1 1 0
Thus to recover u from v, take bits 1, 2 and 4 (in order) of v.
(b) Since G2 is not in RREF, we cannot recover the bits of u directly from the
codeword v. However if we let u = x1 x2 x3 then we have
1 1 0 1 1 1
uG2 = (x1 x2 x3 ) 0 1 1 0 1 0
.
0 0 1 1 0 1
x1 x1 + x2 x2 + x3 x1 + x 3 x1 + x2 x1 + x3
=
Thus, if the codeword is v = v1 v2 v3 v4 v5 v6 , then x1 = v1 , x2 = v2 + x1 and x3 = v3 + x2 .
13. (a) In the parity check matrix H, no single row is a linearly dependent set (no row
of all zeros), but the set of rows 3 and 5 is a linearly dependent set (since row 3 plus
row 5 gives zero). Thus by Theorem 2.42, the distance of C is 2.
(b) Since rows 3 and 5 give a linearly dependent set, the word of length 6 with ones
in positions 3 and 5 must be a codeword. To check this, we see that
(0 0 1 0 1 0)H = 0.
Thus 001010 is a word of minimum weight in C.
18
0
1
H=
0
1
0
1
1
1
.
0
1
(b) Since we have n = 5 and k = 3, there are 253 = 4 cosets of C, each containing
8 words. The cosets of C are:
C
10000 + C
01000 + C
00010 + C
(c)
=
=
=
=
syndrome
00
01
10
11
(d) First the received message is partitioned into received words of length 5. Then
the syndrome of each received word is calculated, which determines the most likely
error pattern(s). From this we can calculate the most likely corresponding codeword
(and hence the English letter).
most likely
received syndrome
word w
wH
error pattern(s)
01110
00
00000
11001
11
01000
00010
10
00010
00110
11
01000
10000
01
10000
00100
00001
corresponding English
codeword
letter
01110
H
10001
A
00000
space
01110
H
00000
space
10100
D
10001
A
Thus the most likely message is HA H?, where the ? is one of space, D or A. Using
the redudancy of the English language, we could guess that the intended message is
HA HA.
19
Problem Set 3
These questions are based on the material in Section 3: Linear Codes II. You do not need
to submit your answers to any of these questions.
1. Use Theorem 3.5 to show that there exists a linear code of length n = 5, dimension
k = 2 and distance = 3. Use the method outlined in the proof of Theorem 3.5 to
construct such a code.
2. Determine a lower and upper bound on the maximum number of codewords in a linear
code with length n = 8 and distance = 3.
3. Prove Theorem 3.14: If C is a perfect code of length n and distance = 2t + 1 then
C will correct all error patterns of weight less than or equal to t, and no other error
patterns.
4. Let C be the linear code with generating and parity check matrices given by:
1 0 1
0 1 1
1 0 1 0 1
1 0 0
G=
and H =
.
0 1 0 1 1
0 1 0
0 0 1
(a) Find a generating matrix G and a parity check matrix H for the extended code
C formed by adding a parity check bit to the start of each codeword of C, and
verify that G H = 0.
(b) What are the length, dimension and distance of C ?
(c) Let B be the code with codewords
{00000, 11000, 00111, 11111}.
Create a new code D using the (a | a + b) construction, where a C and b B.
(i) List the codewords of D.
(ii) What are the length, dimension and distance of D?
(iii) Use the generating and parity check matrices for codes C and B to find a
generating matrix GD and a parity check matrix HD for the code D.
(iv) Verify that the distance of D and the matrix HD satisfy Theorem 2.42.
5. Compare the length, number of codewords, distance and rate of the following codes:
the Hamming code of length 31;
the extended Hamming code of length 32;
the simplex code of length 31;
the first order Reed-Muller code of length 32;
the extended Golay code, C24 .
20
Problem Set 3
6. Let C be the code constructed from codes A and B using the (a | a + b) construction.
(a) How many errors can be corrected by C if A is the Golay code C23 and B is the
code of length 23 and dimension 1 containing the all zeros word and the all ones
word?
(b) How many errors can be corrected by C if B is the Golay code C23 and A is the
code of length 23 and dimension 1 containing the all zeros word and the all ones
word?
7. Let C be the Hamming code of length 3, and C be the simplex code of length 3. List
the codewords of C and C .
8. Use mathematical induction to prove property 4 of Theorem 3.38: For all r 1,
RM (r 1, m) is contained in RM (r, m).
9. (a) Let Rep(n) be the n-fold repetition code with two codewords, the zero word and
all ones word. Prove that
1...1
HRep(n) =
In1
is a parity check matrix for Rep(n).
(b) Let Hr,m be a parity check matrix for RM (r, m). Prove that
H1,m HRep(2m )
H1,m+1 =
.
0
HRep(2m )
10. Suppose that a message was encoded using the first order Reed-Muller code RM (1, 3)
with generating matrix G1,3 and the word w = 11001000 was received. Apply Algorithm 3.44 to determine the most-likely intended message word.
11. Suppose that a message was encoded using the first order Reed-Muller code RM (1, 2)
with generating matrix G1,2 and the word w = 1101 was received. What does Algorithm 3.44 tell you about the most likely transmitted codeword?
I
12. Consider the extended Golay
code
C
and
12 B
24 with generating matrix G =
I12
parity check matrix H =
as given in the lecture notes.
B
(a) Decode the received word w = 111 000 100 100 000 101 001 001.
(b) Decode the received word w = 101 110 101 010 001 001 011 111.
13. Consider the Golay code C23 with generating matrix G =
lecture notes.
I12 B
(a) Decode the received word w = 010 000 100 001 010 100 011 01.
(b) Decode the recieved word w = 001 000 110 010 001 101 010 10.
21
as given in the
1. By Theorem 3.5 there exists a linear code of length n, dimension k and distance at
least if
n1
n1
n1
+
+ +
< 2nk .
0
1
2
For the parameters given we have
4
4
+
= 5 and 252 = 8.
0
1
Since 5 < 8, such a linear code does exist.
In the proof of Theorem 3.5, we construct an n (n k) matrix which can then be
used as a parity check matrix for our linear code. The goal is to construct an 5 3
matrix in which no set of 1 = 2 rows is linearly dependent, and in which there is
a linearly dependent set of three rows. We can choose any word of length 3 for each
row of the matrix, provided that we havent chosen that word already. We must also
ensure that the columns of the matrix are linearly independent. To do this, choose the
first three rows of the matrix to be the rows of I3 . For example, we could have the
matrix
1 0 0
0 1 0
.
0
0
1
H=
1 1 0
0 1 1
No pair of rows form a linearly dependent set but rows 1, 2 and 4 (for example) do
form a linearly dependent set. To construct a code with the required parameters, we
apply Algorithm 2.13 in reverse to obtain the generating matrix
1 1 0 1 0
G=
.
0 1 1 0 1
Thus an example of a code with length 5, dimension 2 and distance 3 is:
C = {00000, 11010, 01101, 10111}.
(Note that there are many different choices for H and hence many different codes with
these parameters.)
2. By Theorem 3.2, we know that
|C|
8
0
28
+
= 28.4.
8
1
7
0
27
+
= 16.
7
1
Thus the upper and lower bounds are equal and so the maximum number of codewords
in a linear code with length 8 and distance 3 is 16.
3. Suppose that C is a perfect code of length n and distance 2t + 1. Since C is perfect
we have
2n
|C| = n
n
n .
+
+
+
0
1
t
Since there are 2n words of length n and
the cosets
of C partition these words into sets
n
n
n
of size |C|, there are precisely 0 + 1 + + t cosets of C.
Also since C has distance 2t+1, we know that C is t-error correcting, that is, every error
pattern of weight less than or equal to t must be correctable. This is only possible if
every
word
of weight
less than or equal to t is a unique coset leader. There are precisely
n
n
n
+ 1 + + t such words.
0
So each word of weight less than or equal to t must be a coset leader and there are no
other coset leaders. Thus, C will correct all error patterns of weight less than or equal
to t and no other error patterns.
4. (a)
b G
G =
H =
1 0...0
j
H
1
1
1
1
1
1
0
1
0
1
0
0
0
0
1
0
1
0
0
1
1
0
0
1
=
1 1 0 1 0 1
1 0 1 0 1 1
or H =
0...0 1
H
j
In each case, G H = 0.
(b)
0000000111
1010110010
0101101100
1111011001
23
0000011000
1010101101
0101110011
1111000110
0000011111
1010101010
0101110100
1111000001
0
1
0
1
0
0
0
0
1
0
1
0
0
1
1
0
0
1
1
1
1
1
1
1
4.(c) (ii) C is a (5, 2, 3) code and B is a (5, 2, 2) code, so D has length n = 10, dimension
k = 4 and distance = min{6, 2} = 2.
(iii)
GD =
GC GC
0 GB
HD =
1
0
=
0
0
HC HB
0 HB
0
1
0
0
1
0
0
0
0
1
0
0
1
1
0
0
1
0
1
0
0
1
1
0
1
0
0
1
1
0
1
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
1
1
0
0
1
0
0
0
0
0
1
1
0
0
0
1
1
0
0
0
0
0
1
1
0
0
0
1
1
0
0
0
1
0
1
0
0
1
0
1
0
1
0
1
1
1
0
1
(iv) D has distance = 2 and rows 6 and 7 of HD form a linearly dependent set,
while no single row is a linearly dependent set. Thus, Theorem 2.42 is satisfied.
5. The following table gives the length n, number of codewords |C|, distance , and rate
for each of the five codes.
n |C|
rate
Hamming length 31
31 226 3 26/31
Ext Hamming length 32 32
226
26/32
Simplex length 31
31
25
16
5/31
Reed-Muller RM (1, 5)
32
26
16
6/32
24
212
12/24
The simplex and Reed-Muller codes give high error correction but not many codewords
and a low information rate. The Hamming and extended Hamming codes give low error
correction but many codewords and a high information rate. The extended Golay code
is in the middle of the two extremes.
6. (a) The code C23 has = 7 and the (23, 1) repetition code Rep(23) has = 23, so if
a C23 and b Rep(23), then the distance of C will be min{14, 23} = 14. Thus the
code C is 6-error correcting.
(b) If a Rep(23) and b C23 , then the distance of C will be min{46, 7} = 7. Thus
the code C is 3-error correcting.
24
1 1
H = 1 0 .
0 1
Thus a generating matrix for the Hamming code of length 3 is G = (1 1 1). The simplex
code of length 3 is the dual of the Hamming code of length 3, so the codewords of C
are generated by the columns of H. The codewords of C and C are thus
C = {000, 111}
and
8. By looking at the codes listed on page 51 of the lecture notes, the statement is clearly
true for m 2 and all 1 r m.
Consider r = 1. We want to show that RM (0, m) RM (1, m). Since
G1,m1 G1,m1
G1,m =
0
G0,m1
and the top row of G1,m1 is the all ones vector, we see that RM (1, m) contains the
all ones word (of length 2m ). Since RM (1, m) is a linear code, it must also contain the
zero word (of length 2m ). But the code RM (0, m) contains only the zero word and the
all ones word (each of length 2n ), so RM (0, m) RM (1, m).
Now suppose that for m0 < m and any r0 where 1 r0 m0 we have that RM (r0
1, m0 ) RM (r0 , m0 ). Also suppose that for r0 < r we have RM (r0 1, m) RM (r0 , m).
We need to prove that RM (r1, m) RM (r, m). Since RM (r1, m1) RM (r, m
1), we know that Gr1,m1 is a submatrix of Gr,m1 (having the same number of
columns). Also since RM (r 2, m 1) RM (r 1, m 1), we know that Gr2,m1
is a submatrix of Gr1,m1 (having the same number of columns). Thus
Gr1,m1 Gr1,m1
Gr1,m =
0
Gr2,m1
is a submatrix (with the same number of columns) of
Gr,m1 Gr,m1
Gr,m =
0
Gr1,m1
and hence RM (r 1, m) RM (r, m).
25
9. (a) The code Rep(n) has length n and dimension 1. Thus a parity check matrix for
Rep(n) must be an n(n1) matrix and must have linearly independent columns. The
given matrix satisfies these conditions. Also, a generating matrix GRep(n) for Rep(n)
is the 1 n matrix consisting of a single row of ones. Clearly
GRep(n) HRep(n) = (1 1 . . . 1)HRep(n) = 0.
Thus HRep(n) is a parity check matrix for Rep(n).
(b) Since RM (1, m + 1) is built from RM (1, m) and RM (0, m) = Rep(2m ) using the
(a | a + b) construction, this result follows from Theorem 3.25 and part (a) above. We
can verify that
G1,m G1,m
H1,m HRep(2m )
G1,m+1 H1,m+1 =
0...0 1...1
0
HRep(2m )
G1,m H1,m + 0G1,m
=
(0 . . . 0)H1,m + (1 . . . 1)0 (0 . . . 0)HRep(2m ) + (1 . . . 1)HRep(2m )
This equals 0 since
G1,m H1,m = 0,
G1,m HRep(2m ) + G1,m HRep(2m ) = 0 (in binary arithmetic),
(1 . . . 1)HRep(2m ) = (0 . . . 0) (every column of HRep(2m ) has exactly two ones).
10. We apply Algorithm 3.44 to the received word w = 11001000.
Thus w = (1, 1, 1, 1, 1, 1, 1, 1).
w1 = wL13 = (2, 0, 2, 0, 0, 2, 2, 0)
w2 = w1 L23 = (0, 0, 4, 0, 2, 2, 2, 2)
w3 = w2 L33 = (2, 2, 6, 2, 2, 2, 2, 2)
The largest component of w3 is 6 occurring in position 2. Since v(2) = 010 and 6 > 0,
the presumed message word is 1010 (with corresponding codeword 11001100).
11. We apply Algorithm 3.44 to the received word w = 1101. Thus w = (1, 1, 1, 1).
w1 = wL12 = (2, 0, 0, 2)
w2 = w1 L22 = (2, 2, 2, 2)
All four components of w2 have the same magnitude. Since
v(0) = 00,
v(1) = 10,
s=w H=w
= 010 000 100 001 + 101 111 011 111 = 111 111 111 110.
B
This the the last row of H so the received word is the most likely transmitted codeword.
(b) Call the received word w. Since wt(w) = 9, we add a zero to the end of w. The
syndrome of w = w0 is
I
s=w H=w
= 001 000 110 010 + 100 000 100 001 = 101 000 010 011.
B
Since wt(s) 6 3 we look for a row of B which differs from s in at most 2 places. No
such row exists. We now calculate the second syndrome
sB = 000 100 010 010.
Since wt(sB) 3, we have
u = [0, sB] = 000 000 000 000 000 100 010 010.
Thus the corresponding codeword in C24 is v = 001 000 110 010 001 001 000 110, so
the most likely transmitted codeword is v = 001 000 110 010 001 001 000 11.
27
Problem Set 4
These questions are based on the material in Section 4: Cyclic Codes. You do not need to
submit your answers to any of these questions.
1. Let f (x) = x + x2 + x3 + x6 + x7 and p(x) = 1 + x + x4 .
(a) Find the quotient q(x) and the remainder r(x) so that f (x) = q(x)p(x) + r(x).
(b) Determine the binary word of length 4 corresponding to f (x) mod p(x).
2. Let C be the smallest cyclic linear code containing the word 011011.
(a) List the codewords of C, both as binary words and as polynomials.
(b) Determine the generator g(x) of C.
(c) Find a generating matrix for C using Corollary 4.24.
(d) Use g(x) to encode the message word 11. Use g(x) to determine the message word
corresponding to the codeword 011011.
3. Show that a cyclic linear code of length n corresponds to an ideal in the ring of
polynomial residues modulo xn + 1.
4. (a) How many cyclic linear codes of length 7 have 8 codewords? Explain your answer.
(b) How many cyclic linear codes of length 7 have 32 codewords? Explain your answer.
(c) Determine the most number of codewords in a proper cyclic linear code of length
7.
5. Let C be the cyclic linear code of length 15 generated by
g(x) = 1 + x2 + x4 + x5 .
(a) Use Theorem 4.27 to find a generating matrix in standard form for C.
(b) Find a parity check matrix for C.
(c) Show that C is a 2 cyclic burst error correcting code.
(d) Is C a 2-error correcting code? Explain your answer.
(e) Assuming that codewords are being sent through a channel where burst errors
are likely and assuming that a cyclic burst error of length at most 2 has occurred
in each of the received words, use the method of Example 4.41 to decode each of
the following received words.
(i) w = 000 101 000 011 101
(ii) w = 100 010 001 101 000
continues overleaf
28
Problem Set 4
6. The codes C1 and C2 of Example 4.50 were used to encode a message by cross interleaving and then having the codewords of C2 interleaved to depth 3. The following
string of digits is received:
100011001111101010011001111010100110100100011101000100 . . .
Determine the most likely messages m1 , m2 and m3 .
7. Theorem 4.48 says that if C is an l burst error correcting code, interleaved to depth
s, then all bursts of length at most sl will be corrected, provided that each codeword
is affected by at most one burst of errors. Determine the required length of error free
transmission between burst of errors to ensure that each codeword is affected by at
most one burst of errors.
29
x + x + 1 x +x
x7
x6
x6
+x4
+x4
x4
x4
x3 +x2
+1
+x3 +x2 +x
+x3
+x2 +x
+x3 +x2
+x3
+x
+x +1
x3
+1
(b) By part (a) we have f (x) = 1 + x3 mod p(x), so the binary word corresponding to
f (x) modulo p(x) is 1001.
2. (a) Since C is cyclic it must contain all cyclic shifts of 011011, these are 101101 and
110110. Since C is linear, it must contain all sums of two or more of these words.
However 011011 + 101101 = 110110 so we do not obtain any new codewords apart
from the zero word. Thus C = {000000, 011011, 101101, 110110} or, equivalently
C = {0, x + x2 + x4 + x5 , 1 + x2 + x3 + x5 , 1 + x + x3 + x4 }.
(b) The generator of C is g(x) = 1 + x + x3 + x4 .
(c) Using Corollary 4.24, a generating matrix for C is
g(x)
1 1 0 1 1 0
G=
=
.
xg(x)
0 1 1 0 1 1
(d) The message word 11 is equivalent to the message polynomial a(x) = 1 + x. Thus
it encodes to 101101 since
a(x)g(x) = (1 + x)(1 + x + x3 + x4 ) = 1 + x + x + x2 + x3 + x4 + x4 + x5 = 1 + x2 + x3 + x5 .
The codeword 011011 is equivalent to the polynomial c(x) = x + x2 + x4 + x5 . The
corresponding message word is found by determining c(x)/g(x). Since
x + x2 + x4 + x5
=x
1 + x + x3 + x4
the corresponding message word is 01.
3. Let C be a cyclic linear code of length n. Each codeword of C corresponds to a unique
polynomial in the ring of polynomial residues modulo 1 + xn . Call this ring R with
operations addition and multiplication (modulo 1 + xn ).
C is a linear code, so the set of polynomials in C with the operation addition is a
subgroup of the abelian group (R, +). The set is closed under addition, contains the
identity (zero word) and each codeword is its own inverse.
30
(1 + x)
(1 + x)(1 + x2 + x3 )
(1 + x + x3 )
(1 + x2 + x3 )
(1 + x + x3 )(1 + x2 + x3 )
(1 + x)(1 + x + x3 )
(1 + x)(1 + x + x3 )(1 + x2 + x3 ).
(a) A linear code with 8 codewords has dimension k = 3. A cyclic linear code of length
n = 7 and dimension k = 3 would have a generator of degree n k = 4. There are
two possible generators of degree 4 listed above, thus there are two cyclic linear codes
of length 7 with 8 codewords.
(b) A linear code with 32 codewords has dimension k = 5. A cyclic linear code of
length 7 and dimension k = 5 would have a generator of degree n k = 2. None of
the generators listed above has degree 2, thus no cyclic linear code of length 7 has 32
codewords.
(c) To find the most number of codewords in a proper cyclic linear code of length 7,
we need to identify the generator (not 1) with the lowest degree (since that will give a
large value for k). The cyclic linear code of length 7 with generator 1+x has dimension
k = 6, thus the most number of codewords in a proper cyclic linear code of length 7 is
26 = 64.
5. (a) Here n = 15 and k = 10. To find a generating matrix in standard form for C we
first calculate r5 , r6 , . . . , r14 .
x5 = 1 + x 2 + x4
x6 = x + x3 + (1 + x2 + x4 ) = 1 + x + x2 + x3 + x4
x7 = x + x2 + x3 + x4 + (1 + x2 + x4 ) = 1 + x + x3
x8 = x + x 2 + x4
x9 = x2 + x3 + (1 + x2 + x4 ) = 1 + x3 + x4
x10 = x + x4 + (1 + x2 + x4 ) = 1 + x + x2
x11 = x + x2 + x3
x12 = x2 + x3 + x4
x13 = x3 + x4 + (1 + x2 + x4 ) = 1 + x2 + x3
x14 = x + x3 + x4
31
r5 = 10101
r6 = 11111
r7 = 11010
r8 = 01101
r9 = 10011
r10 = 11100
r11 = 01110
r12 = 00111
r13 = 10110
r14 = 01011
5. Thus a generating matrix for C is G and a parity check matrix (part (b))
shown below.
1 0 1
1 1 1
1 1 0
1 0 0 0 0 0 0 0 0 0 1 0 1 0 1
0 1 1
0 1 0 0 0 0 0 0 0 0 1 1 1 1 1
1 0 0
0 0 1 0 0 0 0 0 0 0 1 1 0 1 0
1 1 1
0 0 0 1 0 0 0 0 0 0 0 1 1 0 1
0 1 1
0 0 0 0 1 0 0 0 0 0 1 0 0 1 1
0 0 1
H
=
G=
1
1
1
0
0
0
0
0
0
0
1
0
0
0
0
1 0 1
0 0 0 0 0 0 1 0 0 0 0 1 1 1 0
0 1 0
0 0 0 0 0 0 0 1 0 0 0 0 1 1 1
1 0 0
0 0 0 0 0 0 0 0 1 0 1 0 1 1 0
0 1 0
0 0 0 0 0 0 0 0 0 1 0 1 0 1 1
0 0 1
0 0 0
0 0 0
is H as
0
1
1
0
1
0
1
1
1
1
0
0
0
1
0
1
1
0
1
1
0
0
1
0
1
0
0
0
0
1
(c) For C to be a 2 cyclic burst error correcting code, each word in C(B15 (2)) must be
in a different coset. There are 2nk = 32 different cosets, and there are 1 + 15 + 15 = 31
words in C(B15 (2)), so this is possible.
To verify that C is a 2 cyclic burst error correcting code, we show that every word in
C(B15 (2)) has a unique syndrome. To calculate syndromes we use H from part (b).
Error pattern Syndrome
0
00000
10101
1
x
11111
2
x
11010
3
x
01101
10011
x4
5
x
11100
x6
01110
7
x
00111
8
x
10110
01011
x9
10
x
10000
x11
01000
12
x
00100
13
x
00010
x14
00001
5. (d) For C to be a 2-error correcting code, each error pattern of weight 0, 1 or 2 would
have to be in a distinct coset. There are 32 cosets of C, but there are
15
15
15
+
+
= 1 + 15 + 105 = 121
0
1
2
error patterns of weight up to and including 2. Therefore it is not possible for C to be
a 2-error correcting code.
(e) (i) We first calculate the syndrome of w.
s = wH = 01100, so s(x) = x + x2 .
This syndrome contains a burst error pattern with burst length 2, so we have
e = 000000000001100, and the most likely transmitted codeword is
v = w + e = 000 101 000 010 001.
(ii) We first calculate the syndrome of w.
s = wH = 10011, so s(x) = 1 + x3 + x4 .
Now apply Lemma 4.40 to calculate si for i = 1, 2, . . . until a syndrome is found that
contains a burst error pattern with burst length at most 2.
s1 (x) = xs(x) = x + x4 + (1 + x2 + x4 ) = 1 + x + x2
s2 (x) = xs1 (x) = x + x2 + x3
s3 (x) = xs2 (x) = x2 + x3 + x4
s4 (x) = xs3 (x) = x3 + x4 + (1 + x2 + x4 ) = 1 + x2 + x3
s5 (x) = xs4 (x) = x + x3 + x4
s6 (x) = xs5 (x) = x2 + x4 + (1 + x2 + x4 ) = 1
s1
s2
s3
s4
s5
s6
= 11100
= 01110
= 00111
= 10110
= 01011
= 10000
Since s6 is a burst error pattern with burst of length 1 (less than 2), we have
e6 = 000000000010000 and hence e = 000010000000000. Thus the most likely transmitted codeword is
v = w + e = 100 000 001 101 000.
6. We write the string of received digits in three rows by writing column 1 first, then
column 2 etc... The rows then give us received words for the code C2 .
ca = 100110
cb = 010101
cc = 011110
cd = 001011
ce = 101101
cf = 111000
33
cg = 110101
ch = 001000
ci = 001100
6. We now use the parity check matrix H to determine which of the words above are
codewords of C2 .
1 1 0
1 0 1
ca H = 000,
cd H = 000,
cg H = 110,
0 1 1
cb H = 000,
ce H = 000,
ch H = 011,
H=
1 0 0
cc H = 000,
cf H = 000,
ci H = 111.
0 1 0
0 0 1
Thus the first six are codewords but the last three are not. We flag all 18 digits of the
last three words.
Since the generating matrix for C2 is in standard form, we obtain the following message
words
ca 100
cd 001
cg
cb 010
ce 101
ch
cc 011
cf 111
ci
We write these message words in columns, so that the rows give us the received words
for the code C1 .
c1 = 100011 which corresponds to the codeword 10001110
c2 = 011001 which corresponds to the codeword 01100110
c3 = 001111 which corresponds to the codeword 00111100
Again, since the generating matrix for C1 is in standard form, we can determine that
the most likely first three message words were
m1 = 1000
m2 = 0110
m3 = 0011.