605 Ass and Quiz 2011

24
EE 605: Error Correcting Codes Instructor: Saravanan Vijayakumaran Indian Institute of Technology Bombay Autumn 2011 Assignment 1 : 20 points Due date: August 4, 2010 Each of the following exercises is worth 5 points. Every nontrivial step in a proof should be accompanied by justification. 1. Prove that the Hamming distance satisfies the triangle inequality, i.e. d(u, v) d(u, w)+ d(w, v) for all n-tuples u, v, w. 2. Calculate the crossover probability of the binary symmetric channel which is equiva- lent to the system below. BSC(p) Binary Input BSC(p) BSC(p) BSC(p) Majority function BSC(p) Binary Output 3. Derive the optimal decoding rule for a 2n-repetition code for use over a binary sym- metric channel with crossover probability p. Is the optimal decoding rule unique? Calculate the average probability of error for this code when the optimal decoding rule is used. 4. Consider a binary block code C of length n having minimum distance d min where d min is an odd integer. Show that when a overall parity bit is added to all the codewords in C we obtain a code of length n + 1 and minimum distance d min + 1.

description

error correcting codes assignment

Transcript of 605 Ass and Quiz 2011

Page 1: 605 Ass and Quiz 2011

EE 605: Error Correcting CodesInstructor: Saravanan Vijayakumaran

Indian Institute of Technology BombayAutumn 2011

Assignment 1 : 20 points Due date: August 4, 2010

Each of the following exercises is worth 5 points. Every nontrivial step in a proof shouldbe accompanied by justification.

1. Prove that the Hamming distance satisfies the triangle inequality, i.e. d(u,v) ≤d(u,w) + d(w,v) for all n-tuples u,v,w.

2. Calculate the crossover probability of the binary symmetric channel which is equiva-lent to the system below.

BSC(p)BinaryInput

BSC(p)

BSC(p)

BSC(p)

Majorityfunction

BSC(p)BinaryOutput

3. Derive the optimal decoding rule for a 2n-repetition code for use over a binary sym-metric channel with crossover probability p. Is the optimal decoding rule unique?Calculate the average probability of error for this code when the optimal decodingrule is used.

4. Consider a binary block code C of length n having minimum distance dmin where dmin

is an odd integer. Show that when a overall parity bit is added to all the codewordsin C we obtain a code of length n + 1 and minimum distance dmin + 1.

Page 2: 605 Ass and Quiz 2011

EE 605: Error Correcting CodesInstructor: Saravanan Vijayakumaran

Indian Institute of Technology BombayAutumn 2011

Solutions to Assignment 1

1. Prove that the Hamming distance satisfies the triangle inequality, i.e. d(u,v) ≤d(u,w) + d(w,v) for all n-tuples u,v,w.Solution: For a set A, let |A| denote its cardinality. We know that |A∪B| ≤ |A|+|B|and |A| ≤ |A ∪B|. Also, if |A| ≤ |B| then |Ac| ≥ |Bc|.Note that d(u,v) = |A| where A = {i|ui 6= vi}.

Ac = {i|ui = vi}⇒ Ac = {i|ui = vi = wi} ∪ {i|ui = vi 6= wi}⇒ |Ac| ≥ |{i|ui = vi = wi}| = |{i|ui = wi} ∩ {i|vi = wi}|⇒ |A| ≤ |{i|ui = wi}c ∪ {i|vi = wi}c| = |{i|ui 6= wi} ∪ {i|vi 6= wi}|⇒ |A| ≤ |{i|ui 6= wi}|+ |{i|vi 6= wi}|

⇒ d(u,v) ≤ d(u,w) + d(w,v)

2. Calculate the crossover probability of the binary symmetric channel which is equiva-lent to the system below.

BSC(p)BinaryInput

BSC(p)

BSC(p)

BSC(p)

Majorityfunction

BSC(p)BinaryOutput

u v

w1

w2

w3

x y

Solution: The crossover probability of the equivalent binary symmetric channel isPr[u 6= y].

Pr[u 6= y] = Pr[u 6= v] Pr[v = y] + Pr[u = v] Pr[v 6= y]

= (1− p) Pr[v = y] + pPr[v 6= y]

= (1− p) {Pr[v 6= x] Pr[x 6= y] + Pr[v = x] Pr[x = y]}+p {Pr[v 6= x] Pr[x = y] + Pr[v = x] Pr[x 6= y]}

= (1− p) {Pr[v 6= x]p + Pr[v = x](1− p)}+ p {Pr[v 6= x](1− p) + Pr[v = x]p}= 2p(1− p) Pr[v 6= x] + [p2 + (1− p)2] Pr[v = x]

Page 3: 605 Ass and Quiz 2011

The calculation is complete if we can calculate Pr[v = x] which is equal to theprobability that at most one of w1, w2, w3 is different from v because the majorityfunction can correct at most one error. This probability is equal to (1−p)3+3p(1−p)2.

3. Derive the optimal decoding rule for a 2n-repetition code for use over a binary sym-metric channel with crossover probability p. Is the optimal decoding rule unique?Calculate the average probability of error for this code when the optimal decodingrule is used.Solution: If the codewords are equally, the optimal decoding rule for the 2n-repetitioncode over a BSC is the minimum distance decoding rule. For each received vector,its distance to the all zeros and all ones 2n-tuples is calculated. We decide the allzeros codeword was sent if the distance of the received vector to it is smaller andthe all ones codeword was sent otherwise. But every received vector which has nzeros and n ones is equidistant to the all zeros and all ones codewords. Such receivedvectors can be decoded as either codeword without changing the average probabilityof error. Thus the optimal decoder is not unique. The average probability of error ofthe minimum distance decoder is

Pe =2n∑

i=n+1

(2n

i

)pi(1− p)2n−i +

1

2

(2n

n

)pn(1− p)n

