Outline Basic properties of congruence Modular addition and multiplication Introduction to Number Theory II Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Basic properties of congruence Modular addition and multiplication Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Definition 1 Let n > 0 be an integer. We say that integers a and b are congruent modulo n if n divides their difference. We write a ≡ b mod n. The number n is called the modulus and b is called the remainder. 1 Carl F. Gauss, Disquisitiones Arithmeticae, 1801. Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Definition 1 Let n > 0 be an integer. We say that integers a and b are congruent modulo n if n divides their difference. We write a ≡ b mod n. The number n is called the modulus and b is called the remainder. The remainder b is not unique. Here is an example: I 12 ≡ 3 mod 9 ; 3 is a valid remainder since 9 divides 12 − 3 I 12 ≡ 21 mod 9 ; 21 is a valid remainder since 9 divides 12 − 21 I 12 ≡ −6 mod 9 ; −6 is a valid remainder since 9 divides 12 − (−6) 1 Carl F. Gauss, Disquisitiones Arithmeticae, 1801. Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Theorem For arbitrary integers a and b, a ≡ b (mod n) if and only if a mod n = b mod n. Proof: Exercise. Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Lemma The following hold for n ≥ 1: I a ≡ a (mod n) Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Lemma The following hold for n ≥ 1: I a ≡ a (mod n) I a ≡ b (mod n) implies b ≡ a (mod n) Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Lemma The following hold for n ≥ 1: I a ≡ a (mod n) I a ≡ b (mod n) implies b ≡ a (mod n) I a ≡ b (mod n) and b ≡ c (mod n) implies a ≡ c (mod n) Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Lemma The following hold for n ≥ 1: I a ≡ a (mod n) I a ≡ b (mod n) implies b ≡ a (mod n) I a ≡ b (mod n) and b ≡ c (mod n) implies a ≡ c (mod n) I a ≡ b (mod n) implies ak ≡ b k (mod n) for any positive integer k. Proof: Exercise. Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Definition The set Zn = {0, 1, 2, 3, ..., n − 1} has two operations ”+” and ”·” for all a, b ∈ Zn such that: I a + b ≡ c mod n (c ∈ Zn ) I a · b ≡ d mod n (d ∈ Zn ) Example 17 + 20 mod 22 = 15 and 4 · 8 mod 22 = 10. Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Lemma The following hold for n ≥ 1: I a ≡ b (mod n) implies a + c ≡ b + c (mod n) Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Lemma The following hold for n ≥ 1: I a ≡ b (mod n) implies a + c ≡ b + c (mod n) I a ≡ b (mod n) implies ac ≡ bc (mod n) Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Lemma The following hold for n ≥ 1: I a ≡ b (mod n) implies a + c ≡ b + c (mod n) I a ≡ b (mod n) implies ac ≡ bc (mod n) I a ≡ b (mod n) and c ≡ d (mod n) imply a + c ≡ b + d (mod n) Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Lemma The following hold for n ≥ 1: I a ≡ b (mod n) implies a + c ≡ b + c (mod n) I a ≡ b (mod n) implies ac ≡ bc (mod n) I a ≡ b (mod n) and c ≡ d (mod n) imply a + c ≡ b + d (mod n) I a ≡ b (mod n) and c ≡ d (mod n) imply a · c ≡ b · d (mod n) Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication The modulo operation can be applied to intermediate results: (a + b) mod m ≡ (a mod m) + (b mod m) mod m Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication The modulo operation can be applied to intermediate results: (a + b) mod m ≡ (a mod m) + (b mod m) mod m (a · b) mod m ≡ (a mod m) · (b mod m) mod m Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication The modulo operation can be applied to intermediate results: (a + b) mod m ≡ (a mod m) + (b mod m) mod m (a · b) mod m ≡ (a mod m) · (b mod m) mod m Example 83 mod 7 ≡ (8 mod 7) · (8 mod 7) · (8 mod 7) mod 7 ≡ 1 · 1 · 1 mod 7 ≡ 1 Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Definition Let a, b ∈ Zn and n be a positive integer. We say a is a multiplicative inverse of b modulo n if a · b = 1 mod n. Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Definition Let a, b ∈ Zn and n be a positive integer. We say a is a multiplicative inverse of b modulo n if a · b = 1 mod n. Example 36 is a multiplicative inverse of 87 modulo 101. Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Definition Let a, b ∈ Zn and n be a positive integer. We say a is a multiplicative inverse of b modulo n if a · b = 1 mod n. Example 36 is a multiplicative inverse of 87 modulo 101. Example The numbers 1, 2, 4, 5, 7 and 8 have multiplicative inverses in Z9 . The numbers 0, 3 and 6 don’t have multiplicative inverses in Z9 . Introduction to Number Theory II Outline Basic properties of congruence Modular addition and multiplication Definition Let a, b ∈ Zn and n be a positive integer. We say a is a multiplicative inverse of b modulo n if a · b = 1 mod n. Example 36 is a multiplicative inverse of 87 modulo 101. Example The numbers 1, 2, 4, 5, 7 and 8 have multiplicative inverses in Z9 . The numbers 0, 3 and 6 don’t have multiplicative inverses in Z9 . Theorem An integer a > 0 has a multiplicative inverse modulo n if and only if gcd(a, n) = 1. Introduction to Number Theory II