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

Module 9 Modular Systems

The document discusses modular arithmetic and its applications. Some key points: - Modular arithmetic involves dividing problems into cycles and finding remainders, like determining days of the week by dividing the number of days by 7. - Operations like addition, subtraction, and multiplication are performed normally and then the result is divided by the modulus to get the remainder. - Modular arithmetic is used for applications like calculating check digits for ISBNs and credit card numbers to detect errors. The Luhn algorithm and ISBN formulas use modulo 10. - Other applications discussed include determining prices from UPC codes and identifying credit card issuers from number prefixes.

Uploaded by

Erizza Javier
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views

Module 9 Modular Systems

The document discusses modular arithmetic and its applications. Some key points: - Modular arithmetic involves dividing problems into cycles and finding remainders, like determining days of the week by dividing the number of days by 7. - Operations like addition, subtraction, and multiplication are performed normally and then the result is divided by the modulus to get the remainder. - Modular arithmetic is used for applications like calculating check digits for ISBNs and credit card numbers to detect errors. The Luhn algorithm and ISBN formulas use modulo 10. - Other applications discussed include determining prices from UPC codes and identifying credit card issuers from number prefixes.

Uploaded by

Erizza Javier
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

MODULE 9: MODULAR SYSTEMS below, then 6 days after Friday is Thursday

and 16 days after Monday is Wednesday.

9.1 MODULAR ARITHMETIC

INTRODUCTION
If we want to determine a time in the future or in the
past, it is necessary to consider
whether we have passed 12 o’clock.
To determine the time 8 hours after
3 o’clock, we add 3 and 8. Because
we did not pass 12 o’clock, the time
is 11 o’clock (Figure 8.1A).
● Situations such as these that repeat in cycles
However, to determine the time 8
are represented mathematically by using
hours after 9 o’clock, we must take
modular arithmetic or arithmetic modulo n.
into consideration that once we have
passed 12 o’clock, we begin again
with 1. Therefore, 8 hours after 9
o’clock is 5 o’clock (Figure 8.1B).

Example 2: Determine whether a congruence is true

● Now suppose today is Friday. To determine the


day of the week 16 days from now, we
observe that 14 days from now the day will be
Friday, so 16 days from now the day will be
Sunday.
* Note: the remainder when 16 is divided by 7 is 2 or
using modular notation, 16 ≡ 2 mod 7. The 2 signifies
Example 1: Perform clock arithmetic
2 days after Friday, which is Sunday.

Example 3: A day of the week

● A similar example involves the


day-of-the-week arithmetic. If we associate
each day of the week with a number, as shown
Example 6: Calculating times

ARITHMETIC OPERATIONS MODULO n


● Arithmetic modulo n (where n is a natural
number) requires us to evaluate a modular
expression after using the standard rules of
arithmetic.
● Thus, we perform the arithmetic operation and
then divide by the modulus. The answer is the
remainder.
● The result of an arithmetic operation mod n is
always a whole number less than n.

Example 4: Addition modulo n


● Problems involving multiplication can also be
performed modulo n.

Example 7: Multiplication modulo n

Example 5: Subtraction modulo n

SOLVING CONGRUENCE EQUATIONS


● Solving a congruence equation means finding
all whole number values of the variable for
which the congruence is true.

● A congruence equation can have more than


one solution among the whole numbers less than
● The methods of adding and subtracting in the modulus. The next example illustrates that
modular arithmetic can be used for clock you must check all whole numbers less than the
arithmetic and days-of-the-week arithmetic. modulus.
Example 8: Solve a congruence equation Example 10: Find a multiplicative inverse

9.2 APPLICATIONS OF MODULAR ARITHMETIC

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
ADDITIVE AND MULTIPLICATIVE INVERSES IN books are filled accurately and that books are
MODULAR ARITHMETIC catalogued correctly.
● We have known that if the sum of two numbers ● The first three digits of an ISBN are 978 (or
is 0, then the numbers are additive inverses of 979), followed by 9 digits that are divided into
each other. For instance, 8 + (-8) = 0, so 8 is three groups of various lengths. These indicate
the additive inverse of -8, and -8 is the the country or region, the publisher, and the
additive inverse of 8. title of the book. The last digit (the 13th one) is
● The same concept applies in modular called a check digit.
arithmetic. For example, (3+5) ≡ 0 mod 8. ● If we label the first digit of an ISBN d1, the
Thus, in mod 8 arithmetic, 3 is the additive second digit d2, and so on to the 13th digit d13,
inverse of 5, and 5 is the additive inverse of 3. then the check digit is given by the following
Here we consider only those whole numbers modular formula:
smaller than the modulus.

Example 9: Find the additive inverse


● It is this check digit that is used to ensure
accuracy.

● If the product of two numbers is 1, then the


numbers are multiplicative inverses of each
other.
● For instance, , so 2 is the multiplicative
1 1
inverse of 2
, and 2
is the multiplicative
● Because the check digit is 6 and not 4 as it
inverse of 2. The same concept applies to should be, the receiving clerk knows that an
modular arithmetic (although the multiplicative incorrect ISBN has been sent.
inverses will always be natural numbers).
● Transposition errors are among the most
frequent errors that occur.
● The ISBN coding system will catch most of them.
Example 1: Determine a check digit for an ISBN 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 digits are used
to identify the card issuer.
● The table below shows some of the
identification prefixes used by four popular
card issuers.

● Another coding scheme that is closely related


to the ISBN is the UPC (Universal Product ● The Luhn algorithm, used to determine whether
Code). This number is placed on many items a credit card number is valid, is calculated as
and is particularly useful in grocery stores. follows: Beginning with the next-to-last digit
● A check-out clerk passes the product by a (the last digit is the check digit) and reading
scanner, which reads the number from a bar from right to left, double every other digit.
code and records the price on the cash register. ● If a digit becomes a two-digit number after
● If the price of an item changes for a being doubled, treat the number as two
promotional sale, the price is updated in the individual digits.
computer, thereby relieving a clerk of having to ● Now find the sum of the new list of digits; the
reprice each item. final sum must be congruent to 0 mod 10. The
● In addition to pricing items, the UPC gives the Luhn algorithm is demonstrated in the next
store manager accurate information about example.
inventory and the buying habits of the store’s
customers. Example 3: Determine a valid credit card number
● 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
d1, d2, ... , d12, we can write a formula for the
UPC check digit d12.

Example 2: Determine the check digit of a UPC

CRYPTOLOGY
● Related to codes on books and grocery items
are secret codes. These codes are used to send
messages between people, companies, or
nations.
CREDIT CARD NUMBERS ● It is hoped that by devising a code that is
● Companies that issue credit cards also use difficult to break, the sender can prevent the
modular arithmetic to determine whether a communication from being read if it is
credit card number is valid. intercepted by an unauthorized person.
● This is especially important in e-commerce, ● Cryptology is the study of making and
where credit card information is frequently sent breaking secret codes.
● Before we discuss how messages are coded, we
need to define a few terms. Plaintext is a
message before it is coded. The line:
SHE WALKS IN BEAUTY LIKE THE NIGHT
● from Lord Byron’s poem “She Walks in Beauty”
is in plaintext. Ciphertext is the message after
it has been written in code. The line
ODA SWHGO EJ XAWQPU HEGA PDA JECDP
is the same line of the poem in ciphertext.

● The method of changing from plaintext to ● The practicality of a cyclical alphabetic coding
ciphertext is called encryption. scheme is limited because it is relatively easy
● The line from the poem was encrypted by for a cryptologist to determine the coding
substituting each letter in plaintext with the 22 scheme.
letters after that letter in the alphabet. ● A coding scheme that is a little more difficult to
● (Continue from the beginning when the end of break is based on the congruence c ≡(ap + m)
the alphabet is reached.) This is called a mod 26, where a and 26 do not have a
cyclical coding scheme because each letter of common factor.
the alphabet is shifted the same number of
positions. Example 5: Encode a message
● The original alphabet and the substitute
alphabet are shown below.

● To decrypt a message means to take the


ciphertext message and write it in plaintext.
● 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.
● When a recognizable word appears, the key
can be determined.

Example 4: Write messages using cyclical coding

Example 6: Decode a message

You might also like