elec 6131: error detecting and correcting codes

23
LECTURE 4: Linear Block Codes ELEC 6131: Error Detecting and Correcting Codes Instructor: Dr. M. R. Soleymani, Office: EV-5.125, Telephone: 848-2424 ext: 4103. Time and Place: Tuesday, 17:45 โ€“ 20:15. Office Hours: Tuesday, 15:00 โ€“ 17:00

Upload: others

Post on 04-Feb-2022

13 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ELEC 6131: Error Detecting and Correcting Codes

LECTURE 4: Linear Block Codes

ELEC 6131: Error Detecting and Correcting Codes

Instructor: Dr. M. R. Soleymani, Office: EV-5.125, Telephone: 848-2424 ext: 4103. Time and Place: Tuesday, 17:45 โ€“ 20:15.Office Hours: Tuesday, 15:00 โ€“ 17:00

Page 2: ELEC 6131: Error Detecting and Correcting Codes

Linear Block Codes In a digital communication system, the sequence of bits to be transmitted are arranged in

blocks of ๐‘˜๐‘˜ bits. So, there are 2๐‘˜๐‘˜ possible ๐‘˜๐‘˜-tuples to be transmitted. In a block code, the encoder assigns ๐‘›๐‘› bits to each ๐‘˜๐‘˜-tuple where ๐‘›๐‘› > ๐‘˜๐‘˜. For a block code to be useful we require that all of 2๐‘˜๐‘˜, ๐‘›๐‘›-tuples (called codewords) be distinct. That is there should be a 1-to-1 correspondence between the input ๐‘ข๐‘ข and the output ๐‘ฃ๐‘ฃ of the encoder.

Unless the codewords are structured according to a certain structure, the encoding (and obviously decoding) will be prohibitively complex. That is why we are interested in linearblock codes. A code is linear if a linear combination of any two of its codewords is a codeword, or equivalently:

Definition: a block code of length ๐‘›๐‘› and 2๐‘˜๐‘˜ codewords is an (๐‘›๐‘›, ๐‘˜๐‘˜) linear code if and only if its 2๐‘˜๐‘˜ codewords form the ๐‘˜๐‘˜-dimensional subspace of the vector space of ๐‘›๐‘›-tuples over ๐บ๐บ๐บ๐บ(2).

Block Encoderk bits n bits

Page 3: ELEC 6131: Error Detecting and Correcting Codes

Linear Block Codes A linear (๐‘›๐‘›, ๐‘˜๐‘˜) code ๐ถ๐ถ is a ๐‘˜๐‘˜-dimensional subspace of all the binary ๐‘›๐‘›-tuples (๐‘‰๐‘‰๐‘›๐‘›). So,

we can find ๐‘˜๐‘˜ linearly independent members of ๐ถ๐ถ, say ๐‘”๐‘”0,๐‘”๐‘”1,โ‹ฏ ,๐‘”๐‘”๐‘˜๐‘˜โˆ’1 such that any๐‘ฃ๐‘ฃ โˆˆ ๐‘‰๐‘‰ can be written as:

๐‘ฃ๐‘ฃ = ๐‘ข๐‘ข0๐‘”๐‘”0 + ๐‘ข๐‘ข1๐‘”๐‘”1 + โ‹ฏ+ ๐‘ข๐‘ข๐‘˜๐‘˜โˆ’1๐‘”๐‘”๐‘˜๐‘˜โˆ’1.

Arranging these ๐‘˜๐‘˜ linearly independent in a matrix:

๐บ๐บ =

๐‘”๐‘”0๐‘”๐‘”1โ‹ฎ

๐‘”๐‘”๐‘˜๐‘˜โˆ’1

=

๐‘”๐‘”00 ๐‘”๐‘”01 โ‹ฏ ๐‘”๐‘”0,๐‘›๐‘›โˆ’1๐‘”๐‘”10 ๐‘”๐‘”11 โ‹ฏ ๐‘”๐‘”1,๐‘›๐‘›โˆ’1โ‹ฎ

๐‘”๐‘”๐‘˜๐‘˜โˆ’1,0

โ‹ฎ๐‘”๐‘”๐‘˜๐‘˜โˆ’1,1

โ‹ฎโ‹ฏ ๐‘”๐‘”๐‘˜๐‘˜โˆ’1,๐‘›๐‘›โˆ’1

where ๐บ๐บ is a ๐‘˜๐‘˜ ร— ๐‘›๐‘›, binary matrix.

Page 4: ELEC 6131: Error Detecting and Correcting Codes

Linear Block Codes A linear (๐‘›๐‘›, ๐‘˜๐‘˜) code ๐ถ๐ถ is a ๐‘˜๐‘˜-dimensional subspace of all the binary ๐‘›๐‘›-tuples (๐‘‰๐‘‰๐‘›๐‘›). So,

we can find ๐‘˜๐‘˜ linearly independent members of ๐ถ๐ถ, say ๐‘”๐‘”0,๐‘”๐‘”1,โ‹ฏ ,๐‘”๐‘”๐‘˜๐‘˜โˆ’1 such that any๐‘ฃ๐‘ฃ โˆˆ ๐‘‰๐‘‰ can be written as:

๐‘ฃ๐‘ฃ = ๐‘ข๐‘ข0๐‘”๐‘”0 + ๐‘ข๐‘ข1๐‘”๐‘”1 + โ‹ฏ+ ๐‘ข๐‘ข๐‘˜๐‘˜โˆ’1๐‘”๐‘”๐‘˜๐‘˜โˆ’1.

Arranging these ๐‘˜๐‘˜ linearly independent in a matrix:

๐บ๐บ =

๐‘”๐‘”0๐‘”๐‘”1โ‹ฎ

๐‘”๐‘”๐‘˜๐‘˜โˆ’1

=

๐‘”๐‘”00 ๐‘”๐‘”01 โ‹ฏ ๐‘”๐‘”0,๐‘›๐‘›โˆ’1๐‘”๐‘”10 ๐‘”๐‘”11 โ‹ฏ ๐‘”๐‘”1,๐‘›๐‘›โˆ’1โ‹ฎ

