Top Banner
Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many lots of ‘tens’ we have.
54

Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Mar 31, 2015

Download

Documents

Terrell Esarey
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Summary of lecture 4• We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,…

• This is called counting in base 10 – the second digit tells us how many lots of ‘tens’ we have.

Page 2: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Summary of lecture 4• We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,…

• This is called counting in base 10 – the second digit tells us how many lots of ‘tens’ we have.

• We can count in any base we like – e.g., base 5 (tally charts); base 12 (dozens); base 60 (time); base 2 (binary).

Page 3: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Summary of lecture 4• We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,…

• This is called counting in base 10 – the second digit tells us how many lots of ‘tens’ we have.

• We can count in any base we like – e.g., base 5 (tally charts); base 12 (dozens); base 60 (time); base 2 (binary).

• Addition works in any base we like, e.g., 9 in base 10 = 1001 in base 2 6 in base 10 = 110 in base 2

1001+111= 1111 in base 2 = 15 in base 10 = 9 + 6

Page 4: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

MAT199: Math AliveError corretcing and compression

Ian Griffiths

Mathematical Institute, University of Oxford,

Department of Mathematics, Princeton University

Page 5: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

MAT199: Math AliveError corretcing and compression

Ian Griffiths

Mathematical Institute, University of Oxford,

Department of Mathematics, Princeton University

correcting

Page 6: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Error correction

Check digits – U.S. Postal Service money order

Page 7: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Error correction

Check digits – U.S. Postal Service money order

This number is the remainder when we add the other ten numbers together and divide by 9

Page 8: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Error correction and encoding

Check digits - ISBNs

This number is solely to check for

errors

Page 9: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Error correction and encoding

Universal Product Codes (U.P.C.)

Page 10: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Error correction and encoding

Universal Product Codes (U.P.C.)

• Other things that use check digits include: • Bank routing numbers • Airline tickets

QR Codes

Page 11: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Binary encoding – data compression• In data compression binary codes are assigned in a way that minimizes the

number of digits required, by choosing short codes for the most frequently occurring data.

Page 12: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Binary encoding – data compression

• A compression algorithm converts data that is easy to use into a format that is easy to transport. A common compression algorithm is a zip file. When this is uncompressed the file is unzipped you recover the original information.

• In data compression binary codes are assigned in a way that minimizes the number of digits required, by choosing short codes for the most frequently occurring data.

Page 13: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Binary encoding – data compression

• A compression algorithm converts data that is easy to use into a format that is easy to transport. A common compression algorithm is a zip file. When this is uncompressed the file is unzipped you recover the original information.

• In some cases not all of the information is recovered from the encoding.

• In such cases the data is returned only approximately to its original state:

• In data compression binary codes are assigned in a way that minimizes the number of digits required, by choosing short codes for the most frequently occurring data.

Page 14: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Binary encoding – data compression

• A compression algorithm converts data that is easy to use into a format that is easy to transport. A common compression algorithm is a zip file. When this is uncompressed the file is unzipped you recover the original information.

• In some cases not all of the information is recovered from the encoding.

• In such cases the data is returned only approximately to its original state:

e.g., Joint Photographic Expert Group (jpeg) files and Motion Picture Expert Group (mpeg) files.

• (Graphics interchange format (gif) files recover all original information upon decoding.)

• In data compression binary codes are assigned in a way that minimizes the number of digits required, by choosing short codes for the most frequently occurring data.

Page 15: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Binary encoding – CDs• The audio information on a CD is

encoded in ridges on the disc which are read by a laser.

Page 16: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Binary encoding – CDs• The audio information on a CD is

encoded in ridges on the disc which are read by a laser. The data is coded using a Reed-Soloman code.

• The laser may misread a bump so there need to be error-correcting codes to handle single-bit errors. To solve this problem, extra data bits are added that allow the drive to detect single-bit errors and correct these.

Page 17: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Binary encoding – CDs• The audio information on a CD is

encoded in ridges on the disc which are read by a laser. The data is coded using a Reed-Soloman code.

