Unit#4 Set Theory
Unit#4 Set Theory
Discrete Structures
Unit 4:
Set Theory
Power set:
Given a set S, the power set of S is the set of all subsets of the set S.
The power set of S is denoted by (S).
Example: The power set of {0, 1, 2}
= {∅, {0}, {1}, {2}, {0, 1}, {0, 2}, {1, 2}, {0, 1, 2}}
Types of Set
Universal Set
It is a collection of all elements in a particular context or
application. All the sets in that context or application are
essentially subsets of this universal set. Universal sets are
represented as U.
Example: We may define U as the set of all animals on earth. In this
case, set of all mammals is a subset of U, set of all fishes is a subset
of U, set of all insects is a subset of U, and so on.
Cartesian Product
Let A and B be sets. The Cartesian product of A and B, denoted by
A × B, is the set of all ordered pairs (a, b), where a ∈ A and b ∈ B.
Hence,
Let A = {1, 2} and B = {a, b, c}, then the Cartesian product A × B is;
A × B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}.
Cartesian Product
• The Cartesian product of the sets A1, A2,…, An, denoted by A1 × A2
×⋯× An, is the set of ordered n-tuples (a1, a2,…, an), where ai
belongs to Ai for i = 1, 2,…, n.
• In other words,
A1 × A2 ×⋯× An = {(a1, a2,…, an) ∣ ai ∈ Ai for i = 1, 2,…, n}.
• Example: What is the Cartesian product A × B × C, where A = {0,
1}, B = {1, 2}, and C = {0, 1, 2}?
Relation
• A subset R of the Cartesian product A × B is called a relation
from the set A to the set B. The elements of R are ordered pairs,
where the first element belongs to A and the second to B. The set
A is called the domain of R and the set B is called its co-domain.
• For example, R = {(a, 0), (a, 1), (a, 3), (b, 1), (b, 2), (c, 0), (c, 3)} is
a relation from the set {a, b, c} to the set {0, 1, 2, 3}, and it is
also a relation from the set {a, b, c, d, e} to the set {0, 1, 3, 4).
• A relation need not contain a pair (x, y) for every element x of A.
Relation
• The objects of mathematics may be related in various ways.
• A set A may be said to be related to a set B if A is a subset of B, or if A is
not a subset of B, or if A and B have at least one element in common.
• A number x may be said to be related to a number y if x < y, or if x is a
factor of y, or if x2 + y2 = 1.
• Let A = {0, 1, 2} and B = {1, 2, 3} and let us say that an element x in A is
related to an element y in B if, and only if, x is less than y. Let us use the
notation x R y as a shorthand for the sentence “x is related to y.”
Relation
• R × R is the set of all ordered pairs (x, y) where both x and y are
real numbers. If horizontal and vertical axes are drawn on a
plane and a unit length is marked off, then each ordered pair in
R × R corresponds to a unique point in the cartesian plane.
Venn Diagrams
If sets A and B are represented as regions in the plane, relationships
between A and B can be represented by pictures, called Venn
diagrams, that were introduced by the British mathematician John
Venn in 1881.
Set Operation
Union of Sets: Union of Sets A and B is defined to be the set of all those elements which belong to A or B or
both and is denoted by A∪B.
A∪B = {x: x ∈ A or x ∈ B}
Example: Let A = {1, 2, 3}, B= {3, 4, 5, 6}
A∪B = {1, 2, 3, 4, 5, 6}.
|A ∪ B|=|A|+|B|−|A ∩ B|
Principle of inclusion–exclusion.
Intersection of Sets: Intersection of two sets A and B is the set of all those elements which belong to both A
and B and is denoted by A ∩ B.
A ∩ B = {x: x ∈ A and x ∈ B}
Example: Let A = {11, 12, 13}, B = {13, 14, 15}
A ∩ B = {13}.
Difference of Sets: The difference of two sets A and B is a set of all those elements which belongs to A but do
not belong to B and is denoted by A - B.
A - B = {x: x ∈ A and x ∉ B}
Example: Let A = {1, 2, 3, 4} and B = {3, 4, 5, 6}
then A - B = {3, 4} and B - A = {5, 6}
Set Operation
Complement of a Set: The Complement of a Set A is a set of all those elements of the
universal set which do not belong to A and is denoted by Ac.
Symmetric Difference of Sets: The symmetric difference of two sets A and B is the
set containing all the elements that are in A or B but not in both and is denoted by A ⨁ B
i.e.
A ⨁ B = (A ∪ B) - (A ∩ B)
Example: Let A = {a, b, c, d}
B = {a, b, l, m}
A ⨁ B = {c, d, l, m}
Types of Set
Overlapping Sets: Two sets that have at least one common
element.
Example: A={1,2,6} and B={6,12,42}.
Disjoint Set
Two sets A and B are called disjoint sets if they do not have even
one element in common. Therefore, disjoint sets have the
following properties −
n(A∩B)=∅
n(A∪B)=n(A)+n(B)
Example: A={1,2,6} and B={7,9,14}
Set Identities
Methods of identity Proof
Venn diagrams can provide an informal proof for some identities,
such proofs should be formalized using one of the following three
methods:
1. Subset Method: Prove that each set (side of the identity) is a
subset of the other.
2. Set builder notation and propositional logic. Start with one side,
transform it into the other side using a sequence of steps by
applying an established identity.
3. Membership Tables: Verify that elements in the same
combination of sets always either belong or do not belong to
the same side of the identity. Use 1 to indicate it is in the set
and a 0 to indicate that it is not.
Proof of Second De Morgan Law
Set-Builder Notation: Second De Morgan Law
Membership Table: Second De Morgan Law
• To indicate that an element is in a set, a 1 is used; to indicate that
an element is not in a set, a 0 is used.
A B A’ B’
1 1 0 0 1 0 0
1 0 0 1 0 1 1
0 1 1 0 0 1 1
0 0 1 1 0 1 1
Proving Set Identities
Use a membership table to show that A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C).
Generalized Unions and Intersections
Set Notation with Quantifiers
• ∀x ∈ S(P(x)) denotes the universal quantification of P(x) over
all elements in the set S. i.e., ∀x(x ∈ S → P(x)).
• ∃x ∈ S(P(x)) denotes the existential quantification of P(x) over
all elements in S. i.e., ∃x(x ∈ S ∧ P(x)).
• The statement ∀x ∈ R(x2 ≥ 0) states that for every real number
x, x2 ≥ 0.
• The statement ∃x ∈ Z(x2 = 1) states that there exists an integer
x such that x2 = 1
• Given a predicate P, and a domain D, we define the truth set of
P to be the set of elements x in D for which P(x) is true. The
truth set of P(x) is denoted by {x ∈ D ∣ P(x)}.
• What are the truth sets of the predicates P(x), Q(x), and R(x),
where the domain is the set of integers and P(x) is “|x| = 1,”
Q(x) is “x2 = 2,” and R(x) is “|x| = x.”
Computer Representation of Sets
There are various ways to represent sets using a computer. One
method is to store the elements of the set in an unordered fashion.
However, if this is done, the operations of computing the union,
intersection, or difference of two sets would be time-consuming,
because each of these operations would require a large amount of
searching for elements. We will present a method for storing
elements using an arbitrary ordering of the elements of the
universal set. This method of representing sets makes computing
combinations of sets easy.
Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} (Increasing or ascending order).
The bit string for a subset of odd integers in U, namely, {1, 3, 5, 7,
9}, is 10 1010 1010. (blocks of length four for easy reading.)
The bit string for a subset of all even integers in U is 01 0101 0101.
The bit string for a subset of all integers in U that do not exceed 5 is
11 1110 0000.
Multiset or Bag
• Multiset is an unordered collection of elements where an
element can occur multiple times. {a, a, a, b, b}
• The notation {m1 ⋅ a1, m2 ⋅ a2,…, mr ⋅ ar} denotes the multiset
with element ai occurring mi times
• The numbers mi ,i = 1, 2,…, r, are called the multiplicities of the
elements ai , i = 1, 2,…, r.
• The cardinality of a multiset is defined to be the sum of the
multiplicities of its elements.
• Let P and Q be multisets. The union of the multisets P and Q is the
multiset in which the multiplicity of an element is the maximum of its
multiplicities in P and Q.
• The intersection of P and Q is the multiset in which the multiplicity of an
element is the minimum of its multiplicities in P and Q.
• The difference of P and Q is the multiset in which the multiplicity of an
element is the multiplicity of the element in P less its multiplicity in Q
unless this difference is negative, in which case the multiplicity is 0.
• The sum of P and Q is the multiset in which the multiplicity of an
Multiset or Bag
Let P = {4 ⋅ a, 1 ⋅ b, 3 ⋅ c} and Q = {3 ⋅ a, 4 ⋅ b, 2 ⋅ d}
Find P ∪ Q, P ∩ Q, P − Q, and P + Q.
Solution:
P ∪ Q = {max(4, 3) ⋅ a, max(1, 4) ⋅ b, max(3, 0) ⋅ c, max(0, 2) ⋅ d}
= {4 ⋅ a, 4 ⋅ b, 3 ⋅ c, 2 ⋅ d},
P ∩ Q = {min(4, 3) ⋅ a, min(1, 4) ⋅ b, min(3, 0) ⋅ c, min(0, 2) ⋅ d}
= {3 ⋅ a, 1 ⋅ b, 0 ⋅ c, 0 ⋅ d} = {3 ⋅ a, 1 ⋅ b},
P − Q = {max(4 − 3, 0) ⋅ a, max(1 − 4, 0) ⋅ b, max(3 − 0, 0) ⋅ c, max(0
− 2, 0) ⋅ d}
= {1 ⋅ a, 0 ⋅ b, 3 ⋅ c, 0 ⋅ d} = {1 ⋅ a, 3 ⋅ c}, and
P + Q = {(4 + 3) ⋅ a, (1 + 4) ⋅ b, (3 + 0) ⋅ c, (0 + 2) ⋅ d}
= {7 ⋅ a, 5 ⋅ b, 3 ⋅ c, 2 ⋅ d}.