Modular Number
Modular Number
Modular numbers
-Modular numbers up to mod 12
Similarly,
* 9 + 7 = 16 and 16 12 = 1
remainder 4
* 3 + 15 = 18 and 18 12 = 1
remainder 6
* 2 + 9 = 11 and 11 12 = 0
remainder 11
* 12 + 15 = 27 and 27 12 = 2 remainder 3
Definition
*Two numbers a and b, are congruent modulo m
if the difference between them, a - b is divisible
by m.
*
a b (mod m)
* 27 is congruent to 3 modulo 12 since the
difference between 27 and 3 is 24, and 24 is
divisible by 12,
* 27 3 (mod 12)
* Similarly, 15 and 39
are also congruent to 3
modulo 12, 39 3 (mod 12)
* 15 3 (mod 12)
These are also true.
12 0 (mod 12)
14 2 (mod 12)
29 5 (mod 12)
59 ___(mod 12)
36 ___(mod 12)
* (a mod n) means the remainder
when a is divided by n.
* a mod n = r
* a = dn + r for some integer d
(a mod n) means the remainder
when a is divided by n.
a mod n = r
31 81 [mod 2] Written as a n b,
31 2 81
and spoken
a and b are
31 80 [mod 7] equivalent or
31 7 80 congruent modulo
n
n is an equivalence relation
In other words, it is
Reflexive: a n a
Symmetric: (a n b) (b n a)
Transitive: (a n b and b n c) (a n
c)
n induces a natural partition of the
integers into n residue classes.
just do -2 * 2 = -4 = 247
1) x + a n y + b
2) x * a n y * b
Proof of 2: xa = yb (mod n)
(The other proof is similar)
xa = (i n + y)(j n + b) = n(ijn+ib+jy) + y
nyb
Another Simple Fact:
If (x n y) and (k|n), then: x k y
Example: 10 6 16 10 3 16
Proof:
x n y iff x = in + y for some integer i
Let j=n/k, or n=jk Then we have:
x = ijk + y
x = (ij)k + y therefore x k y
A Unique Representation System
Modulo n:
+ and * defined on S:
+ 0 1 2 * 0 1 2
0 0 1 2 0 0 0 0
1 1 2 0 1 0 1 2
2 2 0 1 2 0 2 1
Unique representation system mod 4
+ and * defined on S:
+ 0 1 2 3 * 0 1 2 3
0 0 1 2 3 0 0 0 0 0
1 1 2 3 0 1 0 1 2 3
2 2 3 0 1 2 0 2 0 2
3 3 0 1 2 3 0 3 2 1
Notation
Zn = {0, 1, 2, , n-1}
a +n b = (a + b mod n)
a *n b = (a * b mod n)
Some properties of the operation +n
[Closed]
x, y Zn x +n y Zn
[Associative]
x, y, z Zn (x +n y) +n z = x +n (y +n z)
[Commutative]
x, y Zn x +n y = y +n x
+ and * defined on S:
+ 0 1 2 * 0 1 2
0 0 1 2 0 0 0 0
1 1 2 0 1 0 1 2
2 2 0 1 2 0 2 1
Unique representation system mod 3
+ 0 1 2 * 0 1 2
0 0 1 2 0 0 0 0
1 1 2 0 1 0 1 2
2 2 0 1 2 0 2 1
Unique representation system mod 2
+2 *2
0 1 0 1
XOR AND
0 0 1 0 0 0
1 1 0 1 0 1
Z5 = {0,1,2,3,4}
+ 0 1 2 3 4 * 0 1 2 3 4
0 0 1 2 3 4 0 0 0 0 0 0
1 1 2 3 4 0 1 0 1 2 3
2 2 3 4 0 1 2 0
3 3 4 0 1 2 3 0 3 1 4
4 4 0 1 2 3 4 0 4 3 2
Z6 = {0,1,2,3,4,5}
+ 0 1 2 3 4 5 * 0 1 2 3 4 5
0 0 1 2 3 4 5 0 0 0 0 0 0
1 1 2 3 4 5 0 1 0 1 2 3 4
2 2 3 4 5 0 1 2 0 2 4 0 2
3 3 4 5 0 1 2 3 0
4 4 5 0 1 2 3 4 0 4 2 0 4
5 5 0 1 2 3 4 5 0 5 4 3 2
For addition tables, rows and columns
always are a permutation of Zn
(A group as well see later in the course.)
+ 0 1 2 3 4 5
+ 0 1 2 3 4 0 0 1 2 3 4 5
0 0 1 2 3 4 1 1 2 3 4 5 0
1 1 2 3 4 0 2 2 3 4 5 0 1
2 2 3 4 0 1 3 3 4 5 0 1 2
3 3 4 0 1 2 4 4 5 0 1 2 3
4 4 0 1 2 3 5 5 0 1 2 3 4
For multiplication, some rows and columns
are permutation of Zn, while others arent
* 0 1 2 3 4 * 0 1 2 3 4 5
0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 1 2 3 4 1 0 1 2 3 4 5
2 0 2 4 1 3 2 0 2 4 0 2 4
3 0 3 1 4 2 3 0 3 0 3 0 3
4 0 4 3 2 1 4 0 4 2 0 4 2
5 0 5 4 3 2 1
whats happening here?
For addition, the permutation property
means you can solve, say,
4 + ___ = 1 (mod 6)
4 + ___ = x (mod 6) for any x in Z6
Subtraction mod n is + 0 1 2 3 4 5
well-defined 0 0 1 2 3 4 5
1 1 2 3 4 5 0
Each row has a 0, 2 2 3 4 5 0 1
hence a is that element
3 3 4 5 0 1 2
such that a + (-a) = 0
4 4 5 0 1 2 3
a b = a + (-b) 5 5 0 1 2 3 4
For multiplication, if a row has a permutation
you can solve, say,
5 * ___ = 4 (mod 6)
or, 5 * ___ = 1 (mod 6)
* 0 1 2 3 4 5
0 0 0 0 0 0 0
1 0 1 2 3 4 5
2 0 2 4 0 2 4
3 0 3 0 3 0 3
4 0 4 2 0 4 2
5 0 5 4 3 2 1
But if the row does not have the permutation
property, how do you solve
no solutions! 3 * ___ = 4 (mod 6)
multiple solutions! 3 * ___ = 3 (mod 6)
* 0 1 2 3 4 5
0 0 0 0 0 0 0
1 0 1 2 3 4 5
3 * ___ = 1 (mod 6) 2 0 2 4 0 2 4
3 0 3 0 3 0 3
no multiplicative
4 0 4 2 0 4 2
inverse!
5 0 5 4 3 2 1
Division
If you define 1/a (mod n) = a-1 (mod n)
as the element b in Zn
such that a * b = 1 (mod n)
* 0 1 2 3 4 5 6 7
0 0 0 0 0 0 0 0 0
1 0 1 2 3 4 5 6 7
2 0 2
3 0 3
4 0 4
5 0 5
6 0 6
7 0 7
consider *8 on Z8
A visual way to understand
multiplication
and the
permutation property.
There are exactly 8 distinct
multiples of 3 modulo 8.
0
7
1
6
2
5 3
6
2
5 3
6
2
5 3
4
There are exactly 4 distinct
multiples of 6 modulo 8.
0
7
1
6
2
5 3
4
* exactly 8 distinct multiples of 3 modulo 8.
* exactly 2 distinct multiples of 4 modulo 8
* exactly 1 distinct multiple of 8 modulo 8
* exactly 4 distinct multiples of 6 modulo 8
multiples of x modulo y
Theorem: There are exactly
LCM(n,c)/c = n/GCD(c,n)
distinct multiples of c modulo n
Theorem: There are exactly k = n/GCD(c,n)
distinct multiples of c modulo n, and these
multiples are { c*i mod n | 0 i < k }
Proof:
Clearly, c/GCD(c,n) 1 is a whole number
ck = cn/GCD(c,n) = n(c/GCD(c,n)) n 0
There are k distinct multiples of c mod n:
c*0, c*1, c*2, , c*(k-1)
Hence exactly k.
Theorem: There are exactly
LCM(n,c)/c = n/GCD(c,n)
distinct multiples of c modulo n
Hence,
only those values of c with GCD(c,n) = 1
have n distinct multiples
(i.e., the permutation property for *n on
Zn )
And remember, permutation property means
you can divide out by c (working mod n)
Fundamental lemma of division
modulo n:
if GCD(c,n)=1, then ca n cb a n b
Proof:
c*1, c*2, c*3, , c*(n-1) are all in distinct
residue classes modulo n.
Q E D.
If you want to extend to
general c and n
ca n cb a n/gcd(c,n) b
Fundamental lemmas mod n:
1) x + a n y + b
2) x * a n y * b
3) x - a n y b
if gcd(c,n)=1
4) cx n cy a n b
New definition:
+ 0 1 2 3 4 5 * 0 1 2 3 4 5
0 0 1 2 3 4 5 0 0 0 0 0 0 0
1 1 2 3 4 5 0 1 0 1 2 3 4 5
2 2 3 4 5 0 1 2 0 2 4 0 2 4
3 3 4 5 0 1 2 3 0 3 0 3 0 3
4 4 5 0 1 2 3 4 0 4 2 0 4 2
5 5 0 1 2 3 4 5 0 5 4 3 2 1
Weve got closure
Recall we proved that Zn was closed
under addition and multiplication?
*12 1 5 7 11
1 1 5 7 11
5 5 1 11 7
7 7 11 1 5
11 11 7 5 1
Z15*
* 1 2 4 7 8 11 13 14
1 1 2 4 7 8 11 13 14
2 2 4 8 14 1 7 11 13
4 4 8 1 13 2 14 7 11
7 7 14 13 4 11 2 1 8
8 8 1 2 11 4 13 14 7
11 11 7 14 2 13 1 8 4
13 13 11 7 1 14 8 4 2
14 14 13 11 8 7 4 2 1
Z5* = {1,2,3,4} = Z5 \ {0}
*
1 2 3 4
5
1 1 2 3 4
2 2 4 1 3
3 3 1 4 2
4 4 3 2 1
Fact:
For prime p, the set Zp* = Zp \ {0}
Proof:
It just follows from the
definition!