• The laser may misread a bump so there need to be error-correcting codes to handle single-bit errors. To solve this problem, extra data bits are added that allow the drive to detect single-bit errors and correct these.

• The laser must be able to move between songs, so data needs to be encoded into the music telling the drive ‘where it is’ on the disc. This problem is solved using what is known as subcode data which encodes position on the disc and song title.

• A scratch on the CD might cause a whole packet of bytes to be misread (known as a burst error). We are able to recover from such an event by interleaving the data on the disc, so that it is stored non-sequentially around one of the disc's circuits.

Page 18: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

• We can represent the five-digit code pictorially:

• Here we have marked each codeword with a different box (oval, double oval, solid rectangle, dashed rectangle).

• The codewords and errors don’t overlap, but don’t cover the whole space either.

Page 19: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

The Hamming code

Page 20: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Summary of lecture 5• We wish to correct for one-bit errors using the minimum amount of extra memory.

• We define a perfect code as one in which the total number codes achievable (either correct or one-bit corrupted) is equal to the total available number of code combinations.

Page 21: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

The Hamming code

• The Hamming code is a perfect code.

Page 22: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Summary of lecture 6• The Reed–Solomon code offers sophisticated error correction used in CDs and

transmission of data:

• Eight-bit strings are encoded into ten-bit codes (like the Hamming codes that encode 4-digit strings into 7-digit codes).

• Each ‘word’ in the RS-code is itself 8-bits long.

• Interleaving divides up the data by splitting into five pieces.

Page 23: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

• The Voyager 1 space probe is now the most distant human-made object from Earth at almost 10 billion miles away.

The Voyager 1 space probe

Page 24: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

• The Voyager 1 space probe is now the most distant human-made object from Earth at almost 10 billion miles away.

• The probe is still transmitting information. The signal reached is now one hundred quintillion times weaker than when it was only a mile away (10-20 times weaker).

The Voyager 1 space probe

Page 25: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

• The Voyager 1 space probe is now the most distant human-made object from Earth at almost 10 billion miles away.

• The probe is still transmitting information. The signal reached is now one hundred quintillion times weaker than when it was only a mile away (100000000000000000000 times weaker).

• The total power used by the transmitter is less than one eighth of an electric kettle.

• The signal can still be decoded because of error-correction schemes.

The Voyager 1 space probe

Page 26: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

American Express Traveler’s Checks

Page 27: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

American Express Traveler’s Checks

• Add together the first nine digits: 0+0+0+2+9+9+9+0+1=

• Divide this number by 9 and take the remainder:

• Subtract this number from 9:

• If there are no errors then this is your final digit – this is a check digit.

Page 28: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

American Express Traveler’s Checks

• Add together the first nine digits: 0+0+0+2+9+9+9+0+1=30.

• Divide this number by 9 and take the remainder: 3.

• Subtract this number from 9: 9-3=6.

• If there are no errors then this is your final digit – this is a check digit.

Page 29: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Airline tickets

Page 30: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Airline tickets

• Divide the ten digit number (without the final check digit) by 7 and take the remainder:

Page 31: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Airline tickets

• Divide the ten digit number (without the final check digit) by 7 and take the remainder:

00953046010 = 13614943 + 0 remainder. 7

Page 32: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Airline tickets

• Divide the ten digit number (without the final check digit) by 7 and take the remainder:

00953046010 = 13614943 + 0 remainder. 7

• The remainder is the check digit.

Page 33: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

American banking system

Page 34: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

American banking system

• For a routing number a1a2a3a4a5a6a7a8a9 calculate:7a1 + 3a2 + 9a3 + 7a4 + 3a5 + 9a6 + 7a7 + 3a8

Page 35: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

American banking system

• For a routing number a1a2a3a4a5a6a7a8a9 calculate:7a1 + 3a2 + 9a3 + 7a4 + 3a5 + 9a6 + 7a7 + 3a8

• Take the remainder when you divide by 10 and this is the check digit.

Page 36: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

American banking system

• For a routing number a1a2a3a4a5a6a7a8a9 calculate:7a1 + 3a2 + 9a3 + 7a4 + 3a5 + 9a6 + 7a7 + 3a8

