CS1802 Discrete Structures Recitation Fall 2017 October 9-12, 2017 CS1802 Week 6: Sets Operations, Product Sum Rule Pigeon Hole Principle (Ch 8.5-9.3) Sets i. Set Notation: Draw an arrow from the box on the left to the box on the right to match notation or phrases to the equivalent definition. 1. Notation Definition A B Intersection A B Subset and not equal (i.e. a proper subset such that A is inside B but not equal. A has less elements) A B The complement A B Union A B Subset and may be equal (i.e. A = B) Ā The union of A and B without the intersection of A and B (i.e.a B disjoint (Also a gate we have learned about)) The empty set 1. Notation Definition A B Subset and not equal (i.e. a proper subset such that A is inside B but not equal. A has less elements) A B Subset and may be equal (i.e. A = B) A B The union of A and B without the intersection of A and B (i.e.a B disjoint (Also a gate we have learned about)) A B Union A B Intersection Ā The complement The empty set ii. Express the following in English. Then write the equivalent set expressed and its cardinality. 1. x = 5 : {x, x 2, x 3, x 4 } 1
2. {x x Z and x < 4} 1. Given x equals 5, the set is equivalent to {5, 25, 125, 625} with a cardinality of 4 2. Given x such that x is in the domain of integers, and the absolute value is less than 4. The set is {-3,-2,-1,0,1,2,3 } with a cardinality of 7 2
iii. Compute the following set given: A = {1, 2, 3, 4, 5}, B = { 1, 2, 3, 4, 5}, C = { 4, 2, 0, 2, 4}. Draw a Venn Diagram to visually represent each resulting set (Note you do not need to add in the numbers). Let U = set of all integers 1. A B 2. A B 3. (A B) C 4. C U (Note Venn Diagrams are omitted) 1. {2, 4} 2. { 5, 3, 1, 1, 2, 3, 4, 5} 3. {2, 4} 4. { 4, 2, 0, 2, 4} iv. Compute the Cartesian product of the given sets to generate all of the ordered tuples. A = {a, b, c}, B = {1, 2, 3}, C = {6}. 1. A B 2. A C 1. {(a, 1), (a, 2), (a, 3), (b, 1), (b, 2), (b, 3), (c, 1), (c, 2), (c, 3)} 3
2. {(a, 6), (b, 6), (c, 6)} v. Compute the power sets below given the following. X = {1, 2, 3}, Y = { }. Note to yourself, if given a set of 3 elements, how many subsets total will you have in your power set? 1. P(X) 2. P(Y ) 1. P(X) = {, {1}, {2}, {3}, {1, 2}, {2, 3}, {1, 3}, {1, 2, 3, }}. Note that you should get 2 to the 3rd subsets. 2. P(Y ) = vi. Given the following Set, compute the computer representation(i.e. a bit-string) using 0s and 1s. 1. A = {0, 1, 2, 3, 4, 5, 7} 2. Ā = {6} 3. B = {0, 2, 4, 6} 4. B {1, 3, 5} 1. 11111101 2. 00000010 3. 1010101 4. 1111111 Set Operations 4
i. Given U = {pink, red, blue, white, yellow, black} A = {red, blue, yellow, black} B= {pink, red, white, yellow} C = {white} Determine: A-B B-A A B B-A-C P(A) {V P(A): V = 1} 1. A-B are the elements in A but not in B this is the set = { blue, black} 2. B-A are the elements in set B but not in A this is the set = {pink,white} 3. A B is the set {blue, black,pink,white} 4. B-A-C = {pink} 5. P(A) {, {red}, {blue}, {yellow}, {black}, {red, blue}, {red, yellow}, {red, black}, {blue, yellow}, {blue, black}, {yellow, black}, {red, blue, yellow}, {red, blue, black}, {blue, yellow, black}, {red, yellow, black}, {red, blue, yellow, black} } 6. {V P(A): V = 1} {{red}, {blue}, {yellow}, {black} } 5
Cross Product Operation i. Given the sets defined above, determine A B and draw the results in a color x color 2 dimensional coordinate system ii. { (red,pink), (red,red), (red,white),(red,yellow), (blue,pink),(blue,red),(blue,white),(blue,yellow) (yellow,pink),(yellow,red),(yellow,white),(yellow,yellow), (black,pink), (black,red),(black,white),(black,yellow)} Sets as bit strings i. Represent U, A, B, C, A-B, B-A, B-A-C, A B from problem 1 as a bit string. 1. A=011011 2. B=110110 3. C=000100 4. A-B = 001001 6
5. B-A = 100100 6. A B =101001 7. B-A-C = 100000 7
Proof with sets i. Prove that { x Z: 26 x} { x Z: 13 x} 1. Suppose {a Z: 26 x}. This means that a Z and 18 x. By the definition of divisibility, there is an integer c such that a=26c. Consequently, a=2(13c) and from this we can deduce that 13 a. Therefore a is one of the integers that 13 divides. So a { x Z: 13 x}. We ve shown a {Z: 26 x} implies { x Z: 13 x} so it follows that { x Z: 26 x} { x Z: 13 x} Counting i. Greta plans to register for one course at MyWay University. The school has 4 departments: English, Math, History and Science. The English department offers 7 courses Greta is eligible to take, the Math department offers 3 courses Greta is eligible to take, the History department offers 5 courses Greta is eligible to take and the Science department offers 9 courses Greta is eligible to take. How many different choices does Greta have for her course? 1. Greta chooses one course from either the English or the Math or the History or the Science department. There are 7 English courses, 3 Math courses, 9 Science courses and 5 History courses for a total of 24 different selections Greta could make. ii. Bob is building a garden. He has dug out 6 different plots. He arrives at the garden center to see that the store is offering seven different perennials for sale. How many different perennial garden configurations are available for Bob s garden? 1. For each of the 6 plots Bob has 7 choices, so 7 6 8
iii. How many positive integers less than 111 are divisible by 11 or 2 or 5? 1. {2, 4} 55 positive integers are divisible by 2 22 positive integers are divisible by 5 10 positive integers are divisible by 11 for a total of 76 numbers but this counted is inflated since we have counted the numbers that are divisible by 2 and 5 twice. There are 11 numbers divisible by 10. Similarly, we doubly counted the numbers divided by 11 and 2 (divisible by 22) and there are 5 of those. We also double counted the numbers that are divisible by 55 - there are 2 of those. We need to add in the number of integers that are divisible by 11 and 2 and 5 (i.e. 110), there is 1 such number. 55+22+10-11-5-2+1 = 70 positive integers. Basic Set Operations Consider subsets A = {a, f, d}, B = {b, d, h, e} of the universal set U = {a, b, c, d, e, f, g, h}. Compute each of the following. 1. A B {a, b, d, e, f, h} 2. A B {d} 3. B A 4. B {b, e, h} {a, c, f, g} 5. A B {a, b, e, f, h} 6. {a, b} {b, c} {(a, b), (a, c), (b, b), (b, c)} 7. (A B) (B A) {a, f} {b, e, h} = {(a, b), (a, e), (a, h), (f, b), (f, e), (f, h)} 9
More Basic Set Operations 1. If A B, what is A B? B 2. If A B, what is A B? A 3. When is A B =? when A = B 4. Do sets A B exist such that A B = B A? Yes, select A = and B any non empty set 5. Are there sets A and B such that A B = {(1, 2)}? Yes A = {1} and B = {2} 6. Are there sets A and B such that A B = {(1, 2), (1, 5), (2, 3), (2, 5), (3, 3), (3, 5)}? No as this would imply 1, 2, 3 A and 2, 3, 5 B, but then pairs (1,3), (2,2), (3,2) sould also be in A B Inclusion-Exclusion two sets, basic In a group of 20 students, 11 play the piano and 7 play the guitar. If two play both the piano and the guitar, how many play: 1. at least one of these instruments (piano or guitar)? piano + guitar - (piano guitar) = 11 + 7-2 = 16 2. neither instrument (neither the piano nor the guitar)? 20-16 = 4 Venn Diagrams True or false: The oldest chess player among mathematicians and the oldest mathematician amongst chess players can be two different people. 10
False. The set of mathematicians and chess players can be represented as M C. In both cases chess players in the mathematicians and mathematicians in the set of chess players is the same set (presuming the set of mathematicians and chess players being referred to in both cases are the same group...not New York Chess Players and Boston mathematicians for example. However age is the same measure for both set descriptions (and the same set). Thus false. The best chess player among mathematicians and the best mathematician among chess players can be two different people. True. Both sets can be represented as M C but if that intersection was { Virgil, David, Jay, Kevin, Jacek} Jay could be the best chess player while Jacek is the best mathematician. 11
Equality of Sets State True or False for each of the following. Justify your argument by either giving a proof or a counter-example. You may use Venn diagrams to present your argument. 1. (A B) C = A (B C) False. Elements in C but not in A are in the LHS but not RHS 2. (A B) = A B True. This is DeMorgan s for sets 3. (A C) B = A (C B) False. A = (123), B = (234)C = (345). LHS is (1) RHS is (1 2) 4. (A C) (A B) = A (B C) False. A B = A B. Thus (A C) (A = B) = ((A C) (A B)), then by the distributive law we get A ( C B) = A ( C B) = A (C B) Counter example: A = (123), B = (245)C = (345) gives LHS = (123) while RHS = (1) 5. (A (B C)) ((A C) (D C) (B C)) = ((A B) (C A) (A B)) (((A D) B) C) False. Draw the first part of the left hand side: (A (B C)) which is intersection of A with B and C. Now the second part is just C since it is the only common term for all the various parts in the intersect. That means the whole expression is just (A B) The RHS, is A, B and the intersection of AB and AC - A B C and D (union is associative and commutative). Therefore you remove EVERYTHING possible from the set. The RHS is while the LHS is A B. Take any 4 with unique elements in A and B and it will demonstrate this counter-example. 12
EXTRA: Cutting parts from a large sheet Can one cut three 3x3 squares and six 2x3 rectangles from a sheet of paper 8x8 square? Can one cut four 3x3 squares and eight 2x4 rectangles from a sheet of paper 10x10 square? Can one cut four 4x4 squares and and six 2x4 rectangles from a sheet of paper 11x11 square? EXTRA: remainders mod 15 Given any 7 integers, show that there are 2 of them with either sum or difference or product = multiple of 15. 13