Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Алгебра_1 / Gilbert - Modern algebra with applications.pdf
Скачиваний:
41
Добавлен:
23.02.2015
Размер:
2.55 Mб
Скачать

270

 

 

14 ERROR-CORRECTING CODES

TABLE 14.5. Detection Capabilities of Various Codes

 

 

 

 

 

 

 

 

 

 

Minimum Distance

Number of

Number of

 

 

 

between

Errors

Errors

Information

Code

 

Code Words

Detectable

Correctable

Rate

 

 

 

 

 

 

(3,2)

parity check code

2

1

0

2/3

(3,1)

repeating code

3

2

1

1/3

General (n, k) code

d

d 1

(d 1)/2

k/n

POLYNOMIAL REPRESENTATION

There are various ways that a word of n binary digits can be represented algebraically. One convenient way is by means of a polynomial in Z2[x] of degree less than n. The word a0a1 · · · an1 can be represented by the polynomial

a0 + a1x + · · · + an1xn1 Z2[x].

We now use this representation to show how codes can be constructed.

Let p(x) Z2[x] be a polynomial of degree n k. The polynomial code generated by p(x) is an (n, k)-code whose code words are precisely those polynomials, of degree less than n, which are divisible by p(x).

A message of length k is represented by a polynomial m(x), of degree less than k. In order that the higher-order coefficients in a code polynomial carry the message digits, we multiply m(x) by xnk . This has the effect of shifting the message n k places to the right. To encode the message polynomial m(x), we divide xnk m(x) by p(x) and add the remainder, r(x), to xnk m(x) to form the code polynomial

v(x) = r(x) + xnk m(x).

This code polynomial is always a multiple of p(x) because, by the division algorithm,

xnk m(x)

=

q(x)

·

p(x)

+

r(x) where deg r(x) < n

k

or r(x)

=

0;

 

 

 

 

 

thus

v(x) = r(x) + xnk m(x) = −r(x) + xnk m(x) = q(x) · p(x).

(Remember r(x) = −r(x) in Z2[x].) The polynomial xnk m(x) has zeros in the n k lowest-order terms, whereas the polynomial r(x) is of degree less than n k; hence the k highest-order coefficients of the code polynomial v(x) are the message digits, and the n k lowest-order coefficients are the check digits. These check digits are precisely the coefficients of the remainder r(x).

POLYNOMIAL REPRESENTATION

 

 

 

 

 

 

 

 

 

 

 

271

For example, let p(x) = 1 + x2 + x3 + x4

be the generator polynomial of a

(7, 3)-code. We encode the message 101 as follows:

 

 

 

 

 

 

 

message = 1

0

 

1

 

 

 

 

 

 

 

 

 

m(x) = 1

 

 

+ x2

 

 

 

+ x6

 

x4m(x) =

 

 

 

 

 

 

 

 

x4

 

r(x) = 1 + x

 

 

 

 

+ x4

+ x6

v(x) = r(x) + x4m(x) = 1 + x

 

 

 

 

 

code word = 1

1

 

0

0

1 0

1

 

 

check

 

digits

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

message

 

 

 

x2 + x + 1

 

 

 

 

 

 

 

x4 + x3 + x2 + 0 + 1 x6

 

 

 

+x4

 

 

 

 

 

 

 

 

 

 

 

x6+x5+x4

 

+x2

 

 

 

 

 

 

 

 

 

x5

 

 

 

 

+x2

 

 

 

 

 

 

 

 

 

x5+x4

+x3

+x

 

 

 

 

 

 

 

 

 

 

 

 

 

x4

+x3+x2+x

+1

 

 

 

 

 

 

 

 

 

 

 

x4

+x3+x2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

x+1

 

The generator polynomial p(x) = a0 + a1x + · · · + ank xnk is always chosen so that a0 = 1 and ank = 1, since this avoids wasting check digits. If a0 = 0, any code polynomial would be divisible by x and the first digit of the code word would always be 0; if ank = 0, the coefficient of xnk1 in the code polynomial would always be 0.

Example 14.3. Write down all the code words for the code generated by the polynomial p(x) = 1 + x + x3 when the message length k is 3.

Solution. Since deg p(x) = 3, there will be three check digits, and since the message length k is 3, the code word length n will be 6. The number of messages

is 2k = 8.

 

 

 

 

 

x + 1

 

 

 

x3 + 0 + x + 1 x4+x3

 

 

 

 

 

x4

+x2

+x

 

 

 

x3+x2

+x

 

 

 

x3

 

x+1

x2 +1

Consider the message 110, which is represented by the polynomial m(x) = 1 + x. Its check digits are the coefficients of the remainder r(x) = 1 + x2,

272

14 ERROR-CORRECTING CODES

obtained by dividing x3m(x) = x3 + x4 is v(x) = r(x) + x3m(x) = 1 + x2 + x3

Table 14.6 shows all the code words.