๐‘”๐‘”๐‘˜๐‘˜โˆ’1,0

โ‹ฎ๐‘”๐‘”๐‘˜๐‘˜โˆ’1,1

โ‹ฎโ‹ฏ ๐‘”๐‘”๐‘˜๐‘˜โˆ’1,๐‘›๐‘›โˆ’1

where ๐บ๐บ is a ๐‘˜๐‘˜ ร— ๐‘›๐‘›, binary matrix.

Page 5: ELEC 6131: Error Detecting and Correcting Codes

Linear Block Codes Let ๐‘ข๐‘ข = (๐‘ข๐‘ข0, ๐‘ข๐‘ข1,โ‹ฏ ,๐‘ข๐‘ข๐‘˜๐‘˜โˆ’1) be the message to be sent. Then, the codeword can

be given as:

๐‘ฃ๐‘ฃ = ๐‘ข๐‘ข ๏ฟฝ ๐บ๐บ = ๐‘ข๐‘ข0,๐‘ข๐‘ข1,โ‹ฏ ,๐‘ข๐‘ข๐‘˜๐‘˜โˆ’1

๐‘”๐‘”0๐‘”๐‘”1โ‹ฎ

๐‘”๐‘”๐‘˜๐‘˜โˆ’1

= ๐‘ข๐‘ข0๐‘”๐‘”0 + ๐‘ข๐‘ข1๐‘”๐‘”1 + โ‹ฏ+ ๐‘ข๐‘ข๐‘˜๐‘˜โˆ’1๐‘”๐‘”๐‘˜๐‘˜โˆ’1.

That is, rows of ๐บ๐บ, span or generate ๐ถ๐ถ. That is why ๐บ๐บ is called the generator matrix.

Example (Hamming code): Consider (7,4) code we saw before:

๐บ๐บ =

๐‘”๐‘”0๐‘”๐‘”1๐‘”๐‘”2๐‘”๐‘”3

=

1 1 0 1 0 0 00 1 1 0 1 0 011

10

1 0 0 1 01 0 0 0 1

Page 6: ELEC 6131: Error Detecting and Correcting Codes

Linear Block Codes Letโ€™s message be ๐‘ข๐‘ข = (1 1 0 1). Then,

๐‘ฃ๐‘ฃ = 1 ๏ฟฝ ๐‘”๐‘”0 + 1 ๏ฟฝ ๐‘”๐‘”1 + 0 ๏ฟฝ ๐‘”๐‘”2 + 1 ๏ฟฝ ๐‘”๐‘”3= 1101000 + 0110100 + 1010001 = (0001101)

(7, 4) Hamming Code

message codeword0000 00000001000 11010000100 01101001100 10111000010 11100101010 00110100110 10001101110 01011100001 10100011001 01110010101 11001011101 00011010011 01000111011 10010110111 00101111111 1111111

Page 7: ELEC 6131: Error Detecting and Correcting Codes

Linear Block Codes Definition: a block code is called systematic if its message bits are consecutive and so

are its parity bits.

The generator matrix of a systematic linear code consists of a ๐‘˜๐‘˜ ร— ๐‘˜๐‘˜ identity matrix (to repeat the message bits) and a ๐‘˜๐‘˜ ร— (๐‘›๐‘› โˆ’ ๐‘˜๐‘˜) parity matrix to generate parity bits:

๐บ๐บ =

๐‘”๐‘”0๐‘”๐‘”1โ‹ฎ

๐‘”๐‘”๐‘˜๐‘˜โˆ’1

=

๐‘๐‘00 ๐‘๐‘01 โ‹ฏ ๐‘๐‘0,๐‘›๐‘›โˆ’๐‘˜๐‘˜โˆ’1 1 0 โ‹ฏ 0๐‘๐‘10 ๐‘๐‘11 โ‹ฏ ๐‘๐‘1,๐‘›๐‘›โˆ’๐‘˜๐‘˜โˆ’1 0 1 โ‹ฏ 0โ‹ฎ

๐‘๐‘๐‘˜๐‘˜โˆ’1,0

โ‹ฎ๐‘๐‘๐‘˜๐‘˜โˆ’1,1

โ‹ฎโ‹ฏ ๐‘๐‘๐‘˜๐‘˜โˆ’1,๐‘›๐‘›โˆ’๐‘˜๐‘˜โˆ’1 0 0 โ‹ฏ 1

So, ๐บ๐บ = [๐‘ƒ๐‘ƒ ๐ผ๐ผ๐‘˜๐‘˜], i.e., for an input ๐‘ข๐‘ข = ๐‘ข๐‘ข0,๐‘ข๐‘ข1,โ‹ฏ ,๐‘ข๐‘ข๐‘˜๐‘˜โˆ’1 , the output of the encoder is:๐‘ฃ๐‘ฃ = ๐‘ฃ๐‘ฃ0,๐‘ฃ๐‘ฃ1,โ‹ฏ , ๐‘ฃ๐‘ฃ๐‘›๐‘›โˆ’1 = ๐‘ข๐‘ข0,๐‘ข๐‘ข1,โ‹ฏ ,๐‘ข๐‘ข๐‘˜๐‘˜โˆ’1 ๐บ๐บ.

So, ๐‘ฃ๐‘ฃ๐‘–๐‘– = ๐‘ข๐‘ข0๐‘๐‘0๐‘–๐‘– + ๐‘ข๐‘ข1๐‘๐‘1๐‘–๐‘– + โ‹ฏ+ ๐‘ข๐‘ข๐‘˜๐‘˜โˆ’1๐‘๐‘๐‘˜๐‘˜โˆ’1,๐‘–๐‘– for 0 โ‰ค ๐‘–๐‘– < ๐‘›๐‘› โˆ’ ๐‘˜๐‘˜ and ๐‘ฃ๐‘ฃ๐‘›๐‘›โˆ’๐‘˜๐‘˜+๐‘–๐‘– = ๐‘ข๐‘ข๐‘–๐‘– for 0 โ‰ค๐‘–๐‘– < ๐‘˜๐‘˜.

