§36 Modular Arithmetic

advertisement
§36 Modular Arithmetic
Tom Lewis
Fall Term 2010
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
1 / 10
Outline
1
The set Zn
2
Addition and multiplication
3
Modular additive inverse
4
Modular multiplicative inverse
5
What are the invertible elements of Zn ?
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
2 / 10
The set Zn
Definition
Given an integer n ≥ 1, let
Zn = {0, 1, 2, 3, · · · , n − 1};
We call this the set of integers modulo n.
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
3 / 10
The set Zn
Definition
Given an integer n ≥ 1, let
Zn = {0, 1, 2, 3, · · · , n − 1};
We call this the set of integers modulo n.
Note
It is helpful to think of these as representatives of the equivalence classes
modulo n of Z.
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
3 / 10
Addition and multiplication
Definition
Let a, b ∈ Zn . We define
a ⊕ b = (a + b) mod n
a ⊗ b = (a · b) mod n
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
4 / 10
Addition and multiplication
Definition
Let a, b ∈ Zn . We define
a ⊕ b = (a + b) mod n
a ⊗ b = (a · b) mod n
Problem
Construct addition and multiplication tables for Z3 and Z4 .
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
4 / 10
Addition and multiplication
Theorem
Let n ≥ 2 be an integer. Let a, b, and c be elements of Zn .
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
5 / 10
Addition and multiplication
Theorem
Let n ≥ 2 be an integer. Let a, b, and c be elements of Zn .
Commutative a ⊕ b = b ⊕ a and a ⊗ b = b ⊗ a
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
5 / 10
Addition and multiplication
Theorem
Let n ≥ 2 be an integer. Let a, b, and c be elements of Zn .
Commutative a ⊕ b = b ⊕ a and a ⊗ b = b ⊗ a
Associative a ⊕ (b ⊕ c) = (a ⊕ b) ⊕ c and a ⊗ (b ⊗ c) = (a ⊗ b) ⊗ c
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
5 / 10
Addition and multiplication
Theorem
Let n ≥ 2 be an integer. Let a, b, and c be elements of Zn .
Commutative a ⊕ b = b ⊕ a and a ⊗ b = b ⊗ a
Associative a ⊕ (b ⊕ c) = (a ⊕ b) ⊕ c and a ⊗ (b ⊗ c) = (a ⊗ b) ⊗ c
Identity a ⊕ 0 = 0 and a ⊗ 1 = a
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
5 / 10
Addition and multiplication
Theorem
Let n ≥ 2 be an integer. Let a, b, and c be elements of Zn .
Commutative a ⊕ b = b ⊕ a and a ⊗ b = b ⊗ a
Associative a ⊕ (b ⊕ c) = (a ⊕ b) ⊕ c and a ⊗ (b ⊗ c) = (a ⊗ b) ⊗ c
Identity a ⊕ 0 = 0 and a ⊗ 1 = a
Distributive a ⊗ (b ⊕ c) = (a ⊗ b) ⊕ (a ⊗ c)
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
5 / 10
Modular additive inverse
Theorem
Given a ∈ Zn , there exists a unique x ∈ Zn such that
a ⊕ x = 0 mod n
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
6 / 10
Modular additive inverse
Theorem
Given a ∈ Zn , there exists a unique x ∈ Zn such that
a ⊕ x = 0 mod n
Definition
Given a ∈ Zn , let −a denote the unique element such that
a ⊕ (−a) = 0 mod n
−a is called the additive inverse of a.
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
6 / 10
Modular additive inverse
Definition
Given a, b ∈ Zn , define
a b = a ⊕ (−b)
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
7 / 10
Modular additive inverse
Definition
Given a, b ∈ Zn , define
a b = a ⊕ (−b)
Problem
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
7 / 10
Modular additive inverse
Definition
Given a, b ∈ Zn , define
a b = a ⊕ (−b)
Problem
Evaluate −8 and compute 3 8 in Z11 .
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
7 / 10
Modular additive inverse
Definition
Given a, b ∈ Zn , define
a b = a ⊕ (−b)
Problem
Evaluate −8 and compute 3 8 in Z11 .
Evaluate −8 and compute 3 8 in Z15 .
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
7 / 10
Modular multiplicative inverse
Definition
Let a ∈ Zn . A reciprocal of a is a number b ∈ Zn such that a ⊗ b = 1. A
number that has a reciprocal is called invertible.
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
8 / 10
Modular multiplicative inverse
Definition
Let a ∈ Zn . A reciprocal of a is a number b ∈ Zn such that a ⊗ b = 1. A
number that has a reciprocal is called invertible.
Problem
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
8 / 10
Modular multiplicative inverse
Definition
Let a ∈ Zn . A reciprocal of a is a number b ∈ Zn such that a ⊗ b = 1. A
number that has a reciprocal is called invertible.
Problem
Find a reciprocal of 3 in Z7 .
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
8 / 10
Modular multiplicative inverse
Definition
Let a ∈ Zn . A reciprocal of a is a number b ∈ Zn such that a ⊗ b = 1. A
number that has a reciprocal is called invertible.
Problem
Find a reciprocal of 3 in Z7 .
Find a reciprocal of 5 in Z6 .
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
8 / 10
Modular multiplicative inverse
Definition
Let a ∈ Zn . A reciprocal of a is a number b ∈ Zn such that a ⊗ b = 1. A
number that has a reciprocal is called invertible.
Problem
Find a reciprocal of 3 in Z7 .
Find a reciprocal of 5 in Z6 .
Show that 2 is not invertible in Z6 .
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
8 / 10
Modular multiplicative inverse
Theorem
If a is invertible in Zn , then it has a unique inverse in Zn , denoted by a−1 .
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
9 / 10
Modular multiplicative inverse
Theorem
If a is invertible in Zn , then it has a unique inverse in Zn , denoted by a−1 .
Definition (Division)
Let n be a positive integer and let b be an invertible element of Zn . Let
a ∈ Zn be arbitrary. Then a/b is defined by a ⊗ b −1 .
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
9 / 10
Modular multiplicative inverse
Theorem
If a is invertible in Zn , then it has a unique inverse in Zn , denoted by a−1 .
Definition (Division)
Let n be a positive integer and let b be an invertible element of Zn . Let
a ∈ Zn be arbitrary. Then a/b is defined by a ⊗ b −1 .
Problem
Compute 3/5 in Z6 .
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
9 / 10
What are the invertible elements of Zn ?
Theorem
Let n be a positive integer and let p ∈ Zn . p and n are relatively prime if
and only if p is invertible in Zn .
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
10 / 10
What are the invertible elements of Zn ?
Theorem
Let n be a positive integer and let p ∈ Zn . p and n are relatively prime if
and only if p is invertible in Zn .
Problem
Evaluate 81/35 in Z144 .
Tom Lewis ()
§36 Modular Arithmetic
Fall Term 2010
10 / 10
Download