MAT 105 Fall 2008
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
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 IDmanufacturer IDcategoryof 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 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
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 0-58200-48826-7 is valid
Show that 0-52200-48826-7 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 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
Show that 111000025 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 231381116 is a valid routing number (this is the routing number for PSECU)
Show that 238311116 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 16th digit is the check digit
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
Consider the credit card number4128 0012 3456 7890
Let’s 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 0
4128 0012 3456 78964+2+0+1+3+5+7+9 = 31
31 x 2 = 62
4128 0012 3456 789662 + 3 = 65
4128 0012 3456 789665+1+8+0+2+4+6+8+6 = 100
What if the company is trying to determine which check digit should be appended to a given ID number?
3125 6001 9643 001_
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 ID book IDcheck 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
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 ISBN0-7167-1910-_ ?
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
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 extended assignment