Parity Message

k digits n-k digits

Page 8: ELEC 6131: Error Detecting and Correcting Codes

Linear Block Codes Going back to our (7,4) example:

๐‘ฃ๐‘ฃ = ๐‘ข๐‘ข0,๐‘ข๐‘ข1,โ‹ฏ ,๐‘ข๐‘ข๐‘˜๐‘˜โˆ’1

1 1 0 1 0 0 00 1 1 0 1 0 011

10

1 0 0 1 01 0 0 0 1

.

Therefore,

๐‘ฃ๐‘ฃ0 = ๐‘ข๐‘ข0 + ๐‘ข๐‘ข2 + ๐‘ข๐‘ข3๐‘ฃ๐‘ฃ1 = ๐‘ข๐‘ข0 + ๐‘ข๐‘ข1 + ๐‘ข๐‘ข2๐‘ฃ๐‘ฃ2 = ๐‘ข๐‘ข1 + ๐‘ข๐‘ข2 + ๐‘ข๐‘ข3

And:

๐‘ฃ๐‘ฃ3 = ๐‘ข๐‘ข0, ๐‘ฃ๐‘ฃ4 = ๐‘ข๐‘ข1, ๐‘ฃ๐‘ฃ5 = ๐‘ข๐‘ข2, ๐‘ฃ๐‘ฃ6 = ๐‘ข๐‘ข3.

Page 9: ELEC 6131: Error Detecting and Correcting Codes

Parity Check Matrix Let ๐บ๐บ be the generating matrix of a code ๐ถ๐ถ. Form an (๐‘›๐‘› โˆ’ ๐‘˜๐‘˜) ร— ๐‘›๐‘› matrix ๐ป๐ป

whose rows are orthogonal to all rows of ๐บ๐บ. For a systematic code ๐บ๐บ = ๐‘ƒ๐‘ƒ|๐ผ๐ผ๐‘˜๐‘˜and ๐ป๐ป = [๐ผ๐ผ๐‘›๐‘›โˆ’๐‘˜๐‘˜|๐‘ƒ๐‘ƒ๐‘‡๐‘‡], where ๐‘ƒ๐‘ƒ๐‘‡๐‘‡ is the transpose of ๐‘ƒ๐‘ƒ.

๐ป๐ป ๐ผ๐ผ๐‘›๐‘›โˆ’๐‘˜๐‘˜|๐‘ƒ๐‘ƒ๐‘‡๐‘‡ =

1 0 00 1 0

โ‹ฏ 0 ๐‘๐‘00โ‹ฏ 0 ๐‘๐‘01

โ‹ฎ โ‹ฎ โ‹ฎ0 0 0

โ‹ฏ โ‹ฎ โ‹ฎโ‹ฏ 1 ๐‘๐‘0,๐‘›๐‘›โˆ’๐‘˜๐‘˜โˆ’1

โ‹ฏโ‹ฏโ‹ฏโ‹ฏ

๐‘๐‘๐‘˜๐‘˜โˆ’1,0๐‘๐‘๐‘˜๐‘˜โˆ’1,1โ‹ฎ

๐‘๐‘๐‘˜๐‘˜โˆ’1,๐‘›๐‘›โˆ’๐‘˜๐‘˜โˆ’1

Then, we have:

๐บ๐บ ๏ฟฝ ๐ป๐ป๐‘‡๐‘‡ = 0.

Therefore, for any ๐‘ฃ๐‘ฃ โˆˆ ๐ถ๐ถ โ‡’ ๐‘ฃ๐‘ฃ = ๐‘ข๐‘ข ๏ฟฝ ๐บ๐บ ๏ฟฝ ๐ป๐ป๐‘‡๐‘‡ = 0.

For the (7, 4) Hamming code:

๐ป๐ป =1 0 0 1 0 1 10 1 0 1 1 1 00 0 1 0 1 1 1

.

Page 10: ELEC 6131: Error Detecting and Correcting Codes

Encoding of Linear Block Codes Note that a parity check matrix can generate an (๐‘›๐‘›, ๐‘›๐‘› โˆ’ ๐‘˜๐‘˜) code. Each codeword of this

code, ๐ถ๐ถ๐‘‘๐‘‘ is orthogonal to each codeword of ๐ถ๐ถ. ๐ถ๐ถ๐‘‘๐‘‘ is called the dual code of ๐ถ๐ถ. To encode a linear block code, we use XOR gates to form parities. Following figure

shows how a systematic linear block code is encoded: Bits of the message are fed to a shift register and also go to the channel. When they are

in the shift register, they are linearly combined according to:๐‘ฃ๐‘ฃ๐‘–๐‘– = ๐‘ข๐‘ข0๐‘๐‘0๐‘–๐‘– + ๐‘ข๐‘ข1๐‘๐‘1๐‘–๐‘– + โ‹ฏ+ ๐‘ข๐‘ข๐‘˜๐‘˜โˆ’1๐‘๐‘๐‘˜๐‘˜โˆ’1,๐‘–๐‘– ,

and placed in an output register and fed to channel.

Page 11: ELEC 6131: Error Detecting and Correcting Codes

Encoding of Linear Block Codes As an example, for the (7, 4) Hamming code, the decoder structure is:

Page 12: ELEC 6131: Error Detecting and Correcting Codes

Syndrome Decoding of Linear Block Codes

Assume that the message ๐‘ข๐‘ข is encoded as ๐‘ฃ๐‘ฃ = ๐‘ข๐‘ข ๏ฟฝ ๐บ๐บ. If there is no error, at the receiver we have ๐‘Ÿ๐‘Ÿ = ๐‘ฃ๐‘ฃ and no need for error detection and error

