You are on page 1of 40

Sets, Relations and

Functions
1
DCS5028: DISCRETE STRUCTURE

CHAPTER 2
(PART 2)
The students should be able to describe the
concepts of Sets.
The students should be able to differentiate and
write the Set Operations and its relations.
The students should be able to understand,
differentiate and write the Relations and the
properties of a set.
The students should be able to understand the
concepts of Functions.
Learning Objectives
2
DCS5028
RELATION & FUNCTION
Relation
Definition
Relation and Their Properties
Relations on a Set
Properties of Relation
Equivalence Relation
Partial Order

Function
Definition
From Relations to Functions
Sum and Product of Functions
Image of Subset
Properties of Functions

3
DCS5028
RELATION
A relation is a set of ordered pairs.
The presence of the ordered pair (a,b) in a
relation is interpreted as indicating a
relationship from a to b.
DCS5028
4
RELATIONS
Student Course
Alex Mathematics
Cindy Mathematics
Esther Program Design
Alex Program Design
DCS5028
5
In the terminology of relations, we would say that Alex is related to
Mathematics and Program Design, and Cindy is related to
Mathematics.
Let X and Y be sets. The Cartesian product
of X and Y is denoted by X x Y, is the set of
all ordered pairs (c, d) where c e X and d e Y.

Ex: X = {a,b} Y = {1,2}
X x Y = {(a, 1), (a, 2), (b, 1), (b, 2)}

Cartesian Product
Lets recall back from Part 1
6
DCS5028
7
Relations and Their Properties
Definition :
Let A and B be sets.
A binary relation from A to B is a subset of A X B.
(Meaning : a binary relation from A to B is a set of R ordered pairs
where the first element of each ordered pairs comes from A and
the second element comes from B)
R(1st element,2nd element)

Set A Set B



DCS5028
8
Example 1 :
Let A be the set of several cities
= {jb, muar, klang, shah alam, kota bharu}

Let B be the set of the 14 states in Malaysia
= {Kuala Lumpur, Johor, Selangor, Kelantan, Perlis, Kedah,
Terengganu, Perak, Pahang, Melaka, Sabah, Sarawak,
Pulau Pinang, and Labuan}

Let R be the relation that specifying that (a,b) belongs to
R if city a is in state b.

Solution:
For instance relation R is {(jb, Johor), (muar, Johor),(klang,
Selangor), (shah alam, Selangor) and (kota bharu,
Kelantan)}
DCS5028
9
Example 2 :

Let Set A={1,2,3,4,5} and Set B= {1,2}.

Find the relation R ={(a,b)| (a + b) < 4}.

Solution:
Relation R = {(1,1),(1,2),(2,1)}
DCS5028
10
Relations on a Set
Definition : Relation on A Set
A relation on the set A is a relation from A to A.
In other words, a relation on a Set A is a subset of A X A.

Example
Let A be the set {1,2,3}. Which ordered pairs are in the
relation R={(a,b)| a < b} ?

Solution:

R={(1,2), (1,3),(2,3)}
DCS5028
A relation R is called
reflexive iff a: aRa
symmetric iff ab: aRb bRa (that is R = R
1
)
antisymmetric iff b: ((a = b) . (aRb)) (bRa)
transitive iff abc: aRb . bRc aRc
ALERT!!!

Not symmetric IS NOT
antisymmetric nor asymmetric
Properties of Relation
11
DCS5028
12
1
R
Example:
Let X be the set {a,b,c}.
, , , are relations on the set X.

1) Reflexive = {(a,a), (b,b), (c,c)}
2) Symmetric = {(a,b), (b,a), (c,c)}
3) AntiSymmetric = {(a,b), (c,a), (b,c)}
4) Transitive = {(a,b), (b,c), (a,c)}





2
R
3
R
4
R
1
R
2
R
3
R
4
R
DCS5028
Question
Draw the digraph of the relation:
The relation R = { (1,2), (2,1), (3,3), (1,1), (2,2) } on X = { 1, 2, 3 }

Determine whether its reflexive, symmetric, antisymmentric and
transitive.

13
DCS5028
14
Question
Draw the digraph of the relation:
The relation R = { (1,1), (1,2), (1,3), (1,4), (2,2), (2,3), (2,4), (3,3), (3,4),
(4,4) } on X = {1, 2, 3, 4}

Determine whether its reflexive, symmetric, antisymmentric and
transitive.
DCS5028
Equivalence Relations
Definition:
A binary relation on a set is said to be equivalence
relation if is reflexive, symmetric and transitive.
15
DCS5028
Partial Order
Definition :
A binary relation on a set is said to be partial order if is
reflexive, antisymmetric and transitive.
16
DCS5028
Question
17
DCS5028
Definition
From Relations to Functions
Sum and Product of Functions
Image of Subset
Properties of Functions


18
Function
DCS5028
A function f from a nonempty set A to a nonempty set B is an
assignment of exactly one element of B to each element of A.

We write the function as f : A B.
Functions are also called mappings or transformations.
- b = f(a) is called the image of a under f, and
a is called the preimage of b.
- A is the domain of f and B is the co-domain
- f(A) = { f(a) | a e A} is called the range of f

a

A



b= ](a)

B


f
19
Definition
DCS5028
20
Just think of a function as a way of matching the members.

