Chapter 16: Check Digit Systems, Continued

Presentation on theme: "Chapter 16: Check Digit Systems, Continued"— Presentation transcript:

Chapter 16: Check Digit Systems, Continued
MAT 105 Spring 2008 Chapter 16: Check Digit Systems, Continued

A New Method The methods we’ve been using so far are not great at detecting transposition errors Since these errors are relatively common, we want to find a system that can detect all possible transpositions The method we will use involves a weighted sum

UPC (Universal Product Code)
Here is an example of a UPC from a typical product Notice that there are 12 digits: a single digit, two groups of 5, and another single digit check digit category of goods manufacturer ID product ID

Parts of the UPC The first number represents the general “category of goods” Most fixed-weight products are in category 0 Coupons are in category 5 The next 5 digits identify the manufacturer For example, Coca-Cola is 49000 The next 5 digits identify the particular product For example, a 12 oz. can of Diet Coke is 01134 The last digit is the check digit

Computing the Check Digit
Instead of adding all of the digits together, we do something a little more complex Multiply the first digit by 3 Add the second digit Multiply the third digit by 3 Add the fourth digit etc. The check digit is chosen so that this sum ends in 0 Notice that we include the check digit in our sum!

Weighted Sums This is called a weighted sum
In a weighted sum, we multiply the digits by “weights” before adding them together In this case, the weights are: 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1

Examples Show that 0-58200-48826-7 is valid
Show that is invalid The UPC system detects all substitution errors and 89% of all other kinds of errors

Another System: Bank Routing Numbers

What’s a Routing Number?
A routing number uniquely identifies a bank If you have direct deposit on your paychecks, your employer asks you for your routing number (or for a cancelled check to read the number from) Also listed on your checks are your account number and the specific check number

Check Digits on Checks Routing numbers are 8 digits long
The 9th digit is a check digit The check digit is the last digit of the weighted sum of the first 8 digits with weights 7, 3, 9, 7, 3, 9, 7, 3

Examples Show that is a valid routing number (this is the routing number for a bank in Texas) Our weighted sum is 7*1 + 3*1 + 9*1 + 7*0 + 3*0 + 9*0 + 7*0 + 3*2 = 25 The last digit of the weighted sum is 5, so the routing number is valid!

Another Example Show that is a valid routing number (this is the routing number for PSECU) Show that is not valid What kind of error was committed?

Why Are More Complex Systems Better?
The bank routing number check digit system is fairly complex, but it is better than the UPC system The UPC system cannot detect jump transpositions at all, but the routing number system can The more errors a system can detect, the better More complex systems can detect more errors

Codabar The system used by credit cards is called Codabar
A credit card number is 16 digits long The first 15 digits identify the credit card, and the 16th digit is the check digit

The Codabar Process Add the digits in the odd-numbered positions (1st, 3rd, 5th, etc.) Double this sum Add to this total the number of odd-position digits that are above 4 (add the number of digits, not the digits themselves) Add the remaining (even position) digits The check digit is chosen so that the total ends in 0

An Example Consider the credit card number 4128 0012 3456 7890
Let’s check to make sure this credit card number is valid using Codabar

Running Through the Process
Add the digits in the odd-numbered positions Double this sum Add to this total the number of odd-position digits that are above 4 Add the remaining (even position) digits The check digit is chosen so that the total ends in 0 = 31 31 x 2 = 62 = 65 = 100 

Finding the Check Digit
What if the company is trying to determine which check digit should be appended to a given ID number? _ What should the check digit be?

Benefits of Codabar The Codabar method detects all substitution errors and 98% of all other common errors This is important since credit card numbers are one of the more universal ID numbers we use on a daily basis

ISBN: International Standard Book Number
An ISBN is a 10-digit number For example, the ISBN for our textbook is 0 – 7167 – 5965 – 9 check digit Indicates that the book was published in an English-speaking country publisher ID book ID

Weighted Sums Again For an ISBN number, we compute a weighted sum with weights 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 The check digit is chosen so that the sum is evenly divisible by 11

An Example Let’s check the ISBN 0-7167-5965-9
We compute our weighted sum to be 253, which is evenly divisible by 11 Which check digit would you need for ISBN _ ?

An 11th Digit Since we’re using division by 11, sometimes we’ll need an 11th digit When the check digit would need to be 10, we use the letter X instead

Benefits of ISBN The ISBN system detects all substitution errors and all transposition errors Since valid ISBN’s were running out, new books are published using a new 13-digit system with a different way of computing the check digit You might explore these ideas in the third writing assignment