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

Discrete MATH

ITCS 1313
2020 / 2021
SET THEORY
Lecture #04
Discrete MATH by Yahya AMER

Outlines
◼ Representing Relations
 using Digraphs
◼ Closures of Relations
 Reflexive closure
 Symmetric closure
 Transitive closure
◼ Equivalence Relations
◼ Partial Orderings Relations
◼ Functions & Function types
 One-to-One Functions
 Onto Functions
 One-to-One & Onto Function
◼ Inverse Functions
◼ Floor & Ceiling Functions
Discrete MATH by Yahya AMER

Representing Relations using Digraphs


Definition. A directed graph (digraph) consists of a set V of vertices (or
nodes) together with a set E of ordered pairs of elements of V called
edges (or arcs).

Example #1 : Show the digraph of the relation b


R={(a,a), (a,b), (b,a), (b,c)} on the set {a, b, c}. a
Solution :
vertex : a, b, c c
edge : (a,a),(a,b),(b,a),(b,c)

Example #2 : Show the digraph of the relation


R={(1,1),(1,3),(2,1),(2,3),(2,4), (3,1),(3,2),(4,1)}
on the set {1,2,3,4}.
Solution :
vertex : 1, 2, 3, 4
edge : (1,1), (1,3), (2,1), (2,3), (2,4), (3,1), (3,2), (4,1)
Discrete MATH by Yahya AMER

※ The relation R is reflexive iff for every vertex

※ The relation R is symmetric


iff for any vertices x≠y, either x y
or

※ The relation R is antisymmetric


iff for any x≠y , or x
or
x y y x y
※ The relation R is transitive iff for a, b, c A, (a, b)R and
(b, c)R  (a, c)R. This means:
a b a b

d c d c
Discrete MATH by Yahya AMER

Example: Determine whether the relations R and S are reflexive,


symmetric, antisymmetric, and/or transitive

Solution : Solution :
◼ reflexive,
◼ not symmetric, ◼ not reflexive,
◼ not antisymmetric, ◼ symmetric
◼ not transitive ◼ not antisymmetric
(a→b, b→c, a→c) ◼ not transitive
(b→c, c→a, b→a) (b→a, a→c, b→c)
Discrete MATH by Yahya AMER

Closures of Relations - Reflexive closure


1.(Reflexive closure of R on A)
Rr = the smallest reflexive relation containing R.
Rr = R ∪{ (a, a) | aA , (a, a)R}
Example :
The relation R={(1,1), (1,2), (2,1), (3,2)} on the set A={1, 2, 3} is not
reflexive.
Q: How to construct a smallest reflexive relation Rr such that R Rr ?
Solution: Let Rr = R  {(2,2), (3,3)}.
i. e., Rr = R  D, where D={(a, a)| a  A}.
Rr is a reflexive relation containing R that is as small as possible. It is
called the reflexive closure of R.

So R = {(1,1), (1,2), (2,1), (3,2)}


Reflexive closure of R (Rr) = {(1, 1), (1, 2), (2, 1), (3, 2), (2, 2), (3, 3)}
Discrete MATH by Yahya AMER

Closures of Relations - Symmetric closure


2.(Symmetric closure of R on A)
Rs = the smallest symmetric relation containing R.
Rs = R ∪{ (b, a) | (a, b)R and (b, a) R}
Example :
The relation R={ (1,1), (1,2), (2,2), (2,3), (3,1), (3,2) } on the set A={1,2,3} is
not symmetric. Find a smallest symmetric relation Rs containing R.
Solution : Let R-1={ (b, a) | (a, b)R }
Let Rs= R ∪R-1={ (1,1), (1,2), (2,1), (2,2), (2,3), (3,1), (1,3), (3,2) }
Rs is called the symmetric closure of R.
Example :
The relation R={ (a,a), (a,b), (b,b), (b,c), (c,b), (b,a) } on the set A={1,2,3}
. Find a smallest symmetric relation Rs containing R.
Solution : R = { (a,a), (a,b), (b,b), (b,c), (c,b), (b,a) }
Rs = { (a,a), (a,b), (b,b), (b,c), (c,b), (b,a) }
Rs is same as R.
Discrete MATH by Yahya AMER

Closures of Relations - Transitive closure


3.(Transitive closure of R on A)
Rt=the smallest transitive relation containing R.
Rt=R∪{(a, c) | (a, b)Rt and (b, c)Rt, but (a, c)Rt}(repeat)
Example. Let R be a relation on a set A, where
A={1,2,3,4,5}, R={(1,2),(2,3),(3,4),(4,5)}.
What is the transitive closure Rt of R ?
Solution : 3
1

