Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

ICT 2021: Computational Mathematics

Sets
Lecture 6

Phyela Mbewe
LIS Department
University of Zambia
Overview
➢ Defining Sets
➢ Common Sets in math
➢ Special sets
➢ Venn Diagrams
➢ Subsets
➢ Cardinality
➢ Power set
➢ Set operations
• Set complement
• Laws of set operations
ICT 2021 2
Defining Sets [2]
▪ Defining a set:
1. Listing its elements
Example - 𝑃 = { 1, 2, 3, 4, 5, 6, 7, 8}

2. Using a common property to describe the elements


Example - 𝑃 = 𝑥 1 ≤ 𝑥 < 9, 𝑥 is an integer}

note: ellipses (…) can be used to represent a set with a large number of
elemets P = 1, 2, 3, 4, … 50
ICT 2021 3
Defining Sets
▪ Sets:
➢ An unordered collection of objects which have some common
property. The objects are referred to as elements

➢ An element cannot appear more than once in a set

➢ unordered: the set’s elements can be in any order


Example - A set of variables

𝑆 = {𝑎, 𝑏, 𝑐, 𝑥, 𝑦, 𝑧}
note: 𝑧, 𝑏, 𝑐, 𝑎, 𝑦, 𝑥 would be describing the same set (unordered)
ICT 2021 4
Common Sets in math
1. Natural numbers
ℕ = { 1, 2, 3, … }

2. Integers
ℤ = { … , −2, −1, 0, 1, 2, … }

3. Positive Integers
ℤ+ = { 1, 2, 3, 4, … }

4. Rational Numbers
𝑝
ℚ = { | 𝑝 ∈ ℤ, 𝑞 ∈ ℤ, 𝑞 ≠ 0}
ICT 2021
𝑞
5
Common Sets in math
5. Real numbers
denoted by letter ℝ
➢ A set of all rational numbers and irrational numbers
note: irrational numbers include numbers with a non-terminating
decimal, e.g. 𝟐 1.4142 … , 𝝅 (3.14159 … )

ICT 2021 6
Special sets
▪ The universal set
➢ set of all objects in a given scenario
➢ denoted by 𝑼

▪ The empty set


➢ set with no elements
➢ denoted as ∅ or { }

ICT 2021 7
Venn Diagram
➢ Visual representation of a set

Example – A set and universal set

ICT 2021 8
Subsets
▪ A subset:
➢ A set (set B) whereby every element in the set belongs to another set
(set A)
➢ denoted using 𝐁 ⊆ 𝐀

note: subset also defined by:


∀ 𝒙 𝒙 ∈ 𝑩 → ( 𝒙 ∈ 𝑨) meaning “for all 𝑥, if 𝑥 is in B then 𝑥 is in A”
ICT 2021 9
Subset - Properties
1. Empty set ∅ is a subset of any set
➢ denoted as ∅ ⊆ S
Proof:
- using subset definition ∀ 𝒙 𝒙 ∈ 𝑩 → 𝒙 ∈ 𝑨

- show that ∀ 𝒙 𝒙 ∈ ∅ → 𝒙 ∈ 𝑨

- since the empty set has no elements: 𝒙 ∈ ∅ is always false

- therefore since the premise is always false, the implication is always


true ( ∀ 𝒙 𝒙 ∈ ∅ → 𝒙 ∈ 𝑨 is true )

ICT 2021 10
Subset – Properties [2]
2. Any set S is a subset of itself

also defined by:


∀ 𝒙 𝒙 ∈ 𝑺 → ( 𝒙 ∈ 𝑺) meaning “for all 𝑥, if 𝑥 is in S then 𝑥 is in S” which is true

ICT 2021 11
Subset – Properties [3]
3. Proper subset
➢ Set B is a proper subset of set A if 𝑩 ⊆ 𝑨 and 𝑩 ≠ 𝑨

proper subset

➢ Proper subset is denoted by: 𝑩 ⊂ 𝑨


Example exercise:
A = {2,3,5} B = {3,5} C = {3,2,5}

i) is B a proper subset of A?
ii)
ICT 2021 is C a proper subset of A? 12
Cardinality
➢ When the number of elements in a set is finite, the cardinality of a set
is the number of elements in the set

➢ cardinality of set 𝐴 is denoted as | 𝑨 |

For example

𝑨 = 𝟐, 𝟑, 𝟓
𝑨 =𝟑

|∅ | = 𝟎
ICT 2021 13
Power set
➢ For a set S, the power set of S is the set of all subsets of S
➢ Denoted by P(S)
note: not to be confused with predicates,
in set theory P(S) means the power set of S

Example - power set of S

➢ Let 𝑆 = 𝑎, 𝑏, 𝑥
➢ 𝑃 𝑆 = ∅, 𝑎 , 𝑏 , 𝑥 , 𝑎, 𝑏 , 𝑎, 𝑥 , 𝑏, 𝑥 , 𝑎, 𝑏, 𝑥

ICT 2021 14
Power set [2]
Example 2 - power set of S
➢ Let 𝑆 = 1, 2
➢ 𝑃 𝑆 = ∅, 1 , 2 , 1,2