correction. But if there is an error, we get: ๐‘Ÿ๐‘Ÿ = ๐‘ฃ๐‘ฃ + ๐‘’๐‘’, where ๐‘’๐‘’ = (๐‘’๐‘’0, ๐‘’๐‘’1,โ‹ฏ , ๐‘’๐‘’๐‘›๐‘›) is an error vector.

If we multiply ๐‘Ÿ๐‘Ÿ by ๐ป๐ป๐‘‡๐‘‡, we get: ๐‘Ÿ๐‘Ÿ ๏ฟฝ ๐ป๐ป๐‘‡๐‘‡ = ๐‘ฃ๐‘ฃ + ๐‘’๐‘’ ๏ฟฝ ๐ป๐ป๐‘‡๐‘‡ = ๐‘ฃ๐‘ฃ ๏ฟฝ ๐ป๐ป๐‘‡๐‘‡ + ๐‘’๐‘’ ๏ฟฝ ๐ป๐ป๐‘‡๐‘‡ = ๐‘’๐‘’ ๏ฟฝ ๐ป๐ป๐‘‡๐‘‡

It is important to note that the result does not depend on the message, but on the errorpattern ๐‘’๐‘’. We call the vector ๐‘ ๐‘  = ๐‘Ÿ๐‘Ÿ ๏ฟฝ ๐ป๐ป๐‘‡๐‘‡ the syndrome.

Since ๐‘Ÿ๐‘Ÿ is an ๐‘›๐‘›-vector and ๐ป๐ป๐‘‡๐‘‡ is ๐‘›๐‘› ร— (๐‘›๐‘› โˆ’ ๐‘˜๐‘˜), there are (๐‘›๐‘› โˆ’ ๐‘˜๐‘˜) bits in vector ๐‘ ๐‘ . So, ๐‘ ๐‘ can point to 2๐‘›๐‘›โˆ’๐‘˜๐‘˜ patterns (one correct transmission 0, 0,โ‹ฏ , 0 and 2๐‘›๐‘›โˆ’๐‘˜๐‘˜ โˆ’ 1 errorpatterns).

Page 13: ELEC 6131: Error Detecting and Correcting Codes

Syndrome Decoding of Linear Block Codes Example: consider the (7, 4) code. Let ๐‘Ÿ๐‘Ÿ = (๐‘Ÿ๐‘Ÿ0, ๐‘Ÿ๐‘Ÿ1, ๐‘Ÿ๐‘Ÿ2, ๐‘Ÿ๐‘Ÿ3, ๐‘Ÿ๐‘Ÿ4, ๐‘Ÿ๐‘Ÿ5, ๐‘Ÿ๐‘Ÿ6) be the received

vector (output of demodulator). Then the syndrome is:

๐‘ ๐‘  = ๐‘ ๐‘ 0, ๐‘ ๐‘ 1, ๐‘ ๐‘ 2 = (๐‘Ÿ๐‘Ÿ0, ๐‘Ÿ๐‘Ÿ1, ๐‘Ÿ๐‘Ÿ2, ๐‘Ÿ๐‘Ÿ3, ๐‘Ÿ๐‘Ÿ4, ๐‘Ÿ๐‘Ÿ5, ๐‘Ÿ๐‘Ÿ6)

1 0 00 1 001011

01110

10111

or:๐‘ ๐‘ 0 = ๐‘Ÿ๐‘Ÿ0 + ๐‘Ÿ๐‘Ÿ3 + ๐‘Ÿ๐‘Ÿ5 + ๐‘Ÿ๐‘Ÿ6๐‘ ๐‘ 1 = ๐‘Ÿ๐‘Ÿ1 + ๐‘Ÿ๐‘Ÿ3 + ๐‘Ÿ๐‘Ÿ4 + ๐‘Ÿ๐‘Ÿ5๐‘ ๐‘ 2 = ๐‘Ÿ๐‘Ÿ2 + ๐‘Ÿ๐‘Ÿ4 + ๐‘Ÿ๐‘Ÿ5 + ๐‘Ÿ๐‘Ÿ6

Page 14: ELEC 6131: Error Detecting and Correcting Codes

Syndrome Decoding of Linear Block Codes We saw that:

๐‘ ๐‘  = ๐‘Ÿ๐‘Ÿ ๏ฟฝ ๐ป๐ป๐‘‡๐‘‡ = ๐‘’๐‘’ ๏ฟฝ ๐ป๐ป๐‘‡๐‘‡ .So, we can write ๐‘ ๐‘ ๐‘–๐‘–โ€™s as:

๐‘ ๐‘ ๐‘–๐‘– = ๐‘Ÿ๐‘Ÿ๐‘–๐‘– + ๐‘Ÿ๐‘Ÿ๐‘›๐‘›โˆ’๐‘˜๐‘˜๐‘๐‘0๐‘–๐‘– + ๐‘Ÿ๐‘Ÿ๐‘›๐‘›โˆ’๐‘˜๐‘˜+1๐‘๐‘1๐‘–๐‘– + โ‹ฏ+ ๐‘Ÿ๐‘Ÿ๐‘›๐‘›โˆ’1๐‘๐‘๐‘˜๐‘˜โˆ’1,๐‘–๐‘– , ๐‘–๐‘– = 0, 1,โ‹ฏ ,๐‘›๐‘› โˆ’ ๐‘˜๐‘˜ โˆ’ 1. Since ๐‘Ÿ๐‘Ÿ = ๐‘ฃ๐‘ฃ + ๐‘’๐‘’, we have:

๐‘ ๐‘ ๐‘–๐‘– = ๐‘ฃ๐‘ฃ๐‘–๐‘– + ๐‘’๐‘’๐‘–๐‘– + ๐‘ฃ๐‘ฃ๐‘›๐‘›โˆ’๐‘˜๐‘˜ + ๐‘’๐‘’๐‘›๐‘›โˆ’๐‘˜๐‘˜ ๐‘๐‘0๐‘–๐‘– + โ‹ฏ+ ๐‘ฃ๐‘ฃ๐‘›๐‘›โˆ’1 + ๐‘’๐‘’๐‘›๐‘›โˆ’1 ๐‘๐‘๐‘˜๐‘˜โˆ’1,๐‘–๐‘– .

