chapter 2 part 2 - stud
TRANSCRIPT
Sets, Relations and Functions
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
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
DCS5028
DCS50284
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.
DCS50285
RELATIONSStudent CourseAlex MathematicsCindy MathematicsEsther Program DesignAlex Program Design
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 X and d Y.
Ex: X = {a,b} Y = {1,2}X x Y = {(a, 1), (a, 2), (b, 1), (b, 2)}
Cartesian ProductLets recall back from Part 1…
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
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 SetDefinition : Relation on A SetA 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)}
A relation R is calledreflexive iff a: aRasymmetric 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 NOTantisymmetric nor asymmetric
Properties of Relation
DCS5028
12
1R
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)}
2R 3R 4R
1R
2R
3R
4R
QuestionDraw 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 it’s reflexive, symmetric, antisymmentric and transitive.
DCS5028
14
QuestionDraw 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 it’s reflexive, symmetric, antisymmentric and transitive.
Equivalence Relations
Definition:A binary relation on a set is said to be equivalence
relation if is reflexive, symmetric and transitive.
Partial Order
Definition :A binary relation on a set is said to be partial order if is
reflexive, antisymmetric and transitive.
Question
• Definition• From Relations to Functions• Sum and Product of Functions• Image of Subset• Properties of Functions
Function
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 A} is called the range of f
• a
A
• b= (a)
Bf
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.
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 Bi.e. aA bB (((a,b)f) (b’B ((b’≠b) ((a, b’)f))))
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
From Relation to Function
Determine whether the following diagram is a function
Question
X2 = Y is a function from X to Y. Set X is the domain of X2 = Y and Set Y is the codomain of X2 = Y.
f(a)=bso f(0)=0, f(1)=1 and f(2)=4 Range of function X2 = Y is {0,1,4}
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)= X2
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.
Question
DCS502825
ANSWER
Let f1 and f2 be functions from A to R . Then f1 + f2 and f1 f2 are also functions from A to R defined by
(f1 + f2) (x) = f1(x) + f2 (x),(f1 f2) (x) = f1(x) f2(x)
Let f1 and f2 be the functions from R to R such that f1
(x) = x2 and f2 (x) = x- x2. What are the functions f1 + f2 and f1f2?
Sum and Product of Function
Question
DCS502827
ANSWER
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 S}
Let A = {a,b,c,d,e}, B = {1,2,3,4} and let’s define f with f(a) =2, f(b) =1, f(c) = 4, f(d) = 1 and f(e) = 1. Give f({b,c,d}).
Image of Subset
Question
DCS502829
ANSWER
An Injective functionA Surjective functionA Bijective function
Properties of Function
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.
A function is surjective (onto) if Every element of the codomain is mapped to by at least oneargument. In other words, everyelement in the codomain has nonempty preimage. Equivalently, a function is surjective if its range is equal to its codomain.
Surjective (Onto)
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.
Bijective (One to One & Onto)
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 bB aA (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 Bbijective 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.
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
Question
DCS502836
ANSWER
DCS5028
37
QuestionDetermine 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 ifit’s injective (one-to-one), (surjective) onto and (bijective) both:
{(1,a), (2,d), (3,c)}
DCS502838
ANSWER
DCS502839
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 it’s reflexive, symmetric, anti-symmetric and transitive. Are they partial order or equivalence relation?
DCS502840
REVIEW QUESTIONS3. 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 it’s 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.