hw4-solg

5
EE 387 October 29, 2014 Algebraic Error-Control Codes Handout #19 Homework #4 Solutions 1. Dual spaces. Let V be the vector space of polynomials over GF(2), and let W be the subspace of polynomials with even parity. (Fact: W = {f (x): f (1) = 0}.) Find W and W ⊥⊥ . Solution (5 points) Even though W is a proper subspace of V , its orthogonal complement W contains only the zero polynomial. To see this, let f (x) be any nonzero polynomial of degree m. Then x m+1 + x m is a polynomial of even parity and f (x) · (x m+1 + x m ) = 1, hence f (x) is not in W . Thus W = {0} and W ⊥⊥ = V , the set of all polynomials. In an infinite dimensional vector space, W may be a proper subset of W ⊥⊥ . 2. Binary LBC. (Blahut #3.1) The generator matrix for a code over GF(2) is given by G = 1 0 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1 0 . a. Find the generator matrix and the parity-check matrix for an equivalent systematic code. Note: the systematic generator matrix is of the form [ P | I ]. b. List the vectors in the orthogonal complement of the code. c. Form the standard array for the code. Hint: write small. d. How many codewords are there of weights 0, 1,..., 6? e. Find the codeword with 101 as data symbols. f. Decode the received word 111001. Solution (30 points) a. We use elementary row operations to arrive at a generator matrix for the original code of the form [ P | I ]. G = 1 0 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1 0 1 1 0 0 0 1 0 1 1 1 0 1 0 1 1 0 1 0 (add row 3 to row 1) 1 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 0 (add row 1 to row 2) 1 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 0 1 (move row 1 below row 3) From the systematic generator matrix G =[ P | I ] we obtain the systematic parity-check matrix H =[ I |-P T ]: G = 1 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 0 1 H = 1 0 0 1 0 1 0 1 0 0 1 1 0 0 1 1 1 0

description

gff

Transcript of hw4-solg

Page 1: hw4-solg

EE 387 October 29, 2014Algebraic Error-Control Codes Handout #19

Homework #4 Solutions

1. Dual spaces. Let V be the vector space of polynomials over GF(2), and let W be the subspaceof polynomials with even parity. (Fact: W = {f(x) : f(1) = 0}.) Find W⊥ and W⊥⊥.

Solution (5 points)

Even though W is a proper subspace of V , its orthogonal complement W⊥ contains only the zeropolynomial. To see this, let f(x) be any nonzero polynomial of degree m. Then xm+1 + xm is apolynomial of even parity and f(x) · (xm+1+xm) = 1, hence f(x) is not in W⊥. Thus W⊥ = {0}and W⊥⊥ = V , the set of all polynomials.

In an infinite dimensional vector space, W may be a proper subset of W⊥⊥.