But ๐‘ฃ๐‘ฃ๐‘–๐‘– + ๐‘ฃ๐‘ฃ๐‘›๐‘›โˆ’๐‘˜๐‘˜๐‘๐‘0๐‘–๐‘– + โ‹ฏ+ ๐‘ฃ๐‘ฃ๐‘›๐‘›โˆ’1๐‘๐‘๐‘˜๐‘˜โˆ’1,๐‘–๐‘– = 0 and

๐‘ ๐‘ ๐‘–๐‘– = ๐‘’๐‘’๐‘–๐‘– + ๐‘’๐‘’๐‘›๐‘›โˆ’๐‘˜๐‘˜๐‘๐‘0๐‘–๐‘– + ๐‘’๐‘’๐‘›๐‘›โˆ’๐‘˜๐‘˜+1๐‘๐‘1๐‘–๐‘– + โ‹ฏ+ ๐‘’๐‘’๐‘›๐‘›โˆ’1๐‘๐‘๐‘˜๐‘˜โˆ’1,๐‘–๐‘– , ๐‘–๐‘– = 0, 1,โ‹ฏ ,๐‘›๐‘› โˆ’ ๐‘˜๐‘˜ โˆ’ 1. This shows that ๐‘›๐‘› โˆ’ ๐‘˜๐‘˜ syndromes provide us with 2๐‘›๐‘›โˆ’๐‘˜๐‘˜ equations about error pattern.

There are 2๐‘›๐‘› error patterns, but we have 2๐‘›๐‘›โˆ’๐‘˜๐‘˜ equations. So, we cannot catch all errors. In fact, there are 2๐‘˜๐‘˜ error patterns for each syndrome. To put it another way, the code ๐ถ๐ถ

is a subgroup of the set of ๐‘›๐‘›-tuples. The set of ๐‘›๐‘›-tuples is partitioned into 2๐‘›๐‘›โˆ’๐‘˜๐‘˜ cosetsof ๐ถ๐ถ. All ๐‘›๐‘›-tuples in one coset result in the same syndrome. So, the syndrome onlypoints us to a coset of ๐ถ๐ถ not to a single error pattern. Out of 2๐‘˜๐‘˜ patterns (๐‘›๐‘›-tuples in thecoset), we decide (based on the property of the channel) which error has occurred.

Page 15: ELEC 6131: Error Detecting and Correcting Codes

Syndrome Decoding of Linear Block Codes Example: take again the (7, 4) code. Assume that we receive ๐‘Ÿ๐‘Ÿ = (1001001). Then,

๐‘ ๐‘  = ๐‘Ÿ๐‘Ÿ ๏ฟฝ ๐ป๐ป๐‘‡๐‘‡ = 1, 1, 1 .This means that

1 = ๐‘’๐‘’0 + ๐‘’๐‘’3 + ๐‘’๐‘’5 + ๐‘’๐‘’61 = ๐‘’๐‘’1 + ๐‘’๐‘’3 + ๐‘’๐‘’4 + ๐‘’๐‘’51 = ๐‘’๐‘’2 + ๐‘’๐‘’4 + ๐‘’๐‘’5 + ๐‘’๐‘’6

Any of the following 24 = 16 patterns satisfy these equations:To decide which error to choose depends on our expectation about the channel behaviours. For example, in a BSC channel, we know that the probability of a single error is more than multiple errors. So, we decide ๐‘’๐‘’ = (0000010) as the error and therefore, the codeword transmitted must have been:

๐‘ฃ๐‘ฃ = ๐‘Ÿ๐‘Ÿ + ๐‘’๐‘’ = 1001001 + 0000010 = 1001011 .

Page 16: ELEC 6131: Error Detecting and Correcting Codes

Minimum Distance of Linear Codes Hamming distance ๐‘‘๐‘‘(๐‘ฃ๐‘ฃ,๐‘ค๐‘ค) between two vectors ๐‘ฃ๐‘ฃ and ๐‘ค๐‘ค is the number of places they are

different. In binary case, the distance ๐‘‘๐‘‘(๐‘ฃ๐‘ฃ,๐‘ค๐‘ค) is the weight (the number of places a vector isnon-zero) of ๐‘ฃ๐‘ฃ + ๐‘ค๐‘ค or

๐‘‘๐‘‘ ๐‘ฃ๐‘ฃ,๐‘ค๐‘ค = ๐‘ค๐‘ค(๐‘ฃ๐‘ฃ,๐‘ค๐‘ค)

The minimum distance of a code ๐ถ๐ถ is the minimum value of ๐‘‘๐‘‘ ๐‘ฃ๐‘ฃ,๐‘ค๐‘ค for all non-identical ๐‘ฃ๐‘ฃand ๐‘ค๐‘ค โˆˆ ๐ถ๐ถ

๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› = ๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› ๐‘‘๐‘‘ ๐‘ฃ๐‘ฃ,๐‘ค๐‘ค : ๐‘ฃ๐‘ฃ,๐‘ค๐‘ค โˆˆ ๐ถ๐ถ,๐‘ฃ๐‘ฃ โ‰  ๐‘ค๐‘ค .

Since for any ๐‘ฃ๐‘ฃ and ๐‘ค๐‘ค โˆˆ ๐ถ๐ถ, ๐‘ฃ๐‘ฃ + ๐‘ค๐‘ค โˆˆ ๐ถ๐ถ then the minimum distance of a linear block code isequal to minimum weight of its non-zero codewords:

๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› = ๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› ๐‘ค๐‘ค ๐‘ฃ๐‘ฃ + ๐‘ค๐‘ค : ๐‘ฃ๐‘ฃ,๐‘ค๐‘ค โˆˆ ๐ถ๐ถ, ๐‘ฃ๐‘ฃ โ‰  ๐‘ค๐‘ค

= ๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› ๐‘ค๐‘ค ๐‘ฅ๐‘ฅ : ๐‘ฅ๐‘ฅ โˆˆ ๐ถ๐ถ, ๐‘ฅ๐‘ฅ โ‰  0 = ๐‘ค๐‘ค๐‘š๐‘š๐‘–๐‘–๐‘›๐‘›.Therefore, we have:

Theorem 1: the minimum distance of a linear block code is equal to the minimum weight of itsnon-zero codewords.

Page 17: ELEC 6131: Error Detecting and Correcting Codes

Minimum Distance of Linear Codes Theorem 2: let ๐ถ๐ถ be an (๐‘›๐‘›, ๐‘˜๐‘˜) linear block code with parity check matrix ๐ป๐ป.โ€ข For any codeword ๐‘ฃ๐‘ฃ โˆˆ ๐ถ๐ถ of weight ๐‘™๐‘™, there are ๐‘™๐‘™ columns of ๐ป๐ป such that their vector sum is 0.โ€ข If there are ๐‘™๐‘™ columns of ๐ป๐ป whose vector sum is 0, then there is a codeword ๐‘ฃ๐‘ฃ โˆˆ ๐ถ๐ถ with weight ๐‘™๐‘™. Proof: let ๐‘ฃ๐‘ฃ = (๐‘ฃ๐‘ฃ0, ๐‘ฃ๐‘ฃ1,โ‹ฏ , ๐‘ฃ๐‘ฃ๐‘›๐‘›โˆ’1) have ๐‘™๐‘™ non-zero elements at places ๐‘–๐‘–1, ๐‘–๐‘–2,โ‹ฏ , ๐‘–๐‘–๐‘™๐‘™. Then,

๐‘ฃ๐‘ฃ ๏ฟฝ ๐ป๐ป๐‘‡๐‘‡ = 0 โ‡’ ๐‘ฃ๐‘ฃ0โ„Ž0 + ๐‘ฃ๐‘ฃ1โ„Ž1 + โ‹ฏ+ ๐‘ฃ๐‘ฃ๐‘›๐‘›โˆ’1โ„Ž๐‘›๐‘›โˆ’1 = 0โ‡’ ๐‘ฃ๐‘ฃ๐‘–๐‘–1โ„Ž๐‘–๐‘–1 + ๐‘ฃ๐‘ฃ๐‘–๐‘–2โ„Ž๐‘–๐‘–2 + โ‹ฏ+ ๐‘ฃ๐‘ฃ๐‘–๐‘–๐‘™๐‘™โ„Ž๐‘–๐‘–๐‘™๐‘™ = 0

โ‡’ โ„Ž๐‘–๐‘–1 + โ„Ž๐‘–๐‘–2 + โ„Ž๐‘–๐‘–3 + โ‹ฏ+ โ„Ž๐‘–๐‘–๐‘™๐‘™ = 0So, part 1 is proved.Now assume that:

โ„Ž๐‘–๐‘–1 + โ„Ž๐‘–๐‘–2 + โ„Ž๐‘–๐‘–3 + โ‹ฏ+ โ„Ž๐‘–๐‘–๐‘™๐‘™ = 0.Take ๐‘ฅ๐‘ฅ = (๐‘ฅ๐‘ฅ0, ๐‘ฅ๐‘ฅ1,โ‹ฏ , ๐‘ฅ๐‘ฅ๐‘›๐‘›โˆ’1) such that:

๏ฟฝ๐‘ฅ๐‘ฅ๐‘—๐‘— = 1 ๐‘Ž๐‘Ž๐‘Ž๐‘Ž ๐‘—๐‘— = ๐‘–๐‘–1, ๐‘–๐‘–2,โ‹ฏ , ๐‘–๐‘–๐‘™๐‘™๐‘ฅ๐‘ฅ๐‘—๐‘— = 0 ๐‘œ๐‘œ๐‘Ž๐‘Žโ„Ž๐‘’๐‘’๐‘Ÿ๐‘Ÿ๐‘ค๐‘ค๐‘–๐‘–๐‘ ๐‘ ๐‘’๐‘’.

Then, ๐‘ฅ๐‘ฅ ๏ฟฝ ๐ป๐ป๐‘‡๐‘‡ = ๐‘ฅ๐‘ฅ0โ„Ž0 + ๐‘ฅ๐‘ฅ1โ„Ž1 + โ‹ฏ+ ๐‘ฅ๐‘ฅ๐‘›๐‘›โˆ’1โ„Ž๐‘›๐‘›โˆ’1

= ๐‘ฅ๐‘ฅ๐‘–๐‘–1โ„Ž๐‘–๐‘–1 + ๐‘ฅ๐‘ฅ๐‘–๐‘–2โ„Ž๐‘–๐‘–2 + โ‹ฏ+ ๐‘ฅ๐‘ฅ๐‘–๐‘–๐‘™๐‘™โ„Ž๐‘–๐‘–๐‘™๐‘™= โ„Ž๐‘–๐‘–1 + โ„Ž๐‘–๐‘–2 + โ‹ฏ+ โ„Ž๐‘–๐‘–๐‘™๐‘™ = 0,

so, ๐‘ฅ๐‘ฅ โˆˆ ๐ถ๐ถ.

Page 18: ELEC 6131: Error Detecting and Correcting Codes

Error Detection Capability of Linear Block Codes Corollary 2.1: let ๐ถ๐ถ be a linear block code with parity check matrix ๐ป๐ป. If no ๐‘‘๐‘‘ โˆ’ 1 or less columns of ๐ป๐ป

add to 0, then minimum weight of ๐ป๐ป is at least ๐‘‘๐‘‘. Corollary 2.2: the minimum distance of a linear block code ๐ถ๐ถ is the smallest number of columns of ๐ป๐ป

adding to 0.

If the minimum distance of a code is ๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘›, it can detect any error pattern with๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› โˆ’ 1 or less errors.

