MATH2081: Math for Computing 1
Lecturer: Dr. Nguyen Hieu Thao
Email:
[email protected] Lecture Notes 1: Set Theory
(2024A, Week 1, Monday, March 4, 16:30-18:00)1
Notions and operations
A set is a collection of objects. The objects are referred to as elements or members of the set.
If a set is finite and not too large, it can be described by listing all of its elements. For example,
the equation
A = {1, 2, a, b}
describes the set A consisting of the four elements 1, 2, a, and b. A set is determined by its
elements and not by the order in which the elements are listed. The elements of a set are assumed
to be distinct. If a set is a large finite set or an infinite set, we can describe it using set-builder
notation which characterizes the memberships of the set. For example, the equation
B = {x | x is a positive, even integer} (1)
describes the set B of all positive even integers. The vertical bar ‘|’ is read ‘such that’.
If X is a finite set, the cardinality of X, denoted by |X| or Card(X), is the number of
elements in X. The set with no elements is the empty (or null or void) set and is denoted by
∅. Two sets X and Y are equal if they have the same elements.
If every element of X is an element of Y , then X is a subset of Y and write X ⊂ Y . If X is
a subset of Y and X does not equal Y , then X is a proper subset of Y and write X ⊊ Y .
The set of all subsets of a set X, denoted by P (X) or 2X , is the power set of X.
The following set operators consider two sets X and Y .
(a) The set X ∪ Y = {x | x ∈ X or x ∈ Y } is the union of X and Y .
(b) The set X ∩ Y = {x | x ∈ X and x ∈ Y } is the intersection of X and Y . A feasibility
problem is to find a point in the intersection of a number of sets.
(c) The set X \ Y = {x | x ∈ X and x ∈
/ Y } is the difference (or relative complement).
(d) The symmetric difference of two sets A and B is the set
A △ B = (A ∪ B) − (A ∩ B).
Sets X and Y are disjoint if X ∩ Y = ∅. A collection of sets S is pairwise disjoint if,
whenever X and Y are distinct sets in S, X and Y are disjoint.
1 Most of the content of this document is taken from the book [1].
U U
A B A B
2 3 4 2 3 4
1 1
2 Figure 1.1.3 A Venn Figure 1.1.3 A Venn
diagram. diagram.
When dealing with only subsets of a set U , we call U the universal set or universe. Given
Example
a subset X of the 1.1.20
universal set U , the Example
Particular
set = U \1.1.20
X regionsXin(or U Particular
Venn diagrams
− regions
are
X) is the in Venn
depicted
complement diagrams
by shading. are set
of X. The depicted
A ∪ B by sha
is sho
Figure
Figure 1.1.4, and Figure 1.1.5 1.1.4, and
represents theFigure
set A −1.1.5
B. represents the set A − B.
U U U U
A B A B A B A BCALC PSYCH
34 12 47
8
25 16
❦ Figure❦ Figure Figure
1.1.4 A Venn 1: Venn1.1.4 A Venn
diagrams Figure
of A ∪1.1.5 A Venn
B (left) Figure
and A \ B 1.1.5 A Venn
(right) 14
diagram of A ∪ B. diagram of A ∪ B. diagram of A − B. diagram of A − B.
9 COMPSCI
Venn diagrams provide pictorial views of sets. In a Venn diagram, a rectangle depicts the
universal set. Subsets of the universal set are drawn as circles. The inside of a circle represents Figure 1
Figure 1.1.6 A Venn diagram
the members of that set. of three s
of three sets CALC, PSYCH,
Theorem (set calculus). Let A, B and C be subsets of a universal set U . and COMPSCI. The numbers and COM
show how
show how many students belong
(a) Associative laws: (A ∪ B) ∪ C = A ∪ (B ∪ C), (A ∩ B) ∩ C = A ∩ (B ∩ C).to the particular region depicted.
to the par
(b) Commutative laws: A ∪ B = B ∪ A, A ∩ B = B ∩ A.
To represent three sets, weTo userepresent three sets,circles
three overlapping we use(see
three overlapping
Figure 1.1.6).
(c) Distributive laws: A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C), A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C).
Example 1.1.21 Among Example 1.1.21
a group of Among
165 students, a group
8 are takingofcalculus,
165 students, 8 are taking
psychology, calculus, psy
and computer sci
A. taking calculus and33computer
(d) Identity laws: A ∪ ∅ = A, A ∩ U33=are are taking calculus
science; 20 and
are computer science;
taking calculus and20psycho
are ta
24 are taking psychology 24andare taking psychology
computer science; 79 and computer
are taking science;
calculus; 8379areart
(e) Complement laws: A ∪ A = U, A ∩ A = ∅.
psychology;
psychology; and 63 are taking computerand 63 areHow
science. taking computer
many science.
are taking noneHow
of them
(f) Idempotent laws: A ∪ A = A, A subjects?
∩ A = A. subjects?
(g) Bound laws: A ∪ U = U, A ∩ ∅ SOLUTION
= ∅. SOLUTION
Let CALC, PSYCH, and Let CALC, denote
COMPSCI PSYCH,theand setsCOMPSCI
of studentsdent
calculus, psychology, and calculus,
computerpsychology, and computer
science, respectively. Let science,
U denoterespectiv
the set
(h) Absorption laws: A ∪ (A ∩ B) = A, A ∩ (A ∪ B) = A.
165 students
165 students (see Figure 1.1.6). Since 8(see Figureare
students 1.1.6).
takingSince 8 students
calculus, are ta
psychology
(i) Involution law: A = A. computer science, we writecomputer
8 in the science,
region we write
representing 8 in the
CALC region
∩ PSYCHrepresenting
∩ COMP
Of the 33 students takingOf the 33and
calculus students taking
computer calculus
science, andalso
8 are computer
takingscie
psy
(j) 0/1 laws: ∅ = U, U = ∅. ogy; thus
ogy; thus 25 are taking calculus and25computer
are taking calculus
science but and
not computer
psychology. science
We
(k) De Morgan’s laws: (A ∪ B) = A25∩in B,the(Aregion A ∪ B. 25 in
representing
∩ B) = the region
CALC ∩ PSYCH representing
∩ COMPSCI. ∩ PSYCHwe
CALCSimilarly, COM
∩ write
the region representing CALC the region
∩ PSYCHrepresenting
∩ COMPSCICALC and ∩ PSYCH
16 in the∩ COMPSC
region r
senting CALC ∩ PSYCH senting CALC ∩
∩ COMPSCI. OfPSYCH ∩ COMPSCI.
the 79 students takingOf
△ the 79 45
calculus, stu
A partition of a set X divides now
X intobeennon-overlapping now leaves
beenAaccounted
subsets.
accounted for. This collection
34 students for.ofThis
S taking leavescalculus.
nonempty
only 34 students taking
We write
subsets of X is said to be a partition
theofregion
the set
representing the region
X if everyCALC
element in X
∩ PSYCHrepresenting
belongs toCALC
∩ COMPSCI. exactly ∩ PSYCH
one
Similarly, ∩ COMPSC
we write 47 i
member of S. region representing CALCregion ∩ PSYCHrepresenting
∩ COMPSCICALCand ∩ PSYCH
14 in the COMPSCI
∩ region an
represe
If X and Y are sets, the Cartesian product of X and Y , denoted by X × Y , is the set of
all (ordered) pairs (x, y) where x ∈ X and y ∈ Y . Symbolically,
❦ ❦
X × Y = {(x, y) | x ∈ X, y ∈ Y } .
References
1. Johnsonbaugh, R.: Discrete Mathematics - Eighth Edition. Pearson Education, New York
(2018).