by p(x). Hence the code polynomial

+ x4, and the code word is 101110.

A received message can be checked for errors by testing whether it is divisible by the generator polynomial p(x). If the remainder is nonzero when the received polynomial u(x) is divided by p(x), an error must have occurred during transmission. If the remainder is zero, the received polynomial u(x) is a code word, and either no error has occurred or an undetectable error has occurred.

Example 14.4. If the generator polynomial is p(x) = 1 + x + x3, test whether the following received words contain detectable errors: (i) 100011, (ii) 100110, (iii) 101000.

Solution. The received polynomials are 1 + x4 + x5, 1 + x3 + x4, and 1 + x2, respectively. These contain detectable errors if and only if they have nonzero remainders when divided by p(x) = 1 + x + x3.

x2 + x + 1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

x + 1

 

 

 

 

 

 

 

3

 

 

 

5

4

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

x

 

+ x + 1

 

x

 

+x

+ 0+ 0+0+1

 

3

+ x + 1

 

4

+x

3

+ 0+0+1

 

 

 

 

x

5

 

 

+x

3

+x

2

 

x

 

 

x

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

x4

 

 

 

 

 

+x2+x

 

 

 

 

 

 

 

4

+x

3

+x

2

+1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

x

 

 

 

 

 

 

 

 

 

 

x

3

+x

2

+x

+1

 

 

 

 

 

 

 

x4

 

 

 

+x2+x

 

 

 

 

 

 

 

 

3

 

 

 

 

 

 

 

 

 

 

x

3

 

 

+x+1

 

 

 

 

 

 

 

 

x

 

 

 

+x+1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

x

2

 

 

 

 

 

 

 

 

 

 

 

 

x3

 

 

+x+1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

x3 + x + 1 x2+0+1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

x2

 

+1

 

 

Hence 1 + x4 + x5 is divisible by p(x), but 1 + x3 + x4 and 1 + x2 are not. Therefore, errors have occurred in the latter two words but are unlikely to have occurred in the first.

Table 14.6 lists all the code words for this code. Hence, in Example 14.4 we can tell at a glance whether a word is a code word simply by noting whether it is on this list. However, in practice, the list of code words is usually so large that it is easier to calculate the remainder when the received polynomial is divided by the generator polynomial.

POLYNOMIAL REPRESENTATION

 

 

 

 

 

273

TABLE 14.6. (6, 3) Code Generated by 1 + x + x 3

 

 

 

 

 

 

 

 

 

 

Code Word

 

 

 

 

 

 

 

 

 

Message

 

 

 

Check Digits

 

 

Message Digits

 

 

 

 

 

 

 

 

 

 

0

0

0

0

0

0

 

0

0

0

1

0

0

1

1

0

 

1

0

0

 

0

1

0

0

1

1

 

0

1

0

 

0

0

1

1

1

1

 

0

0

1

 

1

1

0

1

0

1

 

1

1

0

 

1

0

1

0

0

1

 

1

0

1

 

0

1

1

1

0

0

 

0

1

1

 

1

1

1

0

1

0

 

1

1

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1

x

x2

1

x

x2

 

x3

x4

x5

 

 

Furthermore,

this

remainder can

easily

be computed

using shift

registers.

Figure 14.6 shows a shift register for dividing by 1 + x + x3. The square boxes represent unit delays, and the circle with a cross inside denotes a modulo 2 adder (or exclusive OR gate).

The delays are initially zero, and a polynomial u(x) is fed into this shift register with the high-order coefficients first. When all the coefficients of u(x) have been fed in, the delays contain the remainder of u(x) when divided by 1 + x + x3. If these are all zero, the polynomial u(x) is a code word; otherwise, a detectable error has occurred. Table 14.7 illustrates this shift register in operation.

The register in Figure 14.6 could be modified to encode messages, because the check digits for m(x) are the coefficients of the remainder when x3m(x)

x3 = 1 + x

u(x)

(high order first)

x0

x1

x 2

Figure 14.6.

Shift register for dividing by 1 + x + x3.

 

 

Message

 

 

 

 

 

m(x)

 

 

 

 

 

 

 

 

 

 

Encoded

 

 

 

1

 

message

 

 

 

OR

 

x0

 

x1

x 2

v(x)

 

 

 

 

 

2

 

 

Figure 14.7.

Encoding circuit for a code generated by 1 + x + x3.

 

274

 

 

 

 

 

 

14

ERROR-CORRECTING CODES

TABLE 14.7. Contents of the Shift Register When

 

 

1 + x 3 + x 4 Is Divided by 1 + x + x 3

 

 

 

 

 

Received Polynomial

 

 

Register

 

 

 

Waiting to Enter

 

 

Contents

 

 

Stage

 

Register

 

 

x0

x1

x2

 

0

1 0

0

1

1

0

0

0

0

register initially zero

1

1

0

0

1

1

0

0

0

 

2

 

1

0

