You are on page 1of 19

Set Theory

Dr. Ioanna Stamatopoulou


Dr. Thanos Tagaris

1
Overview
▪ Introduction
▪ Definition and notation
▪ Describing sets
▪ The universal and empty sets
▪ Set equality and subsets
▪ Set cardinality
▪ Russell’s paradox
▪ Power set
▪ Tuples
▪ Set operations

2
Definition and Notation
▪ A set is an unordered collection of objects
• E.g. the students of CCP1220
• E.g. the chairs in this room
▪ The objects that participate in a set are called its elements, or
members
• A set is said to contain its members
▪ The notation 𝑎 ∈ 𝐴 denotes that 𝑎 is an element of the set 𝐴
• If 𝑎 is not a member of 𝐴, we write 𝑎 ∉ 𝐴
‒ This is equivalent to ¬ 𝑎 ∈ 𝐴
▪ The members of a set may themselves be sets
• E.g. the set of all CSD classes where each class is a set of students

3
Definition and Notation - Important Sets
Notation Description
ℕ Set of all natural numbers
ℕ1 Set of all natural numbers greater than 0
ℤ Set of all integers
ℤ+ Set of all positive integers
ℤ- Set of all negative integers
ℚ Set of all rational numbers
ℚ+ Set of all positive rational numbers
ℚ- Set of all negative rational numbers
ℝ Set of all real numbers
ℝ+ Set of all positive real numbers
ℝ- Set of all negative real numbers
ℂ Set of all complex numbers

4
Describing Sets – Roster Method
▪ Also known as enumeration
▪ 𝑆 = 𝑎, 𝑏, 𝑐, 𝑑
▪ Order is not important
• E.g. 𝑆 = 𝑎, 𝑏, 𝑐, 𝑑 = 𝑏, 𝑐, 𝑑, 𝑎
▪ Each element appears exactly once – no repetitions
• E.g. 𝑆 = 𝑎, 𝑎, 𝑏, 𝑐, 𝑑 = 𝑎, 𝑏, 𝑐, 𝑑
▪ Ellipses (…) may be used to describe a set without enumerating
(or listing) all its members
• Useful for large (or even infinite) sets
• Of course, the underlying pattern must be clear – e.g.:
‒ 𝑆 = 𝑎, 𝑏, 𝑐, … , 𝑧
‒ ℕ = 0,1,2,3, …

5
Describing Sets – Set Builder Method
▪ Also known as set comprehension
▪ Uses predicates in order to formally capture the condition(s) that
all members of a set must satisfy
▪ Describe the set 𝑆 of all positive integers which are less than 100
• Let 𝑃 𝑥 ≡ 𝑥 ∈ ℤ+ ∧ 𝑥 < 100
• Then 𝑆 = 𝑥 𝑃(𝑥)
• Equivalently
‒ 𝑆 = 𝑥 𝑥 ∈ ℤ+ ∧ 𝑥 < 100
‒ 𝑆 = 𝑥 ∈ ℤ+ 𝑥 < 100
▪ Describe the set ℚ of all rational numbers
𝑝
• Let 𝑃 𝑥 ≡ 𝑥 ∈ ℝ ∧ ∃𝑝∃𝑞 𝑝 ∈ ℤ ∧ 𝑞 ∈ ℤ ∧ 𝑞 ≠ 0 ∧ 𝑥 =
𝑞
• Then 𝑆 = 𝑥 𝑃(𝑥)

6
Describing Sets – Interval Notation

Notation Description
[𝑎, 𝑏] 𝑥 𝑥 ≥𝑎 ∧𝑥 ≤𝑏

Closed interval
[𝑎, 𝑏) 𝑥 𝑥 ≥𝑎 ∧𝑥 <𝑏
(𝑎, 𝑏] 𝑥 𝑥 >𝑎 ∧𝑥 ≤𝑏
(𝑎, 𝑏) 𝑥 𝑥 >𝑎 ∧𝑥 <𝑏

Open interval

7
The Universal and Empty Sets
▪ The universal set 𝑈 is the set containing all the objects currently
under consideration in a particular context
• It may be either explicitly defined and referred to
‒ Or it may be implicitly inferred
• The universal set is what we called a domain of discourse in Predicate
Logic
▪ The empty set is the set which contains no elements
• It is denoted by ∅ (or sometimes by {})
• Note that {} ≠ {∅}
‒ I.e. the empty set is different from the set containing the empty set (the
latter set is not empty as it contains an element – the empty set!)

