Relations 1 Ex. The following are some binary relations on {1, 2, 3, 4}. R1 = {(1, 1), (2, 2), (3, 3), (4, 4)}. R2 = {(1, 1), (2, 2), (3, 3), (4, 4), (1, 2), (2, 1)}. R3 = {(1, 2), (2, 1), (3, 4), (4, 3)}. R4 = {(1, 2), (1, 3), (2, 3), (3, 4)}. R5 = {(1, 1), (2, 2), (2, 3), (3, 4), (2, 4)}. reflexive : R1, R2 irreflexive : R3, R4 symmetric : R1, R2, R3 asymmetric : R4 antisymmetric : transitive : R1, R4, R5 R1, R2, R5 Ex. Define R to be a binary relation on the set of integers, where a R b iff ab 0. R is reflexive and symmetric. R is not transitive (for example, 5 R 0, 0 R 8, but 5 8). 2 Suppose that A = {1, 2, …, n}. 1. There are 2n n reflexive binary relations on A. 2 Each reflexive binary relation on A must contain (1, 1), (2, 2), …, (n, n). |A A {(i, i) : 1 i n}| = n2 n. 2. There are 2( n n) / 2 symmetric binary relations on A. 2 A A = {(i, i) : 1 i n} + {(i, j) : 1 i n, 1 j n, and i j}. 2n 2( n n) / 2 = 2( n n) / 2 . 2 2 3. There are 2( n n) / 2 reflexive and symmetric binary 2 relations on A. 4. There are 2n 3( n n) / 2 antisymmetric binary relations 2 on A. Each (i, i) can be either included or excluded. For each pair of (i, j) and (j, i), there are three choices: 3 (a) include (i, j) and exclude (j, i); (b) exclude (i, j) and include (j, i); (c) exclude (i, j) and (j, i). 2n 3( n n) / 2 . 2 5. There is no general formula for counting the number of transitive binary relations on A. 4 A poset A is called a lattice, if every two elements of A have their least upper bound and greatest lower bound in A. Ex. The poset A in the above example is not a lattice. Ex. Let A be the power set of {1, 2, 3}. Define R on A as follows: a R b iff a b. The least upper bound (greatest lower bound) of a and b is a b (a b). A is a lattice. 5 Ex. Define R on the set Z of integers as follows: a R b iff 4 divides a b. R is an equivalence relation, and its equivalence classes, denoted by [0], [1], [2] and [3], are as follows: [0] = {…, 8, 4, 0, 4, 8, …} = {4k | k Z}; [1] = {…, 7, 3, 1, 5, 9, …} = {4k + 1 | k Z}; [2] = {…, 6, 2, 2, 6, 10, …} = {4k + 2 | k Z}; [3] = {…, 5, 1, 3, 7, 11, …} = {4k + 3 | k Z}. Ex. Define R on the set Z of integers as follows: a R b iff a2 = b2. R is an equivalence relation, and its equivalence classes are {0}, { 1, 1}, { 2, 2}, …, { i, i}, … . Ex. Suppose that R is an equivalence relation on {1, 2, …, 7}, and the induced partition is {{1, 2}, {3}, {4, 5, 7}, {6}}. Then, R = {(1, 1), (2, 2), (1, 2), (2, 1)} {(3, 3)} 6 {(4, 4), (5, 5), (7, 7), (4, 5), (5, 4), (4, 7), (7, 4), (5, 7), (7, 5)} {(6, 6)}. There is a one-to-one correspondence between the set of equivalence relations on {1, 2, …, n} and the set of partitions of {1, 2, …, n}. Ex. What is the number of equivalence relations on A = {1, 2, ..., 6}? Let f(m) be the number of onto functions from A to B = {b1, b2, …, bm}, which can be evaluated by the principle of inclusion and exclusion. The answer is equal to f(1) + f(2)/2! + f(3)/3! + f(4)/4! + f(5)/5! + f(6)/6! = 1 + 31 + 90 + 65 + 15 + 1 = 203. 7 Boolean Algebra 8 f ( w, x, y, z ) = wx yz + wxyz + wx yz + wx yz + wxyz + wx yz f ( w, x, y, z ) = wxz y y wx y z z + wxyz + wx y z = wxz + wx y + wxyz + wx y z wx z 1 y y z + wx y (1 z ) yz wx z y z z + wx y z y y = wx z y z + wx y yz = = 9 = wx z y + wx y z = wxz + wx y + wx y + wxz 10 The elements of a finite Boolean algebra can be partially ordered. Suppose that (K, , +) is a Boolean algebra. For a, b K, define a Then, b iff a b = a. is a partial ordering. reflexisive : a a = a a antisymmetric : a b, b a. a a b = a, b a = b a = b. transitive : a b, b c a b = a, b c = b a = a b = a (b c) = (a b) c = ac a c. The Hasse diagrams for the Boolean algebra of page 12 is depicted below. 11 Notice that 0 a, a 1 for every a K. (0 = 1 and 1 = 30 for the example above) A nonzero element a K is called an atom of K, if b a implies b = 0 or b = a, where b K. The Boolean algebra of the example above has three atoms: 2, 3, 5. Fact 1. If a is an atom of K, then a b = 0 or a b = a for every b K. Fact 2. If a1 a2 are two atoms of K, then a1 a2 = 0. Fact 3. Suppose that a1, a2, …, an are atoms of K, and b is a nonzero element in K. Without loss of generality, assume b ai 0 for 1 i k, and b ai = 0 else. Then, b = a1 + a2 + … + ak. Fact 4. If K has n atoms, then |K| = 2n. For the example above, we have 10 = 2 + 5, 30 = 2 + 3 + 5, and |K| = 23 = 8. 12 The proofs of the four facts can be found in pages 738 and 739 of Grimaldi’s book. 13 Rings 14 Ex. Let R = {a, b, c, d, e}, and define + and as follows. (R, +, ) is a commutative ring with unity, but without proper divisors of zero. zero : a. unity : b. units : b, c, d, e. Every nonzero element has a multiplicative inverse. 15 Ex. Let R = {s, t, v, w, x, y}, and define + and as follows. (R, +, ) is a commutative ring with unity. zero : s. unity : t. units : t, y. (R, +, ) is not an integral domain, because v w = s. (R, +, ) is not a field, because v, w and x have no multiplicative inverses. Also notice that v v = v y = x, i.e., the cancellation law of multiplication does not hold for this example. 16 Proof of Theorem 14.10 in Grimaldi’s book. z S. Let a = b b + ( b) = z S. For each b S, b S. Let a = z z + ( b) = b S. a + b S for all a, b S. a, b S a + ( ( b)) = a + b S. When S is finite, we assume S = {s1, s2, …, sn}. For every a S, {a + s1, a + s2, …, a + sn} = S. a = a + sk = sk + a for some 1 k n sk = z S z = a + sl = sl + a for some 1 l n sl = a S. 17 For 1 a n, gcd(a, n) = 1 [a]1 exists (i.e., [a] is a unit of Zn); gcd(a, n) > 1 [a] is a proper zero divisor of Zn. Ex. Find [25]1 in Z72 (gcd(25, 72) = 1). ( 23) 25 + 8 72 = 1. ( 23) 25 1 (mod 72). [25]1 = [ 23] = [49]. Ex. Find x so that 25x 3 (mod 72). ( 23) 25 1 (mod 72). 3 ( 23) 25 3 (mod 72). ( 69) 25 3 (mod 72). x [ 69] = [3]. Ex. gcd(8, 18) = gcd(2 4, 2 9) = 2. [8] [9] = [0] [8] is a proper zero divisor of Z18. 18 Ex. How many units and how many proper zero divisors are there in Z72? The number of units in Z72 is equal to the number of integers a such that 1 a 72 and gcd(a, 72) = 1. The latter can be computed as (72) = (23 32) = 72 (1 1 ) (1 1 ) = 24, 2 3 where (n) is the Euler’s phi function (refer to Example 8.8 in page 394 of Grimaldi’s book). The number of proper zero divisors in Z72 is equal to 71 24 = 47. Ex. How many units and how many proper zero divisors are there in Z117? The number of units in Z117 is equal to (117) = (32 13) = 117 (1 1 ) (1 1 ) = 72. 13 3 The number of proper zero divisors in Z117 is equal to 116 72 = 44. 19 The Chinese Remainder Theorem m1, m2, …, mk : positive integers that are greater than 1 and are prime to one another , where k 2. 0 ai mi for 1 i k. Mi = m1…mi1mi+1…mk for 1 i k. Mixi 1 (mod mi) for 1 i k. Then, x = a1M1x1 + a2M2x2 + … + akMkxk is a solution to x ai (mod mi) for 1 i k. Moreover, if y is another solution, then y x (mod m1m2…mk). The proof can be found in page 702 of Grimaldi’s book. 20 Ex. x 14 (mod 31), x 16 (mod 32), and x 18 (mod 33). (a1, a2, a3) = (14, 16, 18); (m1, m2, m3) = (31, 32, 33); (M1, M2, M3) = (1056, 1023, 992). M1x1 1 (mod m1) (i.e., gcd(x1, m1) = 1) [x1] = [M1]1 = [1056]1 = [2]1 = [16] in Zm1 = Z31. Similarly, [x2] = [31] in Zm2 = Z32 and [x3] = [17] in Zm3 = Z33. Therefore, x = (a1M1x1 + a2M2x2 + a3M3x3) mod 32736 = 32688 is a solution. The general solution is y x (mod 32736). 21 In the study of cryptology, we often need to compute be mod n, where b, e and n are large integers. Ex. Compute 5143 mod 222. Let E(i) = 5i mod 222, where i 0 integer. E(2i) = (E(i))2 mod 222. 143 = 27 + 23 + 22 + 21 + 20. E(143) = (E(27) E(23) E(22) E(21) E(20)) mod 222. E(20) = 5. E(21) = (E(20))2 mod 222 = 25. E(22) = (E(21))2 mod 222 = 181. E(23) = (E(22))2 mod 222 = 127. E(24) = (E(23))2 mod 222 = 145. E(25) = (E(24))2 mod 222 = 157. E(26) = (E(25))2 mod 222 = 7. E(27) = (E(26))2 mod 222 = 49. E(28) = (E(27))2 mod 222 = 181. 22 Therefore, E(143) = (49 127 181 25 5) mod 222 = ((49 127) mod 222) ((181 25 5) mod 222) mod 222 = 7 203 mod 222 = 89. 23 f (R, +, ) > (S, , ) a f(a) b f(b) a+b f(a + b) = f(a) f(b) ab f(a b) = f(a) f(b) Performing + (or ) in R and then mapping is “equivalent” to mapping and then performing (or ) in S. 24 (a) For any s S, there exist r R with f(r) = s (because f is onto). s = f(r) = f(ruR) = f(r)f(uR) = sf(uR). Similarly, s = f(uR)s. f(uR) is the unity of S. (b) Suppose b = a1. ab = ba = uR f(a)f(b) = f(ab) = f(uR) = uS (uS is the unity of S) Similarly, f(b)f(a) = uS. f(a)f(b) = f(b)f(a) = uS (f(a1) = ) f(b) = [f(a)]1 25 Ex. (following the discussion of the Chinese remainder theorem) (Z32736, +, ) is a ring, where 32736 = 31 32 33. (Z31 Z32 Z33, , ) is a ring, where (x1, x2, x3) (y1, y2, y3) = (x1 + y1, x2 + y2, x3 + y3) and (x1, x2, x3) (y1, y2, y3) = (x1 y1, x2 y2, x3 y3). Define f : (Z32736, +, ) (Z31 Z32 Z33, , ) as follow: f(x) = (x1, x2, x3), where x1 = x mod 31, x2 = x mod 32, and x3 = x mod 33. f is an isomorphism from Z32736 to Z31 Z32 Z33. (Refer to Example 14.21 in page 700 of Grimaldi’s book.) 18152 18153 in Z32736 can be computed as follows. 26 18152 18153 = f1f(18152 18153) = f1(f(18152) f(18153)) = f1((17, 8, 2) (18, 9, 3)) = f1(17 18 mod 31, 8 9 mod 32, 2 3 mod 33) = f1(27, 8, 6) (refer to the example of the Chinese remainder theorem) = 25416 In general, if n = n1 n2 … nk, where ni > 1 is an integer and gcd(ni, nj) = 1, then (Zn, +, ) and ( Z n1 Zn2 … Z nk , , ) are isomorphic. As a result, computation on large integers in Zn can be achieved with (parallel) computation on smaller integers in Z n1 Zn2 … Z nk . 27 Groups 28 Ex. G = {0, 1, 2, r1, r2, r3}, where 1 2 3 0 = 1 2 3 1 2 3 1 = 3 1 2 1 2 3 2 = 2 3 1 1 2 3 r1 = 2 1 3 1 2 3 r2 = 1 3 2 1 2 3 r3 = . 3 2 1 (G, ) is a (nonabelian) group. 1 2 3 1 2 3 1 2 3 = = r3. 3 1 2 2 1 3 3 2 1 1 r1 = 29