Lets say we have set X and set Y. Each member in set X must
have one partner in Y.
DCS5028
A relation f from A to B is a function if:
Every element of A is related to some element of B
An element of A cannot be related to more than one element
of B
i.e. aeA -beB (((a,b)ef) . (beB ((bb) ((a, b)ef))))
A function Not a function because of
1


2


3


4

a


b

c

A
B
1


2


3


4

a


b

c

A
B
21
From Relation to Function
DCS5028
Determine whether the following diagram is a
function
22
Question
DCS5028
X
2
= Y is a function from X to Y. Set X is the domain of X
2
= Y
and Set Y is the codomain of X
2
= Y.

f(a)=b
so f(0)=0, f(1)=1 and f(2)=4
Range of function X
2
= Y is {0,1,4}
23
Example
0

1

2
0
1
2
3
4
f
Set X Set Y
Let f be the function defined by the rule f(x)= X
2

DCS5028

Write the Domain & Codomain.
Find the range of function X

+ 1
Write and Draw the Function X

+ 1 = Y that maps X
to Y.
24
Question
DCS5028
ANSWER
DCS5028
25
Let f
1
and f
2
be functions from A to R .
Then f
1
+ f
2
and f
1
f
2
are also functions from A to R defined by

(f
1
+ f
2
) (x) = f
1
(x) + f
2
(x),
(f
1
f
2
) (x) = f
1
(x) f
2
(x)
Let f
1
and f
2
be the functions from R to R such that f
1
(x) = x
2
and f
2
(x) = x- x
2
. What are the functions

f
1
+
f
2
and f
1
f
2
?
26
Sum and Product of Function
Question
DCS5028
ANSWER
DCS5028
27
Let f be a function from the Set A to the Set B and let S is a
subset of A. The image of S is the subset of B that consists of
the images of the elements of S. We denote the image of S by f
(S), so that
f (S) = {f (s) | s e S}
Let A = {a,b,c,d,e}, B = {1,2,3,4} and lets define f with f(a) =2, f(b)
=1, f(c) = 4, f(d) = 1 and f(e) = 1.
Give f({b,c,d}).
28
Image of Subset
Question
DCS5028
ANSWER
DCS5028
29
An Injective function
A Surjective function
A Bijective function
30
Properties of Function
DCS5028
Injective (One-to-One)
A function is injective (one-to-one) if
every possible element of the
codomain is mapped to by at most
one argument. Equivalently, a function
is injective if it maps distinct arguments
to distinct images. An injective function
is an injection.
31
DCS5028
A function is surjective (onto) if
Every element of the codomain is
mapped to by at least one
argument. In other words, every
element in the codomain has non
empty preimage. Equivalently, a
function is surjective if its range is
equal to its codomain.
32
Surjective (Onto)
DCS5028
A function is bijective if it is both
injective and surjective. A bijective
function is a bijection (one-to-one
correspondence). A function is
bijective if and only if every
possible element of the codomain
is mapped to by exactly one
argument. This equivalent condition
is formally expressed as follows.
33
Bijective (One to One & Onto)
DCS5028
A function f is said to be

one-to-one (or injective) if x y (f(x) = f(y) x = y)
onto (or surjective) if beB -aeA (f(a) = b)
bijective if it is both injective and surjective
In other words, a function f is said to be

one-to-one (or injective) x y (x = y f(x) = f(y))
onto (or surjective) the range of f is B
bijective if it is both one-to-one and onto.
An injective function is called an injection.
A surjective function is called a surjection.
A bijective function is called a bijection.
34
DCS5028
Which of the following functions are injective, surjective, and/or
bijective? Explain why.
1


2


3


4


a

b

c
d
1


2


3


4


a

b

c


1


2


3







a

b

c

d


35
Question
DCS5028
ANSWER
DCS5028
36
37
Question
Determine whether the set below is a function from
X = {1, 2, 3} to Y = {a, b, c, d}. If it is a function, find its
domain and range, draw its arrow diagram and determine if
its injective (one-to-one), (surjective) onto and (bijective)
both:

{(1,a), (2,d), (3,c)}







DCS5028
ANSWER
DCS5028
38
REVIEW QUESTIONS
1. For each of these relations on the set {1, 2, 3, 4},
decide whether it is reflexive, symmetric,
antisymmetric, and transitive.
{(1,1), (1,2), (2,1), (2,2), (3,3), (4,4)}
{(1,2), (2,3), (2,4), (3,4)}

2. Given Y = {1, 2, 3} and R = {(a,b) , (a*b) < 9}. List the
elements of R. Draw its digraph and determine
whether its reflexive, symmetric, anti-symmetric and
transitive. Are they partial order or equivalence
relation?






39
DCS5028
REVIEW QUESTIONS
3. Determine whether each set below is a function from
X = {1, 2, 3} to Y = {p, q, r, s}. If it is a function, find its
domain and range, draw its arrow diagram and determine
if its one-to-one, onto or both.
{(1,p), (2,s), (3,r)}
{{1,s), (2,p), (3,s), (1,p)}

4. Given K = {x | 0 < x < 5} and L = {y | 8 < y < 14} where f is
the function from K to L. Let f(1) = 13, f(2) = 10, f(3) = 11
and f(4) = 9. Draw its arrow diagram and find its domain
and co-domain. Determine if its injective, surjective and
bijective.






40
DCS5028

You might also like