Presentation on theme: "MAT 105 Spring 2008. The methods weve been using so far are not great at detecting transposition errors Since these errors are relatively common, we want."— Presentation transcript:
MAT 105 Spring 2008
The methods weve 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
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 product ID manufacturer ID category of goods
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 The next 5 digits identify the particular product For example, a 12 oz. can of Diet Coke is The last digit is 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!
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
Show that is valid Show that is invalid The UPC system detects all substitution errors and 89% of all other kinds of errors
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
Routing numbers are 8 digits long The 9 th 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
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!
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?
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
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 16 th digit is the check digit
Add the digits in the odd-numbered positions (1 st, 3 rd, 5 th, 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
Consider the credit card number Lets check to make sure this credit card number is valid using Codabar
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 = x 2 = = = 100
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?
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
An ISBN is a 10-digit number For example, the ISBN for our textbook is 0 – 7167 – 5965 – 9 Indicates that the book was published in an English-speaking country publisher IDbook ID check digit
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
Lets check the ISBN We compute our weighted sum to be 253, which is evenly divisible by 11 Which check digit would you need for ISBN _ ?
Since were using division by 11, sometimes well need an 11 th digit When the check digit would need to be 10, we use the letter X instead
The ISBN system detects all substitution errors and all transposition errors Since valid ISBNs 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