11
ELEC 6131: Error Detecting and Correcting Codes Lecture 4: Linear Block Codes Linear block codes: In a digital communication system, the sequence of bits to be transmitted are arranged as 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 linear block 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). 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. 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:

ELEC 6131: Error Detecting and Correcting Codes Lecture 4

  • Upload
    others

  • View
    16

  • Download
    0

Embed Size (px)

Citation preview

Page 1: ELEC 6131: Error Detecting and Correcting Codes Lecture 4

ELEC 6131: Error Detecting and Correcting Codes Lecture 4: Linear Block Codes

Linear block codes:

In a digital communication system, the sequence of bits to be transmitted are arranged as 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 linear block 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).

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.

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:

Page 2: ELEC 6131: Error Detecting and Correcting Codes Lecture 4

๐บ๐บ =

โŽฃโŽขโŽขโŽก๐‘”๐‘”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

๏ฟฝ

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

๐‘ฃ๐‘ฃ = 1 โˆ™ ๐‘”๐‘”0 + 1 โˆ™ ๐‘”๐‘”1 + 0 โˆ™ ๐‘”๐‘”2 + 1 โˆ™ ๐‘”๐‘”3

= (1101000) + (0110100) + (1010001)

= (0001101)

Example: (7,4) linear block code:

message codeword 0000 0000000 1000 1101000 0100 0110100 1100 1011100 0010 1110010 1010 0011010 0110 1000110 1110 0101110 0001 1010001 1001 0111001 0101 1100101 1101 0001101 0011 0100011 1011 1001011 0111 0010111 1111 1111111

Definition: a block code is called systematic if its message bits are consecutive and so are its parity bits.

parity message

The generator of a systematic 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

๏ฟฝ

๐‘›๐‘› โˆ’ ๐‘˜๐‘˜ digits ๐‘˜๐‘˜ digits

Page 3: ELEC 6131: Error Detecting and Correcting Codes Lecture 4

So, ๐บ๐บ = [๐‘ƒ๐‘ƒ ๐ผ๐ผ๐‘˜๐‘˜].

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 โ‰ค ๐‘–๐‘– < ๐‘˜๐‘˜.

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

๐‘ฃ๐‘ฃ3 = ๐‘ข๐‘ข0

๐‘ฃ๐‘ฃ4 = ๐‘ข๐‘ข1

๐‘ฃ๐‘ฃ5 = ๐‘ข๐‘ข2

๐‘ฃ๐‘ฃ6 = ๐‘ข๐‘ข3.

Parity check matrix:

Let ๐บ๐บ be the generating polynomial of a code ๐ถ๐ถ. Form an (๐‘›๐‘› โˆ’ ๐‘˜๐‘˜) ร— ๐‘›๐‘› matrix ๐ป๐ป whose rows are orthogonal to all rows of ๐บ๐บ. For a systematic code ๐บ๐บ = [๐‘ƒ๐‘ƒ ๐ผ๐ผ๐‘˜๐‘˜] and ๐ป๐ป = [๐ผ๐ผ๐‘›๐‘›โˆ’๐‘˜๐‘˜ ๐‘ƒ๐‘ƒ๐‘‡๐‘‡], where ๐‘ƒ๐‘ƒ๐‘‡๐‘‡ is the transpose of ๐‘ƒ๐‘ƒ. That is:

๐ป๐ป = [๐ผ๐ผ๐‘›๐‘›โˆ’๐‘˜๐‘˜ ๐‘ƒ๐‘ƒ๐‘‡๐‘‡] = ๏ฟฝ

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

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

โ‹ฎ0

โ‹ฎ0

โ‹ฎ 0 โ‹ฏ 1 ๐‘๐‘0,๐‘›๐‘›โˆ’๐‘˜๐‘˜โˆ’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 4: ELEC 6131: Error Detecting and Correcting Codes Lecture 4

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.

For the (7, 4) code:

Page 5: ELEC 6131: Error Detecting and Correcting Codes Lecture 4

Syndrome:

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 error pattern ๐‘’๐‘’. 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 error patterns).

Example: consider the (7, 4) code. Let ๐‘Ÿ๐‘Ÿ = (๐‘Ÿ๐‘Ÿ0, ๐‘Ÿ๐‘Ÿ1, ๐‘Ÿ๐‘Ÿ2, ๐‘Ÿ๐‘Ÿ3, ๐‘Ÿ๐‘Ÿ4, ๐‘Ÿ๐‘Ÿ5, ๐‘Ÿ๐‘Ÿ6) be the received vector (output of demodulator). Then the syndrome

๐‘ ๐‘  = (๐‘ ๐‘ 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

Syndrome circuit for a linear systematic (๐‘›๐‘›,๐‘˜๐‘˜) code

Page 6: ELEC 6131: Error Detecting and Correcting Codes Lecture 4

Syndrome circuit for the (7, 4) code

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 ๐‘›๐‘› โˆ’ ๐‘˜๐‘˜ 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๐‘›๐‘›โˆ’๐‘˜๐‘˜ cosets of ๐ถ๐ถ. All the ๐‘›๐‘›-tuples in one coset result in the same syndrome. So, the syndrome only points us to a coset of ๐ถ๐ถ not to a single error pattern. Out of 2๐‘˜๐‘˜ patterns (๐‘›๐‘›-tuples in the coset), we decide (based on the property of the channel) which error has occurred.

Example: take again the (7, 4) code. Assume that we receive ๐‘Ÿ๐‘Ÿ = (1001001). Then,

๐‘ ๐‘  = ๐‘Ÿ๐‘Ÿ โˆ™ ๐ป๐ป๐‘‡๐‘‡ = (1, 1, 1).

This means that

1 = ๐‘’๐‘’0 + ๐‘’๐‘’3 + ๐‘’๐‘’5 + ๐‘’๐‘’6

Page 7: ELEC 6131: Error Detecting and Correcting Codes Lecture 4

1 = ๐‘’๐‘’1 + ๐‘’๐‘’3 + ๐‘’๐‘’4 + ๐‘’๐‘’5

1 = ๐‘’๐‘’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).

