You are on page 1of 4

UNIVERSITY OF ST ANDREWS School of Mathematics and Statistics MT4516 Finite Mathematics: Solutions 2.

1. Prove that for any x, y Zn 2 we have wt(x) = d(x, 0) and wt(x + y ) wt(x) + wt(y ).

By denition wt(x) = |{i : xi = 1}| = |{i : xi = 0}| = d(x, 0). By denition wt(x + y ) = |{i : xi + yi = 1}|. If xi + yi = 1 then at least one of xi , yi is 1. So wt(x + y ) |{i : xi = 1}| + |{i : yi = 1}| = wt(x) + wt(y ). 2. Prove that if x, y Zn 2 both have even weights then their sum x + y also has even weight.

wt(x + y ) = = = =

|{i : xi + yi = 1}| |{i : xi = 1, yi = 0}| + |{i : xi = 0, yi = 1}| |{i : xi = 1}| |{i : xi = yi = 1}| + |{i : yi = 1}| |{i : xi = yi = 1}| wt(x) + wt(y ) 2|{i : xi = yi = 1}|

Since wt(x) and wt(y ) are even, wt(x + y ) is even. 3. Let C Z7 2 be the linear code with 1 1 1 1 1 0 G= 1 0 1 0 1 1 the generator matrix 0 0 1 1 1 0 0 1 . 1 1 0 0 1 1 1 0

Find a parity check matrix for C , list all the code-words, and determine the error-detecting and error-correcting capabilities of C . Consider xG = w with following: x1 x1 x1 x = x1 x2 x3 x4 and w = w1 w2 w3 w4 w5 w6 w7 . This gives the + x2 + x3 + x2 + x3 x2 + x3 x3 + + x2 = = = = = = = w1 w2 w3 w4 w5 w6 w7 (1) (2) (3) (4) (5) (6) (7)

+ + + +

x1 x1 Now

x4 x4 x4 x4 x4

(2) + (3) + (4) : (3) + (5) : (2) + (6) : (1) + (7) :

x4 x1 x2 x3

= = = =

w2 + w3 + w4 w3 + w5 w2 + w6 w1 + w7

Substituting back into (1) gives: w1 = w3 + w5 + w2 + w6 + w1 + w7 0 = w2 + w3 + w5 + w6 + w7 . (A) Substituing back into (2) gives: w2 = w3 + w5 + w2 + w6 + w2 + w3 + w4 0 = w2 + w4 + w5 + w6 . (B ) Substituting back into (3) gives: w3 = w3 + w5 + w1 + w7 + w2 + w3 + w4 0 = w1 + w2 + w3 + w4 + w5 + w7 . (C ) So 0 1 1 0 1 1 1 ( A) H = 0 1 0 1 1 1 0 (B ) 1 1 1 1 1 0 1 (C )

Notice that HGT = 0, this provides a useful check. The codewords are all linear combinations of the rows of G: 0000000, 1110011, 1101001, 1011100, 0111110, 0011010, 0101111, 1001101, 0110101, 1010111, 1100010, 1000110, 0100100, 0010001, 0001011, 1111000. The minimum weight is 2, so C detects single errors but cannot correct any errors. 4. Let C Z6 2 be the linear code 1 H= 1 1 with the parity check matrix 0 1 0 1 1 1 0 1 0 1 . 0 1 1 1 0

Find a generator matrix for C list all the code-words, and determine the error-detecting and error-correcting capabilities of C. Let w = w1 w2 w3 w4 w5 w6 . Then w C if and only if HwT to w1 + w3 + w5 + w6 w1 + w2 + w4 + w6 w1 + w3 + w4 + w5 We set x1 := w1 , x2 := w3 , x3 := w5 . Then (A) x1 + x2 + x3 + w6 = 0 w6 = x1 + x2 + x3 ( C ) x 1 + x 2 + w4 + x 3 = 0 w4 = x 1 + x 2 + x 3 (B ) x1 + w2 + x1 + x2 + x3 + x1 + x2 + x3 = 0 w2 = x1 So 1 1 0 1 0 1 G = 0 0 1 1 0 1 . 0 0 0 1 1 1 = 0. This is equivalent =0 =0 =0 (A) (B ) (C )

Again, notice that HGT = 0. The codewords are all linear combinations of the rows of G: 000000, 110101, 001101, 000111, 111000, 110010, 001010, 111111. The minimum weight is 2, so C detects single errors but cannot correct them. 5. Consider the code C = {000000000, 100110110, 010011011, 001101101, 110101001, 101011101, 011110010, 111000111}. Prove that C is not linear. Determine the weights of the code-words. Verify that the minimum distance is 3. What are the error-detecting and error-correcting capabilities of C ? C is not linear because C is not closed under addition, for example 100110110 + 010011011 = 110101101 C. Let v1 v2 v3 v4 = 000000000 = 100110110 = 010011011 = 001101101 v5 v6 v7 v8 = 110101001 = 101011101 = 011110010 = 111000111

then wt(v1 ) = 0, wt(v2 ) = 5, wt(v3 ) = 5, wt(v4 ) = 5, wt(v5 ) = 5, vt(v6 ) = 6, wt(v7 ) = 5, wt(v8 ) = 6. The code C is not linear, so to nd the minimum distance we must compare all pairs of codewords. We have d(v1 , vi ) = wt(vi ) 5 for 2 i 8. For the other codewords: d(v2 , v3 ) = 6 d(v2 , v4 ) = 6 d(v2 , v5 ) = 6 d(v2 , v6 ) = 5 d(v2 , v7 ) = 4 d(v2 , v8 ) = 5 d(v3 , v4 ) = 6 d(v3 , v5 ) = 4 d(v3 , v6 ) = 5 d(v3 , v7 ) = 4 d(v3 , v8 ) = 5 d(v4 , v5 ) = 4 d(v5 , v6 ) = 5 d(v6 , v7 ) = 7 d(v7 , v8 ) = 5 d(v4 , v6 ) = 3 d(v5 , v7 ) = 6 d(v6 , v8 ) = 4 d(v4 , v7 ) = 6 d(v5 , v8 ) = 5 d(v4 , v8 ) = 5

The minimum distance is 3. Hence C can correct one error and detect 2 errors. 6. Let C Zn 2 be a linear code with a generator matrix G of dimension k n . For each t {1, . . . , n} dene Ct = {x1 x2 . . . xn C : xt = 0} . (i) Prove that each Ct is a linear code. To prove that Ct is a subspace of C , we only need to show that Ct is closed under addition. This is because the only scalars are 1 and 0 so we do not need to check closure under scalar multiplication. w, y Ct xt = yt = 0 (x + y )t = 0 (x + y ) Ct

(ii) Prove that either |Ct | = |C| or else |Ct | = |C|/2 . Suppose that Ct = C and let w Ct := C \ Ct . Then wt = 1. Let f be a map from C to itself given by f (x) = x + w. Then f is a bijection, and for all v Ct the image f (v ) Ct . Similarly, for all v Ct the image f (v ) Ct . Thus |Ct | = |C t | = |C |/2. (iii) Prove that if G has no column consisting entirely of zeros, then the sum of the weights of all of the code-words in C is equal to n 2k1 . Note that |C | = 2k as G is a k n matrix. In each of the n coordinates, |Ct | = 2k1 of the codewords have a 1. Thus
n n

wt(x) =
xC t=1

|Ct | =
t=1

2k1 = n 2k1 .

You might also like