Lecture 5-Set and Relations
Lecture 5-Set and Relations
Learning Objectives
To use set notations
To apply operations (union, intersection) on sets
To define de Morgan’s Laws for sets
To define relations on sets
To define set partitions
Set Theory
Set is a collection of objects
The { } notation for sets
𝐴 = {𝑥 ∈ 𝑆 | 𝑃 𝑥 }
Which is read “the set of all x in S such that P of x.”
Example:
X = { x | x is the alphabetical letter of English }
X = {a, b, c, d ,..., x, y, z}
a X b X p X z X
The element of Set
The objects are called the elements of a
set
We use to denote the elements of
a set.
x is an element of the set A
x A x is a member of A
x belongs to A
The element of Set
The size of a set is called cardinality.
The notation of cardinality is | |.
Example:
X = { x | x is the alphabetical letter of English }
X = { a, b, c, …, x, y, z }
Y = {a, b}, Y = 2
{}
Examples:
1.The set of real numbers x such that x2 = -1.
𝐴 ⊆ 𝐵 ⟺ ∀𝑥, 𝑖𝑓 𝑥 ∈ 𝐴 𝑡ℎ𝑒𝑛 𝑥 ∈ 𝐵
X Y X is contained in Y
X is a subset of Y
ZX Z Y
More on Subsets
N Z Q
Note that the null set is regarded as a subset of every set,
including itself.
|( A) |= 8
Theorem
|( A) |= 2 | A|
Operations on Sets
The union of X and Y
◦ The set of all elements in X or Y
X Y
The intersection of X and Y
◦ The set of all elements in X and Y
X Y
Venn Diagrams
X Y X Y
X Y X Y
Example
X = {a, b, c, d , e} X Y
Y = {c, d , e, f } a
c
d f
e
b
X Y = {a, b, c, d , e, f }
X Y = {c, d , e}
Complement of Y relative to X
X – Y or X \ Y
The “set difference”
X Y
{x X : x Y }
X −Y X Y Y−X
Disjoint Sets
Two sets are disjoint if they don’t intersect
X Y =
1,3,5 ∩{2,4,6}= ∅
Mutually Disjoint Sets
For all i, j =1, 2, 3, …
𝐴𝑖 ∩ 𝐴𝑗 = ∅ whenever 𝑖 ≠ 𝑗
U
If X U we write X
The complement 𝑋ത = 𝑋 𝑐 = 𝑈 ∖ 𝑋
of X
=𝑈 − 𝑋
Lemma: de Morgan’s Law for Sets
X Y = X Y
X Y = X Y
Example
1. U = {1, 2, …, 10}
2. X = {1, 2, 3, 4, 5}
3. Y = {2, 4, 6, 8}
Find:
X Y X X −Y
X Y Y Y−X
Examples of Some Other Sets
X = {x | x 4} Y = {x | x = 9}
2
| X Y |=| X | + | Y | − | X Y |
Relations on Sets
Let X, Y be sets. A relation between X and
Y is a subset of the Cartesian product
Let R be the relation from X to Y
R = X Y = {( x, y ) | x X , y Y }
X = {a, b, c} Y = {1,2}
R = X Y = {( x, y ) | x X , y Y }
= {( a,1), (a,2), (b,1), (b,2), (c,1), (c,2)}
We obtain
Let ρ be a relation on X.
ρ is symmetric if ( x, y ) ( y , x )
Example 5:
Let A = {2, 3}
and ρ be a relation on A defined as
“x ρ y if and only if x + y is odd integer.”
= (2,3), (3,2)
ρ is symmetric
Properties of Relations: transitive
ρ is transitive if for all
x, y , z X
If ( x, y ) and ( y, z ) , and ( x, z )
Example 6:
Let A = {1, 3, 4}
and ρ be a relation on A defined as
𝑥
“x ρ y if and only if > 0 ”
𝑦
𝑎 ≡ 𝑏 𝑚𝑜𝑑 𝑛
𝑎 − 𝑏 = 𝑡𝑛, for some integer t
I. a a (mod n)
II. a b (mod n) b a (mod n)
III. a b (mod n)
a c (mod n)
b c (mod n)
Applications
4 o’clock + 12 hours = “1600 hours” = 16 o’clock = 4 o’clock
◦ This is because 4 ≡ 16 (mod 12)
X = {1, 2, 3, 4, 5, 6, 7}.
Define ρ on X by x ρ y if x ≡ y (mod 3). Write down ρ
as a set of ordered pairs.
Theorem:
Equivalence classes of X given by the relation ρ.
2
5
1 4
7
3
6