cyclic codes ii - mathematical and statistical scienceswcherowi/courses/m7823/cyclicii.pdf · 2005....

24
Cyclic Codes II

Upload: others

Post on 06-Aug-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

Cyclic Codes II

Page 2: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

Generator MatrixWe would now like to consider how the ideas we have previously discussed for linear codes are interpreted in this polynomial version of cyclic codes.

Theorem 6: If the generator polynomial g(x) of C has degree n-k then C is an [n,k]-cyclic code. If g(x) = a

0 + a

1x + a

2x2 + ... + a

n-k xn-k then a

generator matrix for C is the k × n matrix,

[g x

x g xx2 g x

⋮xk−1 g x

]= [a0 a1 a2 ⋯ an−k 0 0 ⋯ 00 a0 a1 ⋯ an−k−1 an−k 0 ⋯ 00 0 a0 ⋯ an−k−2 an−k−1 an−k ⋯ 0⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮0 0 0 ⋯ ⋯ ⋯ ⋯ ⋯ an−k

].

Page 3: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

Generator MatrixProof: The vectors g(x), xg(x), x2g(x), ..., xk-1g(x) are linearly independent. If not, there would exist coefficients {b

i} so that

b0g(x) + b

1xg(x) + b

2 x2 g(x) + ... + b

k-1 xk-1 g(x) = 0,

(b0 + b

1x + b

2x2 + ... + b

k-1 xk-1) g(x) = 0.

But this product has degree k - 1 + n - k = n - 1 < n, so it can not be ≡ 0 mod (xn - 1) unless all the b

i = 0.

Let c(x) ∈ C, then c(x) = b(x) g(x) and we may assume that b(x) has degree ≤ k – 1 (otherwise the product will have degree > n - 1 and we would reduce modulo (xn - 1) to get a b'(x) which satisfies this degree constraint). Thus, c(x) can be written as a linear combination of the xi g(x). The set of {xi g(x) }, 0 ≤ i ≤ k - 1 is thus a basis for C and so this cyclic code has dimension k. ❑

Page 4: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

Dual CodeNow that we have a polynomial approach to describe a cyclic code C, we consider the related polynomial representation of the dual code C⊥ of C. We shall see that C⊥ is a cyclic code if C is cyclic.

Consider h(x) = (xn - 1)/g(x) where g(x) is the generator of C. If the deg g(x) = n - k, then deg h(x) = k and it is also monic, so h(x) generates a cyclic code C' of dimension n - k. Now consider c

1(x) = a

1(x)g(x)∈ C and c

2(x) = a

2(x)h(x) ∈ C'. Then

c1(x) c

2(x) = a

1(x)g(x)a

2(x)h(x) = a

1(x)a

2(x)f(x) ≡ 0 (mod f(x)),

where f(x) = xn - 1. Therefore, using polynomial multiplication mod f(x), any codeword from C multiplies with any codeword from C' to give the polynomial 0. Does this imply that C' is the dual code of C? Unfortunately no, since the isomorphism that we set up does not preserve inner products. However, we now show that the codes C' and C⊥ are closely related - they are equivalent codes.

Page 5: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

Dual CodeConsider two vectors a = (a

0 a

1 ... a

n-1) ∈ C

and b = (b

0 b

1 ... b

n-1) ∈ C',

and the corresponding polynomial product

a xbx=∑i=0

n−1

ai xi∑i=0

n−1

bi xi≡∑i=0

n−1

ci xi mod xn−1

for some ci ∈ F. The constant term in this product is

c0 = a

0 b

0 + a

1b

n-1 + a

2 b

n-2 + ... + a

n-1 b

1,

since xn ≡ 1 (mod f(x)). Now c0 can be written as the inner product

c0 = a b'

where b' is the vector obtained from b by cyclically shifting b one position to the left and then reversing the order of the components (i.e., (b

0 b

n-1 b

n-2 ... b

1)).

Page 6: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

Dual CodeObserve that multiplying the polynomial

∑i=0

n−1

ci xi

by xn-t results in ct being the constant term, and hence the constant

term in the product a(x)(xn-t b(x)). Therefore, c

t = a b'

where b' is now the vector associated with xn-t b(x). In terms of b(x), b' is the vector obtained by cyclically shifting b t+1 positions to the left and then reversing the order of the components.

Page 7: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