Minimum distance of a code:

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 is non-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 is equal 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 its non-zero codewords.

Page 8: ELEC 6131: Error Detecting and Correcting Codes Lecture 4

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 + โ‹ฏ+ โ„Ž๐‘–๐‘–๐‘™๐‘™ = 0

So, 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, ๐‘ฅ๐‘ฅ โˆˆ ๐ถ๐ถ.

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.

Error-detection and error-correction capability of a linear block code:

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 a code ๐ถ๐ถ. ๐ด๐ด0,๐ด๐ด1,๐ด๐ด2,โ‹ฏ ,๐ด๐ด๐‘›๐‘› are called weight distribution of the code.

For example, for (7, 4) Hamming code,

Page 9: ELEC 6131: Error Detecting and Correcting Codes Lecture 4

๐ด๐ด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 error of 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 7 errors go through undetected.

Error correction capability:

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

๏ฟฝ and less errors. (โŒŠ๐‘–๐‘–โŒ‹ denotes the

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

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

Triangle inequality: ๐‘‘๐‘‘๏ฟฝ๐‘ฃ๐‘ฃ, ๐‘Ÿ๐‘Ÿ๏ฟฝ + ๐‘‘๐‘‘(๐‘ค๐‘ค, ๐‘Ÿ๐‘Ÿ) โ‰ฅ ๐‘‘๐‘‘(๐‘ฃ๐‘ฃ,๐‘ค๐‘ค)

But: ๐‘‘๐‘‘๏ฟฝ๐‘ฃ๐‘ฃ,๐‘ค๐‘ค๏ฟฝ โ‰ฅ ๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› โ‰ฅ 2๐‘Ž๐‘Ž + 1.

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

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

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

๐‘๐‘(๐ธ๐ธ) โ‰ค ๏ฟฝ ๏ฟฝ๐‘›๐‘›๐‘–๐‘– ๏ฟฝ ๐‘๐‘๐‘–๐‘–(1 โˆ’ ๐‘๐‘)๐‘›๐‘›โˆ’๐‘–๐‘–

๐‘›๐‘›

๐‘–๐‘–=๐‘ก๐‘ก+1

.

Erasures:

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.

Standard arrays:

We said that a code of length ๐‘›๐‘› and dimension ๐‘˜๐‘˜, i.e., and (๐‘›๐‘›,๐‘˜๐‘˜) 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 take a vector ๐‘’๐‘’2, add ๐‘’๐‘’2 to each element of ๐ถ๐ถ and write in the second row, then

Page 10: ELEC 6131: Error Detecting and Correcting Codes Lecture 4

take an 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.

๐‘ฃ๐‘ฃ1 = 0 ๐‘ฃ๐‘ฃ2 โ‹ฏ ๐‘ฃ๐‘ฃ๐‘–๐‘– โ‹ฏ ๐‘ฃ๐‘ฃ2๐‘˜๐‘˜ ๐‘’๐‘’2 ๐‘’๐‘’2 + ๐‘ฃ๐‘ฃ2 โ‹ฏ ๐‘’๐‘’2 + ๐‘ฃ๐‘ฃ๐‘–๐‘– โ‹ฏ ๐‘’๐‘’2 + ๐‘ฃ๐‘ฃ2๐‘˜๐‘˜ ๐‘’๐‘’3 ๐‘’๐‘’3 + ๐‘ฃ๐‘ฃ2 โ‹ฏ ๐‘’๐‘’3 + ๐‘ฃ๐‘ฃ๐‘–๐‘– โ‹ฏ ๐‘’๐‘’3 + ๐‘ฃ๐‘ฃ2๐‘˜๐‘˜ โ‹ฎ โ‹ฎ โ‹ฎ โ‹ฎ ๐‘’๐‘’๐‘™๐‘™ ๐‘’๐‘’๐‘™๐‘™ + ๐‘ฃ๐‘ฃ2 โ‹ฏ ๐‘’๐‘’๐‘™๐‘™ + ๐‘ฃ๐‘ฃ๐‘–๐‘– โ‹ฏ ๐‘’๐‘’๐‘™๐‘™ + ๐‘ฃ๐‘ฃ2๐‘˜๐‘˜ โ‹ฎ โ‹ฎ โ‹ฎ โ‹ฎ

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

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

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

Since a code ๐ถ๐ถ with minimum distance ๐‘‘๐‘‘๐‘š๐‘š๐‘–๐‘–๐‘›๐‘› can correct up to ๐‘Ž๐‘Ž = ๏ฟฝ๐‘‘๐‘‘๐‘š๐‘š๐‘š๐‘š๐‘š๐‘šโˆ’12

๏ฟฝ errors, 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 patterns with 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

= ๏ฟฝ70๏ฟฝ + ๏ฟฝ7

1๏ฟฝ = 1 + 7 = 8 = 23 = 2๐‘›๐‘›โˆ’๐‘˜๐‘˜.

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 syndromes of all numbers of a coset are the same. So, by finding the syndrome, we find out in what row of the standard array the received vector and hopefully the transmitted codeword is. We can the output the coset leader. For small codes, a lookup table is feasible. But for longer codes, we need to calculate the error based on the syndrome.

Page 11: ELEC 6131: Error Detecting and Correcting Codes Lecture 4

General decoder for a linear block code

Decoding circuit for the (7, 4) code