• Take the remainder when you divide by 10 and this is the check digit.

• In example above, 7x1 + 3x2 + 9x1 + 7x3 + 3x0 + 9x1 + 7x5 + 3x7 = 108. 108 = 10 remainder 8 10

Page 37: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

American banking system

• For a routing number a1a2a3a4a5a6a7a8a9 calculate:7a1 + 3a2 + 9a3 + 7a4 + 3a5 + 9a6 + 7a7 + 3a8

• Take the remainder when you divide by 10 and this is the check digit.

• In example above, 7x1 + 3x2 + 9x1 + 7x3 + 3x0 + 9x1 + 7x5 + 3x7 = 108. 108 = 10 remainder 8

• Check digit is 8.

10

Page 38: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

• The barcode encodes the numbers beneath it.

• In this example the barcode reads:

separatorleft side: 0001101 0100011 0110111 0110001 0001101 0001101 separatorright side: 1110010 1110010 1100110 1000010 1110100 1011100 separator

Universal Product Codes (barcodes)

Separator Separator

Separator• The binary code is then decoded using the following decryption:

Page 39: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Other uses for barcodes

Page 40: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

Other uses for barcodes

Page 41: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

ISBNs

Check digit

Page 42: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

ISBNs

Check digit

• In ISBN codes we add the first number times 10, the second times 9, and so on: 10x3+9x8+8x8+7x0+6x5+5x3+4x1+3x0+2x1=217

Page 43: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

ISBNs

Check digit

• In ISBN codes we add the first number times 10, the second times 9, and so on: 10x3+9x8+8x8+7x0+6x5+5x3+4x1+3x0+2x1=217

• We then divide this number by 11 and take the remainder 217/11=19 remainder 8.

Page 44: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

ISBNs

Check digit

• In ISBN codes we add the first number times 10, the second times 9, and so on: 10x3+9x8+8x8+7x0+6x5+5x3+4x1+3x0+2x1=217

• We then divide this number by 11 and take the remainder 217/11=19 remainder 8.

• We then subtract this number from 11 to get our check digit, 3.

Page 45: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

ISBNs

What errors can we detect?

• We can detect ALL single errors.

• We can detect ALL transpositions.

Page 46: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

ISBNs

What errors can we detect?

• We can detect ALL single errors.

• We can detect ALL transpositions.

• The only inconvenience is if the check digit turns out to be 10 (double figures). In this case we write X for the check digit.

Page 47: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

The ZIP bar code

• The ZIP bar code consists of 52 long and short bars at the bottom of a letter.

• The bars at the start and the end are just guard lines.

Page 48: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

The ZIP bar code• Every group of five digits encodes one digit using the following code:

Page 49: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

The ZIP bar code• Every group of five digits encodes one digit using the following code:

• This gives, in the previous example, the ZIP+4 code 20077-5576-1.

Page 50: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

The ZIP bar code• Every group of five digits encodes one digit using the following code:

• This gives, in the previous example, the ZIP+4 code 20077-5576-1.

• The 1 is a check digit. This makes sure the sum of all the digits is an exact multiple of 10. (In this case the sum of the digits is 40.)

Page 51: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

The ZIP bar code• There is also additional error correction: each group of five bars has exactly

two long and three short bars.

Page 52: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

The ZIP bar code• There is also additional error correction: each group of five bars has exactly

two long and three short bars.

• If you have an incorrect digit you can use the sum of the other digits to work out what this should be (by ensuring the sum of all digits is an exact multiple of 10).

Page 53: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.

The ZIP bar code• There is also additional error correction: each group of five bars has exactly

two long and three short bars.

• If you have an incorrect digit you can use the sum of the other digits to work out what this should be (by ensuring the sum of all digits is an exact multiple of 10).

• More recent codes use 12 digits rather than 10, though the sum still adds up to an exact multiple of 10.

Page 54: Summary of lecture 4 We are accustomed to count like 1,2,3,4,5,6,7,8,9,10,11,12,… This is called counting in base 10 – the second digit tells us how many.