Download Tutorial 4 solutions. File

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

System of linear equations wikipedia , lookup

Resultant wikipedia , lookup

Horner's method wikipedia , lookup

Polynomial greatest common divisor wikipedia , lookup

Polynomial wikipedia , lookup

Polynomial ring wikipedia , lookup

System of polynomial equations wikipedia , lookup

Cayley–Hamilton theorem wikipedia , lookup

Fundamental theorem of algebra wikipedia , lookup

Factorization of polynomials over finite fields wikipedia , lookup

Eisenstein's criterion wikipedia , lookup

Factorization wikipedia , lookup

Transcript
ELEC-E7240 - CODING METHODS
Tutorial 4 on linear and cyclic codes
0. News
The “Pre-assignment B2” for the lecture is available in mycourses.
Did you forget to write your name on activity A3? Check the current standings online.
1. Problems (continued from previous session)
1. Consider a binary code with parity

1
 0

H=
0
0
check matrix
0
1
0
0
0
0
1
0
0
0
0
1
1
1
1
0
0
1
1
1
1
1
1
1

1
1 
.
0 
0
(a) Find a generator matrix for this code!
(b) What is the rate of the code?
(c) What is the minimum distance of the code?
(d) What should the decoder do when this code is used and the word 11000001 is received?
(e) What should the decoder do when this code is used and the word 10011000 is received?
(f) What should the decoder do when this code is used and the word 10101010 is received?
SOLUTION: Parts (a), (b), and (c) were discussed last time. Part (d): since H[1, 1, 0, 0, 0, 0, 0, 1]T =
[0, 0, 0, 0]T , the received word is a valid codeword. The decoder accepts the message. Note that decoding
depends on the particular choice of G. If G is fixed, then the solution m(G) can be obtained by solving
[1, 1, 0, 0, 0, 0, 0, 1] = m(G)G. Part (e): since H[1, 0, 0, 1, 1, 0, 0, 0]T = [0, 1, 1, 1]T 6= [0, 0, 0, 0]T , some
error occurred. Now if r = m + e, where m was the message sent, e was some error pattern, and m
was the message received, then m = r − e. The error pattern can be found by solving HeT = [0, 1, 1, 1]
which is a binary linear system of equations. e = [0, 0, 0, 0, 0, 1, 0, 0] is the solution. [An alternative
way to see this directly (pointed out by one of the students during class), is to observe that if e has
exactly 1 nonzero coordinates at position x, then HeT is the xth column of H. Since [0, 1, 1, 1]T is the
6th column of H, e follows.] Now r − e = [1, 0, 0, 1, 1, 1, 0, 0] is the most likely codeword. Part (f):
again, H[1, 0, 1, 0, 1, 0, 1, 0]T = [1, 0, 1, 1]T 6= 0. Since [1, 0, 1, 1]T is not a column of H, at least two errors
occurred. The decoder cannot recover the message, and declares a decoder failure. [To check for the
most likely message words, solve HeT = [1, 0, 1, 1]T for e having weight 2.]
2. Consider the binary code C of all palindromes of length n, that is, words that are the same read
forwards and backwards.
(a) Show that the code C is linear.
(b) For n = 8, describe the codewords (x1 , x2 , . . . , x8 ) using equations. Give a parity check
matrix for this code, and determine the number of errors it detects.
SOLUTION: Part (a): a code is linear if it is closed under addition and scalar multiplication. This
can be verified by realizing that the sum of palindromes is again a palindrome, and a scalar multiple of
a palindrome is again a palindrome. In fact, since q = 2 (binary case), a scalar multiple of a palindrome
p is either the all 0 vector, or p itself, so this automatically holds. For part (b): the general element
of the subspace C is (x1 , x2 , x3 , x4 , x5 , x6 , x7 , x8 ) ∈ GF(2)8 where additionally x1 = x8 and x2 = x7
and x3 = x6 and x4 = x5 holds. We end up with vectors of the form (x1 , x2 , x3 , x4 , x4 , x3 , x2 , x1 ). The
dimension of this code is 4, so the generator matrix should have four rows. One should pick any 4 linearly
independent palindrome: the easiest way to do this is to specify one coordinate to 1 and all others to
be zero, one at a time. We have g1 = [1, 0, 0, 0, 0, 0, 0, 1] for the choice x1 = 1, x2 = x3 = x4 = 0,
and then g2 = [0, 1, 0, 0, 0, 0, 1, 0] for x2 = 1, and then g3 = [0, 0, 1, 0, 0, 1, 0, 0] for x3 = 1 and finally
g4 = [0, 0, 0, 1, 1, 0, 0, 0]. These are linearly independent generator elements. The matrix G therefore can
be formed by the row vectors g1 , g2 , g3 , g4 . Observe that since this is in systematic form G = [I4 |X], a
parity check matrix can conveniently be obtained by H = [−X T |I4 ]. This code has minimum distance
1
2 (which can be seen by inspecting the columns of H, or by inspecting the codewords themselves).
Therefore it can detect all one error patterns. [Indeed: if two bits at coordinate k and coordinate 8 − k
would flip at the same time, we would get another valid codeword. Therefore not all error patterns of
weight 2 can be detected. On the other hand, if only one bit flips at coordinate k, then it will be apparent
that it is distinct from the one at coordinate 8 − k. Therefore all these error patterns can be detected.]
3. List by dimension all of the binary linear cyclic codes of length 63.
SOLUTION. Recall that the dimension of a cyclic code is k := n − r, where r is the degree of the
generator polynomial. Therefore we need to find out the degrees of the factors of the polynomial x63 − 1
in GF(2)[x]. To get 63rd roots, the field extension GF(26 ) is needed (as 26 − 1 = 64 − 1 = 63 divides
63). Let α be a primitive element. Here
x63 − 1 = (x − α)(x − α2 ) . . . (x − α63 ).
Some of these factors should be multiplied together to have binary coefficients. These can be determined
by the conjugacy classes. Note: any conjugacy class can have size d where d divides the exponent m of
the extension field. Since we are in GF(26 ), m = 6, the potential class sizes are 1, 2, 3, 6. This means
0
1
2
3
4
that whenever we compute the class of an element β, as {β 2 = β, β 2 = β 2 , β 2 = β 4 , β 2 = β 8 , β 2 =
5
6
β 16 , β 2 = β 32 , β 2 = β 64 = β 63 β = β} we guaranteed to have at most six elements. Moreover, if the
size of the set is at least 4, then it is guaranteed to have size of 6. This helps to verify that we have the
correct class sizes. We have
{α0 = 1},
and
{α, α2 , α4 , α8 , α16 , α32 }.
(63-7=56 more to go)
Then we continue with an α-power not encountered so far.
{α3 , α6 , α12 , α24 , α48 , α33 },
{α5 , α10 , α20 , α40 , α80 , α34 },
{α7 , α14 , α28 , α56 , α49 , α35 },
(38 more)
{α9 , α18 , α36 }, {α11 , α22 , α44 , α25 , α50 , α37 }, {α13 , α26 , α52 , α41 , α19 , α38 },
(23 more)
{α , α30 , α60 , α57 , α51 , α39 }, {α21 , α42 }, {α23 , α46 , α29 , α58 , α53 , α43 }, {α27 , α54 , α45 },
(6 more)
31
62
61
59
55
47
{α , α , α , α , α , α }.
(Done!)
[The sharp-eyed reader can realize that we could have saved a lot of ink by not writing out α every time,
instead, we could have written out the exponents only, where calculations were done modulo 63. This
leads to the concept of cyclotomic cosets modulo 63.] The conjugacy classes give us information on how to
factor x63 − 1 in GF(2). The exact factorization is not needed, the only thing we care about this time, is
that there is 1 factor of degree one, 1 factor of degree two, 2 factors of degree three, and 9 factors of degree
six. Indeed, 1×1+1×2+2×3+9×6 = 63. The generator polynomial of any binary cyclic code of length
63 must be a factor of xn −1. The factor x−1 would correspond to the generator polynomial of a (63, 62)
cyclic code. The factor (x − α21 )(x − α42 ) of degree 2 would correspond to a (63, 61) code, and the factor
(x − 1)(x − α21 )(x − α42 ) would correspond to a (63, 63 − (1 + 2)) = (63, 60) code. The question is, what
possible integers can we form from sums from the set of degrees {1, 2, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6}. Clearly,
using polynomials of degree 1, 2 and 3, we can form polynomials of degree 1, 2, 3, 1 + 3 = 4, 2 + 3 = 5,
so any number of the form r = 6x + y, y ∈ 0, 1, 2, 3, 4, 5 is possible as a degree. Now if all degrees are
possible between 1 and 63, then the dimensions of the code, which is 63 − r, is again any number between
1 and 63. Therefore binary cyclic (63, k) codes exist for all k = 1..63. [Note: The polynomial x63 − 1
factors in GF(2)[x] as follows:
15
(x + 1) x2 + x + 1
x3 + x + 1 x3 + x2 + 1 x6 + x + 1 x6 + x3 + 1 x6 + x4 + x2 + x + 1
× x6 + x4 + x3 + x + 1 x6 + x5 + 1 x6 + x5 + x2 + x + 1 x6 + x5 + x3 + x2 + 1
× x6 + x5 + x4 + x + 1 x6 + x5 + x4 + x2 + 1 .
But we do not need this fact in this exercise. To get this factorization, you need a primitive polynomial
of degree 6 (of which α is a root). These are amongst the polynomials shown above, but not all of them
are primitive, as x6 + x3 + 1 is a factor of x9 − 1. Wicker Appendix A says that x6 + x + 1 is primitive.]
4. Let C be the binary cyclic code of length 15 generated by g(x) = x5 + x4 + x2 + 1.
(a) Compute the parity-check polynomial h(x) for C, and show that g(x) is a valid generator
polynomial.
(b) Determine the dimension of C and compute the number of code words in C.
(c) Construct parity check and generator matrices for C.
2
(d) Compute the code polynomial in C and the associated code word for the following message
polynomials using the polynomial multiplication encoding technique: (a) x2 ; (b) x7 +x3 +x.
(e) Compute the code polynomial in C and the associated code word for the following message
polynomials using the systematic encoding technique: (a) x2 ; (b) x7 + x3 + x. Verify that
the messages have been systematically encoded.
(f) Given the code C and the parity check polynomial h(x) from part (a), compute the syndrome
s(x) for the following received polynomials: (a) x3 + x2 ; (b) x14 + x10 + x5 + x3 .
SOLUTION: g(x)h(x) = xn − 1, so we need to divide x15 − 1 by g(x). If the remainder is zero, then
g(x) is indeed a valid generator polynomial. We have h(x) = 1 + x2 + x5 + x6 + x8 + x9 + x10 . Since the
degree of g(x) is r = 5 the dimension of the code is k = n−r = 15−5 = 10. The number of codewords are
210 = 1024. The parity check and generator matrices are 5×15 and 10×15 circulant matrices indexed
by
the coefficients of h(x) and g(x). G = circ 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 . H =
circ 1 1 1 0 1 1 0 0 1 0 1 0 0 0 0 . Encoding is multiplication by the generator
polynomial. We get x2 g(x) = x7 + x6 + x4 + x2 , and (x7 + x3 + x)g(x) = x12 + x11 + x9 + x8 + x6 + x.
With systematic encoding we scale up the message polynomials m(x) by x5 and divide these with g(x)
to get a remainder d(x). The systematically encoded message is then x5 m(x) − d(x). Dividing x7 with
g(x) yields d(x) = x3 + x + 1, and therefore the systematically encoded message is x7 + x3 + x + 1. In
part (b) similar calculations yield d(x) = x4 + x3 + x2 + x + 1 and therefore the systematically encoded
message is x12 + x8 + x6 + x4 + x3 + x2 + x + 1. The original messages can be recovered by looking at the
monomials with degree at least 5: in part (a) this is x7 , and division by x5 gives back the original message
x2 . Similarly, in part (b) the message is encoded within x12 + x8 + x6 , and division yields x7 + x3 + x.
The syndrome polynomial can be computed by multiplying the received message by the parity check
polynomial. It should be zero modulo x15 − 1. In part (a) s(x) = (x3 + x2 )h(x) = x13 + ... 6= 0, so this
is not a valid message. In part (b) s(x) = (x14 + x10 + x5 + x3 )h(x) ≡ 0 (mod x15 − 1), so this is a valid
message.
2. Homeworks
H8. Show that if ϕ(n) = 6 for some n, then n is a product of at most three distinct prime powers!
H9. List by dimension all of the binary linear cyclic codes of length 127.
3