Discrete Mathematics with Applications MATH236 Dr. Hung P. Tong-Viet School of Mathematics, Statistics and Computer Science University of KwaZulu-Natal Pietermaritzburg Campus Semester 1, 2013 Tong-Viet (UKZN) MATH236 Semester 1, 2013 1 / 15 Table of contents 1 Extended Division Algorithm 2 Multiplicative Inverses in Zm Tong-Viet (UKZN) MATH236 Semester 1, 2013 2 / 15 Extended Division Algorithm Extended Division Algorithm Lemma Let S be a nonempty set of integers that is closed under addition and subtraction. The exactly one of the following statements is true: S = {0} S = {0, ±d, ±2d, ±3d, · · · }, where d is the smallest positive integer in S. Tong-Viet (UKZN) MATH236 Semester 1, 2013 3 / 15 Extended Division Algorithm Extended Division Algorithm Theorem Let a and b be nonzero integers. Then gcd(a, b) can be expressed as a linear combination of a and b with integers coefficient, that is, gcd(a, b) = sa + tb for some integer s, t. Tong-Viet (UKZN) MATH236 Semester 1, 2013 4 / 15 Extended Division Algorithm Extended Division Algorithm Example Express gcd(112, 268) as an integer linear combination of 112 and 268. We have that gcd(112, 268) = 4 = r3 Now 4 = 24 − 20 Replace r2 = 20 by 44 − 24 Then 4 = 24 − (44 − 24) = 2 · 24 − 44 Replace r1 = 24 by 112 − 2 · 44 Then 4 = 2 · 112 − 5 · 44 Replace r0 = 44 by 268 − 2 · 112 We obtain 4 = 2 · 112 − 5(268 − 2 · 112) = 12 · 112 − 5 · 268. Consequently, 4 = 12 · 112 + (−5) · 268 Tong-Viet (UKZN) MATH236 Semester 1, 2013 5 / 15 Multiplicative Inverses in Zm Multiplicative inverses in Zm Let m ≥ 1 be an integer Let Zm = {0, 1, 2, , · · · , m − 1} be the set of all remainders when divided by m For a ∈ Zm , if there exists b ∈ Zm such that ab = ba ≡ 1(mod m), then b is said to be a multiplicative inverse of a in Zm and is denoted by a−1 . Given a ∈ Zm , it is not certain that the multiplicative inverse of a exists Tong-Viet (UKZN) MATH236 Semester 1, 2013 6 / 15 Multiplicative Inverses in Zm Multiplicative inverses in Zm Example Consider 2 ∈ Z4 = {0, 1, 2, 3} 2×0 = 0 2×1 = 2 We have 2×2 = 0 2×3 = 2 Thus 2 has no multiplicative inverse in Z4 However, in Z5 , we have 2 × 3 = 3 × 2 = 6 ≡ 1(mod 5) Thus 2−1 = 3 in Z5 Tong-Viet (UKZN) MATH236 Semester 1, 2013 7 / 15 Multiplicative Inverses in Zm Existence of multiplicative inverses in Zm Theorem A number a ∈ Zm has a multiplicative inverse in Zm if and only if gcd(a, m) = 1. Tong-Viet (UKZN) MATH236 Semester 1, 2013 8 / 15 Multiplicative Inverses in Zm Existence of multiplicative inverses in Zm Proof. Suppose first that a and m are relatively prime By the Extended Division Algorithm, there exists integers s, t such that sa + tm = 1 Write s = qm + r with 0 ≤ r < m. Then r ∈ Zm We have ar = a(s − qm) = as − aqm = 1 − tm − aqm = 1 − m(t + aq) ≡ 1(mod m) Thus r is the multiplicative inverse of a in Zm Tong-Viet (UKZN) MATH236 Semester 1, 2013 9 / 15 Multiplicative Inverses in Zm Existence of multiplicative inverses in Zm Proof. Conversely, suppose first that a has a multiplicative inverse b in Zm and there exist t, a0 , m0 ∈ {2, 3, · · · , m − 2} such that a = ta0 and m = tm0 Since ab ≡ 1 (mod m), a0 tb ≡ 1 (mod m) Multiplying both sides by m0 , we obtain a0 btm0 ≡ m0 (mod m) Since m = tm0 , we have that a0 bm ≡ m0 (mod m) Clearly a0 bm ≡ 0 (mod m) so m0 ≡ 0 (mod m), which is impossible Hence, gcd(a, m) = 1 as wanted. Tong-Viet (UKZN) MATH236 Semester 1, 2013 10 / 15 Multiplicative Inverses in Zm Compute the multiplicative inverses in Zm Example Find 4−1 in Z21 . We have gcd(4, 21) = 1 so 4−1 exists in Z21 . As 21 = 4 · 5 + 1, we obtain that 21 − 4 · 5 − 1 Hence, 4−1 = −5 = 21 − 5 = 16 Tong-Viet (UKZN) MATH236 Semester 1, 2013 11 / 15 Multiplicative Inverses in Zm Compute the multiplicative inverses in Zm Example Find 13−1 in Z73 . We first find gcd(13, 73). We have 73 = 13 · 5 + 8 13 = 8 + 5 8 = 5+3 5 = 3+2 3 = 2+1 Thus gcd(13, 73) = 1. Hence 13−1 exists in Z73 . Tong-Viet (UKZN) MATH236 Semester 1, 2013 12 / 15 Multiplicative Inverses in Zm Compute the multiplicative inverses in Zm We have 1 = 3−2 = 3 − (5 − 3) = 3·2−5 = 2 · (8 − 5) − 5 = 2·8−3·5 = 2 · 8 − 3 · (13 − 8) = 5 · 8 − 3 · 13 = 5 · (73 − 13 · 5) − 3 · 13 = 5 · 73 − 28 · 13 Hence 13−1 = 73 − 28 = 45 in Z73 . Tong-Viet (UKZN) MATH236 Semester 1, 2013 13 / 15 Multiplicative Inverses in Zm Uniqueness of multiplicative inverses in Zm Theorem If a has a multiplicative inverse in Zm , then this inverse is unique, i.e., if x, y ∈ Zm such that ax ≡ 1 (mod m) and ay ≡ 1 (mod m), then x = y . Tong-Viet (UKZN) MATH236 Semester 1, 2013 14 / 15 Multiplicative Inverses in Zm Uniqueness of multiplicative inverses in Zm Proof. Suppose that x, y ∈ Zm such that ax ≡ 1 (mod m) and ay ≡ 1 (mod m) Then there exist s, t ∈ Z such that ax = sm + 1 and ay = tm + 1 Hence, a(x − y ) = m(s − t) By assumption, a has at least one inverse a−1 , so x − y = a−1 (s − t)m and thus x − y ≡ 0 (mod m) Since x, y ∈ Zm , the only possibility is that x = y . Tong-Viet (UKZN) MATH236 Semester 1, 2013 15 / 15