L-5. Modular Arithmetic
L-5. Modular Arithmetic
L-5. Modular Arithmetic
Cryptography
Lecture 5
2-2 MODULAR ARITHMETIC
Some Zn sets
5
2.2.3 Congruence
Example
6
2.2.3 Continued
Concept of congruence
8
2.2.3 Continued
Residue Classes
A residue class [a] or [a]n is the set of integers congruent
modulo n.
Example
For n=5,
9
2.2.3 Continued
Binary operations in Zn
11
2.2.4 Continued
Example
Perform the following operations (the inputs come from
Zn):
a. Add 7 to 14 in Z15.
b. Subtract 11 from 7 in Z13.
c. Multiply 11 by 7 in Z20.
Solution
12
2.2.4 Continued
Example
Perform the following operations (the inputs come
from either Z or Zn):
a. Add 17 to 27 in Z14.
b. Subtract 43 from 12 in Z13.
c. Multiply 123 by −10 in Z19.
Solution
14
2.2.4 Continued
15
2.2.4 Continued
Example
16
2.2.4 Continued
Example
Example
10001 mod 7= ?
5
17
2.2.4 Continued
Example
Exponentiation is performed by repeated
multiplication, as in ordinary arithmetic.
18
2.2.4 Continued
Example
We have been told in arithmetic that the remainder of
an integer divided by 3 is the same as the remainder of
the sum of its decimal digits. We write an integer as the
sum of its digits multiplied by the powers of 10.
19
Properties of Modular Arithmetic
Property Expression
Commutative laws (w + x) mod n = (x + w) mod n
(w * x) mod n = (x * w) mod n
21
2.2.5 Continue
Additive Inverse
In Zn, two numbers a and b are additive inverses of
each other if
Note
Solution
The four pairs of additive inverses are (0, 0), (1, 6),
(2, 5), and (3, 4).
Solution
The six pairs of additive inverses are (0, 0), (1, 9), (2,
8), (3, 7), (4, 6), and (5, 5).
23
2.2.5 Continue
Multiplicative Inverse
In Zn, two numbers a and b are the multiplicative
inverse of each other if
Note