Relations and Functions
Relations and Functions
Relations and Functions
AQ010-3-1 (Version E)
The most direct way to express a relationship between elements of two sets is to use
ordered pairs made up of two related elements. For this reason, sets of ordered pairs
are called binary relations.
Applications
Relations can be used to
• solve problems such as determining which pairs of cities are linked by airline flights
in a network,
• finding a viable order for the different phases of a complicated project or producing
a useful way to store information in computer databases.
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.
Definition:
We use the notation aRb to denote that (a, b)R, and a is said to be related to b by R
if aRb.
Consider two sets, the set of all ordered pairs (a, b) where a A and b B is
called the product , or Cartesian product of A and B.
Example 3:
Let A ={ 0,1,2} and B ={a, b}.
Then {(0,a),(0,b),(1,a),(2,b)} is a relation from A to B.
Relations can be represented graphically using arrows to represent ordered pairs or to
use a table.
1 1
2 2
3 3
4 4
R3 ● ● ●
R4 ● ●
●
R5
● ● ● ●
AQ010-3-1-MCFC R6 Relations and Functions SLIDE 12
Relation - Domain and range
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.
Example 6: Let A = {Alice, Bob, Claire, Dan} be a set students, and
B= {CS101, CS201, CS202} be a set of courses.
Then, a possible relation is:
{(Alice, CS101), (Bob, CS201), (Bob, CS202), (Dan, CS201), (Dan, CS202)}
Given A = {1, 2, 3, 4} and B = {x, y, z}. Let R be the following relation from A to B:
R = {(1,y), (1,z), (3,y), (4,x), (4,z)}
(a) Find A x B.
(b) Use table and arrow diagram to represent R.
(c) Determine the domain and range of R.
Example 7: A = { a, b, c}
Properties of a relation:
Let R be 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.
R1 = {(1, 1), (1, 2), (2, 3), (3, 3), (4, 4)}
R2 = {(1, 1), (2, 2), (2, 3), (3, 3), (4, 4)}
Sol: R2
Example 9:
Are the following relations on {1, 2, 3, 4} symmetric?
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
Example 10:
Are the following relations on {1, 2, 3, 4} transitive?
R1 = {(1, 1), (1, 2), (2, 2), (2, 1), (3, 3)}
Sol: R1
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.
A B A B
1 a 1 a
2 b 2 b
3 c 3 c
4 4
A relation allows multiple mappings between the domain and the co-domain.
Example: students enrolled in multiple courses.
A B A B
α 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}.
Sum of functions
(f +g)(x) = f(x) + g(x)
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)
Given
Find:
1.( f g )( x)
2.( f g )( x)
3.( fg )( x)
f ( x)
4.
g ( x)
Let g be a function from the set A to the set B and let f be a function from set B the
set C.
Find the image of a under f and then find the image of f(a) under g.
The composition functions f and g, is defined by
(g o f)(a) = g(f(a))
You use composite functions whenever you buy a sale (discounted) item. When you are
standing in the store trying to decide if you can afford the item, the first thing you
calculate is the discount.
• For example, I want to buy this 20-dollar shirt, and it is on sale at 15% off. This
means that the shirt is really 17 dollars.
• Now, you must calculate what the shirt will cost after sales tax (let's say it is 8%).
• Your total cost for the shirt after the discount and sales tax will be $18.36. This
process of computation can be expressed as a composite function.
• 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)).
1. fog ( x)
2.gof ( x)
• Relations
• Representation of relations
• Cartesian product
• Properties of relations
• Functions
• Domain and range
• Operations on functions
• Composite functions
• Inverse functions