130 likes | 262 Views
More Set Definitions and Proofs. 1.6, 1.7. Ordered n-tuple. The ordered n-tuple (a1,a2,…an) is the ordered collection that has a1 as its first element, a2 as its second element . . . And an as its nth element. 2-tuples are called ordered pairs. Cartesian Product of A and B.
E N D
More Set Definitions and Proofs 1.6, 1.7
Ordered n-tuple The ordered n-tuple (a1,a2,…an) is the ordered collection that has a1 as its first element, a2 as its second element . . . And an as its nth element. 2-tuples are called ordered pairs.
Cartesian Product of A and B Let A and B be sets. The Cartesian product of A and B, denoted A x B is the set of all ordered pairs (a,b) where a A and b B. Hence A x B = {(a,b) | a A b B} The Cartesian product of the sets A1,A2, .. , An denoted by A1 x A2 x … x An is the set of ordered n-tuples (a1,a2,..,an) where ai belongs to Ai for I = 1,2,... ,n. A1 x A2 x…x An = {(a1,a2,..,an) | ai Ai for I=1,2…,n}
Generalized Unions and Intersections A1 A2 ... An = A1 A2 ... An =
Let Ai = {1,2,3…i}for i = 1,2,3,…(that is, A1=1; A2=1,2; A3=1,2,3; etc…) = 1,2,3, . . ., n Find = 1 Find
Let Ai = {i,i+1,i+2…} = Z+ Find = n, n+1, n+2, … Find
Symmetric Difference Problem • Prove(AB) B = A • AB elements in A or B but not in both.
Prove (AB) B = A A B AB (AB) B 1 1 0 1 1 0 1 1 0 1 1 0 0 0 0 0
Prove (AB) B = A Proof: We must show that (AB) B A and that A (AB) B. First we will show that (AB) B A . Let e (AB) B. Then e (AB) or e B but not both. If e (AB), then either eA or eB. If eA and eB then we are done. If eB, and eA, then e (AB) but can not be an element of (AB) B by definition so this case can not exist.
Proof of (AB) B = A, cont. Now we will show that A (AB) B . Let eA. Either e is also B or eB. If e B, then e (AB) so e is an element of (AB) B. If eB, e is an element of (AB) and e must be an element of (AB) B . Thus (AB) B = A.
Computer Representation of Sets How to store the elements of sets and make computing the union, intersection, difference, etc., easier? Assume U is finite and of reasonable size. It has cardinality n. First, specify an arbitrary ordering of the elements of U. Represent a subset A of U with a bit string of length n, where the i’th bit is 1 if ui belongs to A and 0 if ui does not belong to A.
Using the Computer Representation Let U = {1,2,3,4,5,6,7,8,9,10}. Assume an ordering of the elements as written • What bit string represents the subset of all odd integers? • What bit string represents the set of all integers that do not exceed 5? • What’s the complement of this set? 1010101010 1111100000 0000011111 • General rule for complements?
Using the Computer Representation The bits strings of {1,2,3,4,5} and {1,3,5,7,9} are 111110000 and 1010101010, respectively • What is the union of these sets?1111100000 1010101010 = • What is the intersection of these sets?1111100000 1010101010 = • What’s the general rules? 1111101010 1010100000 bitwise OR for union; bitwise AND for intersection