ExampleConsider n = 3, and the vectors a = (a

0 a

1 a

2) and b = (b

0 b

1 b

2). Then

modulo x3 - 1, a(x)b(x) = (a

0 + a

1x + a

2 x2)(b

0 + b

1x + b

2 x2)

= (a0 b

0 + a

1b

2 + a

2 b

1) + (a

0 b

1 + a

1 b

0 + a

2 b

2)x

+ (a0 b

2 + a

1 b

1 + a

2 b

0)x2.

The coefficient of x2 is a(b2 b

1 b

0). This b vector is obtained from b

by shifting 3 ( = 2 + 1) positions to the left (putting b back into its original order) and then reversing the order of the components from last to first. The b-vector in the x coefficient is obtained from b by shifting 2 ( = 1 + 1) to the left, obtaining (b

2 b

0 b

1) and then

reversing the components.

Page 8: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

Parity Check MatrixNow since a(x)b(x) ≡ 0 mod (xn - 1), the coefficient of each power of x must be 0. From the discussion above, this implies that ac = 0 (i.e., a and c are orthogonal) whenever c is any cyclic shift of the vector obtained from b by reversing the components of b. Since h(x) generates C', {h(x), xh(x), ..., xn-k-1h(x) } is a basis for C' and G' = [h(x), xh(x), ..., xn-k-1h(x)]T is a generator matrix for C'. Now G' generates the code C' which has the same dimension n - k as C⊥.

Furthermore, taking b(x) in the above arguments to be h(x) itself, we see that the reverse of every vector in C' is orthogonal to every vector in C. It follows that if we reorder the columns of G' last to first, we obtain a matrix H which generates C⊥ , and hence is theparity-check matrix for C.

Page 9: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

ExampleSuppose we wish to construct a generator matrix and a parity-check matrix for a [7,4]- binary cyclic code. Since g(x) = 1 + x + x3 divides f(x) = x7 - 1, g(x) generates a [7,4] - cyclic code C. h(x) = f(x)/g(x) = 1 + x + x2 + x4 generates a [7,3]-cyclic code C'. A generator matrix for C is

G=[ g xx g xx2 g xx3 g x]= [

1 1 0 1 0 0 00 1 1 0 1 0 00 0 1 1 0 1 00 0 0 1 1 0 1].

Page 10: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

ExampleA generator matrix for C' is

G '=[ hxx hxx2 hx]= [

1 1 1 0 1 0 00 1 1 1 0 1 00 0 1 1 1 0 1].

H=[0 0 1 0 1 1 10 1 0 1 1 1 01 0 1 1 1 0 0].

Writing the columns of G' last to first, a generator matrix for C⊥ is

A simple check verifies that GHT = 0.

Page 11: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

Parity Check MatrixSince C' and C⊥ can be obtained from each other by reversing the components in all vectors, C' and C⊥ are equivalent codes. Recall a definition that we have seen before,

Definition : Let h(x) = a0 + a

1 x + ... + a

k xk be a polynomial of

degree k (ak ≠ 0). Define the reciprocal polynomial h

R (x) of h(x) by

hR x=∑i=0

k

ak−i xi .

Note that hR(x) = xk h(1/x), where k = deg h(x).

Theorem 7 : Let g(x) be a monic divisor of f(x) = xn - 1 of degree n-k, and hence the generator for a cyclic [n,k]-code C. Let h(x) = f(x)/g(x). Then h

R(x), the reciprocal poly of h(x), generates C⊥ .

Page 12: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

SyndromesLet us first consider an alternate form for the generator matrix of a cyclic code of the form [R, I

k] when C is an [n,k]-cyclic code. Let

g(x) be the generator polynomial for the code.

Divide xn-k+i by g(x) for 0 ≤ i ≤ k-1. This gives xn-k+i = q

i(x)g(x) + r

i(x)

where deg ri(x) < deg g(x) = n-k or r

i(x) = 0. Then

xn-k+i - ri(x) = q

i(x)g(x) ∈ C

is a set of k linearly independent code words and the matrix whose rows are these codewords is a generator matrix of the required form.

Page 13: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

