Set Identities The Cartesian Product Partitions Sections 3.5-3.7
Prof. Sandy Irani Set Operations and Logic
• Set operations can be defined using logic operations:
Assume all sets and elements are contained in the Universal set U
(x ∈ A ∩ B) ↔ (x ∈ A) ᴧ ( x ∈ B) (x ∈ A ∪ B) ↔ (x ∈ A) v (x ∈ B) (x ∈ 퐴ഥ) ↔ ¬(x ∈ A)
x ∈ ↔ F x ∈ U ↔ T Can prove set identities that mirror the laws of logic:
x ∈ A ∪ ↔ (x ∈ A) v (x ∈ ) Definition of set union ↔ (x ∈ A) v F Definition of ↔ (x ∈ A) Identity Law
(x ∈ A ∪ ) ↔ (x ∈ A)
A ∪ = A Set Identities * Which set is not equal to Ø? You can assume that A, B, and C are not empty.
A) B ∩ C ∩ 퐵ഥ
B) A ∩ (B ∩ 퐵ഥ )
C) A ∩ (B ∪ 퐵ഥ )
D) (B ∪ 퐵ഥ ) Pairs, Triplets and Tuples
• (a, b) is an ordered pair. – Parens (as opposed to {}) indicate that order matters: • (a, b) ≠ (b, a) • {a, b} = {b, a}
• (a, b, c) is an ordered triple – b is the second entry of the triple (a, b, c)
• (a, b, c, d) is an ordered 4-tuple
• (a1, a2 , …, an) is an ordered n-tuple. Cartesian Product
• Let S and T be sets Cartesian product of S and T is S x T = { (s, t) : s ∈ S and t ∈ T }
• Example: S = {a, b, c} T = {1, 2} – S x T = { (a, 1), (a, 2), (b, 1), (b, 2), (c, 1), (c, 2) }
(a, 2) ∈ S x T ? (2, c) ∈ T x S ?
a ∈ S x T ? (a, b) ∈ S x S ?
(2, c) ∈ S x T ? S x T ∩ T x S ? Cartesian Plane
y
x
ℝ x ℝ = { (x, y): x ∈ ℝ and y ∈ ℝ} Cartesian Products * S = {1, 2} T = { x, y, z }
What is S x T ∩ S?
A) Ø
B) S
C) S ∩ T
D) S x T Cartesian Product on More than Two Sets • Sets A, B, and C: – A x B x C = { (a, b, c): a ∈ A and b ∈ B and c ∈ C }
• Sets A1, A2 , …, An
A1x A2 x … x An= { (a1, a2 , …, an): a1 ∈ A1 and a2 ∈ A2 and… and an ∈ An }
Example: Drink = {OJ, Coffee} Main = {Waffles, Eggs, Pancakes} Side = {Hash browns, Toast}
• Breakfast Selections = Drink x Main x Side – (OJ, Eggs, Toast) ∈ Drink x Main x Side Cartesian Product
• T = {1, 2} T x T = T2 = { (1, 1), (1, 2), (2, 1), (2, 2) } T ⊆ T2 ?
Let S be a set: n S = S x S x … x S = { (s1, .., sn) : each si in S, for 1 ≤ i ≤ n }
• Example: {0, 1}5
• Example: ℝ4 N-tuples and Strings
• If is a set of single characters, elements in n can be denoted without the punctuation, in which case they are called strings. Example: = {a, b} • (a, b, a, b) ∈ 4 (denoted as an n-tuple) • abab ∈ 4 (denoted as a string)
• {0, 1}3 = set of all binary strings with 3 bits: – {0, 1}3 = { 000, 001, 010, 011, 100, 101, 110, 111 }
• n-tuple punctuation is important if the underlying set is not a set of single characters! Strings • Concatenation: x = abba y = bab Concatenation of x and y is xy = abbabab Concatenation of x and a is abbaa
• Empty string has no characters: – x = x = x
• The length of a string x (denoted by |x|) is the number of characters in the string: Example: |abba| = 4. Cartesian Products * x = abba y = bab
What is |xyλ|?
A) 3
B) 4
C) 7
D) 8 Infinite sets of strings • The set of all strings of any length over an alphabet : * = 0 ∪ 1 ∪ 2 ∪ ….. Example: {0, 1}* = {, 0, 1, 00, 01, 10, 11, 000,….}
• The set of all strings of any length over an alphabet : + = 1 ∪ 2 ∪ 3 ∪ ….. Example: {0, 1}+ = {0, 1, 00, 01, 10, 11, 000,….} Disjoint Sets
• Two sets, A and B, are disjoint if A ∩ B =
• A collection of sets A1, A2,.., An are pairwise disjoint if Ai ∩ Aj = if i j. Partition
• A partition of a non-empty set A is a collection
of sets A1, A2,.., An such that
1. Ai ⊆ A, for each i ∈ {1, 2,…, n} 2. A A, for each i ∈ {1, 2,…, n} i A 3. A , A ,.., A are pairwise disjoint 1 2 n l b g 4. A1 ∪ A2 ∪.. ∪ An = A i j d e
c h f k a Cartesian Products *
A = {0, 1}4
A1 = all 4-bit strings that start with 1 A2 = all 4-bit strings that start with 0 A3 = all 4-bit strings that start with 00 A4 = all 4-bit strings that start with 000 A5 = { 0000 }
Do A1, A2, A3, A4, A5 form a partition of A?
A) Yes
B) No Cartesian Products *
A = {0, 1}4
A1 = all 4-bit strings that start with 1 A2 = all 4-bit strings that start with 01 A3 = all 4-bit strings that start with 001 A4 = all 4-bit strings that start with 0001
Do A1, A2, A3, A4, A5 form a partition of A?
A) Yes
B) No