Top Banner
MAT 1000 Mathematics in Today's World Winter 2015
24
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: MAT 1000 Mathematics in Today's World Winter 2015.

MAT 1000

Mathematics in Today's WorldWinter 2015

Page 2: MAT 1000 Mathematics in Today's World Winter 2015.

TodayWe will look at identification numbers.

An important mathematical idea is to include a digit in an ID number that

allows us to catch any errors.

These are called “check digits.”

We will look at several different methods for finding check digits.

Page 3: MAT 1000 Mathematics in Today's World Winter 2015.

Identification numbers

It is common to use numbers as identification. Examples:• Credit card numbers identify a line of credit between a lender and a person.• UPC codes identify products in a store or company’s inventory

Page 4: MAT 1000 Mathematics in Today's World Winter 2015.

Identification numbers

Using ID numbers, or codes, simplifies collecting and processing data. A store may use coding information to manage inventory or to record sales information.Credit card numbers can make some monetary transactions simpler and safer (as opposed to personal checks or cash).

Page 5: MAT 1000 Mathematics in Today's World Winter 2015.

Identification numbers

Another advantage of codes:Coding systems can catch errors.This uses so-called “check digits.”

Check digit: an extra digit in an ID number whose purpose is to verify that the rest of the digits are accurate

Page 6: MAT 1000 Mathematics in Today's World Winter 2015.

Identification numbers

Where do errors come from?• Human error: typos or

misunderstandings• Transmission errors• Corrupted files

Page 7: MAT 1000 Mathematics in Today's World Winter 2015.

Identification numbers

Types of errorsSingle digit errors:

Multiple digit errors

Transposition errors

“Jump” transpositions

Page 8: MAT 1000 Mathematics in Today's World Winter 2015.

Identification numbers

It is possible to have coding schemes that catch 100% of single-digit errors

We can even make coding schemes that catch 100% of single-digit errors and 100% of transposition errors

The tradeoff is that to catch more errors the coding scheme must be more complex.

Page 9: MAT 1000 Mathematics in Today's World Winter 2015.

A simple coding scheme

The following scheme is not used in practice, but will introduce the key ideas.

For an ID number we choose a check digit so that the sum of all of the digits of the ID plus the check digit ends in 0.

Page 10: MAT 1000 Mathematics in Today's World Winter 2015.

A simple coding scheme

ExampleID: 12345

Our check digit should be a single digit that, when added to 15, gives a number that ends in 0.

So the check digit is 5.ID with check digit: 123455

Page 11: MAT 1000 Mathematics in Today's World Winter 2015.

A simple coding scheme

To verify that this is a valid ID, add up all the digits:

The result ends in a 0, so it is valid.

This method catches 100% of single digit errors (even an incorrect check digit).

Page 12: MAT 1000 Mathematics in Today's World Winter 2015.

A simple coding scheme

Suppose we misread the ID number 123455 as 128455

Add up the digits:

The sum does not end in 0, so 12855 is not a valid ID—we know there was an error.

Page 13: MAT 1000 Mathematics in Today's World Winter 2015.

A few coding themes that are used

• Division by nine (money orders)• Universal product codes (UPC)• ISBN• Codabars• Zip+4

Page 14: MAT 1000 Mathematics in Today's World Winter 2015.

First we need to understand:

The Division algorithm

Every division has a quotient and remainder

Page 15: MAT 1000 Mathematics in Today's World Winter 2015.

Division Algorithm •Divide a by b with remainder r.

a = q b + r. ∙•q is the quotient. •r is the remainder. •Example: 22 divided by 9 is “2 remainder 4”.

22 = 2 ∙ 9 + 4.

Page 16: MAT 1000 Mathematics in Today's World Winter 2015.

Division-by-9 Check Digits •Used on US Postal Service money orders. •First 10 digits identify the money order. –Each money order has a unique 10-digit number. •The last digit is a check digit. •To compute the check digit: –Add the first ten digits. –Divide by 9 with remainder. –The remainder is the check digit. •Let’s see an example.

Page 17: MAT 1000 Mathematics in Today's World Winter 2015.

Division-by-9 Check Digits •This system detects some errors in serial numbers. •It detects single-digit errors, except that: –It will not detect an error if 9 is replaced by 0. –It will not detect an error if two digits are switched. •It detects the presence of an error, but it does not tell you how to correct the mistake. •If an error is detected, go back and check for mistakes.

Page 18: MAT 1000 Mathematics in Today's World Winter 2015.

Universal Product Code (UPC) •The UPC system is used on all grocery products. •It consists of 12 digits, such as

0 12345 67890 1 •The first digit represents a broad category of items. •The next five digits identify the manufacturer. •The next five digits identify the product. •The last digit is a check digit.

Page 19: MAT 1000 Mathematics in Today's World Winter 2015.

UPC Numbers

Used in many retail products. Here’s an example, along with a bar code:

As you can see, UPC numbers are 12 digits long. The first 11 digits are the ID, the last digit is the check digit.

Page 20: MAT 1000 Mathematics in Today's World Winter 2015.

UPC Numbers

In the UPC coding scheme, odd digits (the first digit, third digit, fifth digit and so on) are weight 3, and the even digits are weight 1.

More succinctly, if the UPC number is

Then we compute the weighted sum

To be a valid UPC number, this sum must end in a 0.

Page 21: MAT 1000 Mathematics in Today's World Winter 2015.

UPC Numbers

In the example given above, the UPC number is

To check this is valid, we compute the following weighted sum:

This works out to , so this is a valid UPC number.

Page 22: MAT 1000 Mathematics in Today's World Winter 2015.

UPC Numbers

Suppose we try to read a UPC number, but a digit is missing.

The following UPC number is missing its first digit:

Using the UPC coding scheme, we can find the missing digit.

Page 23: MAT 1000 Mathematics in Today's World Winter 2015.

UPC Numbers

If we call the missing digit , then we know the following sum should end in a 0:

Adding up the 11 terms we do know:

So must end in a 0. Using trial and error, we can test the digits

There is only one number which works: This must be the missing first digit.

Page 24: MAT 1000 Mathematics in Today's World Winter 2015.

UPC Numbers

The UPC coding scheme catches 100% of single digit errors, and 89% of most other common errors.

By adding some additional complexity, we can improve the proportion of errors detected.