1 Chapter 16: Check Digit Systems, Continued MAT 105 Spring 2008Chapter 16: Check Digit Systems, Continued
2 A New MethodThe methods we’ve been using so far are not great at detecting transposition errorsSince these errors are relatively common, we want to find a system that can detect all possible transpositionsThe method we will use involves a weighted sum
3 UPC (Universal Product Code) Here is an example of a UPC from a typical productNotice that there are 12 digits: a single digit, two groups of 5, and another single digitcheck digitcategoryof goodsmanufacturer IDproduct ID
4 Parts of the UPCThe first number represents the general “category of goods”Most fixed-weight products are in category 0Coupons are in category 5The next 5 digits identify the manufacturerFor example, Coca-Cola is 49000The next 5 digits identify the particular productFor example, a 12 oz. can of Diet Coke is 01134The last digit is the check digit
5 Computing the Check Digit Instead of adding all of the digits together, we do something a little more complexMultiply the first digit by 3Add the second digitMultiply the third digit by 3Add the fourth digitetc.The check digit is chosen so that this sum ends in 0Notice that we include the check digit in our sum!
6 Weighted Sums This is called a weighted sum In a weighted sum, we multiply the digits by “weights” before adding them togetherIn this case, the weights are:3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1
7 Examples Show that 0-58200-48826-7 is valid Show that is invalidThe UPC system detects all substitution errors and 89% of all other kinds of errors
9 What’s a Routing Number? A routing number uniquely identifies a bankIf 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
10 Check Digits on Checks Routing numbers are 8 digits long The 9th digit is a check digitThe 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
11 ExamplesShow 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 = 25The last digit of the weighted sum is 5, so the routing number is valid!
12 Another ExampleShow that is a valid routing number (this is the routing number for PSECU)Show that is not validWhat kind of error was committed?
13 Why Are More Complex Systems Better? The bank routing number check digit system is fairly complex, but it is better than the UPC systemThe UPC system cannot detect jump transpositions at all, but the routing number system canThe more errors a system can detect, the betterMore complex systems can detect more errors
14 Codabar The system used by credit cards is called Codabar A credit card number is 16 digits longThe first 15 digits identify the credit card, and the 16th digit is the check digit
15 The Codabar ProcessAdd the digits in the odd-numbered positions (1st, 3rd, 5th, etc.)Double this sumAdd 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) digitsThe check digit is chosen so that the total ends in 0
16 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
17 Running Through the Process Add the digits in the odd-numbered positionsDouble this sumAdd to this total the number of odd-position digits that are above 4Add the remaining (even position) digitsThe check digit is chosen so that the total ends in 0= 3131 x 2 = 62= 65= 100
18 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?
19 Benefits of CodabarThe Codabar method detects all substitution errors and 98% of all other common errorsThis is important since credit card numbers are one of the more universal ID numbers we use on a daily basis
20 ISBN: International Standard Book Number An ISBN is a 10-digit numberFor example, the ISBN for our textbook is0 – 7167 – 5965 – 9check digitIndicates that the book was published in an English-speaking countrypublisher IDbook ID
21 Weighted Sums AgainFor an ISBN number, we compute a weighted sum with weights 10, 9, 8, 7, 6, 5, 4, 3, 2, 1The check digit is chosen so that the sum is evenly divisible by 11
22 An Example Let’s check the ISBN 0-7167-5965-9 We compute our weighted sum to be 253, which is evenly divisible by 11Which check digit would you need for ISBN _ ?
23 An 11th DigitSince we’re using division by 11, sometimes we’ll need an 11th digitWhen the check digit would need to be 10, we use the letter X instead
24 Benefits of ISBNThe ISBN system detects all substitution errors and all transposition errorsSince valid ISBN’s were running out, new books are published using a new 13-digit system with a different way of computing the check digitYou might explore these ideas in the third writing assignment