Unit-01 Set, Relation & Function
Unit-01 Set, Relation & Function
P P Savani University
(P P Savani University) Set, Relation & Function July 14, 2022 1 / 103
Set Definition of Set
Definition of Set
(P P Savani University) Set, Relation & Function July 14, 2022 2 / 103
Set Definition of Set
Definition of Set
A set is an unordered collection of objects, called elements or members of the
set. A set is said to contain its elements. We write a ∈ A to denote that a is
an element of the set A. The notation a ∈ / A denotes that a is not an element
of the set A.
Any well-defined collection of objects is called a set.
Note : By the term ‘well-defined’ we mean that it is possible to say, without ambiguity, whether a
particular object belongs to the collection under discussion or not.
(P P Savani University) Set, Relation & Function July 14, 2022 3 / 103
Set Definition of Set
(P P Savani University) Set, Relation & Function July 14, 2022 4 / 103
Set Representation of Set
Representation of Set
(P P Savani University) Set, Relation & Function July 14, 2022 5 / 103
Set Representation of Set
Representation of Set
Under this method, the elements of a set area enumerated between two curly
brackets {} separated by commas.
(P P Savani University) Set, Relation & Function July 14, 2022 6 / 103
Set Representation of Set
Example
(P P Savani University) Set, Relation & Function July 14, 2022 7 / 103
Set Equality of Sets
Equality of Sets
Two sets are equal if and only if they have the same elements. Therefore, if A and B are sets, then A and
B are equal if and only if ∀x (x ∈ A ↔ x ∈ B). We write A = B if A and B are equal sets. If sets A and
B are not equal then we write A 6= B.
Examples:
i A = {1, 2}, B = {1, 2, 1} : In this case A = B
ii A = {x|x is a letter of the word TALE}
B = {x|x is a letter of the word LATE}. In this case A = B
iii C = {x|x is a letter of the word SLATE}
D = {x|x is a letter of the word PLATE}. In this case C 6= D
iv P = {1, −1, 3}, Q = {±1, 3}. In this case P = Q.
(P P Savani University) Set, Relation & Function July 14, 2022 8 / 103
Set Type of Sets
Type of Sets
A set is said to be a null set if no elements belong to it. A null set is also called
empty set or void set. A null set is denoted by φ or {}
Examples:
i S = The set of female Indian noble laureates = φ = {}
ii S = The set of positive integers lying between 1 and 10 which are exactly
divisible by 11 = φ
(P P Savani University) Set, Relation & Function July 14, 2022 9 / 103
Set Type of Sets
Type of Sets
Examples:
i S = Set of prime numbers which are even = {2}
ii S = Set of Nobel Laureate Indian economists till 2007 = {Prof. Amartya Sen}
iii S = {x : x is an integer neither positive nor negative} = {0}
iv S ={x : x is an integer neither prime nor composite}={1}
(P P Savani University) Set, Relation & Function July 14, 2022 10 / 103
Set Type of Sets
Type of Sets
Examples:
i S = The set of days in week,
ii S = The set of students of PPSU,
iii S = The set of prime numbers lying between 1 and 100
(P P Savani University) Set, Relation & Function July 14, 2022 11 / 103
Set Type of Sets
Type of Sets
Examples:
i Z = The set of integers = {0, ±1, ±2, ±3, · · · }
ii N = The set of natural numbers, = {1, 2, 3, · · · }
iii Q = The set of rational numbers.
(P P Savani University) Set, Relation & Function July 14, 2022 12 / 103
Set Subset of a Set
Subset of a Set
(P P Savani University) Set, Relation & Function July 14, 2022 13 / 103
Set Subset of a Set
Examples:
i The set of all Computer 1st year student of a engineering collage is a subset of
the set of all students of the collage.
ii The set of natural number is a subset of the set of integers.
iii The set of positive integers exactly divisible by 4 is a subset of the set of
integers exactly divisible by 2.
iv Let A = {1, 2, 3}. Then the subset of A will be :
φ,{1},{2},{3},{1, 2},{1, 3},{2, 3},{1, 2, 3}
(P P Savani University) Set, Relation & Function July 14, 2022 14 / 103
Set The Size of a Set
(P P Savani University) Set, Relation & Function July 14, 2022 15 / 103
Set Power Set
Power Set
Given a set S, the power set of S is the set of all subsets of the set S. The
power set of S is denoted by P(S).
(P P Savani University) Set, Relation & Function July 14, 2022 16 / 103
Set Cartesian Products
Cartesian Products
The ordered n-tuple (a1 , a2 , · · · , an ) is the ordered collection that has a1 as its
first element,a2 as its second element,· · · , and an as its nth element.
A × B = {(a, b)|a ∈ A ∧ b ∈ B}
(P P Savani University) Set, Relation & Function July 14, 2022 17 / 103
Set Cartesian Products
Examples:
1 What is the Cartesian product of A = {1, 2} and B = {a, b, c}?
Solution: The Cartesian product A × B is
A × B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}
2 Show that the Cartesian product B × A is not equal to the Cartesian product
A × B, where A and B are as above.
Solution: The Cartesian product B × A is
B × A = {(a, 1), (a, 2), (b, 1), (b, 2), (c, 1), (c, 2)}
This is not equal to A × B, which was found in above example. J
Note: The Cartesian products A × B and B × A are not equal, unless A = φ or B = φ (so that
A × B = φ) or A = B
(P P Savani University) Set, Relation & Function July 14, 2022 18 / 103
Set Cartesian Products
Example: What is the Cartesian product A × B × C, where A = {0, 1}, B = {1, 2},
and C = {0, 1, 2}?
Solution: The Cartesian product A×B×C consists of all ordered triples (a, b, c),where
a ∈ A, b ∈ B, and c ∈ C. Hence,
A × B × C = {(0, 1, 0), (0, 1, 1), (0, 1, 2), (0, 2, 0), (0, 2, 1), (0, 2, 2),
(1, 1, 0), (1, 1, 1), (1, 1, 2), (1, 2, 0), (1, 2, 1), (1, 2, 2)}
Remark: Note that when A, B, and C are sets, (A × B) × C is not the same as A × B × C.
We use the notation A2 to denote A × A, the Cartesian product of the set A with
itself. Similarly, A3 = A × A × A, A4 = A × A × A × A, and so on.
Suppose that A = {1, 2}. It follows that A2 = {(1, 1), (1, 2), (2, 1), (2, 2)} and
A3 = {(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2), (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)}.
(P P Savani University) Set, Relation & Function July 14, 2022 19 / 103
Set Set Operation
A ∩ B = {x | x ∈ A ∧ x ∈ B}.
Union Venn Diagram
Let A and B be sets. The union of the U
A ∪ B = {x|x ∈ A ∨ x ∈ B} A 傼 B is shaded.
(P P Savani University) Set, Relation & Function July 14, 2022 20 / 103
Set Set Operation
An element x belongs to the intersection of the sets A and B if and only if x belongs to A and
Set Operation
x belongs to B. This tells us that
A ∩ B = {x | x ∈ A ∧ x ∈ B}.
Intersection Venn Diagram
Let A and B be sets. The U
intersection U
A ∩ B = {x|x ∈ A ∧ x ∈ B}
A 傼 B is shaded. A 傽 B is shaded.
Example:FIGUREThe1 intersection of of
Venn Diagram thethesets {1, 3, 5}FIGURE
and {1,22, 3}
Vennis Diagram {1,the
the set of 3}; that
Union of A and B.
is,{1, 3, 5} ∩ {1, 2, 3} = {1, 3}. Intersection of A and B.
(P P Savani University) Set, Relation & Function July 14, 2022 21 / 103
Set Set Operation
Disjoint
Two sets are called disjoint if their intersection is the empty set.
(P P Savani University) Set, Relation & Function July 14, 2022 22 / 103
Set Set Operation
Difference
Let A and B be sets. The difference of
A and B, denoted by A − B, is the set Venn Diagram
containing those elements which are in U
A but not in B. The difference of A
and B is also called the complement of A B
B with respect to A.
A − B = {x|x ∈ A ∧ x ∈
/ B}.
A – B is shaded.
– B is shaded.
A Ā A is shaded.
= {x ∈ U |x ∈
/ A}.
FIGURE 3 Venn Diagram for FIGURE 4 Venn Diagram for
the Difference of A and B. the Complement of the Set A.
Once the universal set U has been specified, the complement of a set can be defined.
(P P Savani University) Set, Relation & Function July 14, 2022 24 / 103
Set Set Operation
Set Identities
1 Identity laws
A∩U =A
A∪φ=A
2 Domination laws
A∪U =U
A∩φ=φ
3 Idempotent laws
A∪A=A
A∩A=A
(P P Savani University) Set, Relation & Function July 14, 2022 25 / 103
Set Set Operation
Set Identities
4 Complementation law
A =A
5 Commutative laws
A∪B =B∪A
A∩B =B∩A
6 Associative laws
A ∪ (B ∪ C) = (A ∪ B) ∪ C
A ∩ (B ∩ C) = (A ∩ B) ∩ C
(P P Savani University) Set, Relation & Function July 14, 2022 26 / 103
Set Set Operation
Set Identities
7 Distributive laws
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
8 De Morgan‘s laws
A∩B =A∪B
A∪B =A∩B
9 Absorption laws
A ∪ (A ∩ B) = A
A ∩ (A ∪ B) = A
(P P Savani University) Set, Relation & Function July 14, 2022 27 / 103
Set Set Operation
Set Identities
10 Complement laws
A∪A=U
A∩A=φ
(P P Savani University) Set, Relation & Function July 14, 2022 28 / 103
Relation Definition of Relation
Definition of Relation
(P P Savani University) Set, Relation & Function July 14, 2022 29 / 103
Relation Definition of Relation
Definition of Relation
Let A and B be sets. A binary relation from A to B is a subset of A × B.
In other words, a binary relation from A to B is a set R of ordered pairs where the
first element of each ordered pair comes from A and the second element comes from
B. We use the notation a R b to denote that (a, b) ∈ R and a 6R b to denote that
(a, b) ∈
/ R. Moreover, when (a, b) belongs to R, a is said to be related to b by R.
(P P Savani University) Set, Relation & Function July 14, 2022 30 / 103
Relation Definition of Relation
Example
A × B = {(1, 2), (1, 4), (2, 2), (2, 4), (5, 2), (5, 4)}
If we take the relationship x < y, then some ordered pairs are related and some are
not. The subset of A × B whose elements are related is the relation R and is given
by
R = {(1, 2), (1, 4), (2, 4)}
If R is a relationship from a set A to itself, that is, if R is a subset of A2 = A × A,
then we say R is a relation on A.
(P P Savani University) Set, Relation & Function July 14, 2022 31 / 103
Relation Definition of Relation
Example: Let A be the set {1, 2, 3, 4}. Which ordered pairs are in the relation
R = {(a, b) | a divides b}?
Solution: Because (a, b) is in R if and only if a and b are positive integers not
exceeding 4 such that a divides b, we see that
R = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}.
(P P Savani University) Set, Relation & Function July 14, 2022 32 / 103
Relation Domain and Range
Range
Thus, the domain of a relation R is the set of all the first element of the ordered pairs
which belong to R and the range of R is the set of second elements.
(P P Savani University) Set, Relation & Function July 14, 2022 33 / 103
Relation Domain and Range
Example: Let A = {2, 3, 4} and B = {3, 4, 5}. List all elements of each relation R
defined below and the domain and range.
(a) a ∈ A is related to b ∈ B, that is, a R b if, and only if a < b.
(b) a ∈ A is related to b ∈ B, that is, a R b if a and b are both odd numbers.
Solution: (a) 2 ∈ A is less than 3 ∈ B, then 2 R 3. Similarly, 2 R 4, 2 R 5, 3 R 4,
3 R 5, 4 R 5. Therefore,
R = {(2, 3), (2, 4), (2, 5), (3, 4), (3, 5), (4, 5)}
Dom(R) = {2, 3, 4} and Ran(R) = {3, 4, 5}
(b) Since 3 ∈ A and 3 ∈ B are both odd then 3 R 3. Similarly, 3 R 5. Therefore,
R = {(3, 3), (3, 5)}
Dom(R) = {3} and Ran(R) = {3, 5}
J
(P P Savani University) Set, Relation & Function July 14, 2022 34 / 103
Relation Domain and Range
(P P Savani University) Set, Relation & Function July 14, 2022 35 / 103
Relation Domain and Range
x(R ∪ S)y = x R y ∨ x S y
Inverse Relation
Let R be any relation from a set A to a set B. The inverse of R, denoted by
R−1 is the relation from B to A which consist of those ordered pairs which,
when reversed, belong to R; that is R−1 = {(b, a) : (a, b) ∈ R}. Consequently,
x R y = y R−1 x
For example, Let A be the set of all living people. Define relation B and C on A as
follows: B = {(x, y) : x is a parent of y} C = {(y, x) : y is a child of x}
Then each of B and C is the inverse of other, written as B = C −1 and C = B −1 .
(P P Savani University) Set, Relation & Function July 14, 2022 38 / 103
Relation Types of Relation in a Set
Similarly, on the set of real numbers, the relation < is the inverse of the relation >.
Note the difference between R0 and R−1 . The relation R0 contains all elements not in
R, R−1 contains all elements of R, except that their order is reversed. For instance,
if R is the relation <, then R−1 is the relation >, because a < b if and only if b > a.
On the other hand, R0 is the relation ≥ because if x < y is false then x ≥ y.
(P P Savani University) Set, Relation & Function July 14, 2022 39 / 103
Relation Types of Relation in a Set
Identity Relation
A relation R in a set A is said to be identity relation, generally denoted by IA ,
if
IA = {(x, x) : x ∈ A}
Example Let A = {1, 2, 3} then IA = {(1, 1), (2, 2), (3, 3)} is an identity relation in
A.
(P P Savani University) Set, Relation & Function July 14, 2022 40 / 103
Relation Properties of Relation
Properties of Relation
Reflexive Relation
A relation R on a set A is called reflexive if (a, a) ∈ R for every element a ∈ A.
For Example,
(a) If R1 = {(1, 1), (1, 2), (2, 2), (2, 3), (3, 3)} be a relation on A = {1, 2, 3}, then R1
is reflexive relation since for every a ∈ A, (a, a) ∈ R1 .
(b) If R2 = {(1, 1), (1, 2), (2, 3), (3, 3)} be a relation on A = {1, 2, 3}, then R2 is not
a reflexive relation since for 2 ∈ A, (a, a) ∈ R2 .
(P P Savani University) Set, Relation & Function July 14, 2022 41 / 103
Relation Properties of Relation
Symmetric Relation
Antisymmetric Relation
(P P Savani University) Set, Relation & Function July 14, 2022 42 / 103
Relation Properties of Relation
Example: Symmetric
(a) R1 = {(1, 1), (1, 2), (1, 3), (2, 2), (2, 1), (3, 1)} on A = {1, 2, 3} is a symmetric
relation.
(b) R2 = {(x, y) ∈ R2 : x2 + y 2 = 1} is a symmetric relation on R since if x2 + y 2 = 1
then y 2 + x2 = 1 too, i.e. if (x, y) ∈ R2 then (y, x) ∈ R2 .
Example: Antisymmetric Relation
(a) R1 = {(1, 2), (2, 2), (2, 3)} on A = {1, 2, 3} is an antisymmetric relation.
(b) R2 = {(x, y) ∈ R2 |x ≤ y} is an antisymmetric relation on R since x ≤ y and
y ≤ x implies x = y then (x, y) ∈ R and (y, x) ∈ R implies x = y.
(c) R = {(x, y) ∈ N |x is divisor of y} is an antisymmetric relation since x divides y
and y divides x implies x = y.
(P P Savani University) Set, Relation & Function July 14, 2022 43 / 103
Relation Properties of Relation
Note that antisymmetric is not the same as not symmetric (asymmetric). A relation
may be symmetric as well as antisymmetric at the same time. For example, the
relation R = {(1, 1), (3, 3)} is both symmetric and antisymmetric on A = {1, 2, 3}.
(P P Savani University) Set, Relation & Function July 14, 2022 44 / 103
Relation Properties of Relation
Transitive Relation
A relation R on a set A is called transitive if whenever (a, b) ∈ R and (b, c) ∈ R,
then (a, c) ∈ R, for all a, b, c ∈ A.
(a) The relation ‘is parallel to’ on the set of lines in a plane is transitive, because if
a line x is parallel to the line y and if y is parallel to line z, then x is parallel to z.
(b) The relation ‘is less than’ and ‘is greater than’ are transitive relations on the set
of real numbers. If a < b and b < c implies a < c and if a > b and b > c implies a > c
for all real numbers a, b, c.
(P P Savani University) Set, Relation & Function July 14, 2022 45 / 103
Relation Properties of Relation
Composite of relations
Let R be a relation from a set A to a set B and S a relation from B to a set
C. The composite of R and S is the relation consisting of ordered pairs (a, c),
where a ∈ A, c ∈ C, and for which there exists an element b ∈ B such that
(a, b) ∈ R and (b, c) ∈ S. We denote the composite of R and S by S ◦ R.
(P P Savani University) Set, Relation & Function July 14, 2022 46 / 103
Relation Properties of Relation
Example: What is the composite of the relations R and S,where R is the relation
from {1, 2, 3} to {1, 2, 3, 4} with R = {(1, 1), (1, 4), (2, 3), (3, 1), (3, 4)} and S is the
relation from {1, 2, 3, 4} to {0, 1, 2} with S = {(1, 0), (2, 0), (3, 1), (3, 2), (4, 1)}?
Solution: S ◦ R is constructed using all ordered pairs in R and ordered pairs in S,
where the second element of the ordered pair in R agrees with the first element of the
ordered pair in S. For example, the ordered pairs (2, 3) in R and (3, 1) in S produce
the ordered pair (2, 1) in S ◦ R. Computing all the ordered pairs in the composite,
we find
S ◦ R = {(1, 0), (1, 1), (2, 1), (2, 2), (3, 0), (3, 1)}.
J
(P P Savani University) Set, Relation & Function July 14, 2022 47 / 103
Relation Properties of Relation
Equivalence Relation
A relation on a set A is called an equivalence relation if it is reflexive,
symmetric, and transitive.
(P P Savani University) Set, Relation & Function July 14, 2022 48 / 103
Relation Properties of Relation
Example: Suppose that R is the relation on the set of strings of English letters such
that a R b if and only if l(a) = l(b), where l(x) is the length of the string x. Is R an
equivalence relation?
Solution: Because l(a) = l(a), it follows that a R a whenever a is a string, so that
R is reflexive.
Next, suppose that a R b, so that l(a) = l(b). Then b R a, because l(b) = l(a).
Hence, R is symmetric.
Finally, suppose that a R b and b R c. Then l(a) = l(b) and l(b) = l(c). Hence,
l(a) = l(c), so a R c. Consequently, R is transitive.
Because R is reflexive, symmetric, and transitive, it is an equivalence relation.
(P P Savani University) Set, Relation & Function July 14, 2022 49 / 103
Relation Properties of Relation
(P P Savani University) Set, Relation & Function July 14, 2022 50 / 103
Relation Properties of Relation
For example, the greater or equal (≥) relation is a partial ordering on Z, the set of
integers.
(P P Savani University) Set, Relation & Function July 14, 2022 51 / 103
Relation Properties of Relation
(P P Savani University) Set, Relation & Function July 14, 2022 52 / 103
Relation Representing Relations
Representing Relations
The Matrix of Relation
Let A = {a1 , a2 , a3 , · · · , am } and B = {b1 , b2 , b3 , · · · , bn } are finite sets
containing m and n elements respectively and let R be a relation from A to B.
Then R can be represented by the mn matrix
MR = [mij ] where
1 if (a , b ) ∈ R
i j
mij =
0 if (ai , bj ) ∈
/R
(P P Savani University) Set, Relation & Function July 14, 2022 53 / 103
Relation Representing Relations
Example: Suppose that A = {1, 2, 3} and B = {1, 2}. Let R be the relation from
A to B containing (a, b) if a ∈ A, b ∈ B, and a > b. What is the matrix representing
R?
Solution: Because R = {(2, 1), (3, 1), (3, 2)}, the matrix for R is
0 0
MR = 1 0
1 1
The 1s in MR show that the pairs (2, 1), (3, 1), and (3, 2) belong to R. The 0s show
that no other pairs belong to R. J
(P P Savani University) Set, Relation & Function July 14, 2022 54 / 103
Relation Representing Relations
1 0 1 0 1
Solution: Because R consists of those ordered pairs (ai , bj ) with mij = 1, it follows
that R = {(a1 , b2 ), (a2 , b1 ), (a2 , b3 ), (a2 , b4 ), (a3 , b1 ), (a3 , b3 ), (a3 , b5 )}. J
(P P Savani University) Set, Relation & Function July 14, 2022 55 / 103
ji ij
i,for all pairs of integers the i and relation
j with hasi certain 2,properties.
= 1, Relation andRecall
. . . , n Representing that . , n. R on A is reflexive if (a, a) ∈
2, .a.relation
j = 1,Relations
thatofis,
nition theif transpose
MR is a symmetric a ∈ A. Thus,
of a matrixmatrix. R is
The form
from Section reflexive
ofwe
2.6, if
thesee and
matrix only
that for if (a i i ) ∈ relation
R isa symmetric, a
symmetric R for i = 1, 2, . . . , n. Hence, R
is illustrated
in1 Figure 2(a). if and only if m ii = 1, for i = 1, 2, . . . , n. In other words, R is reflexive if all the
1 The relation R is antisymmetric if and onlyRif (a, b) ∈ R and (b, a) ∈ R imply that
the main diagonal of M are equal to 1, as shown in Figure a = b.
1. Note that the elem
t 1
, Consequently, the matrix of an antisymmetric relation has the property that if mij = 1 with
main diagonal can be either 0 or 1.
i = j , then mj i = 0. Or, inThe words, Reither
otherrelation mij = 0 orifm(a,
is symmetric b) ∈ R implies that (b, a) ∈ R. Conse
j i = 0 when i = j . The form of
the matrix
symmetric for
matrix. 1 an relation
antisymmetric R on
relationthe set A =
for aissymmetric {a , a
illustrated1 relation , .
in 2Figure. . , a n } is symmetric if and only if (aj , ai ) ∈ R
is 2(b).
1The form(a of the matrix
, a ) ∈ R.
illustrated
i j
The Zero–One In terms of the entries
Matrix for a Reflexive Relation. of M R , R is symmetric if and only if mj i =
R isFIGURE m = 1.
ij if (a, This ∈ R and (b, a) ∈j iR imply that a =mb.
also means m = 0 whenever ij = 0. Consequently, R is symm
0b)=
1
antisymmetric
1 if and only
e matrix
1 The
of an Matrix
antisymmetric only if m
relation m j i property that if m = 1 withj with i = 1, 2, . . . , n and j =
ij 0 has the , for all pairs of integers i and
0 ij
of from Section 2.6, we see that R i
Zero–One
= 0. for other words, either mij = 0 or mj i = 0ofwhen
Or,ainReflexive Recalling the definition the transpose
i = j . The of aform
matrix
1 0if and only if
antisymmetric
Relation. relation is illustrated
(Off 0 in Figure 2(b).
0 The Zero–One 1 Matrix for a Symmetric Relation.
Diagonal Ele-
1 MR = (MR )t ,
ments Can0
(a) Symmetric (b) Antisymmetric
Be 0 or 1.) 0 that is, if MR is a symmetric matrix. The form of the matrix for a symmetric relation
FIGURE 2 The Zero–One Matrices for
0 in Figure 2(a).
Symmetric and Antisymmetric Relations.
0 The relation R is antisymmetric if and only if (a, b) ∈ R and (b, a) ∈ R imply
1 The Zero–One Matrix for a Antisymmetric Relation.
Consequently, the matrix of an antisymmetric relation has the property that if m
(b) Antisymmetric
3 Suppose that the relation i =R jon, then = 0. Or, inby
a setmisj irepresented other matrix either mij = 0 or mj i = 0 when i = j . T
the words,
(P P Savani University)
the matrix for an antisymmetric relation
Set, Relation & Function
is illustrated in Figure 2(b).
July 14, 2022 56 / 103
Relation Representing Relations
0 1 1
(P P Savani University) Set, Relation & Function July 14, 2022 57 / 103
Relation Representing Relations
Representing Relations
An edge of the form (a, a) is represented using an arc from the vertex a back to itself.
Such an edge is called a loop.
(P P Savani University) Set, Relation & Function July 14, 2022 58 / 103
Relation Representing Relations
An edge of the form (a, a
an edge is called a loop.
4 3 4 3
J
(P P Savani University)
FIGURE 4 The
Set, Relation & Function
FIGURE
July 14, 2022
5 60 /The
103
Relation Representing Relations
Example: What are the ordered pairs in the relation R represented by the directed
graph shown in Figure a
1 2
1 2
b
4 3 4 3 (a) Directed graph o
The directed graph representing a relation can be used to determine whether the
relation has various properties.
1 A relation is reflexive if and only if there is a loop at every vertex of the
digraph.
2 A relation is symmetric if and only if for every edge between distinct vertices
in its digraph there is an edge in the opposite direction.
3 A relation is antisymmetric if no two distinct points in the digraph have an
edge going between them in both directions.
4 A relation is transitive if and only if whenever there is a directed edge from a
vertex a to a vertex b and from a vertex b to vertex c, then there is also a
directed edge from a to c.
(P P Savani University) Set, Relation & Function July 14, 2022 62 / 103
b and c.
are edges in both directions connectingRelation Finally,
Representing R is not transitive because
Relations
dge from a to b and an edge from b to c, but no edge from a to c.
Example: Determine whether the relation R for the directed graphs shown in Figure are
reflexive, symmetric, antisymmetric, and/or transitive.
a b
a
1 2
b c c d
4 Solution: 3 Because there are loops
(a) Directed
at every graph of R of the directed
vertex (b) Directed graphofof R,
graph S it is
reflexive. R is neither symmetric nor antisymmetric because there is an edge from a to
FIGURE 5 The FIGURE 6 The Directed Graphs of the
b but not one from b to a, but there are edges in both directions connecting b and c.
Directed Graph Relations R and S.
Finally,
f the R is not
Relation R. transitive because there is an edge from a to b and an edge from b to c,
but no edge from a to c. J
(P P Savani University) Set, Relation & Function July 14, 2022 63 / 103
e from b to c, but no edge from a to c. Relation Representing Relations
Example: Determine whether the relation S for the directed graphs shown in Figure are
reflexive, symmetric, antisymmetric, and/or transitive.
a b
a
b c c d
(a) Directed
Solution: graph of
Because R are not
loops (b)present
Directed at allofthe
graph S vertices of the directed graph of
S,this relation is not reflexive. It is symmetric and not antisymmetric, because every
FIGURE 6 The Directed Graphs of the
edge between distinct vertices is accompanied by an edge in the opposite direction. It is
Relations R and S.
also not hard to see from the directed graph that S is not transitive, because (c, a) and
(a, b) belong to S, but (c, b) does not belong to S. J
(P P Savani University) Set, Relation & Function July 14, 2022 64 / 103
Relation Hasse Diagram
Hasse Diagram
We can represent a finite poset (S, ) using this procedure: Start with the directed
graph for this relation. Because a partial ordering is reflexive, a loop (a, a) is present
at every vertex a. Remove these loops.
Next, remove all edges that must be in the partial ordering because of the presence
of other edges and transitivity. That is, remove all edges (x, y) for which there is an
element z ∈ S such that x ≺ z and z ≺ x.
Finally, arrange each edge so that its initial vertex is below its terminal vertex.
Remove all the arrows on the directed edges, because all edges point “upward” toward
their terminal vertex.
The resulting diagram is called the Hasse diagram of (S, )
(P P Savani University) Set, Relation & Function July 14, 2022 65 / 103
Relation Hasse Diagram
9.6 Pa
For instance, consider the directed graph for the partial ordering {(a, b)|a ≤ b} on
the set {1, 2, 3, 4}, shown in Figure(a).
4 4 4
3 3 3
2 2 2
1 1 1
(a) (b) (c)
(P P Savani University) Set, Relation & Function July 14, 2022 66 / 103
Relation Hasse Diagram
must be present; in Figure (b) loops are not shown. Because a partial ordering
is transitive, we do not have to show those edges that must be present because of
transitivity. For example, in Figure (c) the edges (1, 3), (1, 4), and (2, 4) are not shown
because they must be present. If we assume that all edges are pointed “upward” (as
they are drawn in the figure), we do not have to show the directions of the edges;
Figure (c) does not show directions.
(P P Savani University) Set, Relation & Function July 14, 2022 67 / 103
Relation Hasse Diagram
Example: Draw the Hasse diagram representing the partial ordering {(a, b)|a divides b}
on {1, 2, 3, 4, 6, 8, 12}.
Relations
Solution: Begin with the digraph for this partial order, as shown in Figure (a).
8 12 8 12 8 12
4 6 4 6
4 6
2 3
2 3
2 3
1 1 1
(P P Savani University) Set, Relation & Function July 14, 2022 68 / 103
Relation Hasse Diagram
Remove all loops, as shown in Figure (b). Then delete all the edges implied by the
transitive property. These are (1, 4), (1, 6), (1, 8), (1, 12), (2, 8), (2, 12), and (3, 12).
Arrange all edges to point upward, and delete all arrows to obtain the Hasse diagram.
The resulting Hasse diagram is shown in Figure (c). J
(P P Savani University) Set, Relation & Function July 14, 2022 69 / 103
Relation Hasse Diagram
{a, c} {b, c}
{a, b}
{a} {b}
{c}
Maximal Elements
An element of a poset is called maximal if it is not less than any element of
the poset. That is, a is maximal in the poset (S, ) if there is no b ∈ S such
that a b.
Minimal Elements
An element of a poset is called minimal if it is not greater than any element
of the poset. That is, a is minimal if there is no element b ∈ S such that b a.
Maximal and minimal elements are easy to spot using a Hasse diagram. They are
the “top” and “bottom” elements in the diagram.
(P P Savani University) Set, Relation & Function July 14, 2022 71 / 103
in a poset that is greater than every other
Relation
element. Such an
Maximal and Minimal Elements
4 10 25
2
5
The Hasse diagram in Figure for this poset shows that the maximal elements are
FIGURE 5 The Hasse
12, 20, and 25, and the minimal elements are 2 and 5. J
(P P Savani University) DiagramSet,ofRelation
a Poset.
& Function July 14, 2022 72 / 103
Relation Maximal and Minimal Elements
As this example shows, a poset can have more than one maximal
element and more than one minimal element.
(P P Savani University) Set, Relation & Function July 14, 2022 73 / 103
Relation Maximal and Minimal Elements
(P P Savani University) Set, Relation & Function July 14, 2022 74 / 103
Relation Maximal and Minimal Elements
c c b c
a a b a b a
Solution:FIGURE
The least6 element of the poset
Hasse Diagrams withPosets.
of Four Hasse diagram (a) is a. This poset
has no greatest element. The poset with Hasse diagram (b) has neither a least nor
if b a for all b ∈ S. The greatest element is unique when it exists [see Exercis
a greatest Likewise,
element. anThe poset
element with Hasse
is called diagram
the least element(c)if ithas no than
is less leastallelement. Its
the other eleme
greatest element
poset. That is, aThe
is d. is theposet with Hasse
least element ) if a
of (S,diagram (d)b for b ∈ S.element
hasallleast The leasta element
and
when it d.
greatest element exists [see Exercise 40(b)]. J
(P P Savani University) Set, Relation & Function July 14, 2022 75 / 103
Relation Maximal and Minimal Elements
(P P Savani University) Set, Relation & Function July 14, 2022 76 / 103
Relation
all the elements in A. If l is an eleme
Maximal and Minimal Elements
Example: Find the lower and upper bounds of the called a lower
subsets {a,bound of A.
b, c}, {j, h}, and
EXAMPLE
{a, c, d, f } in the poset with the Hasse diagram 18 Find
shown the lower and upper bounds of
in Figure
h with the Hasse diagram shown in Fig
j
(P P Savani University) Set, Relation & Function July 14, 2022 78 / 103
Relation
all the elements in A. If l is an eleme
Maximal and Minimal Elements
called
Example: Find the greatest lower bound and the least a lower
upper bound
bound {b,A.d, g}, if
of of
EXAMPLE 18 Find the lower and upper bounds of
they exist, in the poset shown in Figure
h with the Hasse diagram shown in Fig
j
Example: Find the greatest lower bound and the least upper bound of the sets
{3, 9, 12} and {1, 2, 4, 5, 10},if they exist, in the poset (Z + , |).
Solution: An integer is a lower bound of {3, 9, 12} if 3, 9, and 12 are divisible by
this integer. The only such integers are 1 and 3. Because 1|3, 3 is the greatest lower
bound of {3, 9, 12}.The only lower bound for the set {1, 2, 4, 5, 10} with respect to |
is the element 1. Hence, 1 is the greatest lower bound for {1, 2, 4, 5, 10}.
An integer is an upper bound for {3, 9, 12} if and only if it is divisible by 3, 9, and 12.
The integers with this property are those divisible by the least common multiple of
3, 9, and 12, which is 36. Hence, 36 is the least upper bound of {3, 9, 12}. A positive
integer is an upper bound for the set {1, 2, 4, 5, 10} if and only if it is divisible by 1,
2, 4, 5, and 10. The integers with this property are those integers divisible by the
least common multiple of these integers, which is 20. Hence, 20 is the least upper
bound of {1, 2, 4, 5, 10}.
(P P Savani University) Set, Relation & Function July 14, 2022 80 / 103
Function
Definition of Function
(P P Savani University) Set, Relation & Function July 14, 2022 81 / 103
Function Definition of Function
Function
Let A and B be nonempty sets. A function f from A to B is an assignment of
exactly one element of B to each element of A. We write f (a) = b if b is the
unique element of B assigned by the function f to the element a of A. If f is
a function from A to B, we write f : A → B.
(P P Savani University) Set, Relation & Function July 14, 2022 82 / 103
of f is the set ofFunction
all images of elements
Domain, A. Also, if f is a function fro
ofRange
Codomain and
that f maps A to B.
Domain, Codomain and Range
Figure 2 represents a function f from A to B.
If f is a function from A to
When we B, we asay
define that we
function A is the domain
specify of fitsand
its domain, B is the
codomain, and the m
codomain of f . Ifof fthe
(a)domain
= b, weto say that binisthe
elements the image ofTwo
codomain. a and a is a preimage
functions are equal when
of b. The range,domain,
or image,have
ofthe same
f is thecodomain,
set of all and map of
images each elementofofA.
elements their common
Also,
element in their common codomain. Note that if we change either the doma
if f is a function from A to B, we say that f maps A to B.
a b = f(a)
A B
f
The2 Function
FIGURE f Maps
The Function AA
f Maps totoB.
B.
(P P Savani University) Set, Relation & Function July 14, 2022 83 / 103
Function Domain, Codomain and Range
Example: What are the domain, codomain, and range of the function that assigns
grades to students in below data?
Adams A
Chou B
Goodfriend C
Rodriguez D
Stevens F
Example: Let R be the relation with ordered pairs (Abdul, 22), (Brenda, 24),
(Carla, 21), (Desire, 22), (Eddie, 24), and (F elicia, 22). Here each pair consists
of a graduate student and this student’s age. Specify a function determined by this
relation.
Solution: If f is a function specified by R, then f (Abdul) = 22, f (Brenda) = 24,
f (Carla) = 21, f (Desire) = 22, f (Eddie) = 24, and f (F elicia) = 22. (Here, f (x)
is the age of x, where x is a student.)
For domain take the set {Abdul, Brenda, Carla, Desire, Eddie, F elicia}.
For codomain contain all possible ages of students. we take it as all positive integers.
And the range of the function we have specified is the set of different ages of these
students, which is the set {21, 22, 24}. J
(P P Savani University) Set, Relation & Function July 14, 2022 85 / 103
Function Domain, Codomain and Range
Remark: The notation f (S) for the image of the set S under the function f is
potentially ambiguous. Here, f (S) denotes a set, and not the value of the function
f for the set S.
Example: Let A = {a, b, c, d, e} and B = {1, 2, 3, 4} with f (a) = 2,f (b) = 1,f (c) =
4, f (d) = 1, and f (e) = 1. The image of the subset S = {b, c, d} is the set f (S) =
{1, 4}. J
(P P Savani University) Set, Relation & Function July 14, 2022 86 / 103
Function Type of Function
Type of Function
One-to-One Function
A function f is said to be one-to-one, or an injunction, if and only if f (a) = f (b)
implies that a = b for all a and b in the domain of f . A function is said to be
injective if it is one-to-one.
(P P Savani University) Set, Relation & Function July 14, 2022 87 / 103
Function Type of Function
b 2
c 3
d 4
Example: Determine whether the function f (x) = x2 from the set of integers to the
set of integers is one-to-one.
Solution: The function f (x) = x2 is not one-to-one because, for instance,
f (1) = f (−1) = 1, but 1 6= −1. J
(P P Savani University) Set, Relation & Function July 14, 2022 89 / 103
Function Type of Function
Onto Function
A function f from A to B is called onto, or a surjection, if and only if for every
element b ∈ B there is an element a ∈ A with f (a) = b. A function f is called
surjective if it is onto.
(P P Savani University) Set, Relation & Function July 14, 2022 90 / 103
Function Type of Function
b 1
c 2
d 3
(P P Savani University) Set, Relation & Function July 14, 2022 91 / 103
Function Type of Function
Example: Is the function f (x) = x2 from the set of integers to the set of integers
onto?
Solution: The function f is not onto because there is no integer x with x2 = −1,for
instance. J
(P P Savani University) Set, Relation & Function July 14, 2022 92 / 103
Function Type of Function
Bijective
The function f is a one-to-one correspondence, or a bijection, if it is both
one-to-one and onto. We also say that such a function is bijective.
Example: Let f be the function from {a, b, c, d} to {1, 2, 3, 4} with f (a) = 4, f (b) =
2, f (c) = 1, and f (d) = 3. Is f a bijection?
Solution: The function f is one-to-one and onto. It is one-to-one because no two
values in the domain are assigned the same function value. It is onto because all
four elements of the codomain are images of elements in the domain. Hence, f is a
bijection. J
(P P Savani University) Set, Relation & Function July 14, 2022 93 / 103
Function Type of Function
(a) One-to-one, (b) Onto, (c) One-to-one, (d) Neither one-to-one (e) N
not onto not one-to-one and onto nor onto
1 a a 1 a 1
a 1 a
2 b b 2 b 2
b 2 b
es, Sums, and Matrices 3 c c 3 c 3
c 3 c
4 d d 4 d 4
One-to-one, (d) Neither one-to-one (e) Not a function
and onto nor onto
FIGURE
1 a 5 Examples of1 Different Types of Correspondences.
1
a
2 b 2 2
Solution:b This function is onto, because for every integer y there
3 c f (x)3 = y. To see this, note
3 that f (x) = y if and only if x + 1 = y,
x = y −c 1.
4 d 4 4
EXAMPLE 15
(P P Savani University) ConsiderSet,
theRelation
function f in Example 11 that assigns
& Function jobs
July 14, 2022 to workers
94 / 103
Function Type of Function
A function f whose domain and codomain are subsets of the set of real numbers
is called increasing if f (x) ≤ f (y), and strictly increasing if f (x) < f (y),
whenever x < y and x and y are in the domain of f . Similarly, f is called
decreasing if f (x) ≥ f (y), and strictly decreasing if f (x) > f (y), whenever
x < y and x and y are in the domain of f . (The word strictly in this definition
indicates a strict inequality.)
(P P Savani University) Set, Relation & Function July 14, 2022 95 / 103
Function Type of Function
Note
Suppose that f : A → B.
To show that f is injective Show that if f (x) = f (y) for arbitrary x, y ∈ A
with x 6= y,then x = y.
To show that f is not injective Find particular elements x, y ∈ A such that
x 6= y and f (x) = f (y).
To show that f is surjective Consider an arbitrary element y ∈ B and find
an element x ∈ A such that f (x) = y.
To show that f is not surjective Find a particular y ∈ B such that f (x) 6= y
for all x ∈ A.
(P P Savani University) Set, Relation & Function July 14, 2022 96 / 103
f is not one-to-one,Function
some element b in the codomain is the image of more th
Inverse Function
the domain. If f is not onto, for some element b in the codomain, no elemen
exists for which f (a) = b. Consequently, if f is not a one-to-one correspon
Inverse Functions
assign to each element b in the codomain a unique element a in the domain su
Let f be a one-to-one
(becausecorrespondence
for some b therefrom themore
is either set Athanto the
one set
suchB. The
a or no inverse
such a).
function of f is theA function that assigns to an element b belonging
one-to-one correspondence is called invertible because we to B can
the define
unique elementfunction. A function
a in A such is not
that f (a) = b.invertible
The inverse if it function
is not a one-to-one correspond
of f is denoted
inverse of such a function does not exist.
by f −1 . Hence, f −1 (b) = a when f (a) = b.
f –1(b)
f –1
A B
(P P Savani University) Set, Relation & Function July 14, 2022 97 / 103
Function Inverse Function
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 it is, what is its inverse?
Solution: The function f is invertible because it is a one-to-one correspondence.
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. J
g(a) f( g(a))
a g(a) f (g(a))
g f
A B C
f g
(P P Savani University) Set, Relation & Function July 14, 2022 99 / 103
Function Composite Function
Example: Let g be the function from the set {a, b, c} to itself such that g(a) = b,
g(b) = c, and g(c) = a. Let f be the function from the set {a, b, c} to the set {1, 2, 3}
such that f (a) = 3, f (b) = 2, and f (c) = 1. What is the composition of f and g, and
what is the composition of g and f ?
Solution: The composition f ◦ g is defined by
Note that g ◦ f is not defined, because the range of f is not a subset of the domain
of g.
(P P Savani University) Set, Relation & Function July 14, 2022 100 / 103
Function Composite Function
Remark: The floor function is often also called the greatest integer function. It is
often denoted by [x].
b 12 c = 0, d 12 e = 1, b− 21 c = −1, d− 12 e = 0, b3.1c = 3, d3.1e = 4, b7c = 7, d7e = 7
(P P Savani University) Set, Relation & Function July 14, 2022 101 / 103
Function Composite Function
Recursive Function
A function is said to be recursive if and only if it can be obtained from the
initial functions and by it self.
(P P Savani University) Set, Relation & Function July 14, 2022 102 / 103
Function Composite Function
τ ~αnk Ψφu !!
(P P Savani University) Set, Relation & Function July 14, 2022 103 / 103