2. January 29, Applied Discrete Mathematics 2
Set TheorySet Theory
• Set: Collection of objects (“elements”)Set: Collection of objects (“elements”)
• aa∈∈AA “a is an element of A”“a is an element of A”
“a is a member of A”“a is a member of A”
• aa∉∉AA “a is not an element of A”“a is not an element of A”
• A = {aA = {a11, a, a22, …, a, …, ann}} “A contains…”“A contains…”
• Order of elements is meaninglessOrder of elements is meaningless
• It does not matter how often the same elementIt does not matter how often the same element
is listed.is listed.
3. January 29, Applied Discrete Mathematics 3
Set EqualitySet Equality
Sets A and B are equal if and only if they containSets A and B are equal if and only if they contain
exactly the same elements.exactly the same elements.
Examples:Examples:
• A = {9, 2, 7, -3}, B = {7, 9, -3, 2} :A = {9, 2, 7, -3}, B = {7, 9, -3, 2} : A = BA = B
• A = {dog, cat, horse},A = {dog, cat, horse},
B = {cat, horse, squirrel, dog} :B = {cat, horse, squirrel, dog} : AA ≠≠ BB
• A = {dog, cat, horse},A = {dog, cat, horse},
B = {cat, horse, dog, dog} :B = {cat, horse, dog, dog} : A = BA = B
5. January 29, Applied Discrete Mathematics 5
Examples for SetsExamples for Sets
• A =A = ∅∅ “empty set/null set”“empty set/null set”
• A = {z}A = {z} Note: zNote: z∈∈A, but zA, but z ≠≠ {z}{z}
• A = {{b, c}, {c, x, d}}A = {{b, c}, {c, x, d}}
• A = {{x, y}}A = {{x, y}}
Note: {x, y}Note: {x, y} ∈∈A, but {x, y}A, but {x, y} ≠≠ {{x, y}}{{x, y}}
• A = {x | P(x)}A = {x | P(x)}
“set of all x such that P(x)”“set of all x such that P(x)”
• A = {x | xA = {x | x∈∈NN ∧∧ x > 7} = {8, 9, 10, …}x > 7} = {8, 9, 10, …}
“set builder notation”“set builder notation”
6. January 29, Applied Discrete Mathematics 6
Examples for SetsExamples for Sets
We are now able to define the set of rationalWe are now able to define the set of rational
numbers Q:numbers Q:
QQ = {a/b | a= {a/b | a∈∈ZZ ∧∧ bb∈∈ZZ++
}}
oror
QQ = {a/b | a= {a/b | a∈∈ZZ ∧∧ bb∈∈ZZ ∧∧ bb≠≠0}0}
And how about the set of real numbers R?And how about the set of real numbers R?
RR = {r | r is a real number}= {r | r is a real number}
That is the best we can do.That is the best we can do.
7. January 29, Applied Discrete Mathematics 7
SubsetsSubsets
AA ⊆⊆ BB “A is a subset of B”“A is a subset of B”
AA ⊆⊆ B if and only if every element of A is alsoB if and only if every element of A is also
an element of B.an element of B.
We can completely formalize this:We can completely formalize this:
AA ⊆⊆ BB ⇔⇔ ∀∀x (xx (x∈∈AA →→ xx∈∈B)B)
Examples:Examples:
A = {3, 9}, B = {5, 9, 1, 3}, AA = {3, 9}, B = {5, 9, 1, 3}, A ⊆⊆ B ?B ? truetrue
A = {3, 3, 3, 9}, B = {5, 9, 1, 3}, AA = {3, 3, 3, 9}, B = {5, 9, 1, 3}, A ⊆⊆ B ?B ?
falsefalse
truetrue
A = {1, 2, 3}, B = {2, 3, 4}, AA = {1, 2, 3}, B = {2, 3, 4}, A ⊆⊆ B ?B ?
8. January 29, Applied Discrete Mathematics 8
SubsetsSubsets
Useful rules:Useful rules:
• A = BA = B ⇔⇔ (A(A ⊆⊆ B)B) ∧∧ (B(B ⊆⊆ A)A)
• (A(A ⊆⊆ B)B) ∧∧ (B(B ⊆⊆ C)C) ⇒⇒ AA ⊆⊆ CC (see Venn Diagram)(see Venn Diagram)
UU
AA
BB
CC
9. January 29, Applied Discrete Mathematics 9
SubsetsSubsets
Useful rules:Useful rules:
∀ ∅∅ ⊆⊆ A for any set AA for any set A
• AA ⊆⊆ A for any set AA for any set A
Proper subsets:Proper subsets:
AA ⊂⊂ BB “A is a proper subset of B”“A is a proper subset of B”
AA ⊂⊂ BB ⇔⇔ ∀∀x (xx (x∈∈AA →→ xx∈∈B)B) ∧∧ ∃∃x (xx (x∈∈BB ∧∧ xx∉∉A)A)
oror
AA ⊂⊂ BB ⇔⇔ ∀∀x (xx (x∈∈AA →→ xx∈∈B)B) ∧∧ ¬∀¬∀x (xx (x∈∈BB →→ xx∈∈A)A)
10. January 29, Applied Discrete Mathematics 9
SubsetsSubsets
Useful rules:Useful rules:
∀ ∅∅ ⊆⊆ A for any set AA for any set A
• AA ⊆⊆ A for any set AA for any set A
Proper subsets:Proper subsets:
AA ⊂⊂ BB “A is a proper subset of B”“A is a proper subset of B”
AA ⊂⊂ BB ⇔⇔ ∀∀x (xx (x∈∈AA →→ xx∈∈B)B) ∧∧ ∃∃x (xx (x∈∈BB ∧∧ xx∉∉A)A)
oror
AA ⊂⊂ BB ⇔⇔ ∀∀x (xx (x∈∈AA →→ xx∈∈B)B) ∧∧ ¬∀¬∀x (xx (x∈∈BB →→ xx∈∈A)A)