Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 37

Error correcting codes

Oon Boey Lay Rujukan: EMM400 StudyGuideFA EMM400Tasks&Solns1

The need for powerful (and public) encryption has grown out of our ever increasing reliance on digital information you will no doubt have seen yourselves how when you sometimes go to or leave a web page you are told that the page is (or is not) encrypted for security purposes. Security issues arise not only in the public domain but also in the secrecy that surrounds military operations.

There is a conflict between governments trying to restrict the use of encryption which they regard as a tool for terrorists, and civil libertarians who argue that encryption is necessary to protect privacy

Another product of the digital age is errorcorrecting codes. This area of mathematics began just 60 years ago in 1948.

Have you ever wondered how satellites send photographs back to earth? Or why you cant just invent a credit card number when you try to buy something on the internet? Or how you can be sure when you deposit money into an ATM that the correct amount will go to your account?

We will begin by looking at: what are error-correcting codes and why we need them; the Mariner 6 space mission; and some examples of error-correcting codes.

The Mariner 6 space mission


In 1965, the USAs Mariner 4 was the first spaceship to photograph Mars. At that time, each picture took 8 hours to transmit. Later Mariner missions, such as Mariner 6, produced improved pictures, using what are called error-correcting codes.

Mariner 6 spaceship sending pictures from Mars

In order to transmit pictures, a fine grid was placed on the picture and each square or what we would now refer to as a pixel, was given a degree of blackness ranging from 0 to 63

FIGURE 2.2 Converting Mariner 6 pictures to binary digits

Each of these numbers was written as a sequence of six 0s and 1s, for example by writing it in the binary system (that is, in base 2), as shown below. 0 000000 1 000001 2 000010 3 000011 4 000100 5 000101 6 000110 7 000111 8 001000 9 001001 43 101011 63 111111

So we have degree of blackness = 43 101011. In the case of Mariner 6, each picture was broken up into 700 x 832 squares, so if each square was coded using 6 binary digits, each picture would consist of a sequence of 6 x 700 x 832 = 3 494 400 binary digits.

However, while the degree of blackness of each square consisted of a six binary digits, the message that was sent actually used many more digits for each degree of blackness in fact 32 binary digits were sent for each square, so each picture consisted of a sequence of 32 x 700 x 832 = 18 636 800 binary digits.

Transmitting data through a communication channel


Message to be transmitted

Coder

Binary code to be transmitted


Channel transmitting code

Decoder Message received

Binary code received

Errors introduced by noise

If we have many errors like this they will affect the quality of the picture that is received and we cannot really ask for the message to be repeated. This is the reason we need error-correcting codes. Error-correcting codes combat error by introducing redundancy by including more symbols than is necessary for the message.

Digital alphabet
The process of encoding a message usually begins with the conversion of ordinary text into a string of numbers by means of a digital alphabet like the one shown below. In the code shown in Figure 2.6, each letter (and a few punctuation marks) are represented by a sequence of 0s and 1s of length 5 we can think of these sequences as being the numbers between 0 and 32 written in the binary (base 2) system.

A binary code using the numbers 0 to 32 in base 2


= 00000 A = 00001 B = 00010 C = 00011 D = 00100

E = 00101 F = 00110 G = 00111 H = 01000 I = 01001


J = 01010 K = 01011 L = 01100 M = 01101 N = 01110 O = 01111 P = 10000 Q = 10001 R = 10010 S = 10011 T = 10100 U = 10101 V = 10110 W = 10111 X = 11000

Y = 110001

Z = 11010 , = 11011 . = 11100 ? = 11101

: = 11110 ; = 11111

So, for example, if I were to write my name in this code I would get: SUSIE 10011 10101 10011 01001 00101 ACTIVITY 2.1 Write your name using the binary code above.

An example of a single-error-correcting code


In this example, we will assume that every message we want to transmit consists of just 3 binary digits. There are 8 such possible messages, so we could think of them as representing the integers from 0 to 7. In this example, we will add an extra 5 redundant digits to each message as shown below to give codewords of length 8. (Right now we wont try to explain how we choose the extra digits.)

A single-error-correcting code of length 8


0 = 000 000 00000

1
2 3

=
= =

001
010 011

001 10110
010 10101 011 00011

4
5 6 7

=
= = =

100
101 110 111

100 10011
101 00101 110 00110 111 10000

ACTIVITY 2.2

Check that every codeword differs from every other codeword in exactly four places.

Imagine that we receive the following message: 00111110 we see that the codeword closest to 00111110 is 00110110. It differs in just one place the fifth place (underlined here). hence the name single-error-correcting code.

In this example, we have: 8 digit codewords with 3 information digits and 5 redundant digits. So we can say this code has information rate = 3/8

Repetition codes
One simple way of introducing redundancy is to repeat everything. So if we have a message we could decide to code it by repeating each digit n times. For example, if n = 5, we get a repetition code of length 5.

In my example earlier, my name would be coded as shown below.


S 10011 11111 00000 00000 11111 11111

10101

11111 00000 11111 00000 11111

10011

11111 00000 00000 11111 11111

01001

00000 11111 00000 00000 11111

00101

00000 00000 11111 00000 11111

For example what should we do if we receive the following message: 11011 00110 11000 10000 10111 ?

A decoding algorithm for a repetition code of length 5

The following is an example of a decoding algorithm for any one 5-digit block: Count the number of 1s. If number of 1s 3 , write 11111. If number of 1s 2 , write 00000.

ACTIVITY 2.3
You receive the following message, which was sent using the alphabet from Activity 2.1 and a repetition code of length 5. 00000 10010 11011 11000 01111

11110
00111

01010
10000

01000
01100

01011
11100

00001
00000

01000
01111

11111
00010

00111
01000

10111
10111

11101
10000

Convert the message to the 5 digit binary code. Use the alphabet from Activity 2.1 to convert it to ordinary letters.

ACTIVITY 2.4 Using the same code as in Activity 2.3, you receive the following message:
00000 01000 11101 11111 10111 01100 11011 11111 00100 10000 00010 10001 01111 00100 00000 01000 10000 01010 00100 00001 11110 00000 00111 00011 11111 11101 01111 00100 01100 11001

01010 11111

10111 00010

01111 11011

11111 01000

00000 00000

Convert the message to the 5 digit binary code. Use the alphabet from Figure 2.6 to convert it to ordinary letters. What message do you think was really intended?

Single parity-check codes


Single parity-check codes are the other extreme from repetition codes. While repetition codes have a single message digit, single parity-check codes have only one check digit. The check digit is obtained by taking the sum of the information digits mod 2.

So, for example, using the code in Figure 2.6, we get


A 000001 1

5 message 1check digit digits

B C

000010 1 000011 0

000100 1

In general, the codewords look like c1 c2 c3 c4 c5 c6 where c6 = c1 + c2 + c3 + c4 + c5 (mod 2).

ACTIVITY 2.8 Find the codewords representing each of the following letters in the single-parity-check code above: J , L , Q , S , G , X.

ACTIVITY 2.9
Write the message NO ERRORS in the single-parity-check code above. ACTIVITY 2.10 The following message is received in the single-parity-check code: 000011 000000 001111 011110 010110 001001 000000 100100 001010 100111 101001 011000 101000 Detect the places where the errors occur. Decode the remaining letter. Use guesswork to complete the message.

SINGLE-PARITY- CHECK CODE


The information rate is which is very high! However, a single-parity-check code can only detect an odd number of errors and cannot correct them!
k n

n 1 n

You might also like