0% found this document useful (0 votes)
400 views

Applications of Modular Arithmetic (ISBN & UPC)

The document discusses several applications of modular arithmetic including: - ISBN and UPC codes which use a check digit to detect errors in book and product codes. - Credit card numbers which use the Luhn algorithm - a check digit method based on modular arithmetic to validate numbers. - While check digits catch most transposition errors, some adjacent digit swaps may not be detected like the example given of a Crisco canola oil UPC code.

Uploaded by

Joevyvamae Torre
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
400 views

Applications of Modular Arithmetic (ISBN & UPC)

The document discusses several applications of modular arithmetic including: - ISBN and UPC codes which use a check digit to detect errors in book and product codes. - Credit card numbers which use the Luhn algorithm - a check digit method based on modular arithmetic to validate numbers. - While check digits catch most transposition errors, some adjacent digit swaps may not be detected like the example given of a Crisco canola oil UPC code.

Uploaded by

Joevyvamae Torre
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Applications of Modular Arithmetic

ISBN and UPC

Every book that is cataloged in the Library of Congress must be ISBN (International Standard
Book Number). This 13-digit number was created to help ensure that orders for book are filled
accurately and that books are catalogued correctly.

The first three digits of ISBN are 978 (or 979), followed by 9 digits that are divided into three
groups of various lengths. These indicate the country or region, the publisher, and the title of the of the
book. The last digit (the 13th one) is called the check digit.

If we label the first digit of an ISBN d 1, the second digit d 2, and so on to the 13th digit d 13, then
the check digit is given by the following modular formula.

Formula for ISBN Check Digit

d 13=10−( d 1 +3 d 2+ d 3+ 3 d 4 +d 5 +3 d 6 +d 7 +3 d 8 +d 9 +3 d 10 +d 11 +3 d 12 ) mod 10

If d 13=10 ,then the check digit is 0.

It is this check digit that is used to ensure accuracy. For instance, the ISBN for the fourth edition of
American Heritage Dictionary is 978−0−395−82517−4 . Suppose, however, that a bookstore clerk
sends an order for the American Heritage Dictionary and inadvertently enters the number
978−0−395−28517−4 , where the clerk transposed the 8 and 2 in the five numbers that identify the
book.

Correct ISBN: 978−0−395−82517−4

Incorrect ISBN: 978−0−395−28517−4

The receiving clerk calculates the check digit as follows.

d 13=10−[ 9+3 ( 7 ) +8+ 3 ( 0 )+ 3+3 ( 9 ) +5+3 ( 2 ) +8+3 ( 5 ) +1+3 ( 7 ) ] mod 10

¿ 10−124 mod 10
¿ 10−4=6
Because the check digit is 6 and not 4 as it should be, the receiving clerk knows that an incorrect ISBN
has been sent. Transposition errors are among the most frequent errors that occur. The ISBN coding
system will catch most of them.

Example: Determine a Check Digit for an ISBN


Determine the ISBN check digit for the book The Equation that Couldn’t Be Solve by Mario Livio. The first
12 digits of ISBN are 978−0−7432−5820−?

Solution:

d 13=10−[ 9+3 ( 7 ) +8+ 3 ( 0 )+ 7+3 ( 4 ) +3+3 ( 2 ) +5+3 ( 8 ) +2+3 ( 0 ) ] mod 10

¿ 10−97 mod 10
¿ 10−7=3
The check digit is 3.

Try this! A purchase order for the book The Mathematical Tourist by Ivars Peterson includes the ISBN
978-0-716-73250-5. Determine whether this is a valid ISBN.

Another coding scheme that is closely related to ISBN is the UPC (Universal Product Code). This number
is place on many items and is particularly useful in grocery stores. A check-out clerk passes the product
by a scanner, which reads the number from a bar code and records the price on the cash register .if the
price of an item changes for a promotional sale, the price is updated in the computer, thereby relieving
a clerk of having to reprice each item. In addition to pricing items, the UPC gives the store manager
accurate information about inventory and the buying habits of the store’s costumers.

