MAT 1000 Mathematics in Today's World Winter 2015.

24
MAT 1000 Mathematics in Today's World Winter 2015

Transcript of MAT 1000 Mathematics in Today's World Winter 2015.

MAT 1000

Mathematics in Today's WorldWinter 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.

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

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).

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

Identification numbers

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

misunderstandings• Transmission errors• Corrupted files

Identification numbers

Types of errorsSingle digit errors:

Multiple digit errors

Transposition errors

“Jump” transpositions

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.

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.

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

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).

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.

A few coding themes that are used

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

First we need to understand:

The Division algorithm

Every division has a quotient and remainder

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.