4. Consider a binary block code C of length n having minimum distance dmin where dmin

is an odd integer. Show that when a overall parity bit is added to all the codewordsin C we obtain a code of length n + 1 and minimum distance dmin + 1.Solution: Consider any pair of codewords u,v which are at a distance dmin fromeach other. Since dmin is odd, u and v differ in an odd number of locations. If we addan overall parity bit to u and v, their parity bits will differ. For example, suppose∑n

i=1 vi = 0, then∑n

i=1 ui has to be 1 since we are changing an odd number of termsin the summation. So any pair of codewords in C which are at a distance dmin willbe at a distance dmin + 1 after the addition of the overall parity check.

Now consider any pair of codewords which are not a minimum distance dmin. Theyare at a distance of at least dmin + 1. After the addition of the overall parity checkbit, the distance between them will remain the same if their parity bits are the sameor increase by one if their parity bits are different. So they will still be at a distanceof at least dmin + 1.

Hence the minimum distance of the new code is dmin + 1.

2

Page 4: 605 Ass and Quiz 2011

EE 605: Error Correcting CodesInstructor: Saravanan Vijayakumaran

Indian Institute of Technology BombayAutumn 2011

Assignment 2 : 20 points Due date: August 30, 2011

Each of the following exercises is worth 5 points. Every nontrivial step in a proof shouldbe accompanied by justification.

1. Construct the standard array and syndrome decoding table for the (7, 4) linear blockcode with generator matrix

1 0 0 0 0 1 10 1 0 0 1 0 10 0 1 0 1 1 00 0 0 1 1 1 1

2. A burst error of length l is an error pattern which causes l consecutive locations in

the transmitted code to be corrupted. Let H be the parity check matrix of a binarylinear block code.

(a) What is the necessary and sufficient condition on the columns of H so that everyburst error of length up to t can be detected?

(b) What is the necessary and sufficient condition on the columns of H so that everyburst error of length up to t can be corrected?

3. Let C be (n, k) linear code. Let T be a set of coordinates of the codewords i.e.T ⊆ {1, 2, . . . , n}. Let CT be the code obtained by puncturing C on the coordinatesin T and let CT be the code obtained by shortening C on the coordinates in T . Provethat

(a) (C⊥)T = (CT )⊥

(b) (C⊥)T = (CT )⊥

4. Let C1 be a (n1, k1) binary linear block code with minimum distance d1 and let C2

be a (n2, k2) binary linear block code with minimum distance d2. The direct sum ofC1 and C2 is defined as

C1 ⊕ C2 = {(c1, c2)‖c1 ∈ C1, c2 ∈ C2}.

Show that C1 ⊕ C2 is a (n1 + n2, k1 + k2) linear block code with minimum distancemin(d1, d2). Derive the generator matrix of C1⊕C2 in terms of the generator matricesof C1 and C2. Derive the parity check matrix of C1⊕C2 in terms of the parity checkmatrices of C1 and C2.

Page 5: 605 Ass and Quiz 2011

EE 605: Error Correcting CodesInstructor: Saravanan Vijayakumaran

Indian Institute of Technology BombayAutumn 2011

Solutions to Assignment 2

1. Construct the standard array and syndrome decoding table for the (7, 4) linear blockcode with generator matrix

1 0 0 0 0 1 10 1 0 0 1 0 10 0 1 0 1 1 00 0 0 1 1 1 1

Solution:

The standard array is given in Table 1 and the syndrome decoding table is given inTable 2. The parity check matrix which is given by

H =

0 1 1 1 1 0 01 0 1 1 0 1 01 1 0 1 0 0 1

The syndrome decoding table is obtained by multiplying the coset leaders in thestandard array by HT .

2. A burst error of length l is an error pattern which causes l consecutive locations inthe transmitted code to be corrupted. Let H be the parity check matrix of a binarylinear block code.

(a) What is the necessary and sufficient condition on the columns of H so that everyburst error of length up to t can be detected?

Solution: We know that the syndrome of a received vector is equal to the syn-drome of the error pattern. If r = v+e where v is the transmitted codeword ande is the error vector, rHT = eHT . Suppose H has no zero columns, then everyerror pattern of weight 1 will be detected by a scheme which declares an errordetection whenever a nonzero syndrome is observed. Suppose no 2 consecutivecolumns in H add up to zero, then no error pattern with 2 consecutive oneswill result in a zero syndrome. Thus every burst of length two can be detectedby a scheme which declares an error detection whenever a nonzero syndrome isobserved. Similarly if no 3, 4, ..., t consecutive columns in H add up to zero, thenevery burst error of length upto t can be detected. Thus a sufficient conditionfor detecting a burst of length upto t is that H has no zero columns and thesum of any 2, 3, . . . , t consecutive columns is not zero.

We claim that the above sufficient condition is also necessary. Consider an errordetection scheme which is capable of detecting burst errors of length upto t.

Page 6: 605 Ass and Quiz 2011

Any error detection scheme for an (n, k) block code C is a partition of the spaceFn2 into two subsets E and Ec such that an error detection is declared when the

received vector r ∈ E. Since the scheme should not declare an error when theerror pattern e is the all zeros vector i.e. when r = v, we require C ⊆ Ec. Thusan error is not detected whenever r ∈ C. If a burst error of length upto t resultsin the received vector which is equal to a codeword then this error will not bedetected. So it is necessary that v + e /∈ C for any v ∈ C and any burst errore of length upto t. Since v + e /∈ C if and only if e /∈ C, it is necessary forevery burst error e of length upto t does not belong to C for the error detectionscheme to be able to detect it. Since e /∈ C ⇐⇒ eHT 6= 0, it is necessarythat eHT is not equal to zero for any burst error e of length up to t. Thus it isnecessary that there are no nonzero columns in H and no 2, 3, . . . , t consecutivecolumns of H add up to zero.