ExampleConsider the binary [7,4]-cyclic code generated by g(x) = 1 + x + x3. By the division algorithm we compute, x3 = (1)(x3 + x + 1) + (1+ x) x4 = (x)(x3 + x + 1) + (x + x2) x5 = (x2 + 1)(x3 + x + 1) + (1 + x + x2) x6 = (x3 + x + 1)(x3 + x + 1) + (1 + x2).A generator matrix for this code is

G=[1 1 0 1 0 0 00 1 1 0 1 0 01 1 1 0 0 1 01 0 1 0 0 0 1]=[R I 4] where R=[1 1 0

0 1 11 1 11 0 1].

Notice that the rows of R are just the remainder polynomials.

Page 14: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

SyndromesThe corresponding parity-check matrix for this generator is H = [I

n-k -RT]. A reason for making this selection is that it affords a

convenient polynomial interpretation for the syndrome of a vector.

Theorem 8 : Let r(x) and s(x) be the respective polynomial representations of a vector r and its syndrome s = HrT. Then s(x) is the remainder polynomial when r(x) is divided by g(x).

Page 15: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

SyndromesProof: Suppose r(x) = a

0 + a

1 x + ... + a

n-1 xn-1. Noting that column i,

0 ≤ i ≤ n-k-1, of H corresponds to the polynomial xi and column j, n-k ≤ j ≤ n-1, corresponds to r

j-n+k(x), so that

s x=a0a1 x⋯an−k−1 xn−k−1an−k r0x⋯an−1 r k−1x=a0a1 x⋯an−k−1 xn−k−1an−k xn−k−q0x g x⋯

⋯an−1xn−1−qk−1x g x=r x−an−k q0x g x⋯an−1 qk−1x g x

=r x−h x g xwhere h(x) = a

n-k q

0(x) + ... + a

n-1 q

k-1(x). Thus r(x) = h(x)g(x) + s(x).

Since deg ri(x) ≤ n-k-1, it follows that deg s(x) ≤ n-k-1. By the

uniqueness of the quotient and remainder in the division algorithm for polynomials, we conclude that s(x) is the remainder when r(x) is divided by g(x). ❑

Page 16: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

SyndromesThus the syndrome of a vector can be determined by polynomial division. Furthermore, the syndrome of a vector and its cyclic shift are closely related. Suppose r(x) = q(x)g(x) + s(x),where deg s(x) is at most n-k-1. By the above theorem s(x) is the syndrome of r(x). Now xr(x) = xq(x)g(x) + xs(x).If xs(x) has degree at most n-k-1, then again by the above theorem it is the syndrome of xr(x). Otherwise, the syndrome of xr(x) is the remainder when xs(x) is divided by g(x). In this case, let

s x = ∑i=0

n−k−1

si xi=s x sn−k−1 xn−k−1 , where degree s x ≤n−k−2.

Page 17: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

SyndromesLet the (monic) generator polynomial be,

g x=∑i=0

n−k

g i xi= g xxn−k , degree g x≤ n−k−1.

x s x=x s xsn−k−1g x− g x=sn−k−1 g xx s x−sn−k−1 g x ,

where degree x s x−sn−k−1 g x≤ n−k−1.

Then

Now by the uniqueness of the remainder in the division algorithm and the previous theorem, we see that the syndrome of xs(x) is xs(x) - s

n-k-1 g(x). We summarize this as,

Page 18: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

SyndromesTheorem 9 : Let C be a cyclic [n,k]-code over F with generator polynomial g(x), and let r(x) be a polynomial with syndrome s(x) = s

0 + s

1 x + ... + s

m xm. Then the syndrome of xr(x) is

xs(x) if deg s(x) < n-k-1, and

xs(x) - sn-k-1

g(x), if deg s(x) = n-k-1. ❑

Page 19: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

ExampleConsider the previous example with g(x) = 1 + x + x3. From the generator matrix written there, we may form the parity check matrix,

H=[ I 3−RT ]=[1 0 0 1 0 1 10 1 0 1 1 1 00 0 1 0 1 1 1].

Consider r = (1011011). The syndrome of r is HrT = (001)T = s. Now, r(x) = 1 + x2 + x3 + x5 + x6.If we divide r(x) by g(x), we get r(x) = (x3 + x2 + x + 1)g(x) + x2. The remainder is, as expected, s. To compute the syndrome of a cyclic shift of r, let w = (1101101) which corresponds to the polynomial xr(x). HwT = (110)T. Using polynomial operations, since deg s(x) = 2 = n-k-1, the syndrome of xr(x) is xs(x) - 1g(x) = x3 - (x3 + x + 1) = 1 + x.