0

1

1

0

0

 

3

 

 

1

0

0

1

1

0

 

4

 

 

 

1

0

0

1

1

 

5

 

 

 

 

1

1

1

1

remainder is x2

6

 

 

 

 

 

0

0

1

is divided by 1 + x + x3. However, the circuit in Figure 14.7 is more efficient for encoding. Here the message m(x) is fed simultaneously to the shift register and the output. While m(x) is being fed in, the switch is in position 1 and the remainder is calculated by the register. Then the switch is changed to position 2, and the check digits are let out to immediately follow the message.

This encoding circuit could also be used for error detection. When u(x) is fed into the encoding circuit with the switch in position 1, the register calculates the remainder of x3u(x) when divided by p(x). However, u(x) is divisible by p(x) if and only if x3u(x) is divisible by p(x), assuming that p(x) does not contain a factor x.

How is the generator polynomial chosen so that the code has useful properties without adding too many check digits? We now give some examples.

Proposition 14.5. The polynomial p(x) = 1 + x generates the (n, n 1) parity check code.

Proof. By Proposition 9.33, a polynomial in Z2[x] is divisible by 1 + x if and only if it contains an even number of nonzero coefficients. Hence the code words of a code generated by 1 + x are those words containing an even number of 1’s. The check digit for the message polynomial m(x) is the remainder when xm(x) is divided by 1 + x. Therefore, by the remainder theorem, Theorem 9.4, the check digit is m(1), the parity of the number of 1’s in the message. This code is the parity check code.

The (3, 1) code that repeats the single message digit three times has code words 000 and 111, and is generated by the polynomial 1 + x + x2.

We now give one method, using primitive polynomials, of finding a generator for a code that will always detect single, double, or triple errors. Furthermore, the degree of the generator polynomial will be as small as possible so that the check digits are reduced to a minimum. Recall (see Proposition 11.29) that an

irreducible polynomial p(x) of degree m over Z

 

p(x) (

1 +

xk )

for k = 2m 1 and for no smaller k.

2 is primitive if

|

 

POLYNOMIAL REPRESENTATION

275

Theorem 14.6. If p(x) is a primitive polynomial of degree m, then the

(n, n m)-code generated by p(x) detects all single and double errors whenever n 2m 1.

Proof. Let v(x) be a transmitted code word and u(x) = v(x) + e(x) be the received word. The polynomial e(x) is called the error polynomial. An error is detectable if and only if p(x) |u(x). Since p(x) does divide the code word v(x), an error e(x) will be detectable if and only if p(x) |e(x).

If a single error occurs, the error polynomial contains a single term, say xi , where 0 i < n. Since p(x) is irreducible, it does not have 0 as a root; therefore, p(x) |xi , and the error xi is detectable.

If a double error occurs, the error polynomial e(x) is of the form xi + xj where 0 i < j < n. Hence e(x) = xi (1 + xj i ), where 0 < j i < n. Now

p(x) |xi , and since p(x) is primitive, p(x) |(1 + xj i ) if j i < 2m 1. Since

p(x) is irreducible, p(x) |xi (1 + xj i ) whenever

n 2m 1, and all double

errors are detectable.

 

Corollary 14.7. If p1(x) is a primitive polynomial of degree m, the

(n, n m 1)-code generated by p(x) = (1 +m

1(x) detects all double errors

x)p

 

and any odd number of errors whenever n 2 1.

Proof. The code words in the code generated by p(x) must be divisible by p1(x) and by (1 + x). The factor (1 + x) has the effect of adding an overall parity check digit to the code. By Proposition 9.33, all the code words have an even number of terms, and the code will detect any odd number of errors. Since the code words are divisible by the primitive polynomial p1(x), the code will detect all double errors if n 2m 1.

Some primitive polynomials of low degree are given in Table 14.8. For example, by adding 11 check digits to a message of length 1012 or less, using the generator polynomial (1 + x)(1 + x3 + x10) = 1 + x + x3 + x4 + x10 + x11, we can detect single, double, triple, and any odd number of errors. Furthermore, the

TABLE 14.8. Short Table of Primitive Polynomials

in Z2[x ]

Primitive Polynomial

 

Degree m

2m 1

1

+ x

 

 

 

2

 

 

 

 

 

1

1

1

+ x + x

3

 

 

 

 

 

2

3

1

+ x + x

4

 

 

 

 

 

3

7

1

+ x

2+ x

6

5

 

 

 

 

4

15

1

+ x

 

+

 

 

 

 

 

 

5

31

 

 

 

 

x

 

 

 

 

 

 

 

1

+ x

3+ x

 

7

 

 

 

 

6

63

1

+ x

2

+ x

3

+ x

4

+ x

8

7

127

1

+ x

4

+ x

9

 

 

8

255

1

+ x

3

+ x

10

 

 

 

9

511

1

+ x

 

+ x

 

 

 

 

 

10

1023