Definition: assume that ๐ด๐ด0,๐ด๐ด1,๐ด๐ด2,โ‹ฏ ,๐ด๐ด๐‘›๐‘› are the number of codewords with weight 0, 1, 2,โ‹ฏ ,๐‘›๐‘› in acode ๐ถ๐ถ. ๐ด๐ด0,๐ด๐ด1,๐ด๐ด2,โ‹ฏ ,๐ด๐ด๐‘›๐‘› are called weight distribution of the code.

For example, for (7, 4) Hamming code,๐ด๐ด0 = ๐ด๐ด7 = 1, ๐ด๐ด3 = 7, ๐ด๐ด4 = 7, and ๐ด๐ด๐‘–๐‘– = 0 otherwise.

If we send a codeword ๐‘ฃ๐‘ฃ and we receive ๐‘Ÿ๐‘Ÿ = ๐‘ฃ๐‘ฃ + ๐‘’๐‘’, we can detect errors unless ๐‘’๐‘’ โˆˆ ๐ถ๐ถ. So, ๐‘๐‘๐‘ข๐‘ข ๐ธ๐ธ =โˆ‘๐‘–๐‘–=1๐‘›๐‘› ๐ด๐ด๐‘–๐‘–(1 โˆ’ ๐‘๐‘)๐‘›๐‘›โˆ’๐‘–๐‘–๐‘๐‘๐‘–๐‘–, where ๐‘๐‘๐‘ข๐‘ข ๐ธ๐ธ is the probability of undetected error and ๐‘๐‘ is the probability of errorof modulation-demodulation.

For the (7, 4) code, we have:

๐‘๐‘๐‘ข๐‘ข ๐ธ๐ธ = 7๐‘๐‘3(1 โˆ’ ๐‘๐‘)4+7๐‘๐‘4(1 โˆ’ ๐‘๐‘)3+๐‘๐‘7.

So, if ๐‘๐‘ = 10โˆ’2, we get ๐‘๐‘๐‘ข๐‘ข ๐ธ๐ธ = 7 ร— 10โˆ’6. That is if one million bits are transmitted on the average 7errors go through undetected.

Page 19: ELEC 6131: Error Detecting and Correcting Codes

Error correction capability of Linear Block Codes A code ๐ถ๐ถ with minimum distance ๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› can correct ๐‘Ž๐‘Ž = ๐‘‘๐‘‘๐‘š๐‘š๐‘š๐‘š๐‘š๐‘šโˆ’1

2and less errors. ( ๐‘–๐‘– denotes

the floor, i.e., the largest integer less than ๐‘–๐‘–). ๐‘Ž๐‘Ž = ๐‘‘๐‘‘๐‘š๐‘š๐‘š๐‘š๐‘š๐‘šโˆ’12

means that ๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› = 2๐‘Ž๐‘Ž + 1 or๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› = 2๐‘Ž๐‘Ž + 2 or 2๐‘Ž๐‘Ž + 1 โ‰ค ๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› โ‰ค 2๐‘Ž๐‘Ž + 2.

Proof: We use the Triangle inequality: ๐‘‘๐‘‘ ๐‘ฃ๐‘ฃ, ๐‘Ÿ๐‘Ÿ + ๐‘‘๐‘‘(๐‘ค๐‘ค, ๐‘Ÿ๐‘Ÿ) โ‰ฅ ๐‘‘๐‘‘(๐‘ฃ๐‘ฃ,๐‘ค๐‘ค)

๐‘‘๐‘‘ ๐‘ฃ๐‘ฃ,๐‘ค๐‘ค โ‰ฅ ๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› โ‰ฅ 2๐‘Ž๐‘Ž + 1.

Let ๐‘‘๐‘‘ ๐‘ฃ๐‘ฃ, ๐‘Ÿ๐‘Ÿ = ๐‘Ž๐‘Žโ€ฒ, then: ๐‘‘๐‘‘ ๐‘ค๐‘ค, ๐‘Ÿ๐‘Ÿ โ‰ฅ 2๐‘Ž๐‘Ž + 1 โˆ’ ๐‘Ž๐‘Žโ€ฒ. If ๐‘Ž๐‘Žโ€ฒ โ‰ค ๐‘Ž๐‘Ž, then ๐‘‘๐‘‘ ๐‘ค๐‘ค, ๐‘Ÿ๐‘Ÿ โ‰ฅ ๐‘Ž๐‘Ž. This means if thedistance between the received vector and the transmitted codeword is less than or equal to ๐‘Ž๐‘Ž, thereceived vector is closer to this codeword, say ๐‘ฃ๐‘ฃ, than any other codeword ๐‘ค๐‘ค.

A code ๐ถ๐ถ with minimum distance ๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› can correct ๐‘Ž๐‘Ž = ๐‘‘๐‘‘๐‘š๐‘š๐‘š๐‘š๐‘š๐‘šโˆ’12

errors. It may correct someof the error patterns of weight higher than ๐‘Ž๐‘Ž, but it cannot correct all of those with ๐‘Ž๐‘Ž + 1errors. Probability of error is upper bounded as

๐‘๐‘ ๐ธ๐ธ โ‰ค ๏ฟฝ๐‘–๐‘–=๐‘ก๐‘ก+1

๐‘›๐‘›๐‘›๐‘›๐‘–๐‘– ๐‘๐‘๐‘–๐‘– 1 โˆ’ ๐‘๐‘ ๐‘›๐‘›โˆ’๐‘–๐‘– .

Page 20: ELEC 6131: Error Detecting and Correcting Codes

Erasure Decoding Sometimes instead of deciding 0 or 1 at the output of the demodulator, we decide 0 and

1 for those received values far away zero and ๐‘’๐‘’ or erasure for those close to zero.

A linear block code with ๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› can correct ๐›พ๐›พ errors and ๐‘’๐‘’ erasures such that:

๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› โ‰ฅ 2๐›พ๐›พ + ๐‘’๐‘’ + 1.