8
Set Equality and Subsets
▪ Two sets are equal iff they contain exactly the same elements
• For any two sets 𝐴 and 𝐵, we write 𝐴 = 𝐵 to denote their equality
‒ Formally: 𝐴 = 𝐵 ⇔ ∀𝑥. 𝑥 ∈ 𝐴 ⇔ 𝑥 ∈ 𝐵
‒ We write 𝐴 ≠ 𝐵 to denote that the two sets are not equal
▪ For any two sets 𝐴 and 𝐵, 𝐴 is a subset of 𝐵 iff every element of
𝐴 is also an element of 𝐵
• We denote this as 𝐴 ⊆ 𝐵
• Formally: 𝐴 ⊆ 𝐵 ⇔ ∀𝑥. (𝑥 ∈ 𝐴 ⇒ 𝑥 ∈ 𝐵)
▪ For any two sets 𝐴 and 𝐵, 𝐴 is a proper subset of 𝐵 iff 𝐴 is subset
of 𝐵 and 𝐴 is not equal to 𝐵 U
• We denote this as 𝐴 ⊂ 𝐵 B
• Formally: 𝐴 ⊂ 𝐵 ⇔𝐴 ⊆ 𝐵 ∧ 𝐴 ≠ 𝐵 A

9
Set Equality and Subsets contd.

▪ To formally demonstrate equality between two sets 𝐴 and 𝐵 the


truth of the proposition ∀𝑥. 𝑥 ∈ 𝐴 ⇔ 𝑥 ∈ 𝐵 must be
established through a formal proof
• To demonstrate inequality it suffices to find an element 𝑦 such that 𝑦 ∈
𝐴 ∧𝑦 ∉𝐵
‒ Or equivalently an element 𝑦 such that 𝑦 ∈ 𝐵 ∧ 𝑦 ∉ 𝐴
▪ To formally demonstrate that a set 𝐴 is a subset of a set 𝐵 the
truth of the proposition ∀𝑥. 𝑥 ∈ 𝐴 ⇒ 𝑥 ∈ 𝐵 must be
established through a formal proof
• To demonstrate that 𝐴 is not a subset of 𝐵 it suffices to find an element
𝑦 such that 𝑦 ∈ 𝐴 ∧ 𝑦 ∉ 𝐵

10
Russell’s Paradox
▪ Let 𝑆 be the set of all sets which are not members of themselves
• Then is 𝑆 a member of itself?
• If the answer is yes then 𝑆 is, by virtue of being a member of itself, one of
the sets which are not members of themselves
‒ This is a contradiction!
• If the answer is no then 𝑆, by virtue of not being a member of 𝑆, is not
among the sets that are not members of themselves
‒ This means that S must be among the sets that are members of themselves
‒ This is again a contradiction!!
• So the question above cannot be answered!
• This is a result of the fact that one can form sets freely without any
restrictions
• The Zermelo-Fraenkel axiomatic set theory is free of such
paradoxes
Bertrand Russell
(1872-1970)

11
Set Cardinality
▪ If a set 𝑆 contains 𝑛 elements (for some natural number 𝑛) then
• 𝑆 is finite
• 𝑆 has a cardinality of 𝑛
‒ Cardinality is denoted as 𝑆 or #𝑆
‒ I.e. 𝑆 = #𝑆 = 𝑛
▪ Example cardinalities
• |∅| = 0
• |𝑆| = 26 if S is the set of all letters in the English alphabet
• | 1,2,3 | = 3
• | ∅ |=1
▪ Cardinalities are also associated with infinite sets
• Not expressed in terms of natural numbers

12
Power Set contd.

▪ The power set of a set 𝑆, denoted ℙ(𝑆), is the set of all subsets
of 𝑆
• Formally: ℙ 𝑆 = 𝐴 𝐴 ⊆ 𝑆
▪ If the cardinality of 𝑆 is 𝑛, then the cardinality of ℙ(𝑆) is 2𝑛
• This gives rise to an alternative notation for power sets: 2𝑆
▪ Let
• 𝑆 = 𝑎, 𝑏 then ℙ 𝑆 = ∅, 𝑎 , 𝑏 , 𝑎, 𝑏
• 𝑆 = 𝑎, 𝑏, 𝑐 then ℙ 𝑆 = ∅, 𝑎 , 𝑏 , 𝑐 , 𝑎, 𝑏 , 𝑏, 𝑐 , 𝑎, 𝑐 , 𝑎, 𝑏, 𝑐
▪ Note that 𝐴 ⊆ 𝐵 ⇒ ℙ 𝐴 ⊆ ℙ 𝐵

