480 likes | 952 Views
Modular Arithmetic. Lecture 8. Modular Arithmetic. Def : a b (mod n) iff n|( a - b) iff a mod n = b mod n. Modular Addition. Lemma : If a c (mod n), and b d (mod n) then a+b c+d (mod n). Modular Multiplication.
E N D
Modular Arithmetic Lecture 8
Modular Arithmetic Def:a b (mod n) iff n|(a - b) iff a mod n = b mod n.
Modular Addition Lemma: If a c (mod n), and b d (mod n) then a+b c+d (mod n).
Modular Multiplication Lemma: If a c (mod n), and b d (mod n) then ab cd (mod n).
Exercise 1444 mod 713 =
Exercise 1243 mod 713 =
Application Why is a number written in decimal evenly divisible by 9 if and only if the sum of its digits is a multiple of 9? Hint: 10 1 (mod 9).
Linear Combination vs Common Divisor Greatest common divisor d is a common divisor of a and b if d|a and d|b gcd(a,b) = greatest common divisor of a and b Smallest positive integer linear combination d is an integer linear combination of a and b if d=sa+tb spc(a,b) = smallestpositive integer linear combination of a and b Theorem: gcd(a,b) = spc(a,b)
Linear Combination vs Common Divisor Theorem: gcd(a,b) = spc(a,b) For example, the greatest common divisor of 52 and 44 is 4. And 4 is a linear combination of 52 and 44: 6 · 52 + (−7) · 44 = 4 Furthermore, no linear combination of 52 and 44 is equal to a smaller positive integer. To prove the theorem, we will prove: gcd(a,b) | spc(a,b) gcd(a,b) <= spc(a,b) spc(a,b) is a common divisor of a and b spc(a,b) <= gcd(a,b)
SPC <= GCD We will prove that spc(a,b) is actually a common divisor of a and b.
Linear Combination vs Common Divisor Theorem: gcd(a,b) = spc(a,b) Lemma:p prime and p|a·b implies p|a or p|b. Cor : If p is prime, and p| a1·a2···amthen p|aifor some i.
Linear Combination vs Common Divisor Theorem: gcd(a,b) = spc(a,b) Lemma. If gcd(a,b)=1 and gcd(a,c)=1, then gcd(a,bc)=1.
Fundamental Theorem of Arithmetic Every integer, n>1, has a unique factorization into primes: p0≤ p1 ≤ ··· ≤ pk p0p1 ··· pk = n Example: 61394323221 = 3·3·3·7·11·11·37·37·37·53
Unique Factorization Claim: There is a unique factorization.
Extended GCD Algorithm Example: a = 259, b=70
GCD Algorithm Example: a = 899, b=493
Multiplication Inverse The multiplicative inverse of a number a is another number a’ such that: a · a’ = 1 (mod n) Does every number has a multiplicative inverse in modular arithmetic?
Multiplication Inverse Does every number has a multiplicative inverse in modular arithmetic? Nope…
Multiplication Inverse What is the pattern?
Multiplication Inverse Theorem. If gcd(k,n)=1, then have k’ k·k’ 1 (mod n). k’ is an inversemod n of k
Cancellation So (mod n) a lot like =. main diff: can’t cancel 4·2 1·2 (mod 6) 4 1 (mod 6) No general cancellation Cor: If i·k j·k (mod n), andgcd(k,n) = 1, then i j (mod n)
Fermat’s Little Theorem If p is prime & k not a multiple of p, can cancel k. So k, 2k, …, (p-1)k are all different (mod p). So their remainders on division by p are all different (mod p). This means that rem(k, p), rem(2k, p),…,rem((p-1)k, p) must be a permutation of 1, 2, ···, (p-1)
Fermat’s Little Theorem Theorem: If p is prime & k not a multiple of p 1 kp-1 (mod p)
Chinese Remainder Theorem Theorem: If n1,n2,…,nkare relatively prime and a1,a2,…,ak are integers, then x a1(mod n1) x a2(mod n2) x ak(mod nk) have a simultaneous solution x that is unique modulo n, where n = n1n2…nk.