CmSc 365 Theory of Computation Solutions to Exercise on Sets 1. Subsets A ⊆ B True or false? {1,2,3} ⊆ {2,3,4} False {1} ⊆ {1,2,3} True {1} ⊆ {{1},1, 2, 3} True {1} ⊆ {{1}, 2, 3} False Ø ⊆ {1, 2} True Ø ⊆ Ø True Ø ⊆ {Ø} True {1,2,3} є {2,3,4} False {1} є {1,2,3} False {1} є {{1},1, 2, 3} True {1} є {{1}, 2, 3} True {1} є {{1,2}, 2, 3} False 1 є {{1,2}, 2, 3} False 2 є {{1,2}, 2, 3} True {1,2} є {{1,2}, 2, 3} True Ø є {1, 2} False Ø є Ø False Ø є {Ø} True 2. Operations on sets a. Intersections A ∩ B = {x : (x є A ) Λ (x є B)} Define the intersection of the set containing all positive numbers and the set of all numbers divisible by 11 using the setbuilder notation A = { x : x > 0 Λ ∃ q such that q > 0 Λ x = 11*q} b. Unions A ∪ B = {x : (x є A) V (x є B)} A⊆A∪B, B ⊆ A∪B A ∪ Ø = A, A ∪ U = U Define the union of the set containing all positive numbers and the set of all numbers divisible by 11 using the setbuilder notation A = { x : x > 0 V ∃ q such that q > 0 Λ x = 11*q} ١ c. Differences A - B = { x : ( x є A) Λ ( x ∉ B)} A-Ø=A A -U=Ø Define the difference of the set containing all positive numbers and the set of all numbers divisible by 11 using the setbuilder notation A = { x : x > 0 Λ ∼(∃ q such that q > 0 Λ x = 11*q) } = { x : x > 0 Λ ∀ q > 0, x ≠ 11*q) } Will 22 be in the difference? Will -22 be in the difference? Will 21 be in the difference? No No Yes Complementary set of a set A: ~A = U - A Define the compliment of the set containing all positive numbers divisible by 11 using the setbuilder notation A = { x : ~(x > 0 Λ ∃ q such that q > 0 Λ x = 11*q)} = { x : x ≤ 0 V ∀ q > 0, x ≠ 11*q} Will 22 be in the complement? No Will -22 be in the complement? Yes Will 21 be in the complement? Yes 3. Basic set identities Prove that A - (B ∩ C) A - (B ∩ C) = = = = = (A - B) ∪ (A - C) A ∩ ~ (B ∩ C) Alternate representation of set difference A ∩ (~B ∪ ~C) By De Morgan's Laws (A ∩ ~B ) ∪ (A ∩ ~C) By distributive laws (A - B) ∪ (A – C) Alternate representation of set difference ٢ 4. Disjoint sets, Cartesian product, Power sets, Partitions Disjoint sets: S1 and S2 are disjoint sets iff S1 ∩ S2 = ∅ Are the sets A = { 1,2,{3}} and B = {1,2,3} disjoint? No Cartesian product of two sets A and B: A x B = {(x,y) : x є A Λ y є B} A x B x C = {(x,y,z): x є A Λ y є B Λ z є C} Find the Cartesian product of {∅} and {a,b} { (∅, a), (∅,b)} Find the Cartesian product of ∅ and {a,b} ∅ Power set of a set A: 2A The set of all subsets of A Find 2{1, 2, 3} 2{1, 2, 3} = { ∅ , {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}} Find 2{1, 2, {3}} 2{1, 2, {3}} = { ∅ , {1}, {2}, {{3}}, {1,2}, {1,{3}}, {2,{3}}, {1,2,{3}}} Find 2{1, ∅ } 2{1, ∅ } = { ∅ , {1}, {∅}, {1,∅}} Partition of a nonempty set A: A non-empty set Π ⊂ 2 A, such that (1) Ø ∉ Π (2) No two distinct sets in Π have common elements (3) U Π = A Find two partitions of A = {1, 2, {1}} {{1}, {2, {1}}}, {{1,{1}}, {2}} Find the Cartesian product C of A = {1,2} and B = {a,b,c} C = {(1,a), (1,b), (1,c), (2,a), (2,b), (2,c)} ٣