(b) What is the necessary and sufficient condition on the columns of H so that everyburst error of length up to t can be corrected?

Solution: Suppose that all the columns of H are nonzero and distinct. Alsosuppose that the sum of any 2, 3, . . . , t consecutive columns add up to a distinctvector. This is sufficient to correct any burst error of length upto t because eachone of these burst errors corresponds will result in a distinct syndrome (becauseit is a sum of columns). If r = v + e where v is the transmitted codeword ande is the error vector, rHT = eHT = s. A burst error vector e of length uptot can be identified from the syndrome (due to the uniqueness) and the errorsintroduced can be corrected by adding e to r.

To prove the necessity of the above condition, consider any error correctionscheme capable of correcting burst errors of length upto t. Any error correctionscheme for an (n, k) block code is a partition of the space F

n2 into 2k subsets

Ai, i = 1, 2, . . . , 2k each of which corresponds to a codeword. If r ∈ Ai, wedecode it as the codeword vi. Since the scheme is capable of correcting bursterrors of length upto t, it is necessary for vi + e to be in Ai where e is a bursterror of length upto t. Since the Ai’s are disjoint, we have vi + e1 6= vj + e2where i 6= j and e1, e2 are burst errors of length upto t. Multiplying both sidesby HT , we get e1H

T 6= e2HT for any two distinct burst errors of length upto t.

If we set e1 to be a weight one error pattern and e2 = 0, we see that e1HT 6= 0

which means that all the columns of H are necessarily nonzero. Setting bothe1 and e2 to be weight one error patterns we see that all the columns of H arenecessarily distinct. When e is an error pattern of weight two or more, eHT

corresponds to a sum of columns in H which needs to be necessarily distinct fordifferent values of e.

3. Let C be (n, k) linear code. Let T be a set of coordinates of the codewords i.e.T ⊆ {1, 2, . . . , n}. Let CT be the code obtained by puncturing C on the coordinatesin T and let CT be the code obtained by shortening C on the coordinates in T . Provethat

(a) (C⊥)T = (CT )⊥

Solution: Let u ∈ (C⊥)T . Then u is obtained by shortening a vector v in C⊥

on the coordinates in T . So v is zero in the coordinates specified by T . Since

2

Page 7: 605 Ass and Quiz 2011

v ∈ C⊥, we have∑n

i=1 viwi = 0 for all w ∈ C which implies∑

i∈T c viwi = 0(as vi = 0 for i ∈ T ). This implies that the vector x obtained by puncturingv on T is perpendicular to all the codewords in CT . But u = x as it is thevector obtained by puncturing v on T . Thus u ∈ (CT )⊥ and we have shown that(C⊥)T ⊆ (CT )⊥.

Let u ∈ (CT )⊥. Then u is perpendicular to all the codewords v ∈ CT . Eachv is obtained by puncturing a codeword w in C on the coordinates in T . Wecan extend the vector u to another vector x of length n such that x has zerosin the coordinates in T and is equal to u in the other coordinates. Now x isperpendicular to all the codewords w in C obtained by extending each v ∈ CT

(because u and v are perpendicular on T and x,w are extended versions of themwith x being zero in the new coordinates). Thus x ∈ C⊥. Since x has zeros onT and u can be obtained by puncturing x on T we conclude that u ∈ (C⊥)T .We have shown that (CT )⊥ ⊆ (C⊥)T .

Since each set is the subset of the other they have to be equal.

(b) (C⊥)T = (CT )⊥

Solution: Similar argument as in (a).

4. Let C1 be a (n1, k1) binary linear block code with minimum distance d1 and let C2

be a (n2, k2) binary linear block code with minimum distance d2. The direct sum ofC1 and C2 is defined as

C1 ⊕ C2 = {(c1, c2)‖c1 ∈ C1, c2 ∈ C2}.

Show that C1 ⊕ C2 is a (n1 + n2, k1 + k2) linear block code with minimum distancemin(d1, d2). Derive the generator matrix of C1⊕C2 in terms of the generator matricesof C1 and C2. Derive the parity check matrix of C1 ⊕C2 in terms of the parity checkmatrices of C1 and C2.

Solution: By definition, C1 ⊕ C2 is a nonempty subset of Fn1+n2

2 . To show that itis a linear code of dimension k1 + k2, we have to first show that it is a subspace ofFn1+n2

2 over F2. Consider any two elements x and y in C1 ⊕ C2. Then x = (x1, x2)and y = (y1, y2) for some x1, y1 ∈ C1 and x2, y2 ∈ C2. Their sum x + y is equal to(x1+x2, y1+y2). This sum belongs to C1⊕C2 because x1+x2 ∈ C1 and y1+y2 ∈ C2

(as C1 and C2 are linear codes). For any a ∈ F2 and x ∈ C1 ⊕ C2, ax = x orax = (0n1

, 0n2) where the former happens when a = 1 and the latter happens when

a = 0. Here 0niis a ni-tuple of zeros. In both cases ax ∈ C1 ⊕ C2. Thus C1 ⊕ C2

satisfies the two conditions required for a nonempty subset to be subspace. HenceC1 ⊕ C2 is a linear code.