Page 20: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

Error TrappingThe preceding observations lead us to an interesting method of decoding certain error patterns in cyclic codes. The technique is sometimes referred to as error trapping.

Suppose C is an [n,k]-code with minimum distance d = 2t + 1, and parity-check matrix H = [I

n-k A]. Let c be a codeword and e an error

pattern of weight at most t. If r = c + e is received, then the syndrome of r is s = H rT = H (c + e)T = H eT.Let e* = (sT, 0), where 0 is the k-tuple of all 0's. Then H e*T = s, and e* and e have the same syndrome, so are in the same coset of C. Now suppose wt(s) ≤ t. Then wt(e*) ≤ t and it follows that e = e* since a coset can contain at most one vector of weight less than or equal to t. Hence, the error is known to be e = (sT,0) in this case.

Page 21: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

Error Trapping

Now suppose C is cyclic with generating polynomial g(x). Let e be an error pattern of weight at most t with a cyclic run of at least k 0's. Then there is some i, 0 ≤ i ≤ n-1, such that a cyclic shift of e through i positions is a vector whose non-zero components all lie within the first n-k components. For this i, wt(s

i(x)) ≤ t, where

si(x) is the syndrome of xi e(x) mod (xn - 1). If we compute s

i(x) as

the remainder of xi r(x) divided by g(x), then when wt(si(x)) ≤ t, for

this i by the above argument xi e(x) = (si,0). Thus e(x) = xn-i(s

i,0).

Page 22: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

Error TrappingThis gives rise to the following algorithm (stated for the binary case, but easily modifiable for the q-ary case): (1) Compute the syndrome s

0(x) of r(x) from the division algorithm.

(2) Set i = 0.(3) If wt(s

i(x)) ≤ t, then set e(x) = xn-i(s

i,0), and decode to r(x) - e(x).

(4) Set i = i + 1.(5) If i = n then stop; the error pattern is not trappable.(6) If deg s

i-1(x) < n-k-1, then set s

i(x) = xs

i-1(x);

otherwise si(x) = xs

i-1(x) - g(x).

(7) Go to (3).

Page 23: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

Example g(x) = 1 + x2 + x3 generates a binary [7,4]-cyclic code having minimum distance 3 (and so is 1-error correcting). Consider the codeword 1 + x + x5 = (1 + x + x2) g(x), if upon transmission r(x) = 1 + x + x5 + x6 is received we would decode as follows. Divide r(x) by g(x) to find the syndrome, r(x) = (x3 + 1)g(x) + (x + x2),so s(x) = x + x2. Since the weight of s(x) is > 1 (= t), we compute the syndrome s

1(x) of xr(x). As the degree of s(x) = 2 = n - k - 1, we

mutiply s(x) by x and subtract g(x) to get s1(x) = 1. As this has

weight 1, we obtain the error pattern e(x) = x7-1(s

1,0) = x6(1000000) = x6.

Since for n = 7 all error patterns of weight 1 have a cyclic run of six 0's and 6 > k = 4, this technique will correct all single errors.

Page 24: Cyclic Codes II - Mathematical and Statistical Scienceswcherowi/courses/m7823/cyclicII.pdf · 2005. 10. 14. · Dual Code Now that we have a polynomial approach to describe a cyclic

Example g(x) = 1 + x4 + x6 + x7 + x8 generates a binary [15,7]-cyclic code. If the minimum distance of this code is 5, then t = 2. Any (at most) weight 2 error pattern must contain a run of at least 7 0's and so can be trapped. If a received 15-tuple is r = (1100 1110 1100 010)we calculate, r(x) = (x + x2 + x4 + x5)g(x) + (1 + x2 + x5 + x7).We then compute the syndrome s

i(x) of xi r(x) until wt(s

i(x)) ≤ 2.

s0(x) = 10100101 s

1(x) = 11011001 s

2(x) = 11100111

s3(x) = 11111000 s

4(x) = 01111100 s

5(x) = 00111110

s6(x) = 00011111 s

7(x) = 10000100

Thus the error pattern is e = x15-7(s

7,0) = x8(100001000000000) = (0000 0000 1000 010),

and we decode r(x) to r - e = (1100 1110 0100 000).