Professional Documents
Culture Documents
Application To Congruences
Application To Congruences
Number Theory
88
SP MATH 120
Number Theory
Gregorian calendar was not adopted everywhere in the whole word in 1582. In
Britain and what is now the United States, it was adopted only in 1752, Japan changed
over in 1873, Russia and nearby countries in 1917, while in Greece held out until 1923.
Definition. Leap years that are divisible by 4, except that those exactly divisible by
100, that is, the years that mark centuries would be leap years only divisible by 400.
Since leap years come at the end of February, we take care of this by
remembering the months as follows and considering the months of January and
February as part of the preceding year. That is,
January → 11 July → 5
February → 12 August → 6
March → 1 September → 7
April → 2 October → 8
May → 3 November → 9
June → 4 December → 10
Example
February 1984 → considered as the 12th month of 1983.
May 1985 → considered as the 3rd month of 1985.
January 2006 → Considered as the 11th month of 2005.
To find the day of the week, we have
𝑌 𝐶
W ≡ k + [2.6𝑚 − 0.2] − 2𝐶 + 𝑌 + [4 ] + [4 ] (mod 7)
where
𝑘 → day of the month 𝑌 → particular year of the country
𝑚 → month of the year 𝐶 → century
Example
To find the day of the week of January 1, 1899, we have 𝐶 = 18, 𝑌 = 98, 𝑚 =
11 and 𝑘 = 1 (since we consider January as the 11th month of the preceding year). We
have,
𝑌 𝐶
W ≡ k + [2.6𝑚 − 0.2] − 2𝐶 + 𝑌 + [4 ] + [4 ] (mod 7)
98 18
W ≡ 1 + [2.6(11) − 0.2] − 2(18) + 98 + [ 4 ] + [ 4 ] (mod 7)
≡ 1 + 28 − 36 + 98 + 24 + 4 (mod 7)
≡ 119 (mod 7)
≡ 0 (mod 7)
89
SP MATH 120
Number Theory
≡ 29 + 25 − 40 + 20 + 5 + 5 (mod 7)
≡ 44 (mod 7)
W ≡ 2 (mod 7)
Hence, December 29, 2020 was a Tuesday.
Note: Discard the decimal number.
Example
What day of the week is October 24, 2019?
Solution
To find the day of the week of October 24, 2019, we have 𝐶 = 20, 𝑌 = 19,
𝑚 = 8 and 𝑘 = 24 (since we consider December as the 8th month of the preceding
year). We have,
𝑌 𝐶
W ≡ k + [2.6𝑚 − 0.2] − 2𝐶 + 𝑌 + [ ] + [ ] (mod 7)
4 4
19 20
≡ 24 + [2.6(8) − 0.2] − 2(20) + 19 + [ ] + [ ] (mod 7)
4 4
90
SP MATH 120
Number Theory
REMARKS:
A new calendar called the “international Fixed Calendar” has been proposed
in which there are 13 months, including all our present months, plus a new month called
Sol, which is placed between June and July.
Each month has 28 days except for the month of June of leap years which has an extra
day called “Year End Day”, which is not in any month, which may consider as
December 29.
Try me!
Find the day of the week of the following important dates.
1. July 20, 1969 → First Man in the Moon
2. June 5, 2013 → First Man on Mars
Congruence can be used to schedule round-robin tournaments, that is,
scheduling a tournament for N different teams so that each team plays every other team
exactly once.
Note that if N is odd, not all teams can be scheduled in each round, since when
team are paired, the total number of teams playing is even.
So, if 𝑛 is odd, we add a “dummy team” and if a team is paired with the dummy
team during a particular round, it draws a “bye” in that round, and does not play.
Teams are labeled as 1, 2, 3, … , 𝑁 − 1, 𝑁. To contrast the schedule, team 𝑖 plays
team 𝑗 in the 𝑘 𝑡ℎ round if
𝑖 + 𝑗 ≡ 𝑘 (mod 𝑁 − 1) where 𝑖 ≠ 𝑗, 𝑖 ≠ 𝑁 and 𝑗 ≠ 𝑁
This schedule games for all teams in round 𝑘, except for team 𝑁 and team 𝑖 for
which 2𝑖 ≡ (mod 𝑁 − 1).
Example
Set-up a round robin tournament for 5 teams.
Solutions: To schedule a round-robin tournament for 5 teams, label the teams with
1, 2, 3, 4, 5 and a dummy labeled as 6.
Round 1. 𝑖 + 𝑗 ≡ 1 (mod 5)
Team 1 vs. Team 5
Team 2 vs. Team 4
Team 3 → bye
Round 2: 𝑖 + 𝑗 ≡ 2 (mod 5)
Team 2 vs. Team 5
91
SP MATH 120
Number Theory
Round 3: 𝑖 + 𝑗 ≡ 3 (mod 5)
Team 1 vs. Team 2
Team 3 vs. Team 5
Team 4 vs. bye
Round 4: 𝑖 + 𝑗 ≡ 2 (mod 5)
Team 1 vs. Team 3
Team 4 vs. Team 5
Team 2 vs. bye
Round 5: 𝑖 + 𝑗 ≡ 2 (mod 5)
Team 1 vs. Team 4
Team 2 vs. Team 3
Team 5 vs. bye
Example
Set-up a round-robin tournament for 8 teams, label the teams, say
𝑇1, 𝑇2, 𝑇3, 𝑇4, 𝑇5, 𝑇6, 𝑇7 and 𝑇8.
Round 1: 𝑖 + 𝑗 ≡ 1 (mod 7)
2𝑖 ≡ 1 (mod 7) → 𝑖 = 4
Team 1 vs. Team 7
Team 2 vs. Team 6
92
SP MATH 120
Number Theory
Round 2: 𝑖 + 𝑗 ≡ 2 (mod 7)
2𝑖 ≡ 2 (mod 7) → 𝑖 = 1
Team 2 vs. Team 7
Team 3 vs. Team 6
Team 4 vs. Team 5
Team 1 vs. Team 8
Round 3: 𝑖 + 𝑗 ≡ 3 (mod 7)
2𝑖 ≡ 3 (mod 7) → 𝑖 = 5
Team 1 vs. Team 2
Team 3 vs. Team 7
Team 4 vs. Team 6
Team 5 vs. Team 8
Round 4: 𝑖 + 𝑗 ≡ 1 (mod 7)
2𝑖 ≡ 1 (mod 7) → 𝑖 = 2
Team 1 vs. Team 3
Team 5 vs. Team 6
Team 4 vs. Team 7
Team 2 vs. Team 8
Round 5: 𝑖 + 𝑗 ≡ 5 (mod 7)
2𝑖 ≡ 5 (mod 7) → 𝑖 = 6
Team 1 vs. Team 4
Team 2 vs. Team 3
Team 5 vs. Team 7
Team 6 vs. Team 8
93
SP MATH 120
Number Theory
Round 6: 𝑖 + 𝑗 ≡ 6 (mod 7)
2𝑖 ≡ 6 (mod 7) → 𝑖 = 3
Team 1 vs. Team 5
Team 2 vs. Team 4
Team 6 vs. Team 7
Team 3 vs. Team 8
Round 7: 𝑖 + 𝑗 ≡ 7 (mod 7)
2𝑖 ≡ 7 (mod 7) → 𝑖 = 7
Team 1 vs. Team 6
Team 2 vs. Team 5
Team 3 vs. Team 4
Team 7 vs. Team 8
Round T1 T2 T3 T4 T5 T6 T7 T8
1 7 6 5 8 3 2 1 4
2 8 7 6 5 4 3 2 1
3 2 1 7 6 8 4 3 5
4 3 8 1 7 6 5 4 2
5 4 3 2 1 7 8 6 5
6 5 4 8 2 1 7 6 3
7 6 5 4 3 2 1 8 7
94
SP MATH 120
Number Theory
Example
1. 0 − 201 − 06561 − 4
2. 0 − 404 − 50874 − 𝑋
Since there are ten digits in an ISBN, thus we use the congruence modulo 11.
Further, an ISBN was grouped into four blocks of digits, we have
1. 1st block → the language of the book
2. 2nd block → publishing company
3. 3rd block → number assigns to the book by the publishing company
4. 4th block → check digit
The size of the blocks differs for different languages and publishers. Further,
some ISBN’s were only grouped to 3 blocks.
The first nine digits are called decimal digits, each of the digit could be either
0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
The last digit is called the check digit, it could be 0, 1, … , 9, 𝑋.
Check digit is selected so that the congruence
10
Example
Determine whether the 𝐼𝑆𝐵𝑁 0 − 394 − 38049 − 5 is valid.
Solutions:
We need to check whether the congruence
∑10
𝑖=1 𝑖𝑥1 ≡ 0 (mod 11)
≡ 0 + 6 + 27 + 16 + 15 + 48 + 0 + 32 + 81 + 50 (mod 11)
≡ 275 (mod 11)
≡ 0 (mod 11)
Thus, the ISBN is valid.
95
SP MATH 120
Number Theory
Example
Determine whether the 𝐼𝑆𝐵𝑁 0 − 201 − 06561 − 4 is valid.
Solutions:
We need to check whether the congruence
∑10
𝑖=1 𝑖𝑥1 ≡ 0 (mod 11)
≡ 1(0) + 2(2) + 3(0) + 4(1) + 5(0) + 6(6) + 7(5) + 8(6) + 9(1) + 10(4) (mod 11)
≡ 0 + 4 + 0 + 4 + 0 + 36 + 35 + 48 + 9 + 40 (mod 11)
≡ 176 (mod 11)
≡ 0 (mod 11)
Thus, the ISBN is valid.
Try me!
Determine whether the following International Standard Book Number are valid. Write
your answer on a separate sheet of paper.
1. 0 − 13 − 190190 − 7
2. 0 − 618 − 12214 − 1
3. 0 − 63 − 124474 − 3
The identification number for a bank printed on a check consists of eight digits
𝑥1 , 𝑥2 , … , 𝑥8 followed by a ninth check digit 𝑥9 , with
𝑥9 ≡ 7𝑥1 + 3𝑥2 + 9𝑥3 + 7𝑥4 + 3𝑥5 + 9𝑥6 + 7𝑥7 + 3𝑥8 (mod 10)
Example
What is the check digit following the eight-digit identification number
00185403 for a bank?
Solution
𝑥9 ≡ 7𝑥1 + 3𝑥2 + 9𝑥3 + 7𝑥4 + 3𝑥5 + 9𝑥6 + 7𝑥7 + 3𝑥8 (mod 10)
≡ 7(0) + 3(0) + 9(1) + 7(8) + 3(5) + 9(4) + 7(0) + 3(3) (mod 10)
≡ 0 + 0 + 9 + 56 + 15 + 36 + 0 + 9 (mod 10)
≡ 125 (mod 10)
≡ 5 (mod 10)
Thus, the check digit is 5.
Check digits are also used to detect errors in passport numbers. For some
European countries, the identification number of a passport consist of a 6-digit number
𝑥1 , 𝑥2 , 𝑥3 , 𝑥4, 𝑥5 , 𝑥6 and the check digit 𝑥7 is chosen so that
96
SP MATH 120
Number Theory
97
SP MATH 120
Number Theory
98
SP MATH 120
Number Theory
Group the letters into a block of five letters, then change it to its numerical
equivalent. Thus,
I L O V E MAT HE T I C S
8 11 14 21 4 12 0 19 7 4 19 8 2 18
Now, applying Ceasar’s transformation (𝐶 ≡ 𝑃 + 3 (mod 26)), we obtain
8 11 14 21 4 12 0 19 7 4 19 8 2 18
⇓
11 14 17 24 7 15 3 22 10 7 22 11 5 21
Translating back to letters, we have
LORYH PDWKH WLFV
Hence, instead of sending the original message, the above ciphertext will be sent.
Try Me!
Decipher the ciphertext message using Ceasar’s transformation.
1. “NUMBER THEORY IS AN EASY SUBJECT”
2. “WKLVL VKRZZ HGHFL SKHU”
In general, we fix an alphabet {𝐴, 𝐵, … , 𝑌, 𝑍} so that 𝑚 = 26. Then choose a
secret key such that 0 < 𝑘 < 𝑚. Then the encryption and decryption functions are
𝐶 = 𝑃 + 𝑘 (mod 𝑚) and 𝑃 = 𝐶 + 𝑘 (mod 𝑚)
respectively.
Clearly, Ceasar cipher (Shift Transfortations) is insecure since the key space is
only as large as the alphabet. Thus, an alternative cipher (though still not secure) was
introduced, which is known as the affine transformations.
The encryption and decryption functions are
𝐶 ≡ 𝑎𝑃 + 𝑏 (mod 26) and 𝑃 = 𝑎−1 (𝐶 − 𝑏) (mod 26)
respectively
We require that (𝑎, 26) = 1, so that 𝑃 runs through a complete system of
residues modulo 26, 𝐶 also does.
Since there are 𝜙 (26) = 12 choices of 𝑎 and 26 choices for 𝑏 giving a total of
12 ∙ 26 = 312 transformations (key space).
As an example of such cipher, let 𝑎 = 7 and 𝑏 = 10, so that 𝐶 ≡ 7𝑃 +
10 (mod 26).
Now to find the value of 𝑎−1 , we will use the congruence 𝑎−1 ≡ 1 (mod 26).
To decode the inverse of 7 modulo 26 is 15. Thus 7 ∙ 15 ≡ 105 (mod 26) ≡
1 (mod 26).
99
SP MATH 120
Number Theory
Example
Encipher the message “PLEASE SEND MONEY”.
Solution
Group the letters into a block of five letters, then change it to its numerical
equivalent. Thus,
P LEAS E SEND M O N EY
15 11 4 0 18 4 18 4 13 3 12 14 13 4 24
Now, applying affine transformations encryption (𝐶 ≡ 𝑎𝑃 + 𝑏 (mod 26)) we
obtain
𝐶 ≡ 7(15) + 10 (mod 26) ≡ 115 (mod 26) ≡ 11 (mod 26) ⟹L
𝐶 ≡ 7(11) + 10 (mod 26) ≡ 87 (mod 26) ≡ 9 (mod 26) ⟹J
𝐶 ≡ 7(4) + 10 (mod 26) ≡ 38 (mod 26) ≡ 12 (mod 26) ⟹M
𝐶 ≡ 7(0) + 10 (mod 26) ≡ 10 (mod 26) ≡ 10 (mod 26) ⟹K
𝐶 ≡ 7(18) + 10 (mod 26) ≡ 136 (mod 26) ≡ 6 (mod 26) ⟹G
100
SP MATH 120
Number Theory
𝑃 ≡ 15 (4 − 10) (mod 26) ≡ 15(−6) (mod 26) ≡ −90 (mod 26) ≡ 14 (mod 26) ⟹O
𝑃 ≡ 15 (23 − 10) (mod 26) ≡ 15(13) (mod 26) ≡ 195 (mod 26) ≡ 13 (mod 26) ⟹N
𝑃 ≡ 15 (4 − 10) (mod 26) ≡ 15(−6) (mod 26) ≡ −90 (mod 26) ≡ 14 (mod 26) ⟹O
𝑃 ≡ 15 (13 − 10) (mod 26) ≡ 15(3) (mod 26) ≡ 45 (mod 26) ≡ 19 (mod 26) ⟹T
𝑃 ≡ 15 (25 − 10) (mod 26) ≡ 15(15) (mod 26) ≡ 225 (mod 26) ≡ 13 (mod 26) ⟹R
𝑃 ≡ 15 (12 − 10) (mod 26) ≡ 15(2) (mod 26) ≡ 30 (mod 26) ≡ 4 (mod 26) ⟹E
𝑃 ≡ 15 (1 − 10) (mod 26) ≡ 15(−9) (mod 26) ≡ 135 (mod 26) ≡ 21 (mod 26) ⟹V
𝑃 ≡ 15 (12 − 10) (mod 26) ≡ 15(2) (mod 26) ≡ 30 (mod 26) ≡ 4 (mod 26) ⟹E
𝑃 ≡ 15 (10 − 10) (mod 26) ≡ 15(0) (mod 26) ≡ 0 (mod 26) ≡ 0 (mod 26) ⟹A
𝑃 ≡ 15 (9 − 10) (mod 26) ≡ 15(−1) (mod 26) ≡ −15 (mod 26) ≡ 11 (mod 26) ⟹L
𝑃 ≡ 15 (13 − 10) (mod 26) ≡ 15(3) (mod 26) ≡ 45 (mod 26) ≡ 19 (mod 26) ⟹T
𝑃 ≡ 15 (7 − 10) (mod 26) ≡ 15(−3) (mod 26) ≡ 45 (mod 26) ≡ 7 (mod 26) ⟹H
𝑃 ≡ 15 (12 − 10) (mod 26) ≡ 15(2) (mod 26) ≡ 30 (mod 26) ≡ 4 (mod 26) ⟹E
𝑃 ≡ 15 (6 − 10) (mod 26) ≡ 15(−4) (mod 26) ≡ −60 (mod 26) ≡ 18 (mod 26) ⟹S
𝑃 ≡ 15 (12 − 10) (mod 26) ≡ 15(2) (mod 26) ≡ 30 (mod 26) ≡ 4 (mod 26) ⟹E
𝑃 ≡ 15 (24 − 10) (mod 26) ≡ 15(14) (mod 26) ≡ 210 (mod 26) ≡ 2 (mod 26) ⟹C
𝑃 ≡ 15 (25 − 10) (mod 26) ≡ 15(15) (mod 26) ≡ 225 (mod 26) ≡ 17 (mod 26) ⟹R
𝑃 ≡ 15 (12 − 10) (mod 26) ≡ 15(2) (mod 26) ≡ 30 (mod 26) ≡ 4 (mod 26) ⟹E
𝑃 ≡ 15 (13 − 10) (mod 26) ≡ 15(3) (mod 26) ≡ 45 (mod 26) ≡ 19 (mod 26) ⟹T
101
SP MATH 120
Number Theory
Try Me!
Use affine transformations to encipher and decipher the text. Write your answer on a
separate sheet.
1. Encipher the message “I LOVE NUMBER THEORY”, then decipher back to
original text. When 𝑎 = 6 and 𝑏 = 8.
Overall Analysis
1. How did you solve real world applications of congruences?
_________________________________________________________
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
2. What are the steps in solving real world applications of congruences?
_________________________________________________________
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
3. Make a conclusion on your learning about the lesson.
_________________________________________________________
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
Application
Apply the different definitions and theorems discussed above to solve the following
statement. Write your answer on a separate sheet of paper.
1. Encipher the message “BSED MAJOR IN MATH”, then decipher back to
original text. When 𝑎 = 3 and 𝑏 = 15.
Assessment
Solve the following real-world applications of congruences. Write your answer on a
separate sheet.
1. Using affine transformations encipher the message “BSED MAJOR IN
MATH”, then decipher back to original text. When 𝑎 = 3 and 𝑏 = 15.
2. Using Ceasar’s transformation encipher the message “I WILL PASS THE
EXAM”, then decipher back to original text.
3. Compute the check digit of European pass with an identification number of
913246.
4. Determine whether the ISBN 0 − 635 − 30481 − 3 is valid.
5. In a round-robin tournament scheduling, determine the home team for each
game where there are; a. 3 teams, b. 4 teams.
102
SP MATH 120
Number Theory
103