∴Rt = {(1,2),(2,3),(3,4),(4,5),
(1,3), (2,4), (3,5),
(1,4), (2,5),
5 (1,5)}

2 4
Discrete MATH by Yahya AMER

Equivalence Relations
Definition. A relation R on a set A is called an equivalence
relation if it is reflexive, symmetric, and transitive.

Example. : Which of these relations on {0, 1, 2, 3} are equivalence relations?


Determine the properties of an equivalence relation that the others lack
a) { (0,0), (1,1), (2,2), (3,3) }
Has all the properties, thus, is an equivalence relation
b) { (0,0), (0,2), (2,0), (2,2), (2,3), (3,2), (3,3) }
Not reflexive: (1,1) is missing
Not transitive: (0,2) and (2,3) are in the relation, but not (0,3)
c) { (0,0), (1,1), (1,2), (2,1), (2,2), (3,3) }
Has all the properties, thus, is an equivalence relation

Example. : Let R be the relation on the set of integers such


that aRb if and only if a=b or a=-b. Then R is an equivalence
relation.
Discrete MATH by Yahya AMER

Partial Orderings
Definition. A relation R on a set S is called a partial ordering or
partial order if it is reflexive, antisymmetric, and transitive.

Example. Show that the “greater than or equal” () is a partial ordering on the
set of integers.
Solution :  x  x xZ  reflexive
 If x  y and y  x then x = y.  antisymmetric
 x  y, y  z  x  z  transitive

Exercise. Determine whether the relation with the


directed graph shown is a partial order.
Discrete MATH by Yahya AMER

Definition of Function
◼ Given any sets A, B, a relation from A to B is a function if every
element of set A has one and only one image in set B

◼ Every element of set A will have an image


◼ Every element of set A will only have one image in set B
Example: Let A = {a, b, c, d} , B = {Ayman, Ahmed, Belal, khalid, Allaa}.
Check if the following are functions ?
Discrete MATH by Yahya AMER

Function Terminologies
◼ If f:A→B, and f(a)=b (where aA & bB), then:
 A is the domain of f.
 B is the codomain of f.
 b is the image of a under f.
 a is a pre-image of b under f.

Example: The Relation S from the set D ={1,2,3,4} to the set C={a,b,c,d},
where S= {(1,a), (2,c), (3,d), (4,b)}. Is S function? If so, determine the
domain, codomain, image , preimages.
- The domain of S = {1,2,3,4} = D
- The codomain of S = {a,b,c,d} = C
- a is the image of 1, c is the image of 2, d is the image of 3, b is the
image of 4
- 1 is the preimage of a, 2 is the preimage of c, 3 is the preimage of d, 4
is the preimage of b
Discrete MATH by Yahya AMER

Example: f(a) = Z , f(b) = Y . the image of d is Z . The


image of b is Y . the domain of f is A = {a, b, c, d} the
codomain is B = {X, Y, Z} . f(A) = {Y, Z} . the preimage of Y
is b . the preimages of Z are a, c and d . f({c,d}) = {Z}

◼ One-to-One Functions : A function is one-


to-one (1-1), or injective, iff every element of
the codomain has at most one preimage (1-1) NOT (1-1)

◼ Onto (Surjective) Functions : A function


f:A→B is onto or surjective iff, every element
of the codomain has at least one preimage
ONTO NOT ONTO

◼ Bijective Function : A function f is


bijection,, iff it is both one-to-one and
onto. In other words, every element of the
codomain has exactly one preimage
Bijective
Discrete MATH by Yahya AMER

Illustration of function types

a 1 a 1 a a 1
b b 1 b
2 2 b 2
c 3 c 3 c 2 c 3
d 4 4 d 3 d 4
Discrete MATH by Yahya AMER

Inverse Functions
Definition: Let f be a bijection from A to B. Then the inverse of
f, denoted , is the function from B to A defined as

No inverse exists unless


f is a bijection. Why?

Example : Let f be the function from {a,b,c} to {1,2,3} such that f(a) = 2, f(b) = 3,
and f(c) = 1. Is f invertible and if so what is its inverse?
Solution:. The inverse function f -1 reverses the correspondence given by f,
so f -1 (1) = c, f -1 (2) = a, and f -1 (3) = b.
Discrete MATH by Yahya AMER

Floor & Ceiling Functions


The floor function, denoted
4.9 4
3
is the largest integer less than or equal to x.
2

The ceiling function, denoted


4.9 5
is the smallest integer greater than or equal to x 6
7
Examples:
Discrete MATH by Yahya AMER

END OF
SET THEORY

You might also like