Professional Documents
Culture Documents
Applications of Modular Arithmetic
Applications of Modular Arithmetic
Applications of Modular Arithmetic
8
Mathematical
Systems
3
ISBN and UPC
Every book that is cataloged in the Library of Congress
must have an ISBN (International Standard Book Number).
This 13-digit number was created to help ensure that
orders for books are filled accurately and that books are
catalogued correctly.
The first three digits of an 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 book. The last digit (the 13th one) is
called a check digit.
4
ISBN and UPC
If we label the first digit of an ISBN d1, the second digit d2,
and so on to the 13th digit d13, then the check digit is given
by the following modular formula.
5
ISBN and UPC
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.
6
ISBN and UPC
Because the check digit is 6 and not 4 as it should be, the
receiving clerk knows that an incorrect ISBN has been
sent.
7
Example 1 – Determine a Check Digit for an ISBN
Determine the ISBN check digit for the book The Equation
that Couldn’t Be Solved by Mario Livio. The first 12 digits of
the ISBN are 978-0-7432-5820-?
Solution:
10
Example 2 – 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:
12
Credit Card Numbers
Companies that issue credit cards also use modular
arithmetic to determine whether a credit card number is
valid.
13
Credit Card Numbers
The table below shows some of the identification prefixes
used by four popular card issuers.
14
Credit Card Numbers
The Luhn algorithm, used to determine whether a credit
card number is valid, is calculated as follows: Beginning
with the next-to-last digit (the last digit is the check digit)
and reading from right to left, double every other digit.
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.
15
Example 3 – Determine a Valid Credit Card Number
Solution:
Highlight every other digit, beginning with the next-to-last
digit and reading from right to left.
16
Example 3 – Solution cont’d
17
Cryptology
18
Cryptology
Related to codes on books and grocery items are secret
codes. These codes are used to send messages between
people, companies, or nations.
19
Cryptology
Before we discuss how messages are coded, we need to
define a few terms. Plaintext is a message before it is
coded. The line
21
Cryptology
The original alphabet and the substitute alphabet are
shown below.
22
Cryptology
If a cryptologist thinks a message has been encrypted
using a cyclical substitution code like the one shown
previously, the key to the code can be found by taking a
word from the message (usually one of the longer words)
and continuing the alphabet for each letter of the word.
23
Example 4 – Write Messages Using Cyclical Coding
Solution:
a. The encrypting congruence is c (p + 11) mod 26.
Replace p by the numerical equivalent of each letter of
plaintext and determine c.
24
Example 4 – Solution cont’d
26
Cryptology
The practicality of a cyclical alphabetic coding scheme is
limited because it is relatively easy for a cryptologist to
determine the coding scheme.
27
Example 5 – Encode a Message
Use the congruence c (5p + 2) mod 26 to encode the
message LASER PRINTER.
Solution:
The encrypting congruence is c (5p + 2) mod 26. Replace
p by the numerical equivalent of each letter from Table 8.1
and determine c.
28
Example 5 – Solution cont’d
29
Example 6 – Decode a Message
Decode the message ACXUT CXRT, which was encrypted
using the congruence c (3p + 5) mod 26.
Solution:
Solve the congruence equation for p.
31