Error and Erasure Channel Erasure Channel

๐ถ๐ถ = 1 โˆ’ ๐›ผ๐›ผ

Page 21: ELEC 6131: Error Detecting and Correcting Codes

Standard Arrays We said that a code of length ๐‘›๐‘› and dimension ๐‘˜๐‘˜, i.e., an (๐‘›๐‘›, ๐‘˜๐‘˜) code partitions the set

๐‘‰๐‘‰๐‘›๐‘› of ๐‘›๐‘›-tuples into 2๐‘›๐‘›โˆ’๐‘˜๐‘˜ cosets of the code ๐ถ๐ถ. If we write elements of ๐ถ๐ถ in a row and then from 2๐‘›๐‘› โˆ’ 2๐‘˜๐‘˜ remaining ๐‘›๐‘›-tuples by taking a vector ๐‘’๐‘’2, add ๐‘’๐‘’2 to each element of ๐ถ๐ถ and write in the second row, then taking another unused element of the ๐‘›๐‘›-tuples say ๐‘’๐‘’3, add it to each codeword and write in the second row and continue this until we have used all ๐‘›๐‘›-tuples, we get a standard array.

Theorem 3: no two ๐‘›๐‘›-tuples in the same row are identical. Every ๐‘›๐‘›-tuple is in one andonly one row.

Proof: since ๐ถ๐ถ is a subgroup of ๐‘‰๐‘‰๐‘›๐‘› and each row is a coset of ๐ถ๐ถ.

๐‘ฃ๐‘ฃ1 = 0 ๐‘ฃ๐‘ฃ2 โ‹ฏ ๐‘ฃ๐‘ฃ๐‘–๐‘– โ‹ฏ ๐‘ฃ๐‘ฃ2๐‘˜๐‘˜

๐‘’๐‘’2 ๐‘’๐‘’2 + ๐‘ฃ๐‘ฃ2 โ‹ฏ ๐‘’๐‘’2 + ๐‘ฃ๐‘ฃ๐‘–๐‘– โ‹ฏ ๐‘’๐‘’2 + ๐‘ฃ๐‘ฃ2๐‘˜๐‘˜

๐‘’๐‘’3 ๐‘’๐‘’3 + ๐‘ฃ๐‘ฃ2 โ‹ฏ ๐‘’๐‘’3 + ๐‘ฃ๐‘ฃ๐‘–๐‘– โ‹ฏ ๐‘’๐‘’3 + ๐‘ฃ๐‘ฃ2๐‘˜๐‘˜

โ‹ฎ โ‹ฎ โ‹ฎ โ‹ฎ

๐‘’๐‘’๐‘™๐‘™ ๐‘’๐‘’๐‘™๐‘™ + ๐‘ฃ๐‘ฃ2 โ‹ฏ ๐‘’๐‘’๐‘™๐‘™ + ๐‘ฃ๐‘ฃ๐‘–๐‘– โ‹ฏ ๐‘’๐‘’๐‘™๐‘™ + ๐‘ฃ๐‘ฃ2๐‘˜๐‘˜

โ‹ฎ โ‹ฎ โ‹ฎ โ‹ฎ

๐‘’๐‘’2๐‘›๐‘›โˆ’๐‘˜๐‘˜ ๐‘’๐‘’2๐‘›๐‘›โˆ’๐‘˜๐‘˜ + ๐‘ฃ๐‘ฃ2 โ‹ฏ ๐‘’๐‘’2๐‘›๐‘›โˆ’๐‘˜๐‘˜ + ๐‘ฃ๐‘ฃ๐‘–๐‘– โ‹ฏ ๐‘’๐‘’2๐‘›๐‘›โˆ’๐‘˜๐‘˜ + ๐‘ฃ๐‘ฃ2๐‘˜๐‘˜

Page 22: ELEC 6131: Error Detecting and Correcting Codes

Standard Arrays Since a code ๐ถ๐ถ with minimum distance ๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› can correct up to ๐‘Ž๐‘Ž = ๐‘‘๐‘‘๐‘š๐‘š๐‘š๐‘š๐‘š๐‘šโˆ’1

2errors, we

can use as the first coset leaders (๐‘’๐‘’๐‘–๐‘–โ€™s) the patterns with ๐‘Ž๐‘Ž and less 1โ€™s. this covers for:

๐‘›๐‘›0 + ๐‘›๐‘›

1 + โ‹ฏ+ ๐‘›๐‘›๐‘Ž๐‘Ž = ๏ฟฝ

๐‘–๐‘–=0

๐‘ก๐‘ก๐‘›๐‘›๐‘–๐‘–

coset leaders, but this sum may not be equal to 2๐‘›๐‘›โˆ’๐‘˜๐‘˜. So, we may add some error patternswith two or more errors.

Definition: if โˆ‘๐‘–๐‘–=0๐‘ก๐‘ก ๐‘›๐‘›๐‘–๐‘– = 2๐‘›๐‘›โˆ’๐‘˜๐‘˜, we say that the (๐‘›๐‘›, ๐‘˜๐‘˜) code is perfect.

(7, 4) code is perfect since it has ๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› = 3 and therefore, ๐‘Ž๐‘Ž = 1 and

๏ฟฝ๐‘–๐‘–=0

๐‘ก๐‘ก๐‘›๐‘›๐‘–๐‘– = 7

0 + 71 = 1 + 7 = 8 = 23 = 2๐‘›๐‘›โˆ’๐‘˜๐‘˜ .

Page 23: ELEC 6131: Error Detecting and Correcting Codes

Standard Arrays Note that since the elements on each row of the standard array are the 2๐‘˜๐‘˜

codewords each added to a unique ๐‘›๐‘›-tuple (the coset leader), the syndromesof all members of a coset are the same. So, by finding the syndrome, we findout in what row of the standard array the received vector and hopefully thetransmitted codeword is. We can then output the coset leader as the errorpattern. For small codes, a lookup table is feasible. But for longer codes, weneed to calculate the error based on the syndrome