Module 4 GE
Module 4 GE
in INTRODUCTION
ge 4 It’s dark, rainy night as you pull up to the drive at your home. You press a remote in your car
that opens your garage door and you drive in. You press the remote again and the garage
door closes.
(mathematics in the modern world)
Unbeknownst to you, there is a crook lurking on the street with a radio scanner who picks up
the signal from your remote. The next time you’re not home, the crook plans on using the
saved signal to open your garage door and burglarize your home. However, when the crook
arrives and sends the signal, the door doesn’t open.
Although a garage door opener and a secure website mat seem to be quite different, the
mathematics behind each of these is similar. Both are based on modular arithmetic, one of
the topics of this chapter.
at the end of this module, the students are expected to discuss extensively and articulate
information in the core areas of science and mathematics (5.1.1). and perform appropriate
suitable mathematical and statistical computations in data analysis (5.4.1)
Modulo n
𝑎−𝑏
Discussion Two integers a and b are said to be congruent modulo n, where n is a natural number, if 𝑛
is an integer. In this case, we write a ≡ 𝑏 mod n. The number n is called the modulus. The
Many clocks have the familiar 12- hour design. We designate whether the time is before noon statement a ≡ 𝑏 mod n. is called a congruence.
or after noon by using the abbreviations A.M. and P.M. A reference to 7: 00 A.M means 7 hours
after 12: 00 midnight; a reference to 7:00 P.M. means 7 hours after 12:00 noon. In both cases, Example 2. Determine Whether a Congruence is True
once 12 is reached on the clock, we begin again with 1.
Determine whether the congruence is true. Solution
a. 29 ≡ 8 mod 3 Add 23 + 38 to produce 61. To evaluate 61 mod 12, divide 61 by the modulus, 12. The answer
b. 15 ≡ 4 mod 6 is the remainder.
Solution 5
12√61
29−8 21
a. Find = = 7. Because 7 is an integer, 29 ≡ 8 mod 3 is a true congruence. 60
3 3
15−4 11 11 1
b. Find = . Because is not an integer, 15 ≡ 4 mod 6 is not a true congruence.
6 6 6
Arithmetic Operation Modulo n a. Subtract 33 – 16 = 17 . the result is positive. Divide the difference by the modulus, 6.
In Example 2a we verified that 29 ≡ 8 mod 3. ( both 29 and 8 have remainder 2 when divided The answer is the remainder.
by 3, the modulus.) there are many other numbers congruent to 8 modulo 3, but of all these,
only one is a whole number less than the modulus. This number is the result when evaluating a
modulo expression, and in this case we use an equal sign. Because 2 ≡ 8 mod 3 and 2 is less b. Subtract 14 - 27 = -13. Because the answer is negative, we must find x so that -13 ≡
than the modulus, we can write 8 mod 3 = 2. In general, m mod n becomes the remainder when x mod 5. Thus we must find x so that the value of 5
−13−𝑥
=
−( 13+𝑥)
is an integer.
m is divided by n. 5
Trying the whole number values of x less than 5, the modulus, we find that when x =2,
−( 13+12) 15
Arithmetic modulo n ( where n is a natural numbers) requires us to evaluate a modular = − = −3.
5 5
expression after using the standard rules of arithmetic. Thus we perform the arithmetic ( 14 – 27 ) mod 5 = 2
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 6. Calculating Times
Example 4. Arithmetic Modulo n Disregarding A.M. or P.M., if it is 5 o’ clock now, what time it 57 hours ago?
Solving a congruence equation means finding all whole number values of the variable for which The solutions between 0 and 9 are 1 and 6; the remaining solutions are determined by
the congruence is true. repeatedly adding the modulus, 10, to these solutions. The solutions are 1, 6,11 16, 21, 26,..
For example, to solve 15 3𝑥 + 5 = 3 mod 4, we search for whole number values of Computing the Day of the Week
𝑥 for which the congruence is true.
A function that is related to the modulo function is called the floor function. In the modulo
3 (0) + 5 ≡ 3 mod 4 function, we determine the remainder when one number is divided by another. In the floor
3 (1) + 5 ≡ 3 mod 4 function, we determine the quotient ( and ignore the remainder) when one number is divided
3 (2) + 5 ≡ 3 mod 4 2 is a solution by another. The symbol for the floor function is ˪ ˩. Here are some examples.
3 (3) + 5 ≡ 3 mod 4
2 10 17 2
3 (4) + 5 ≡ 3 mod 4 ⌊ ⌋ = 0, ⌊ ⌋ = 5, ⌊ ⌋ = 8, 𝑎𝑛𝑑 ⌊ ⌋ = 1
3 2 2 √2
3 (5) + 5 ≡ 3 mod 4
3 (6) + 5 ≡ 3 mod 4 6 is solution Using the floor function, we can write a formula that gives the day of the week for any date on
the Gregorian Calendar. The formula, known as Zeller’s congruence, is given by
If we continued trying values, we would find that 10 and 14 are also solutions. Note that the
solutions 6, 10, and 14 are all congruent to modulo 4. In general, once a solution is determined. 𝑥 = (⌊
13𝑚−1
⌋+
𝑦 𝑐
⌊ ⌋ + ⌊ ⌋ + 𝑑 + 𝑦 − 2𝑐) mod 7
5 4 4
Example 8. Solve a Congruence Equation Where
𝑑 is the day of the month 7. In 2015, Halloween (October 31) fell on a Saturday, on what day of the week will Halloween
fall in the year 2015?
𝑚 is the month using 1 for March, 2 for April,.. , 10 for December; January and February are assigned 8. Valentine’s day ( February 14) fell on a Tuesday in 2017. On what day of the week will
the values 11 and 12, respectively Valentine’s Day fall in 2032?
𝑦 is the last two digits of the year if the month is March through December, if the month is January or 9. Cinco de Mayo ( MAY 5) fell on a Wednesday in 2010. On what day of the week will Cinco de
February, y is the last two digits of the year 𝑚𝑖𝑛𝑢𝑠 1 Mayo fall in 2028?
10. There is only one whole number solution between 0 and 11 of the congruence equation
𝑐 is the first two digits of the year
(𝑥 2 + 3𝑥 + 7) ≡ 2 mod 11
𝑥 is the day of the week ( using 0 for Sunday, 1 for Monday, … , 6 for Saturday)
For example, to determine the day of the week on July 4, 1776, we have 𝑐 = 17, 𝑦 = 76, 𝑑 =
4, 𝑎𝑛𝑑 𝑚 = 5. Using these values, we can calculate 𝑥. Lesson 2: Application of Modular Arithmetic
𝑥 = (⌊
13(5)−1
⌋+
76 17
⌊ ⌋ + ⌊ ⌋ + 4 + 76 − 2(17)) mod 7 ISBN and UPC
5 4 4
The first three digits of an ISBN are 978 (or 979), followed by 9 digits that are divided into three groups
EXERCISE SET of various lengths. These indicate the country or region, the publisher, and the title of the book. The last
1. Determine the day of the week on which you were born. digit (the 13th one) is called a check digit. If we label the first digit of an ISBN 𝑑1 , the second digit 𝑑2 ,
2. Determine the day of the week on which Abraham Lincoln’s birthday ( February 12) will fall in and so on to the 13th digit 𝑑13 , then the check digit is given by the following modular formula.
2155.
3. Determine the day of the week on which January 1, 2050, will fall.
4. Determine the day of the week on which Valentine’s Day ( February 14) 1950 fell. Formula for the ISBN Check Digit
5. There are only two whole number solutions between 0 and 27 of the congruence equation
𝑑13 = 10 - (𝑑1 + 3𝑑2 + 𝑑3 + 3𝑑4 + 𝑑5 , + 3𝑑6 + 𝑑7 , + 3𝑑8 + 𝑑9 + 3𝑑10 , + 𝑑11 +
(𝑥 2 + 5𝑥 + 4) ≡ 1 mod 27 3𝑑12 ) mod 10
Find the solutions.
6. Use modular arithmetic to determine each of the following. If 𝑑13 = 10, then the check digit is 0.
a. If today is Friday,
1. What day of the week will it be 25 days from now?
2. What day of the week was it 81 days ago?
It is this check that is used to ensure accuracy. For instance, the ISBN for the fourth edition of the the product by a scanner., which reads the number from a bar code and records the price on the cash
American Heritage Dictionary is 978 – 0 – 395 – 82517 – 4. Suppose, however, that a bookstore clerk register. If the price of an item changes for a promotional sale, the price is updated in the computer,
sends an order for the American Heritage Dictionary and inadvertently enters the number 978 – 5 – 395 thereby relieving a clerk of having to reprice each item. In addition to pricing items, the UPS gives the
– 82517 – 4, where the clerk transposed the 8 and 2 in the five numbers that identify the book. store manager accurate information about inventory and the buying habits of the store’s customers.
Correct ISBN : 978 – 0 – 395 – 82517 – 4 The UPC is a 12- digit number that satisfies a modular equation that is similar to the one for ISBNs. The
last digit number is the check digit. If we label the 12 digits of the UPC as 𝑑1 , 𝑑2 , … , 𝑑3 ., we can write a
Incorrect ISBN : 978 – 0 – 395 – 28517 – 4 formula for the UPC check digit 𝑑12 .
The receiving clerk calculates the check digit as follows.
Solution A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Highlights every other digit, beginning with the next- to- last digit and reading from right to left.
W X Y Z A B C D E F G H I J K L M N O P Q R S T U V
5 2 3 4 8 2 1 3 3 4 1 0 1 2 9 8
Y B X R Q V
Cryptology Z C Y S R W
Related to codes on books and grocery items are secret codes. These codes are used to send A D Z T S X
messages between people, companies, or nations. It is hoped that by devising a code that is B E A U T Y
Once a recognizable word has been found ( BEAUTY). Count the number of positions that the letters 𝑝 = (𝑆 𝑖𝑠 𝑡ℎ𝑒 19𝑡ℎ 𝑙𝑒𝑡𝑡𝑒𝑟. )
have been shifted (four, in this case). To decode the message, substitute the letter of the normal 𝑚 = 22, the number of positions the letter is shifted
alphabet that comes four positions after the letter in the ciphertext.
The 15th letter is O . Thus, 𝑆 is coded as O.
Once plaintext has been converted to ciphertext, there must be a method by which the person receiving
the message can return the message to plaintext. For the cyclical code, the congruence is
𝑐 ≡ (𝑐 + 𝑛) mod 26, where 𝑝 and 𝑐 are defined as before and 𝑛 = 26 − 𝑚. The letter O in
ciphertext is decoded below using the congruence 𝑝 ≡ ( 𝑐 + 𝑛)𝑚𝑜𝑑 26.
Four positions
𝑝 ≡ ( 𝑐 + 𝑛)𝑚𝑜𝑑 26
O D A S H E
𝑝 ≡ ( 15 + 4)𝑚𝑜𝑑 26
Cyclical encrypting using the alphabet is related to modular arithmetic. We begin with the normal
alphabet and associate each letter with a number as shown in Table 7.1. 𝑝 ≡ 19 𝑚𝑜𝑑 26
If the encrypting code is to shift each letter of the plaintext message 𝑚 positions, then the
corresponding letter in the ciphertext message is given by 𝑐 ≡ ( 𝑝 + 𝑚) 𝑚𝑜𝑑 26, where 𝑝 is the
numerical equivalent of the plaintext letter and 𝑐 is the numerical equivalent of the ciphertext letter. The
letter 𝑍 is coded as 0 because 26 ≡ 0 𝑚𝑜𝑑 26.
Each letter in Lord Byron’s poem was shifted 22 positions (𝑚 = 22) to the right. To code the plaintext
letter 𝑆 in the word SHE, we use the congruence 𝑐 ≡ ( 𝑝 + 𝑚) 𝑚𝑜𝑑 26.
𝑐 ≡ ( 𝑝 + 𝑚) 𝑚𝑜𝑑 26
𝑐 ≡ ( 19 + 22) 𝑚𝑜𝑑 26
𝑐 ≡ 41 𝑚𝑜𝑑 26
𝑐 ≡ 15
Example 4. Write messages Using Cyclical Coding Continuing, the ciphertext would be decoded as IVAN THE TERRIBLE.
Use the cyclical alphabet encrypting code that shifts letter 11 positions to
I 𝑐 ≡ (9 + 11)𝑚𝑜𝑑 26 ≡ 20 𝑚𝑜𝑑 26 = 20 Code I as T. Continuing, the plaintext is coded in ciphertext as JGSAN DNUTXAN.
N 𝑐 ≡ (14 + 11)𝑚𝑜𝑑 26 ≡ 25 𝑚𝑜𝑑 26 = 25 Code N as Y.
E 𝑐 ≡ (5 + 11)𝑚𝑜𝑑 26 ≡ 16 𝑚𝑜𝑑 26 = 14 Code E as P. Decoding a message that was encrypted using the congruence 𝑐 ≡ (𝑎𝑝 + 𝑚)𝑚𝑜𝑑 𝑛 requires
solving the congruence for 𝑝. The method relies on multiplicative inverses, which we discussed in
section 7.1
Continuing, the plaintext would be coded as NLESPCTYP ESP RCPLE.
Here we solve the congruence used in Example 5 for 𝑝.
b. Because 𝑚 = 11, 𝑛 = 26 − 11 = 15. The ciphertext decoded by using the congruence
𝑝 ≡ (𝑐 + 15) 𝑚𝑜𝑑 26. The results for TGLY are shown below. 𝑐 = 5𝑝 + 2
T 𝑐 ≡ (20 + 15)𝑚𝑜𝑑 26 ≡ 35 𝑚𝑜𝑑 26 = 9 Decode T as I. 𝑐 − 2 = 5𝑝 * Subtract from each side of the equation.
G 𝑐 ≡ (7 + 15)𝑚𝑜𝑑 26 ≡ 22 𝑚𝑜𝑑 26 = 22 Decode G as V. 21 ( 𝑐 − 2) = 21 (5𝑝) *multiply each side of the equation by the multiplicative inverse of 5. Because
L 𝑐 ≡ (12 + 15)𝑚𝑜𝑑 26 ≡ 27 𝑚𝑜𝑑 26 = 1 Decode L as A. 21 . 5 ≡ 1 𝑚𝑜𝑑 26, 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑦 𝑒𝑎𝑐ℎ 𝑠𝑖𝑑𝑒 𝑏𝑦 21.
[21( 𝑐 − 2)] mod 26 ≡ 𝑝
Y 𝑐 ≡ (25 + 15)𝑚𝑜𝑑 26 ≡ 40 𝑚𝑜𝑑 26 = 14 Decode Y as N.
Using this congruence equation, we can decode the ciphertext message JGSAN DNUTXAN. The Using this congruence, we will show the details for decoding ACXUT.
method for decoding JGSAN is shown below.
A [9(1 − 5)] 𝑚𝑜𝑑 26 ≡ (−36) 𝑚𝑜𝑑 26 = 16 Decode A as P.
EXERSICES
Note that to decode A it was necessary to determine (−21) 𝑚𝑜𝑑 26. Recall that this requires adding
the modulus until a whole number less than 26 results. Because (−21) + 26 = 5, we have I. Determine the correct check digit for each ISBN.
(−21) 𝑚𝑜𝑑 26 = 5.
1. The hunger games by Suzanne Collins; 978 – 0 – 4390 – 2352 --?
Example 6. Decode a message 2. The hobbit by J.R.R. Tolkien; 978 – 0 – 345 --27257--?
3. The Girl on the Train by Paula Hawkins; 978 – 0 – 857—52232--?
Decode the message ACXUT CXRT, which was encrypted using the congruence 𝑐 ≡ 4. Inside of a Dog: what Dogs See, Smell, and Know by Alexandra Horowitz; 978 –1--
( 3𝑝 + 5)𝑚𝑜𝑑 26. 4165 – 8343 --?
5. The Girl with the Dragon Tattoo by Stieg Larson; 978 –0 –307-- 47347--?
Solution
II. Determine the correct check digit for the UPC.
Solve the congruence equation for 𝑝. 1. 0 — 79893 — 46500 --? ( Organics Honey)
𝑐 ≡ ( 3𝑝 + 5) 2. 6 –53569 –39973 --? ( Scrabble)
3. 7 – 14043 – 01126--? (monopoly)
𝑐 − 5 = 3𝑝 4. 8 – 88462 – 52148 --? (Apple iPad Pro)
5. 0 – 71818 –02100 --? (Guittard Chocolate Chips)
9(𝑐 − 5) = 9(3𝑝) * 9(3) = 27 ≡ 1 𝑚𝑜𝑑 26
III. Encode the message by using a cyclical alphabet encrypting code that shifts the
message the stated number of positions.
[9 ( 𝑐 − 5)] 𝑚𝑜𝑑 26 ≡ 𝑝
1. 8 positions: THREE MUSKETEERS
The decoding congruence is 𝑝 ≡ [9 ( 𝑐 − 5)] 𝑚𝑜𝑑 26. 2. 6 positions: FLY TONIGHT
3. 12 positions: IT’S A GIRL
4. 9 positions: MEET AT NOON
5. 3 positions: STICKS AND STONES
Note: the compiler never claims ownership of this module. This should not be shared and
IV. Use a cyclical alphabet encrypting code that shifts the letters the stated number of posted to any social media platform.
positions to decode the encrypted message.
If you have questions, you may contact me through my cellular no.:
1. 18 positions: SYW GX WFDAYZLWFEWFL 09531054411
2. 20 positions: CGUACHUNCIH LOFYM NBY QILFX Take a picture of you answer and PM them in my FB account: Nathan Jabel
3. 15 positions: UGXTCS XC CTTS
4. 8 positions: VWJWLG QA XMZNMKB
5. 17 positions: ALPINE SKIING
God bless and keep safe!
V. Use a cyclical alphabet encrypting code to decode the encrypted message.
VI. Encryption. Use the encrypting congruence 𝑐 ≡ (3𝑝 + 11)𝑚𝑜𝑑 26 to code the
message NONE SHALL PASS
VII. Encryption. Use the encrypting congruence 𝑐 ≡ (7𝑝 + 8)𝑚𝑜𝑑 26 to code the
message DELIGHT SAVING TIME
References: