Chapter 2 - Discrete-Mathematics-Set-Operations-Discrete-Mathematics-Basic-Structures-Sets
Chapter 2 - Discrete-Mathematics-Set-Operations-Discrete-Mathematics-Basic-Structures-Sets
Set
Operations
2.1: Sets
Definition
A set is an unordered collection of objects, called elements
or members of the set. A set is said to contain its elements.
We use “a ∈ A” to denote that a is an element of the set
A. Likewise, we use “a /∈ A” to denote that a is not an
element of A.
Example
Q + = {x ∈ R | x =qp for positive integers p and q}
Discrete Mathematics
Sets
Set
Operations
Sets
Definition
When a and b are real numbers with a < b, we write:
[a, b] = {x | a ≤ x ≤ b},
[a, b) = {x | a ≤ x < b},
(a, b] = {x | a < x ≤ b},
(a, b) = {x | a < x < b}.
Definition
Two sets are said to be equal when they have the same elements,
meaning that A and B are equal if and only if the sentence
∀x (x ∈ A ↔ x ∈
sentence.
Definition
Two sets are said to be equal when they have the same elements,
meaning that A and B are equal if and only if the sentence
∀x (x ∈ A ↔ x ∈
sentence.
Definition
There is a special set that contains no
elements. This set is called the empty set or the null set and is
denoted by ∅ or by { }.
Prof. Steven Evans Discrete Mathematics
Sets
Set
Operations
Venn Diagrams
Example
A Venn diagram for the set of
vowels:
e u
V
i o
Definition
The set A is a subset of B if every element of A is also an element
of B. This is written symbolically as
∀x (x ∈ A → x ∈ B).
Definition
The set A is a subset of B if every element of A is also an element
of B. This is written symbolically as
∀x (x ∈ A → x ∈ B).
Note
Note that to show that A is not a subset of B, we need only find
one element x ∈ A with x /∈ B. This element is a counterexample
to the claim that x ∈ A implies x ∈ B.
“Subset” as a Venn
diagram
A B
∀x (x ∈ A → x ∈ B) ∧ ∃x (x ∈ B ∧ x /∈ A).
∀x (x ∈ A → x ∈ B) ∧ ∃x (x ∈ B ∧ x /∈ A).
Double containment
A useful way to show that two sets are equal is to show that each
is a subset of the other. In other words, if we can show A ⊆ B and
B ⊆ A, then A = B.
∀x (x ∈ A → x ∈ B) ∧ ∃x (x ∈ B ∧ x /∈ A).
Double containment
A useful way to show that two sets are equal is to show that each
is a subset of the other. In other words, if we can show A ⊆ B and
B ⊆ A, then A = B. In symbols,
(∀x (x ∈ A ↔ x ∈ B))
↔ (∀x (x ∈ A → x ∈ B) ∧ ∀x (x ∈ B → x ∈ A)) .
Prof. Steven Evans Discrete Mathematics
Sets
Set
Operations
Sets with other sets as
members
Note that these sets are equal: A = B. Note also that {a} is a
member of A, but a is not.
Definition
Let S be a set. If there are exactly n elements in S, where n is a
non-negative integer, then we say that S is a finite set and that n
is the cardinality of S, denoted by |S|.
Definition
Let S be a set. If there are exactly n elements in S, where n is a
non-negative integer, then we say that S is a finite set and that n
is the cardinality of S, denoted by |S|.
Definition
If S is not a finite set, then it is said to be infinite.
Definition
Given a set S, the power set of S is the set of all the subsets of S.
It is denoted P(S).
Equality
If (b1, . . . , bn) is another n-tuple, then these are said to be equal
when each of their terms is equal, i.e., when ai = bi for each choice
of i . Note that the pairs (x, y ) and (y, x ) are equal only if x =
y.
Equality
If (b1, . . . , bn) is another n-tuple, then these are said to be equal
when each of their terms is equal, i.e., when ai = bi for each choice
of i . Note that the pairs (x, y ) and (y, x ) are equal only if x =
y.
Definition
Let A and B be sets. Their Cartesian product, written A × B, is
the set of all ordered pairs (a, b) with a ∈ A and b ∈ B.
Equality
If (b1, . . . , bn) is another n-tuple, then these are said to be equal
when each of their terms is equal, i.e., when ai = bi for each choice
of i . Note that the pairs (x, y ) and (y, x ) are equal only if x =
y.
Definition
Let A and B be sets. Their Cartesian product, written A × B, is
the set of all ordered pairs (a, b) with a ∈ A and b ∈ B.
A ×Prof.
B Steven
= {(a,
Evansb) | Discrete
a ∈ AMathematics
∧ b ∈ B}.
Sets
Set
Operations
Cartesian products
Definition
More generally, given sets A1 , A2 , . . . , An , their Cartesian product
is the set of n-tuples (a1, a2, . . . , an) with ai ∈ A i .
Definition
More generally, given sets A1 , A2 , . . . , An , their Cartesian product
is the set of n-tuples (a1, a2, . . . , an) with ai ∈ A i .
Definition
More generally, given sets A1 , A2 , . . . , An , their Cartesian product
is the set of n-tuples (a1, a2, . . . , an) with ai ∈ A i .
Definition
A subset of the Cartesian product A × B is called a relation from
the set A to the set B.
∀x ∈ S(P(x ))
∃x ∈ S(P(x ))
Definition
Given a predicate P and domain D, we define the truth set of P to
be the set of elements x in D for which P(x ) is true. This truth
set is denoted
{x ∈ D | P(x )}.
Definition
Given a predicate P and domain D, we define the truth set of P to
be the set of elements x in D for which P(x ) is true. This truth
set is denoted
{x ∈ D | P(x )}.
Example
What are the truth sets of P(x ), Q(x ), and R(x ), where
the domain is the set of integers and
Definition
Given a predicate P and domain D, we define the truth set of P to
be the set of elements x in D for which P(x ) is true. This truth
set is denoted
{x ∈ D | P(x )}.
Example
What are the truth sets of P(x ), Q(x ), and R(x ), where
the domain is the set of integers and
Definition
Given a predicate P and domain D, we define the truth set of P to
be the set of elements x in D for which P(x ) is true. This truth
set is denoted
{x ∈ D | P(x )}.
Example
What are the truth sets of P(x ), Q(x ), and R(x ), where
the domain is the set of integers and
Union
Let A and B be sets. Their union, written A ∪ B, is the set that
contains those elements which are in A, in B, or in both.
A ∪ B = {x | x ∈ A ∨ x ∈ B}.
Union
Let A and B be sets. Their union, written A ∪ B, is the set that
contains those elements which are in A, in B, or in both.
A ∪ B = {x | x ∈ A ∨ x ∈ B}.
Intersection
Let A and B be sets. Their intersection, written A ∩ B, is the set
that contains those elements which are in both A and B.
A ∩ B = {x | x ∈ A ∧ x ∈ B}.
A: A B
B: A B
A: A B A∪ A B
B:
B: A B
A: A B A∪ A B
B:
B: A B A∩ A B
B:
Definition
Two sets are called disjoint if their intersection is the empty
set.
Definition
Two sets are called disjoint if their intersection is the empty set.
Cardinalities
We are often interested in finding the cardinality of the union of
two finite sets A and B. Note that |A| + |B| counts once each
element which is in A or B but the the other, while it counts twice
each element that appears in both A and B.
Definition
Two sets are called disjoint if their intersection is the empty set.
Cardinalities
We are often interested in finding the cardinality of the union of
two finite sets A and B. Note that |A| + |B| counts once each
element which is in A or B but the the other, while it counts twice
each element that appears in both A and B. Hence:
Difference
Let A and B be sets. The difference of A and B, denoted A \ B
(or sometimes A − B) is the set of elements of A which are
not elements of B.
Difference
Let A and B be sets. The difference of A and B, denoted A \ B
(or sometimes A − B) is the set of elements of A which are
not elements of B.
A \ B = {x | x ∈ A ∧ x /∈ B}.
Difference
Let A and B be sets. The difference of A and B, denoted A \ B
(or sometimes A − B) is the set of elements of A which are
not elements of B.
A \ B = {x | x ∈ A ∧ x /∈ B}.
Complement
A\ A B
B:
A\ A B A¯ A
B:
:
Identity laws:
A ∩U =
A,
A∪∅=
A.
Identity laws:
A ∩ U = A,
A ∪ ∅ = A.
Domination
laws:
A ∪U
= U,
A∩∅
= ∅.
Identity laws:
A ∩ U = A,
A ∪ ∅ = A.
Domination
laws:
A ∪U
= U,
A∩∅ =
∅. Idempotent
laws:
A∪A
= A, A ∩
A = A.
Prof. Steven Evans Discrete Mathematics
Sets
Set
Operations
Set identities
Identity laws:
A ∩ U = A, Commutative laws:
A ∪ ∅ = A. A∪B =B∪
Domination A, A ∩ B = B
laws: ∩ A.
A ∪U
= U,
A∩∅ =
∅. Idempotent
laws:
A∪A
= A, A ∩
A = A.
Prof. Steven Evans Discrete Mathematics
Sets
Set
Operations
Set identities
Identity laws:
A ∩ U = A, Commutative laws:
A ∪ ∅ = A. A∪B =B∪
Domination A, A ∩ B = B
laws: ∩ A.
A ∪U Associative laws:
= U, A ∪ (B ∪ C ) = (A
A∩∅ = ∪ B) ∪C,
∅. Idempotent A ∩ (B ∩ B) = (A
laws: ∩ B) ∩C.
A∪A
(A) = A.
= A, A ∩
A = A.
Prof. Steven Evans Discrete Mathematics
Sets
Set
Operations
Set identities
Identity laws:
A ∩ U = A, Commutative laws:
A ∪ ∅ = A. A∪B =B∪
Domination A, A ∩ B = B
laws: ∩ A.
A ∪U Associative laws:
= U, A ∪ (B ∪ C ) = (A
A∩∅ = ∪ B) ∪C,
∅. Idempotent A ∩ (B ∩ B) = (A
laws: ∩ B) ∩C.
A∪A Distributive laws:
(A) = A.
= A, A ∩ A ∪ (B ∩ C ) = (A
∪ B) ∩ (A ∪
A = A.
Prof. Steven Evans C Discrete
), Mathematics
Sets
Set
Operations
Set identities
De Morgan’s laws:
A∩B =A∪
B, A ∪ B = A
∩ B.
De Morgan’s laws:
A∩B =A∪
B, A ∪ B = A
∩ B.
Absorption laws:
A ∪ (A ∩ B) = A, A
∩ (A ∪ B) = A.
De Morgan’s laws:
A∩B =A∪
B, A ∪ B = A
∩ B.
Absorption laws:
A ∪ (A ∩ B) = A, A
∩ (A ∪ B) = A.
Complement laws:
A ∪ A = U,
A ∩ A = ∅.
A ∩ B = {x | x /∈ A ∩ B }
A ∩ B = {x | x /∈ A ∩ B }
= {x | ¬(x ∈ (A ∩ B))}
A ∩ B = {x | x /∈ A ∩ B }
= {x | ¬(x ∈ (A ∩ B))}
= {x | ¬(x ∈ A ∧ x ∈ B ) }
A ∩ B = {x | x /∈ A ∩ B }
= {x | ¬(x ∈ (A ∩ B))}
= {x | ¬(x ∈ A ∧ x ∈ B ) }
= {x | ¬(x ∈ A) ∨ ¬(x ∈ B ) }
A ∩ B = {x | x /∈ A ∩ B }
= {x | ¬(x ∈ (A ∩ B))}
= {x | ¬(x ∈ A ∧ x ∈ B ) }
= {x | ¬(x ∈ A) ∨ ¬(x ∈ B ) }
= {x | x /∈ A ∨ x /∈ B }
A ∩ B = {x | x /∈ A ∩ B }
= {x | ¬(x ∈ (A ∩ B))}
= {x | ¬(x ∈ A ∧ x ∈ B ) }
= {x | ¬(x ∈ A) ∨ ¬(x ∈ B ) }
= {x | x /∈ A ∨ x /∈ B }
= {x | x ∈ A ∨ x ∈ B }
A ∩ B = {x | x /∈ A ∩ B }
= {x | ¬(x ∈ (A ∩ B))}
= {x | ¬(x ∈ A ∧ x ∈ B ) }
= {x | ¬(x ∈ A) ∨ ¬(x ∈ B ) }
= {x | x /∈ A ∨ x /∈ B }
= {x | x ∈ A ∨ x ∈ B }
= {x | x ∈ A ∪ B }
A ∩ B = {x | x /∈ A ∩ B }
= {x | ¬(x ∈ (A ∩ B))}
= {x | ¬(x ∈ A ∧ x ∈ B ) }
= {x | ¬(x ∈ A) ∨ ¬(x ∈ B ) }
= {x | x /∈ A ∨ x /∈ B }
= {x | x ∈ A ∨ x ∈ B }
= {x | x ∈ A ∪ B }
= A ∪ B.
Prof. Steven Evans Discrete Mathematics
Sets
Set
Operations
Set identities
Example
Use a membership table to show
A ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩
C ).
A B C B ∪ C A ∩ (B ∪ C ) A ∩ B A ∩ C (A ∩ B) ∪ (A ∩ C
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
A ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩
C ).
A B C B ∪ C A ∩ (B ∪ C ) A ∩ B A ∩ C (A ∩ B) ∪ (A ∩
C
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 1 0
1 0 0 0 0
1 0 1 1 1
1 1 0 1 1
1 1 1 1 1
A ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩
C ).
A B C B ∪ C A ∩ (B ∪ C ) A ∩ B A ∩ C (A ∩ B) ∪ (A ∩ C
0 0 0 0 0 0 0
0 0 1 1 0 0 0
0 1 0 1 0 0 0
0 1 1 1 0 0 0
1 0 0 0 0 0 0
1 0 1 1 1 0 1
1 1 0 1 1 1 0
1 1 1 1 1 1 1
A ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩
C ).
A B C B ∪ C A ∩ (B ∪ C ) A ∩ B A ∩ C (A ∩ B) ∪ (A ∩
C
0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0
0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 0
1 0 0 0 0 0 0 0
1 0 1 1 1 0 1 1
1 1 0 1 1 1 0 1
1 1 1 1 1 1 1 1
Definition
The union of a collection of sets is the set that contains those
elements which are members of at least one set in the
collection.
[
A1 ∪ · · · ∪n A n= i A = {x | ∃i 1, . . . , n}(x ∈ i
∈{ i A )}.
=1
Definition
The intersection of a collection of sets is the set that contains
those elements which are members of all the sets in the
collection.
\
A1 ∩ · · · ∩n A n= i A = {x | ∀i1, . . . , n}(x ∈ i
∈{ i A )}.
=1
A B
A∪B∪C:
C
A B
A∪B∪C:
C
A B
A∩B∩C:
C