The UPC is a 12-digit number that satisfies a modular equation that is similar to the one for ISBNs. The
last digit is the check digit. If we label the 12 digits of the UPC as d 1 , d 2 , … , d 12 , we can write a formula
for the UPC check digit d 12.

Formula for the UPC Check Digit

d 12=10−( 3 d 1+ d 2+ 3 d3 + d 4 +3 d 5 +d 6 +3 d 7 +d 8 +3 d 9 +d 10+ 3 d 11 ) mod 10

If d 12=10 ,then the check digit is 0.

Example: Determine the check digit of a UPC

Find the check digit for the UPC of the Blu-ray Disc release of the film Jurassic World. The first 11 digits
are 0-25192-21221-?

Solution:

d 12=10−[ 3 ( 0 ) +2+3 (5 )+ 1+ 3 ( 9 ) +2+3 ( 2 )+ 1+3 ( 2 ) +2+3(1) ] mod 10

¿ 10−65 mod 10
¿ 10−5=5
The check digit is 5.

Try this! Is 1-32342-65933-9 a valid UPC?

The ISBN and UPC coding systems will normally catch transposition errors. There are instances,
however, when they do not.

The UPC for Crisco Puritan Canola Oil with Omega-DHA is 0-51500-24275-9

Suppose, however, that the product code is written 0-51500-24725-9, where 2 and 7 have been
transposed. Calculating the check digit, we have

d 12=10−[ 3 ( 0 ) +5+3 ( 1 )+ 5+3 ( 0 ) +0+3 ( 2 ) +4 +3 ( 7 ) +2+3(5) ] mod 10


¿ 10−61mod 10
¿ 10−1=9
The same check digit is calculated, yet the UPC has been entered incorrectly. This was an unfortunate
coincidence; if any other 2 digits were transposed, the result would have been caught. It can be shown
that the ISBN and UPC coding methods will not catch a transposition error of adjacent digits a and b if
|a−b|=5. For the Canola Oil UPC, |7−2|=5

Credit Card Numbers

Companies that issue credit cards also use modular arithmetic to determine whether a credit number is
valid. This is especially important in e-commerce, where credit card information is frequently sent over
the Internet. The primary coding method is based on the Luhn algorithm, which uses mod 10 arithmetic.
Credit card numbers are normally 13 to 16 digits long. The first one to six are used to identify the card
issuer. The table below shows some of the identification prefixes used by four popular card issuers.

Card Issuer Prefix Number of Digits


Master Card 51 to 55 16
Visa 4 13 or 16
American Express 34 or 37 15
Discover 6011 16

The Luhn Algorithm, used to determine whether a credit card is valid, is calculated as follows: Beginning
with the next-to-last digits (the last digit is the check digit) and reading from right to left, double every
other digit. If a digit becomes a two-digit number after being doubled, treat the number as two
individual digits. Now find the sum of the new list of digits; the final sum must be congruent to 0 mod 10
. The Luhn Algorithm is demonstrated in the next example.

Example: Determine a Valid Credit Card Number


Determine whether 5234 8213 3410 1298 is a valid credit card number.

Solution:

Highlight every other digit, beginning with the next-to-last digit and reading from right to left.

5 2 3 4 8 2 1 3 3 4 1 0 1 2 9 8

Next double each of the highlighted digit

10 2 6 4 16 2 2 3 6 4 2 0 2 2 18 8

Finally, add all digits, treating two-digit number as two single digits.

(1+0)+2+6+ 4+(1+6)+2+2+3+6+ 4+2+ 0+2+2+(1+8)+8=60


Because 60 ≡0 mod 10 , this is a valid credit card number.

Try this! Is 6011 0123 9145 2317 a valid credit card number?

Prepared by:

RENE BOY H. CALCAÑA


Course Instructor

You might also like