Relations and Functions: Mathematics Concepts For Computing
Relations and Functions: Mathematics Concepts For Computing
Relations and Functions: Mathematics Concepts For Computing
Introduction
Cartesian Product Set
Relations, Mapping & Function
Properties of Relations
Operations on Functions
Invertible Functions
Ordered pairs
An ordered pair consists of two elements, of which one
is designated as the first element and the other as the
second element.
It is written as (a, b) where a is the first element and b
is the second element.
Def 1: We use the notation aRb to denote that (a,
b)R, and a is said to be related to b by R if aRb.
1 1
2 2
3 3
4 4
R2 ● ●
R3 ● ● ●
● ●
R4
●
R5
● ● ● ●
R
AQ010-3-1-Mathematical Concepts for Computing Relation & Function
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.
• Domain of R : Dom(R) is the set of all elements in A that
are related to some element in B.
• Range of R : Ran(R) is the set of all elements in B that
are related to some element in A.
Properties of a relation:
Let R be the a relation on a set A,
- R is reflexive : If (a,a) R for every element a A.
- R is symmetric : If (b,a) R whenever (a,b) R, for
some a,b A.
- R is transitive: If (a,b) R and (b,c) R, then (a,c) R ,
for a, b, c A.
• The relations “has the same hair color as” or “is the
same age as” in the set of people are equivalence
relations.
• The equivalence classes under the relation “has the
same hair color as” are the set of blond people, the set
of red-haired people, etc.
Symmetric
Answer:
• R is reflexive because (1,1), (2,2), (3,3), (4,4), (5,5) are
in R.
• R is symmetric because whenever (x,y) is in R, (y,x) is in
R as well.
• R is transitive because whenever (x,y) and (y,z) are in R,
(x,z) is in R as well.
• So, R is an equivalence realtion.
Answer:
R is NOT an equivalence relation because R is not
symmetric.
R1 = {(1, 1), (1, 2), (2, 3), (3, 3), (4, 4)}
R2 = {(1, 1), (2, 2), (2, 3), (3, 3), (4, 4)}
R3 = {(1, 3), (3, 2), (2, 1)}
Sol: R2
R1 = {(1, 1), (1, 2), (2, 1), (3, 3), (4, 4)}
R2 = {(1, 1)}
R3 = {(1, 3), (3, 2), (2, 1)}
R4 = {(4, 4), (3, 3), (1, 4)}
Sol: R1, R2
R1 = {(1, 1), (1, 2), (2, 2), (2, 1), (3, 3)}
Sol: R1
A B A B
1 a 1 a
2 b 2 b
3 c 3 c
4 4
α 1 α 1
β 2 β
γ 2
γ 3
A Not a function B A B
Not a function
α 1 α 1
2
β 2 β
3
γ γ
4
a function a function
0 0
1
1 2
3
2 4
Set X Set Y
X2 = Y is a function from X to Y.
Domain is {0, 1, 2} and Codomain is {0, 1, 2, 3, 4}.
Difference of functions
(f – g)(x) = f(x) – g(x)
Product of functions
(fg)(x) = f(x) . g(x)
Quotient of functions
(f/g)(x) = f(x)
g(x)
AQ010-3-1-Mathematical Concepts for Computing Relation & Function
Example 1
2
Given f (x) =x - 4, g(x) =x + 2
Find:
1) (f + g)(x)
2) (f - g)(x)
3) (fg)(x)
4) (f/g)(x)
• If f(x) = The price of the shirt after the discount and g(x)
= The price after sales tax then,
• The function for the final cost of the shirt = g(f(x)).
Given that f ( x ) 2
Find ,
( x 1) 3
1
(i) f ( x)
(ii) f 1 (16)
Q&A
Discrete Probability