▪ Power set cardinality:


➢ If 𝑺 = 𝒏 then 𝑷 𝑺 = 𝟐𝒏

Example
➢ if 𝑆 = 1, 2, 3
➢ 𝑷 𝑺 =𝟖
ICT 2021 15
Cartesian Product
➢ For sets S and T, the Cartesian product of S and T is the set of all
ordered pairs (𝑠, 𝑡), whereby 𝒔 ∈ 𝑺 𝐚𝐧𝐝 𝐭 ∈ 𝑻
➢ denoted as 𝑺 × 𝑻
also defined as 𝑺 × 𝑻 = 𝒔, 𝒕 𝒔 ∈ 𝑺 ‫}𝑻 ∈ 𝒕 ٿ‬

Example

➢ Let 𝑆 = 1, 2 and T = {x, y, z}


➢ 𝑆 × 𝑇 = 1, 𝑥 , 1, 𝑦 , 1, 𝑧 , 2, 𝑥 , 2, 𝑦 , 2, 𝑧
➢ 𝑇 × 𝑆 = { 𝑥, 1 , 𝑥, 2 , 𝑦, 1 , 𝑦, 2 , 𝑧, 1 , 𝑧, 2 }

note: 𝑺 × 𝑻 ≠ 𝑻 × 𝑺

withICTordered
2021 pairs, in general, 𝑎, 𝑏 ≠ (𝑏, 𝑎) 16
Cartesian Product [2]
▪ Cardinality of the Cartesian product:
➢ 𝑆 × 𝑇 = 𝑆 × |𝑇|

Example
➢ Let 𝑆 = 1, 2 and T = x, y, z
➢ 𝑆 × 𝑇 = 1, 𝑥 , 1, 𝑦 , 1, 𝑧 , 2, 𝑥 , 2, 𝑦 , 2, 𝑧

➢ 𝑆×𝑇 =6 as seen above

➢ 𝑆 = 2, 𝑇 = 3, 𝑆 × 𝑇 =3 ×2

ICT 2021 17
Set operations
▪ Union
➢ Union of A and B is a set which contains elements in set A, set B, or in both
➢ denoted as 𝑨 ∪ 𝑩

➢ Cardinality of the set union


• 𝑨 ∪ 𝑩 = 𝑨 + 𝑩 − |𝑨 ∩ 𝑩|

ICT 2021 18
Set operations [2]
▪ Intersection
➢ Intersection of A and B is a set which contains elements that are in
both A and B
➢ denoted as 𝑨 ∩ 𝑩

ICT 2021 19
Set operations [3]
▪ Set difference
➢ Set difference of A and B is a set which contains elements that are in
A but not in B
➢ denoted as 𝑨 − 𝑩

Example - 𝐴 = 1,2,3,7 𝐵 = 3,4,5,7


𝐴ICT−2021
𝐵 = {1,2} 20
Set operations [4]
▪ Disjoint sets
➢ Two sets A and B, are called disjoint if their intersection is empty
➢ A and B are disjoint if 𝑨 ∩ 𝑩 = ∅

Example - 𝐴 = 1,2,7 𝐵 = 3,4,5


A∩ICT 𝐵 = ∅
2021 21
Set complement
➢ the compliment of set 𝑨 is a set of all elements which are within a given
universe 𝑼 but not within set 𝐴
➢ denoted as 𝑨′
➢ 𝑨′ = 𝑼 − 𝑨

𝐴′

➢ Complement Properties:
• 𝑨 ∩ 𝑨′ = ∅
ICT 2021 • 𝑨 ∪ 𝑨′ = 𝑼 22
Laws of set operations
1. Commutative law:
➢ 𝑨 ∪ 𝑩=𝑩 ∪𝑨
➢ 𝑨 ∩𝑩=𝑩∩𝑨

2. Associative law:
➢ 𝑨 ∪ 𝑩 ∪𝑪 = 𝑨 ∪𝑩 ∪𝑪
➢ 𝑨∩ 𝑩 ∩𝑪 = 𝑨∩𝑩 ∩𝑪

ICT 2021 23
Laws of set operations [2]
3. Distributive law
➢ 𝐴 ∪ 𝐵∩𝐶 = 𝐴 ∪𝐵 ∩ 𝐴 ∪𝐶
➢ 𝐴 ∩ 𝐵 ∪ 𝐶 = 𝐴 ∩ 𝐵 ∪ (𝐴 ∩ 𝐶)

3. De Morgan’s law
➢ (𝐴 ∪ 𝐵)′ = 𝐴′ ∩ 𝐵′
➢ (𝐴 ∩ 𝐵)′ = 𝐴′ ∪ 𝐵′
Compare with propositions

ICT 2021 24
Laws of set operations - Exercise
➢ Given that
𝑈 = 1,2,3,4,5,6,7,8,9 ,
𝐴 = 1,4, 5,7 B = {1,2, 5,6, 7,8,9} C = {2,3,4,5,7}

i) List the elements of 𝐴 ∪ 𝐵 ∩ ( 𝐴 ∪ 𝐶 )

ii) Give the cardinality of (𝐴 ∩ 𝐵)′

ICT 2021 25

You might also like