To show that the dimension of C1⊕C2 is k1+k2, consider bases for C1 and C2. Let A ={a1, a2, . . . , ak1} be a basis for C1 and let B = {b1, b2, . . . , bk2} be a basis for C2. Weclaim that the setD = {(a1, 0n2

), (a2, 0n2), . . . , (ak1 , 0n2

), (0n1, b1), (0n1

, b2), . . . , (0n1, bk2}

is a basis for C1 ⊕ C2. Each element in this set is in C1 ⊕ C2 because ai, 0n1∈ C1

and bi, 0n2∈ C2. First we check that this set spans C1 ⊕ C2. Consider any element

in C1 ⊕ C2. It is of the form (x, y) where x ∈ C1 and y ∈ C2. Then x =∑k1

i=1 αiaiwhere αi ∈ F2 and y =

∑k2i=1 βibi where βi ∈ F2 because the ai’s form a basis for C1

3

Page 8: 605 Ass and Quiz 2011

and the bi’s form a basis for C2. We can write (x, 0n2) as

(x, 0n2) =

k1∑

i=1

αi(ai, 0n2)

and (0n1, y) as

(0n1, y) =

k2∑

i=1

βi(0n1, bi).

Combining these two equations we get

(x, y) =

k1∑

i=1

αi(ai, 0n2) +

k2∑

j=1

βj(0n1, bj).

Thus D spans C1 ⊕ C2. Now we need to show that the elements of D are linearlyindependent. Consider a linear combination of the vectors in D which is equal tozero.

k1∑

i=1

αi(ai, 0n2) +

k2∑

j=1

βj(0n1, bj) = (0n1

, 0n2) ⇒

k1∑

i=1

αiai = 0n1and

k2∑

j=1

βjbj = 0n2

Since the elements of A and B form a basis of C1 and C2 respectively, they are linearlyindependent and the above equation gives us αi = 0 and βi = 0. Thus the elementsof D are linearly independent. Since they also span C1 ⊕ C2, they form a basis forthis space. Since the number of elements in D is k1 + k2, the dimension of C1 ⊕ C2

is k1 + k2.

The basis D also gives us the structure of the generator matrix of C1 ⊕ C2. If G1 isthe generator matrix of C1, then it has the ai’s in the set A as its rows and if G2 isthe generator matrix of C2 then it has the bi’s in the set B as its rows. The generatormatrix for C1 ⊕ C2 has the elements in the set D as its rows. Thus it is given by

G =

[

G1 0k1×n2

0k2×n1G2

]

If H1 is the parity check matrix of C1 and H2 is the parity check matrix of C2, theparity check matrix of C1 ⊕ C2 is given by

H =

[

H1 0(n1−k1)×n2

0(n2−k2)×n1H2

]

This can be verified by writing v ·HT = 0 where v ∈ Fn1+n2

2 .

Since C1⊕C2 is a linear code, its minimum distance is equal to the minimum weightof its nonzero codewords. Let x be a nonzero codeword of minimum weight in C1

i.e. d1 = wH(x). Let y be a nonzero codeword of minimum weight in C2 i.e. d2 =wH(y). Then (x, 0n2

) ∈ C1 and (0n1, y) ∈ C2 because 0n1

∈ C1 and 0n2∈ C2. Since

4

Page 9: 605 Ass and Quiz 2011

wH((x, 0n2)) = d1 and wH((0n1

, y)) = d2, the minimum distance dmin of C1 ⊕ C2

satisfies the following inequality

dmin ≤ min(d1, d2).

Let z be a nonzero codeword in C1 ⊕ C2. Then z = (u, v) where u ∈ C1, v ∈ C2

and both u and v acannot be zero codewords. The Hamming weight of z is wH(z) =wH(u) + wH(v). Since at least one of u and v is nonzero and wH(u) ≥ d1 whenu 6= 0n1

, wH(v) ≥ d2 when v 6= 0n2, we have

wH(z) ≥ min(d1, d2).

Since z was an arbitrary nonzero codeword, we have

dmin ≥ min(d1, d2).

Thus dmin = min(d1, d2).

5

Page 10: 605 Ass and Quiz 2011

0000000 1000011 0100101 0010110 0001111 1100110 1010101 1001100 0110011 0101010 0011001 1110000 1101001 1011010 0111100 1111111

0000001 1000010 0100100 0010111 0001110 1100111 1010100 1001101 0110010 0101011 0011000 1110001 1101000 1011011 0111101 1111110

0000010 1000001 0100111 0010100 0001101 1100100 1010111 1001110 0110001 0101000 0011011 1110010 1101011 1011000 0111110 1111101

0000100 1000111 0100001 0010010 0001011 1100010 1010001 1001000 0110111 0101110 0011101 1110100 1101101 1011110 0111000 1111011

0001000 1001011 0101101 0011110 0000111 1101110 1011101 1000100 0111011 0100010 0010001 1111000 1100001 1010010 0110100 1110111

0010000 1010011 0110101 0000110 0011111 1110110 1000101 1011100 0100011 0111010 0001001 1100000 1111001 1001010 0101100 1101111

0100000 1100011 0000101 0110110 0101111 1000110 1110101 1101100 0010011 0001010 0111001 1010000 1001001 1111010 0011100 1011111

1000000 0000011 1100101 1010110 1001111 0100110 0010101 0001100 1110011 1101010 1011001 0110000 0101001 0011010 1111100 0111111

Table 1: Standard array for the code given in Exercise 1

6

Page 11: 605 Ass and Quiz 2011

Coset leader Syndrome0000000 0000000001 0010000010 0100000100 1000001000 1110010000 1100100000 1011000000 011

Table 2: Syndrome table for the code given in Exercise 1

7

Page 12: 605 Ass and Quiz 2011

EE 605: Error Correcting CodesInstructor: Saravanan Vijayakumaran

Indian Institute of Technology BombayAutumn 2011

Assignment 3 : 20 points Due date: October 10, 2011

Each of the following exercises is worth 5 points. Every nontrivial step in a proof shouldbe accompanied by justification.

1. Let g(X) be the generator polynomial of a binary cyclic code of length n.

(a) Show that if g(X) has X + 1 as a factor, the code contains no codewords of oddweight.

(b) If n is odd and X + 1 is not a factor of g(X), show that the code contains acodeword consisting of all ones.

(c) Show that the code has a minimum weight of at least 3 if n is the smallest integersuch that g(X) divides Xn + 1.

2. (a) For a cyclic code, if an error pattern e(X) is detectable, show that its ith cyclicshift e(i)(X) is also detectable.

(b) Let v(X) be a code polynomial in a cyclic code of length n. Let i be the smallestinteger such that v(i)(X) = v(X). Show that if i 6= 0, i is a factor of n.

3. Consider a binary (n, k) cyclic code C generated by g(X). Let g∗(X) = Xn−kg(X−1)be the reciprocal polynomial of g(X).

(a) Show that g∗(X) also generates an (n, k) cyclic code.

(b) Let C∗ be the cyclic code generated by g∗(X). Show that C and C∗ havethe same weight distribution. (Hint: If v(X) is a code polynomial in C, thenXn−1v(X−1) is a code polynomial in C∗).

4. Draw the Meggitt decoder circuit for the (7, 3) binary cyclic code generated by g(X) =(X + 1)(X3 + X + 1)

Page 13: 605 Ass and Quiz 2011

EE 605: Error Correcting CodesInstructor: Saravanan Vijayakumaran

Indian Institute of Technology BombayAutumn 2011

Solution to Assignment 3

1. Let g(X) be the generator polynomial of a binary cyclic code of length n.

(a) Show that if g(X) has X +1 as a factor, the code contains no codewords of oddweight.

Solution: Since every code polynomial in a cyclic code is a multiple of thegenerator polynomial g(X), every code polynomial has X + 1 as a factor. Thisimplies that c(1) = 0 for a code polynomial c(X) which in turn requires c(X) tohave an even number of terms. So every codeword is of even weight.

(b) If n is odd and X + 1 is not a factor of g(X), show that the code contains acodeword consisting of all ones.

Solution: The oddness of n is in fact not required for the existence of a codewordconsisting of all ones. We know that the generator polynomial g(X) dividesXn + 1. We have

a(X)g(X) = Xn + 1 = (X + 1)(Xn−1 +Xn−2 + · · ·+X + 1). (1)

Since X + 1 appears on the right hand side and is not a factor of g(X), it hasto be a factor of a(X). Let a(X) = (X + 1)b(X). This implies

b(X)g(X) = Xn−1 +Xn−2 + · · ·+X + 1. (2)

So g(X) divides Xn−1 +Xn−2 + · · ·+X + 1 and hence the all ones codeword iscontained in this code.

(c) Show that the code has a minimum weight of at least 3 if n is the smallest integersuch that g(X) divides Xn + 1.

Solution: For this question to be well defined n has to be at least 3. In theminimum weight calculation of a code, we consider only nonzero codewords. Soit is enough to show that weight one and weight two codewords do not exist.

If a weight one codeword exists, its corresponding code polynomial will be ofthe form X i for 0 ≤ i ≤ n− 1 which has to be divisible by g(X). The generatorpolynomial of a cyclic code has a nonzero constant term. We have g(X) 6= 1because otherwise g(X) would divide X + 1 which is not equal to Xn + 1 forn ≥ 3. So g(X) has at least two terms which implies that any polynomialmultiple of g(X) has at least two terms. Thus X i cannot be a multiple of g(X).In fact, X i and g(X) have no factors in common because if they do the commonfactor will have to be of the form Xj for 1 ≤ j ≤ i. Such a factor has zero as aroot but zero is not a root of g(X) because it has a nonzero constant term.

Page 14: 605 Ass and Quiz 2011

If a weight two codeword exists, its corresponding code polynomial will be ofthe form X i +Xj for 0 ≤ i < j ≤ n − 1 which has to be divisible by g(X). SoXj(X i−j + 1) has to be divisible by g(X). Since g(X) and Xj have no factorsin common, X i−j + 1 has to be divisible by g(X) but this is not possible sincei− j ≤ n− 1.

Since no weight one or two codewords exist, the minimum weight is at leastthree.

2. (a) For a cyclic code, if an error pattern e(X) is detectable, show that its ith cyclicshift e(i)(X) is also detectable.

Solution: If an error pattern e(X) is detectable, e(X) 6= 0 mod g(X). The ithcyclic shift e(i)(X) is equal to X ie(X) mod Xn + 1 where n is the blocklengthof the cyclic code. Let a(X) be the quotient when X ie(X) is divided by Xn+1.Then X ie(X) = a(X)(Xn + 1) + e(i)(X) which implies e(i)(X) = X ie(X) +a(X)(Xn + 1). If we divide both sides by g(X), we get

e(i)(X) mod g(X) = X ie(X) mod g(X) + a(X)(Xn + 1) mod g(X)

= X ie(X) mod g(X)

where the second equality is obtained by the fact that g(X) divides Xn+1. Theerror pattern e(i)(X) is undetectable if and only if e(i)(X) mod g(X) is equalto zero which happens if and only if X ie(X) mod g(X) is equal to zero. Sinceg(X) and X i have no factors in common (see solution to question 1(c)), g(X)would need to divide e(X). But this is not possible as e(X) mod g(X) is notequal to zero.

(b) Let v(X) be a code polynomial in a cyclic code of length n. Let i be the smallestinteger such that v(i)(X) = v(X). Show that if i 6= 0, i is a factor of n.

Solution: Since n cyclic shifts of a codeword of length n returns the codewordto the initial state, v(n)(X) = v(X). If i is not a factor of n, divide n by i to geta quotient q and remainder r (0 ≤ r < i), n = qi+ r. We get

v(X) = v(n)(X) = v(qi+r)(X) = v(i+[q−1]i+r)(X) = v([q−1]i+r)(X) = · · · = v(r)(X)

Since i is the smallest integer such that v(X) = v(i)(X) and 0 ≤ r < i, we musthave r = 0. Thus i divides n.

3. Consider a binary (n, k) cyclic code C generated by g(X). Let g∗(X) = Xn−kg(X−1)be the reciprocal polynomial of g(X).

(a) Show that g∗(X) also generates an (n, k) cyclic code.

Solution: Since any polynomial which divides Xn+1 generates an (n, k) cycliccode, we need to prove that g∗(X) divides Xn+1. Since g(X) generates an (n, k)cyclic code it has degree n− k and it divides Xn + 1. Let g(X)h(X) = Xn + 1where the degree of h(X) is k. We get

g(X−1)h(X−1) = X−n + 1

⇒ Xng(X−1)h(X−1) = Xn(X−n + 1) = 1 +Xn

⇒ Xn−kg(X−1)Xkh(X−1) = 1 +Xn.

2

Page 15: 605 Ass and Quiz 2011

Both Xn−kg(X−1) and Xkh(X−1) are polynomials in X since g(X) has degreen− k and h(X) has degree k. From the above expression, we see that g∗(X) =Xn−kg(X−1) divides Xn + 1 and as a consequence it generates an (n, k) cycliccode.

(b) Let C∗ be the cyclic code generated by g∗(X). Show that C and C∗ havethe same weight distribution. (Hint: If v(X) is a code polynomial in C, thenXn−1v(X−1) is a code polynomial in C∗).

Solution: Any codeword in C corresponds to a code polynomial v(X) =u(X)g(X) where the degree of u(X) is at most k − 1. The number of termsin v(X) corresponds to the weight of the corresponding codeword. The polyno-mial Xn−1v(X−1) has the same number of terms as v(X) albeit in reverse order.We will show that for every code polynomial in C there is a code polynomial inC∗ with the same number of terms. This will in turn prove that for every code-word in C there is an equal weight codeword in C∗. So the weight distributionsof these two codes will have to be the same. We have

v(X) = u(X)g(X)

Xn−1v(X−1) = Xn−1u(X−1)g(X−1)

Xn−1v(X−1) = Xk−1u(X−1)Xn−kg(X−1)

Xn−1v(X−1) = Xk−1u(X−1)g∗(X)

Since the degree of u(X) is at most k − 1, Xk−1u(X−1) is a polynomial. ThusXn−1v(X−1) is a polynomial multiple of g∗(X). It is thus a code polynomial inC∗. So for every code polynomial in C there is a code polynomial in C∗.

4. Draw the Meggitt decoder circuit for the (7, 3) binary cyclic code generated by g(X) =(X + 1)(X3 +X + 1)

Solution: For the Meggitt decoder, we need to identify all correctable error patternswhich have a one in the last location, i.e. the corresponding polynomial representationhas the term X6. For this code n = 7 and k = 3, so there are 2n−k = 24 = 16correctable error patterns. These can be found by constructing the standard array.First we calculate the eight codewords and find that the minimum weight of thenonzero codewords is four. So if we take weight one coset leaders the cosets willcontain vectors of weight at least three. So after we choose all weight one vectors ascoset leaders we are free to choose any weight two vector as a coset leader for theninth coset because it has not appeared so far in the standard array. But we choosethose weight two vectors as coset leaders which have a one in the last location so thatthe Megitt decoder can immediately correct it. When weight two vectors are chosenas coset leaders other weight two vectors can appear in the coset and hence care mustbe taken to make sure that they are not chosen as coset leaders for the subsequentcosets. There are

(

72

)

= 21 weight two vectors of length 7 and they all appear withinthe first 15 cosets. For the last coset, the coset leader has to be of weight three andwe choose it to be 0100011 because it has a one in the last location. We could alsohave chosen 0001101 or 1010001.

Once we have constructed the standard array, we see that the coset leaders of cosets2, 9, 10, 11, 12, 13, 14 and 16 have a one in the last location i.e. their corresponding

3

Page 16: 605 Ass and Quiz 2011

1 0000000 1011100 0101110 0010111 1110010 1001011 0111001 11001012 0000001 1011101 0101111 0010110 1110011 1001010 0111000 11001003 0000010 1011110 0101100 0010101 1110000 1001001 0111011 11001114 0000100 1011000 0101010 0010011 1110110 1001111 0111101 11000015 0001000 1010100 0100110 0011111 1111010 1000011 0110001 11011016 0010000 1001100 0111110 0000111 1100010 1011011 0101001 11101017 0100000 1111100 0001110 0110111 1010010 1101011 0011001 10001018 1000000 0011100 1101110 1010111 0110010 0001011 1111001 01001019 0000011 1011111 0101101 0010100 1110001 1001000 0111010 110011010 0000101 1011001 0101011 0010010 1110111 1001110 0111100 110000011 0001001 1010101 0100111 0011110 1111011 1000010 0110000 110110012 0010001 1001101 0111111 0000110 1100011 1011010 0101000 111010013 0100001 1111101 0001111 0110110 1010011 1101010 0011000 100010014 1000001 0011101 1101111 1010110 0110011 0001010 1111000 010010015 0100010 1111110 0001100 0110101 1010000 1101001 0011011 100011116 0100011 1111111 0001101 0110100 1010001 1101000 0011010 1000110

polynomials have a X6 term. So the error pattern detection circuit of the Megittdecoder should output a one when the syndromes corresponding to these coset leadersappears in the syndrome register. The truth table of the error pattern detection circuitis given in the last two columns of the following table. If the syndrome is representedas the bit string abcd, using Karnaugh map minimization we get the error patterndetection circuit to be equal to bd+ (b+ c)(ac + ac).

4

Page 17: 605 Ass and Quiz 2011

Coset leader Syndrome Syndrome (binary)1 0 0 0000 02 X6 X3 +X2 +X 0111 13 X5 X2 +X + 1 1110 04 X4 X3 +X2 + 1 1011 05 X3 X3 0001 06 X2 X2 0010 07 X X 0100 08 1 1 1000 09 X6 +X5 X3 + 1 1001 110 X6 +X4 X + 1 1100 111 X6 +X3 X2 +X 0110 112 X6 +X2 X3 +X 0101 113 X6 +X X3 +X2 0011 114 X6 + 1 X3 +X2 +X + 1 1111 115 X5 +X X2 + 1 1010 016 X6 +X5 +X X3 +X + 1 1101 1

5

Page 18: 605 Ass and Quiz 2011

EE 605: Error Correcting CodesInstructor: Saravanan Vijayakumaran

Indian Institute of Technology BombayAutumn 2011

Assignment 4 : 20 points Due date: November 11, 2011

Each of the following exercises is worth 5 points. Every nontrivial step in a proof shouldbe accompanied by justification.

1. Let F16 be the field generated by p(X) = 1 +X +X4. Let α be a primitive elementof F16 which is a root of p(X). Devise a circuit which is capable of multiplying anyelement in F16 by α7.

2. Consider a t-error-correcting binary BCH code of length n = 2m−1. If 2t+1 is a factorof n, prove that the minimum distance of the code is exactly2t + 1. You can assumethe BCH bound in your solution (dmin ≥ 2t + 1). (Hint: Let n = l(2t + 1). Showthat Xn+1

Xl+1is a code polynomial of weight 2t+ 1. Remember that a code polynomial

has α, α2, . . . , α2t as roots where α is a primitive element of F2m which has ordern = 2m − 1.)

3. Prove that the dual of a Reed-Solomon code is a Reed-Solomon code. (Hint : Thedual code of an (n, k) cyclic code with generator polynomial g(X) has generatorpolynomial Xkh(X−1) where h(X) = Xn

−1g(X)

.)

4. Consider a (2, 1) convolutional code with encoder matrixG(D) =[

1 +D2 1 +D +D2 +D3]

.

(a) Draw the encoder circuit.

(b) Draw the encoder state diagram.

(c) Is this encoder catastrophic? If yes, find an infinite weight information sequencewhich generates a codeword of finite weight.

Page 19: 605 Ass and Quiz 2011

EE 605: Error Correcting CodesInstructor: Saravanan Vijayakumaran

Indian Institute of Technology BombayAutumn 2011

Solution to Assignment 4

1. Let F16 be the field generated by p(X) = 1 +X +X4. Let α be a primitive elementof F16 which is a root of p(X). Devise a circuit which is capable of multiplying anyelement in F16 by α7.

Solution: Any element in the field F16 can be represented as a0+a1α+a2α2+a3α

3.If we multiply this element by α7, we get the element a0α

7 + a1α8 + a2α

9 + a3α10.

We have the following identities.

• α7 = α3 + α + 1

• α8 = α2 + 1

• α9 = α3 + α

• α10 = α2 + α + 1

Using these identities, the product can be written as

a0α7 + a1α

8 + a2α9 + a3α

10 = a0(α3 + α + 1) + a1(α

2 + 1) + a2(α3 + α) + a3(α

2 + α + 1)

= a0 + a1 + a3 + (a0 + a2 + a3)α + (a1 + a3)α2 + (a0 + a2)α

3

The circuit for multiplication by α7 can be now obtained by taking a register con-taining a0, a1, a2, a3 and using XOR gates to obtain a0 + a1 + a3, a0 + a2 + a3, a1 + a3and a0 + a2.

2. Consider a t-error-correcting binary BCH code of length n = 2m−1. If 2t+1 is a factorof n, prove that the minimum distance of the code is exactly2t + 1. You can assumethe BCH bound in your solution (dmin ≥ 2t + 1). (Hint: Let n = l(2t + 1). Showthat Xn+1

Xl+1is a code polynomial of weight 2t+ 1. Remember that a code polynomial

has α, α2, . . . , α2t as roots where α is a primitive element of F2m which has ordern = 2m − 1.)

Solution: Since the BCH bound gives us dmin ≥ 2t + 1, we will be done if we canshow the existence of a codeword whose weight is equal to 2t + 1. Let Y = X l. Thewe have the following identities.

Xn + 1

X l + 1=

X l(2t+1) + 1

X l + 1=

Y 2t+1 + 1

Y + 1= 1 + Y + Y 2 + · · ·+ Y 2t

= 1 +X l +X2l + · · ·+X2tl

So we can see that c(X) = Xn+1Xl+1

is a polynomial of weight 2t+ 1. We have

c(α) =αn + 1

αl + 1=

1 + 1

αl + 1= 0.

Page 20: 605 Ass and Quiz 2011

The above calculation is valid since the denominator αl + 1 6= 0 due to the fact thatl < n = 2m − 1 and α has order 2m − 1 (note that t ≥ 1). Similarly, we get

c(αi) =αni + 1

αli + 1=

1 + 1

αli + 1= 0

for i = 2, 3, . . . , 2t since 2tl < n. Hence c(X) is a codeword of weight 2t+ 1.

3. Prove that the dual of a Reed-Solomon code is a Reed-Solomon code. (Hint : Thedual code of an (n, k) cyclic code with generator polynomial g(X) has generatorpolynomial Xkh(X−1) where h(X) = Xn

−1g(X)

.)

Solution: Consider a t-error correcting Reed-Solomon code over a field Fq. Then thelength of the codewords is n = q−1. It has a generator polynomial g(X) =

∏2ti=1(X−

αi) where α is a primitive element of Fq. In any field Xq−1 − 1 =∏q−2

i=0 (X − αi) andconsequently we have

h(X) =Xn − 1

g(X)=

Xq−1 − 1

g(X)= (X − 1)

q−2∏

i=2t+1

(X − αi) =

q−1∏

i=2t+1

(X − αi)

since αq−1 = 1. Here the degree of h(X) is k (remember that the degree of thegenerator polynomial of an (n, k) cyclic code is n−k). Then the generator polynomialof the dual code is given by

Xkh(X−1) =

q−1∏

i=2t+1

(1− αiX).

Since αq−1 = 1, the generator polynomial of the dual code has roots αq−2t−2, αq−2t−1,. . ., αq−1. Thus the dual code is a Reed-Solomon code (see comment in Moodle forthe definition of a general RS code).

4. Consider a (2, 1) convolutional code with encoder matrixG(D) =[

1 +D2 1 +D +D2 +D3]

.

(a) Draw the encoder circuit.

(b) Draw the encoder state diagram.

(c) Is this encoder catastrophic? If yes, find an infinite weight information sequencewhich generates a codeword of finite weight.

Solution: The encoder is catastrophic since the greatest common divisor ofthe polynomials is 1 + D2 which is not of the form Dl. Consider the all onesinfinite length information sequence whose polynomial representation is givenby 1 + D + D2 + D3 + · · · = 1

1+D. The output corresponding to this input is

v(D) = 11+D

G(D) =[

1 +D 1 +D2]

.

2

Page 21: 605 Ass and Quiz 2011

EE 605: Error Correcting CodesInstructor: Saravanan Vijayakumaran

Indian Institute of Technology BombayAutumn 2011

Quiz 1 : 15 points Duration: 60 minutes

Each of the following questions is worth 5 points. Every nontrivial step in a proofshould be accompanied by justification.

1. Find the smallest binary linear block code which contains the following codewords{100101, 110010, 010111, 001011}. Find a systematic generator matrix for this code.What is the minimum distance of this code?

2. Let C1 and C2 be two linear block codes of same length n.

(a) Show that C1 ∩ C2 is a linear code.

(b) Show that C1 ∪ C2 is a linear code if and only if either C1 ⊆ C2 or C2 ⊆ C1.

3. Show that in every binary linear block code either all the codewords have even Ham-ming weight or exactly half of the codewords have even Hamming weight. Hint:∑n

i=1 vi = 0 for a codeword v of even weight or equivalently v ·1T = 0 where 1 is the1× n vector containing all ones.

Page 22: 605 Ass and Quiz 2011

EE 605: Error Correcting CodesInstructor: Saravanan Vijayakumaran

Indian Institute of Technology BombayAutumn 2011

Quiz 2 : 10 points Duration: 60 minutes

Every nontrivial step in a proof should be accompanied by justification.

1. Let m be a positive integer. If m is not a prime, prove that the set {1, 2, 3, . . . ,m−1}is not a group under modulo-m multiplication. [2 points]

2. Prove that a group G cannot have a subgroup H with |H| = n−1, where n = |G| > 2.

[2 points]

3. Prove that a nonzero finite field element β satisfies βm = 1 for some positive integerm if and only if m is divisible by the order of β. [3 points]

4. Construct a finite field F8 with 8 elements. You have to write down the addition andmultiplication tables for this field. [3 points]

Page 23: 605 Ass and Quiz 2011

EE 605: Error Correcting CodesInstructor: Saravanan Vijayakumaran

Indian Institute of Technology BombayAutumn 2011

Quiz 3 : 10 points Duration: 60 minutes

1. (a) Using the field F16 generated by the primitive polynomial p(X) = X4 +X3 + 1,determine the generator polynomial of the double error correcting binary BCHcode of length 15. The power and remainder representations of the field elementsin F16 in terms of a primitive element α are given below. [3 points]

0 01 1α α

α2 α2

α3 α3

α4 α3 + 1α5 α3 + α+ 1α6 α3 + α2 + α + 1α7 α2 + α+ 1α8 α3 + α2 + α

α9 α2 + 1α10 α3 + α

α11 α3 + α2 + 1α12 α + 1α13 α2 + α

α14 α3 + α2

(b) Suppose for the BCH code described above the error locator polynomial foundby the Berlekamp-Massey algorithm is σ(X) = 1 + α10X + α12X2. If the allzeros codeword was sent, determine a received vector r =

[

r0 r1 · · · rn−1

]

which results in this error locator polynomial. [3 points]

2. Determine the generator polynomial of a double error correcting Reed-Solomon codewith symbols from F16. Assume a primitive element α for F16 whose minimal poly-nomial is p(X) = X4+X3+1 (you can use the table above for calculations involvingα). What is the codeword corresponding to the following information bits? [4points]

u =[

0001 0001 0000 0000 · · · 0000]

Page 24: 605 Ass and Quiz 2011

EE 605: Error Correcting CodesInstructor: Saravanan Vijayakumaran

Indian Institute of Technology BombayAutumn 2011

Midsemester Exam : 30 points Duration: 120 minutes

Each of the following questions is worth 5 points.

1. Construct the standard array and syndrome decoding table for the (6, 3) binary linearblock code with generator matrix1 0 0 0 1 1

0 1 0 1 0 10 0 1 1 1 0

Decode the following received vectors using the syndrome table generated.

(a) 110110

(b) 110111

(c) 110001

2. Consider a binary linear code with generator matrix

G =

1 1 0 0 0 00 0 1 1 0 00 0 0 0 1 1

Suppose N codewords from this code are sent over a binary symmetric channel withcrossover probability p. What is the probability that no undetected errors occurduring this transmission?

3. State and prove the Singleton bound for binary block codes.

4. Let C1 be an (n, k1) binary linear block code with minimum distance d1 and let C2 bean (n, k2) binary linear block code with minimum distance d2. Consider the followingset of 2n-tuples

C = {(u,u+ v)|u ∈ C1,v ∈ C2}.

Prove that the set C is a binary linear block code with dimension k = k1 + k2 andminimum distance dmin = min{2d1, d2}.

5. Let C1 and C2 be two cyclic codes of same length n with generator polynomials g1(X)and g2(X) respectively. Show that C1 ⊆ C2 if and only if g2(X) divides g1(X).

6. Let C1 and C2 be two cyclic codes of same length n with generator polynomials g1(X)and g2(X) respectively. Show that C1 ∩ C2 is a cyclic code. What is its generatorpoynomial?