13
Tuples
▪ An 𝑛-tuple 𝑎1 , 𝑎2 , … , 𝑎𝑛 is an ordered collection, or sequence,
of elements
• 𝑎1 is the first element
• 𝑎2 is the second element
• …
• 𝑎𝑛 is the last element
▪ Two 𝑛-tuples 𝑎1 , 𝑎2 , … , 𝑎𝑛 and 𝑏1 , 𝑏2 , … , 𝑏𝑛 are equal iff
their corresponding elements are equal
• I.e. 𝑎1 = 𝑏1 and 𝑎2 = 𝑏2 and … 𝑎𝑛 = 𝑏𝑛
▪ 2-tuples are called (ordered) pairs

14
Cartesian Product
▪ The Cartesian product of two sets 𝐴 and 𝐵, denoted 𝐴 × 𝐵 is the
set of all pairs (𝑎, 𝑏) such that 𝑎 ∈ 𝐴 and b ∈ 𝐵
• Formally: 𝐴 × 𝐵 = (𝑎, 𝑏) 𝑎 ∈ 𝐴 ∧ b ∈ 𝐵

René Descartes
▪ The Cartesian product of the sets {𝑎, 𝑏} and 1,2,3 : (1596-1650)
• 𝑎, 𝑏 × 1,2,3 = 𝑎, 1 , 𝑎, 2 , 𝑎, 3 , 𝑏, 1 , 𝑏, 2 , 𝑏, 3
▪ The Cartesian product of the sets 𝐴1 , 𝐴2 , … , 𝐴𝑛 , denoted 𝐴1 ×
𝐴2 × ⋯ × 𝐴𝑛 , is the set of all n-tuples (𝑎1 , 𝑎2 , … , 𝑎𝑛 ) such that
𝑎𝑖 ∈ 𝐴𝑖 for 𝑖 = 1, … , 𝑛
• Formally:𝐴1 × 𝐴2 × ⋯ × 𝐴𝑛 = (𝑎1 , 𝑎2 , … , 𝑎𝑛 ) 𝑎𝑖 ∈ 𝐴𝑖 ∧ 𝑖 = 1, … , 𝑛
▪ The Cartesian product of the sets 0,1 , 1,2 , and {0,1,2} :
• 0,1 × 1,2 × 0,1,2 =
{ 0,1,0 , 0,1,1 , 0,1,2 , 0,2,0 , 0,2,1 , 0,2,2 , 1,1,0 , 1,1,1 , 1,1,2 ,
(1,2,0), (1,2,1), (1,2,2)}

15
Set Operations - Intersection
▪ The intersection of two sets 𝐴 and 𝐵, denoted 𝐴 ∩ 𝐵, is the set
comprising all elements that belong to both 𝐴 and 𝐵
• Formally: 𝐴 ∩ 𝐵 = {𝑥│𝑥 ∈ 𝐴 ∧ 𝑥 ∈ 𝐵}

𝐴 𝐵

𝐴∩𝐵

▪ 1,2,3 ∩ 3, 4, 5 = 3
1,2,3 ∩ 4, 5 = ∅

16
Set Operations - Union
▪ The union of two sets 𝐴 and 𝐵, denoted 𝐴 ∪ 𝐵, is the set
comprising all elements of 𝐴 and 𝐵
• Formally: 𝐴 ∪ 𝐵 = 𝑥 𝑥 ∈ 𝐴 ∨ 𝑥 ∈ 𝐵

𝐴 𝐵

𝐴∪𝐵

▪ 1,2,3 ∪ 3, 4, 5 = {1,2,3,4,5}
▪ Cardinality: 𝐴 ∪ 𝐵 = 𝐴 + 𝐵 − 𝐴 ∩ 𝐵
▪ Let 𝐴 be the Math majors in your class and 𝐵 be the CS majors
• To count students who are either Math majors or CS majors, add the
number of math majors and the number of CS majors, and subtract the
number of joint CS/math majors

17
Set Operations - Difference

𝐴 𝐵

A−B

18
Set Operations - Complement
▪ The complement of a set 𝐴 (with respect to the universal set 𝑈),
denoted 𝐴ҧ or 𝐴’, is the set of all elements of 𝑈 that do not
belong to 𝐴
• Formally: 𝐴ҧ = 𝑈 − 𝐴

𝐴ҧ

▪ If 𝑈 is the positive integers less than 100 determine the


complement of {𝑥 | 𝑥 > 70}
• Answer: 𝑥 𝑥 ≤ 70}

19

You might also like