2. Binary LBC. (Blahut #3.1) The generator matrix for a code over GF(2) is given by

G =

1 0 1 0 1 10 1 1 1 0 10 1 1 0 1 0

.

a. Find the generator matrix and the parity-check matrix for an equivalent systematic code.Note: the systematic generator matrix is of the form [P | I ].

b. List the vectors in the orthogonal complement of the code.

c. Form the standard array for the code. Hint: write small.

d. How many codewords are there of weights 0, 1, . . . , 6 ?

e. Find the codeword with 101 as data symbols.

f. Decode the received word 111001.

Solution (30 points)

a. We use elementary row operations to arrive at a generator matrix for the original code of theform [P | I ].

G =

1 0 1 0 1 10 1 1 1 0 10 1 1 0 1 0

1 1 0 0 0 10 1 1 1 0 10 1 1 0 1 0

(add row 3 to row 1)

1 1 0 0 0 11 0 1 1 0 00 1 1 0 1 0

(add row 1 to row 2)

1 0 1 1 0 00 1 1 0 1 01 1 0 0 0 1

(move row 1 below row 3)

From the systematic generator matrix G = [P | I ] we obtain the systematic parity-checkmatrix H = [ I | −P T ]:

G =

1 0 1 1 0 00 1 1 0 1 01 1 0 0 0 1

⇒ H =

1 0 0 1 0 10 1 0 0 1 10 0 1 1 1 0

Page 2: hw4-solg

Note: in chapter 3 of Blahut’s book, a generator matrix is defined to be of the form [ I |P ]. An(n, k) code has such a systematic generator matrix if and only if the first k columns of everygenerator matrix are linearly independent. The first three columns of the G of this problemsare linearly dependent. Thus there is no systematic generator matirx, but by rearrangingcolumns we can obtain the systematic generator matrix of an equivalent code. There aremany sets of three linearly independent columns.

b. The orthogonal complement of the code is the set of linear combinations of the rows of a checkmatrix of the code.

H =

1 0 0 1 0 10 1 0 0 1 10 0 1 1 1 0

⇒ C⊥ =

{000000, 100101, 010011, 110110,

001110, 101011, 011101, 111000

}

c. The code C generated by G has 23 = 8 codewords and 26/23 = 8 cosets. The standard arrayconsists of eight rows and eight columns and is shown in the table on page 2.

000000 101011 011101 110110 011010 110001 000111 101100000001 101010 011100 110111 011011 110000 000110 101101000010 101001 011111 110100 011000 110011 000101 101110000100 101111 011001 110010 011110 110101 000011 101000001000 100011 010101 111110 010010 111001 001111 100100010000 111011 001101 100110 001010 100001 010111 111100100000 001011 111101 010110 111010 010001 100111 001100001001 100010 010100 111111 010011 111000 001110 100101

Table 1: Standard array for part (c)

d. From the list of codewords in the first row of the standard array, we see that there is onecodeword of weight 0, four of weight 3, and three of weight 4. The weight distribution is(1, 0, 0, 4, 3, 0, 0), and the weight enumerator is A(x) = 1 + 4x3 + 3x4.

e. The codeword corresponding to message m = 1 0 1 is c = mG = 1 1 0 0 0 1:

c = mG = [ 1 0 1 ]

1 0 1 0 1 10 1 1 1 0 10 1 1 0 1 0

= [ 1 1 0 0 0 1 ] ,

which is the sum (bitwise exclusive-or) of the first and third rows of G.

f. The received word 1 1 1 0 0 1 appears in row 5 column 6 of the standard array of part (c).The coset leader 0 0 1 0 0 0 is the estimated error, and the estimated codeword at the top ofcolumn 6 is 1 1 0 0 0 1 .

3. LBC over GF(5). Let G̃ be a nonsystematic generator matrix for a linear block code over GF(5).

G̃ =

2 4 2 2 4 40 0 3 0 1 13 1 4 0 4 02 3 4 1 1 1

.

Find the systematic generator matrix G = [P | I ] and the systematic parity-check matrix H =

[ I | −P T ] for the linear block code generated by G̃.

Page 2 of 5 EE 387, Autumn 2014

Page 3: hw4-solg

Solution (10 points)

Using elementary row operations, we transform the original generator matrix as follows.

G̃ →

1 2 1 1 2 20 0 3 0 1 13 1 4 0 4 02 3 4 1 1 1

1 2 1 1 2 22 4 0 2 0 04 3 0 1 1 23 0 0 2 3 3

(normalize row 1, clear column 3)

1 2 1 1 2 21 2 0 1 0 04 3 0 1 1 23 0 0 2 3 3

0 0 1 0 2 21 2 0 1 0 03 1 0 0 1 21 1 0 0 3 3

(normalize row 2, clear column 4)

0 0 1 0 2 21 2 0 1 0 03 1 0 0 1 21 1 0 0 3 3

4 3 1 0 0 31 2 0 1 0 03 1 0 0 1 22 3 0 0 0 2

(normalize row 3, clear column 5)

4 3 1 0 0 31 2 0 1 0 03 1 0 0 1 21 4 0 0 0 1

1 1 1 0 0 01 2 0 1 0 01 3 0 0 1 01 4 0 0 0 1

(normalize row 4, clear column 6)

= G (systematic)

The parity-check portion of the systematic generator matrix G is

P =

1 11 21 31 4

Therefore the systematic parity-check matrix over GF(5) is

H = [ I | −P T ] =

[1 0 −1 −1 −1 −10 1 −1 −2 −3 −4

]=

[1 0 4 4 4 40 1 4 3 2 1

].

4. Weight distribution of Golay codes. (Computational) In 1949 Marcel Golay found the last inter-esting perfect block codes, the (23,12,7) binary code and the (11,6,5) ternary code.

a. The first row of a generator matrix for the (23,12) binary Golay code is

[ 1 0 1 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 ] .

The other 11 rows are right shifts of this 23-tuple. Find the weight distribution of the code.

b. The first row of a generator matrix for a (11,6) ternary Golay code is

[−1 0 1 −1 1 1 0 0 0 0 0 ] = [ 2 0 1 2 1 1 0 0 0 0 0 ] .

The other 5 rows are right shifts of this 11-tuple. Find the weight distribution of the code.

Solution (15 points)

a. The weight enumerator of the (23,12) binary Golay code is

A(x) = 1 + 253x7 + 506x8 + 1288x11 + 1288x12 + 506x15 + 253x16 + x23 .

Homework #4 Solutions Page 3 of 5

Page 4: hw4-solg

The weight distribution was found by the following Matlab code.

g = [1 0 1 0 1 1 1 0 0 0 1 1];

% create generator matrix by shifting first row

n = 23;

k = 12;

G = zeros(k, n);

for i=0 : k-1

G(i+1,:) = [zeros(1,i) g zeros(1,n-k-i)];

end

% create 2^12 by 12 matrix of all messages

M = [0;1];

n = 2;

for m = 2:k

M = [zeros(n,1) M; ones(n,1) M ];

n = 2 * n;

end

% create codebook and compute weight distribution

C = mod(M * G, 2);

W = sum(C, 2);

A = histc(W, 0:23)

b. The weight enumerator of the (11,6) ternary Golay code is

A(x) = 1 + 132x5 + 132x6 + 330x8 + 110x9 + 24x11

The weight distribution was found by the following Matlab code.

% g(x) = 2 + x^2 + 2x^3 + x^4 + x^5

g = [2 0 1 2 1 1];

% create generator matrix by shifting first row

n = 11;

k = 6;

G = zeros(k, n);

for i=0 : k-1

G(i+1, :) = [zeros(1,i) g zeros(1,n-k-i)];

end

% create 3^6 by 6 matrix of all messages

N = 3;

M = [0 : N-1]’;

for m = 2 : k

M = [0*ones(N,1) M; 1*ones(N,1) M; 2*ones(N,1) M];

N = 3 * N;

end

% create codebook and compute weight distribution

C = mod(M * G, 3);

% Matlab trick to replace 2’s by 1’s

C(C == 2) = 1;

W = sum(C, 2);

A = histc(W, 0:11)

Page 4 of 5 EE 387, Autumn 2014

Page 5: hw4-solg

5. Plotkin bound. Let C = {c1, c2, . . . , cM} be a binary linear block code.

a. Let cij be the j-th bit of ci. Show that for every j, either every cij is 0 or exactly half of thecij are 0.

b. Use the previous part of this problem to obtain the Plotkin bound,

d∗ ≤n · 2k−1

2k − 1,

on the minimum distance d∗ of any binary parity-check code of blocklength n.

Solution (10 points)

a. Suppose that cij = 1 for some codeword c. If C0 is the subgroup of codewords for which cijis 0, then C1 = c + C0 is the set of codewords for which cij is 1. These cosets have the samenumber of elements. Therefore cij = 1 for exactly half the values of i.

b. By part (a), for each j, the number of ones in bit position j averaged over all codewords iseither 0 or 1/2. Summing over all n bit positions, the average number of ones in all codewordsis at most n/2. If the code has no useless bit positions, the average is exactly n/2. At leastone of the 2k − 1 nonzero codewords has weight ≤ the average weight, so an upper bound onthe minimum distance is

d∗ = w∗ ≤ average weight ≤n2k−1

2k − 1≈ 1

2n for large k .

This inequality is known as the Plotkin bound. The Plotkin bound is achieved by maximum-length codes and by the Reed-Muller codes R(1, m) of order 1 and blocklength 2m.

Homework #4 Solutions Page 5 of 5