Uploaded by John Rey Domingo

1 AA - Modular Arithmetic

advertisement
OBJECTIVES
• UNDERSTAND MODULAR ARITHMETIC WITH EXAMPLES
• UNDERSTAND ABOUT CONGRUENCE
• IDENTIFY VALID AND INVALID CONGRUENCE
• USE MODULO CONCEPTS AND PROPERTIES TO SOLVE
MODULAR ARITHMETIC PROBLEMS AND COMPOSE
PROOFS
MODULAR ARITHMETIC
•ANOTHER
APPLICATION OF THE DIVISION
ALGORITHM THAT WILL BE IMPORTANT TO US IS
MODULAR ARITHMETIC. MODULAR ARITHMETIC
IS AN ABSTRACTION OF A METHOD OF
COUNTING THAT YOU OFTEN USE
FOR EXAMPLE
•
IF IT IS NOW SEPTEMBER, WHAT MONTH WILL IT BE 25 MONTHS
FROM NOW?
• OF COURSE, THE
ANSWER IS OCTOBER, BUT THE INTERESTING
FACT IS THAT YOU DIDN’T ARRIVE AT THE ANSWER BY STARTING
WITH SEPTEMBER AND COUNTING OFF 25 MONTHS.
• INSTEAD,
WITHOUT EVEN THINKING ABOUT IT, YOU SIMPLY
OBSERVED THAT 25=2∙12+1, AND YOU ADDED 1 MONTH TO
SEPTEMBER
FOR EXAMPLE
• If it is now wednesday, you know that in 23 days it
will be friday.
• This time, you arrived at your answer by noting that
23=3∙ 7+2, so you added 2 days to wednesday instead
of counting off 23 days
WHAT IS MODULAR ARITHMETIC?
•Modular arithmetic is an abstraction of a
method of counting that you often use.
Surprisingly, this simple idea has numerous
important applications in mathematics and
computer science.
THE DIVISION ALGORITHM:
• Given any positive integer n and any nonnegative integer a, if we
divide a by n, we get an integer quotient q and an integer remainder
r that obey the following relationship:
•
a=qn+r
0  r < n ; q = a / n 
• Where x is the largest integer less than or equal to x.
E.G. Let a = 7 and n = 3, then 7 = 2  3 + 1. Here, q = 2 and r = 1,
Let a = 10 and n = 2, then 10 = 5  2 + 0. Here, q = 5 and r = 0,
Let a = -11 and n = 7, then -11 = (-2)  7 + 3. Here, q = -2 and r = 3.
WHAT IS MODULAR ARITHMETIC?
•When a=qn+r, where q is the
quotient and r is the remainder
upon dividing a by n, we write
a mod n = r.
EXAMPLE
3 mod 2 = 1 since 3= 1∙2+1
6 mod 2=0 since 6=3∙2+0,
11 mod 3=2 since 11=3∙3+2,
62 mod 85=62 since 62=0∙85+62,
-2 mod 15 = 13 since -2 =(-1)15+13
a≡ r mod n
a: dividend
r:remainder
n:divisor
Modular arithmetic
operations:
• The (mod n) operation maps all integers into the set of integers
{0, 1, … , (n -1)}. The modular arithmetic exhibits the following
properties:
How to calculate
b
a
mod n
5
Calculate 2 𝑚𝑜𝑑5
10
Calculate 8 𝑚𝑜𝑑13
Calculate
8
4 𝑚𝑜𝑑11
Download