Congruence mod n Mathematics for Computer Science MIT 6.042J/18.062J Def : a ≡ b (mod n) Congruences: iff n|(a - - b) example: 30 ≡ 12 (mod 9) arithmetic (mod n) since 9 divides (30 - 12) congruence.1 congruence.2 Albert R Meyer, March 9, 2015 Albert R Meyer, March 9, 2015 Congruence mod n Remainder Lemma example: a ≡ b (mod n) 66666663 ≡ 788253 (mod 10) iff WHY? rem(a,n) = rem(b,n) 66666663 example: 30 ≡ 12 (mod 9) 788253 - since xxxxxxx0 rem(30,9) = 3 = rem(12,9) Albert R Meyer, March 9, 2015 congruence.3 Albert R Meyer, March 9, 2015 congruence.4 4/2/08 2:20PM 1
( � ) Remainder Lemma proof: (if) a = q a n + r a,n a ≡ b (mod n) b = q b n + r b,n iff rem(a,n) = rem(b,n) if rem’s are =, then r b,n abbreviate: a-b=(q a -q b )n so n|(a-b) congruence.5 congruence.6 Albert R Meyer, March 9, 2015 Albert R Meyer, March 9, 2015 ( � ) proof: (only if) proof: (only if) a = q a n + r a,n |--| < n b = q b n + r b,n n|((q a -q b )n + (r a,n -r b,n )) conversely, n|(a-b) means n| n| so IMPLIES r a,n = r b,n congruence.9 congruence.10 Albert R Meyer, March 9, 2015 Albert R Meyer, March 9, 2015 4/2/08 2:20PM 2
Corollaries Remainder Lemma symmetric a ≡ b (mod n) a ≡ b (mod n) implies iff b ≡ a (mod n) rem(a,n) = rem(b,n) transitive a ≡ b & b ≡ c (mod n) QED implies a ≡ c (mod n) congruence.11 congruence.12 Albert R Meyer, March 9, 2015 Albert R Meyer, March 9, 2015 Congruence mod n Remainder arithmetic Corollary: If a ≡ b (mod n), then a ≡ rem(a,n) (mod n) a ≡ rem(a,n) (mod n) rem a,n (mod n ) ≡ a+c ≡ b+c (mod n) pf: 0 ≤ r a,n < n, so f 0 pf: n | (a - - b) implies r a,n = rem(r a,n ,n) n | ((a+c) - (b +c)) Albert R Meyer, March 9, 2015 congruence.13 Albert R Meyer, March 9, 2015 congruence.14 4/2/08 2:20PM 3
Congruence mod n Congruence mod n If a ≡ b (mod n), then Corollary: a ⋅ c ≡ b ⋅ c (mod n) If a ≡ b (mod n) & pf: n | (a - b) implies c ≡ d (mod n), n | (a - b) ⋅ c, and so then a+c ≡ b+d (mod n) ⋅ ⋅ n | ((a ⋅ c) – (b ⋅ c)) congruence.16 congruence.17 Albert R Meyer, March 9, 2015 Albert R Meyer, March 9, 2015 Congruence mod n Congruence mod n Cor: If a ≡ a’ (mod n), So arithmetic (mod n) then replacing a by a’ in any arithmetic a lot like ordinary formula gives an arithmetic (mod n) formula ≡ congruence.18 congruence.19 Albert R Meyer, March 9, 2015 Albert R Meyer, March 9, 2015 4/2/08 2:20PM 4
Remainder arithmetic Remainder arithmetic example: 287 9 ≡ ? (mod 4) important: congruence & 287 9 ≡ 3 9 since r 287,4 = 3 a ≡ rem(a,n) (mod n) = ((3 2 ) 2 ) 2 . 3 keeps (mod n) arithmetic ≡ (1 2 ) 2 . 3 since r 9,4 =1 in the remainder range = 3 (mod 4) [0,n) 0 to n-1 congruence.20 congruence.21 Albert R Meyer, March 9, 2015 Albert R Meyer, March 9, 2015 4/2/08 2:20PM 5
MIT OpenCourseWare http://ocw.mit.edu 6.042J / 18.062J Mathematics for Computer Science Spring 20 15 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Recommend
More recommend