Did You Know That You Use Modular Arithmetic Daily
Did You Know That You Use Modular Arithmetic Daily
Jenn, Founder Calcworkshop ®, 15+ Years Experience (Licensed & Certified Teacher)
It’s true!
The Clock
Every time you think about “time,” you use modular arithmetic because it deals with cycles of
integers and remainders just like a clock.
For example, suppose your clock reads 9:00 (am/pm is not important).
Well, 9 + 10 = 19, but “19 o’clock” is not something that can be displayed on a clock with the
numbers 1 to 12.
We subtract 12 from 19 and proudly say that the clock will show 7:00.
This is the idea behind modular arithmetic, which is sometimes referred to as “clock arithmetic”
because 19 mod 12 = 7 mod 12, where 7 represents the remainder when 19 is divided by 12. You
can review more history behind the idea at the Institute for Advanced Studies .
Example #1
What is 16 mod 12?
Example #3
And if you have 18 mod 9?
Alright, so we know that 18 divided by 9 equals 2 remainder 0, so that means 18 mod 9 is equivalent
to 0!
Example #4
For this problem, suppose we wanted to evaluate -97 mod 11.
Modular Congruence
Now, in number theory, we often want to focus on whether two integers say a and b, have the same
remainder when divided by m. This is the idea behind modular congruence.
Congruence is nothing more than a statement about divisibility and was first introduced by Carl
Friederich Gauss.
He surmised that if a and b are integers, and m is a positive integer, then a is congruent
to b modulo m if and only if m divides a minus b.
In other words, a congruence modulo asks whether or not a and b are in the same equivalence
class.
Congruence Modulo Property
Equivalence Class
What’s an equivalence class?
It’s best explained with an example.
Suppose we want to find the equivalence classes of mod 3. Well, we know that “mod” means we are
interested in remainders, so what are the possible remainders when a number is divided by 3?
It’s 0, 1, or 2!
Here’s how.
Okay, so the remainders of 0, 1, or 2 comprise the equivalence classes for mod 3, which we write as
[0], [1], and [2].
But let’s look a bit deeper and find all the values within each class (partition).
Here’s a trick, start by listing the equivalence classes as separate columns and then start at zero and
keep writing numbers consecutively, wrapping to the next row, as shown below.
Equivalence Class Mod 3
This means that [0] = {…-6,-3,0,3,6,9,…} and [1] = {…-5,-2,1,4,7,10,…} and [2] = {…-5,-1,2,5,8,11,…}
Why?
Because every integer within the equivalence class has the same remainder when divided by 3!
If n is a positive integer then integers a and b are congruent modulo n if they have the same
remainder when divided by n. Another way to think of congruence modulo, is to say that integers a
and b congruent modulo n if their difference is a multiple of n.
For example, 7 and 4 are congruent modulo 3 because not only are they in the same equivalence
class, but their difference 7-4 = 3, is a multiple of 3 (i.e., 3 divides 3), as shown below.
Problem #1
Determine Congruence — Example
But 11 and 6 are not congruent modulo 3 because they are not in the same equivalence class and
their difference, 11-6 = 5, is not a multiple of 3, as illustrated below.
Problem #2
So, what have we learned? If the remainders are equal to each other, then they are congruent! And
the following theorem highlights this very idea:
Congruence Property
In our lesson, we will work through several proofs for these essential theorems, as they are pivotal
in our understanding of equivalence relations (future lesson) and allow us to define arithmetic
operations.
For example, let’s find:
1. (7+9)(mod 11)
2. (7)(9)(mod 5)
The definition of addition and multiplication modulo follows the same properties of ordinary
addition and multiplication of algebra.
Closure
Commutativity
Associativity
Identity
Inverse
Distributivity
Together we will work through countless examples of modular arithmetic and the importance of the
remainder and congruence modulus and arithmetic operations to ensure mastery and
understanding of this fascinating topic.
Introduction to Video
Practical overview of clock arithmetic
00:00:28
Exclusive Content for Members Only
3. Solve 5x ≡ 4 (mod 6)
4. Solve 3x − 2 ≡ 0 (mod 11)
5. What is the time 100 hours after 7 a.m.?
6. What is the time 15 hours before 11 p.m.?
7. Today is Tuesday. My uncle will come after 45 days. In which day my uncle will be coming?
8. Prove that 2n + 6 × 9n is always divisible by 7 for any positive integer n.
9. Find the remainder when 281 is divided by 17.
10. The duration of flight travel from Chennai to London through British Airlines is approximately 11 hours. The
airplane begins its journey on Sunday at 23:30 hours. If the time at Chennai is four and half hours ahead to that of
London’s time, then find the time at London, when will the flight lands at London Airport.
Answers:
1.(i) 7 (ii) 5 (iii) 2 (iv) 7 (v) 2
2. 3
3. 2,8,14,…
4. 8, 19, 30, …
5. 11 a.m
6. 8 p.m
7. Friday
9. 2
10. 6 am, Monday
The receiving clerk calculates the check digit as follows: (from the Incorrect ISBN)
d
13
= 10 – (d
1
+ 3d
2
+d
3
+ 3d
4
+d
5
+ 3d
6
+d
7
+ 3d
8
+d
9
+ 3d
10
+d
11
+3d
12
) mod 10
= 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.
Solution
d
13
= 10 – (d
1
+ 3d
2
+d
3
+ 3d
4
+d
5
+ 3d
6
+d
7
+ 3d
8
+d
9
+ 3d
10
+d
11
+3d
12
) mod 10
= 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
Thus, the check digit is 3.
Check your progress. 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 or not.
(valid ISBN means that the value of d
13
and the check digit are the same).
Your answer should be: not valid because the given check digit is 5 which is not equal to d
13
which is 1.
Another coding scheme that is closely related to the ISBN is the UPC (Universal Product
Code). This number is placed on many items and is particularly useful in grocery stores. A
Formula for the ISBN Check Digit
d
13
= 10 – (d
1
+ 3d
2
+d
3
+ 3d
4
+d
5
+ 3d
6
+d
7
+ 3d
8
+d
9
+ 3d
10
+d
11
+3d
12
) mod 10
Note: If d
13
= 10, then the check digit is 0.
CHECK DIGIT
2
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 customers.
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
3
,…,
d
12
, we can write a formula for the UPC check digit d
12
.
Solution
d
12
= 10 – (3d
1
+d
2
+ 3d
3
+d
4
+ 3d
5
+d
6
+ 3d
7
+d
8
+ 3d
9
+d
10
+ 3d
11
) mod 10
= 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
Thus, the check digit is 5.
Companies that issue credit cards also use modular arithmetic to determine whether a
credit card 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 digits 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
MasterCard
51 or 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 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. If a digit becomes a two digit number, after
being doubled, treat the number as two individual digits, find the sum. Now, the sum of the new
list of digits must be congruent to 0 mod 10. The Luhn algorithm is demonstrated in the next
example.
Formula for the UPC Check Digit
d
12
= 10 – (3d
1
+d
2
+ 3d
3
+d
4
+ 3d
5
+d
6
+ 3d
7
+d
8
+ 3d
9
+d
10
+ 3d
11
) mod 10
Note: If d
12
= 10, then the check digit is 0.
Sign up to view the full document!
lock_open S I G N U P
Showing Page:
3/5