Relation Unit 1 DSTL
Relation Unit 1 DSTL
Relation
Unit: 1
Prof. Shraddha
Mishra
9/19/2024 2
Cartesian product of two sets (CO1)
The Cartesian Product of two sets P and Q in that order is the set of all
ordered pairs whose first member belongs to the set P and second
member belong to set Q and is denoted by P x Q, i.e.,
P x Q = {(x, y): x P, y Q}
3
Ordered Set & Ordered Pairs (CO1)
Ordered Set:
It is defined as the ordered collection of distinct objects.
Example:
Roll no {3, 6, 7, 8, 9}
Week Days {S, M, T, W, TH, F, S}
Ordered Pairs
An Ordered Pair consists of two elements such that one of them is designated
as the first member and other as the second member.
4
Binary Relation (CO1)
6
Domain and Range of Relation (CO1)
Domain of Relation: The Domain of relation R is the set of elements in
P which are related to some elements in Q, or it is the set of all first
entries of the ordered pairs in R. It is denoted by DOM (R).
9
Representation of Relations (CO1)
Mij = 0 if ( ai,bj ) ∉ R
1 if ( ai,bj ) ∈ R
Example
Let P = {1, 2, 3, 4}, Q = {a, b, c, d} and R = {(1, a),
(1, b), (1, c), (2, b), (2, c), (2, d)}.
The matrix of relation R is shown as fig:
10
Representation of Relations (CO1)
11
Representation of Relations (CO1)
12
Representation of Relations (CO1)
13
Composition of Relations (CO1)
Solution:
(i) The composition relation R1 o R2 as shown in fig:
R1 o R2 ={(4, l), (4, n), (4, m), (5, l), (5, m), (5, n), (6, l), (6, m), (6, n)}
16
Composition of Relations and Matrices (CO1)
Example:
Let P = {2, 3, 4, 5}. Consider the relation R and S on P defined by
R = {(2, 2), (2, 3), (2, 4), (2, 5), (3, 4), (3, 5), (4, 5), (5, 3)}
S = {(2, 3), (2, 5), (3, 4), (3, 5), (4, 2), (4, 3), (4, 5), (5, 2), (5, 5)}.
Find the matrices of the above relations. Use matrices to find the follow
ing composition of the relation R and S.
17
Composition of Relations and Matrices (CO1)
(i)RoS (ii)RoR (iii)SoR
(i) To obtain the composition of relation R and S. First multiply MR with
MS to obtain the matrix MR x MS as shown in fig:
The non zero entries in the matrix MR x MS tells the elements related in
RoS. So,
Hence the composition R o S of the relation R and S is
18
Composition of Relations and Matrices (CO1)
R o S = {(2, 2), (2, 3), (2, 4), (2,5),(3, 2), (3, 3), (3,5), (4, 2), (4, 5),
(5, 4), (5, 5)}.
R o R = {(2, 2), (2, 3), (2, 4), (2, 5), (3, 3), (3, 5), (4, 3), (5, 4), (5, 5)}
shown in fig:
20
Composition of Relations and Matrices (CO1)
21
(Types of Relations)
1. Reflexive Relation
A relation R on set A is said to be a reflexive if (a, a) ∈ R for every a∈
A. Example: If A = {1, 2, 3, 4} then R = {(1, 1), (2, 2), (1, 3), (2, 4), (3, 3),
(3, 4), (4, 4)}. Is a relation reflexive?
Solution: The relation is reflexive as for every a A. (a, a) R, i.e. (1, 1),
(2, 2), (3, 3), (4, 4) R.
Ex. The total number of reflexive relations on a finite set having n
elements is __________.
Consider a set A with n elements Say A ={1, 2, ....... n } out of n2
elements n elements are compulsory for relation to be reflexive.
i.e (1, 1) (2, 2) (3, 3) .... (n, n) and for remaining n2-n
22
elements, we have choice of filling i.e either they are present or
absent. Hence, Total number of reflexive relation are 2(n2 – n)
2. Irreflexive Relation
A relation R on set A is said to be irreflexive if (a, a) ∉ R for every a ∈ A.
Example: Let A = {1, 2, 3} and R = {(1, 2), (2, 2), (3, 1), (1, 3)}. Is the
relation R reflexive or irreflexive?
Solution: The relation R is not reflexive as for every a ∈ A, (a, a) ∉ R, i.e.,
(1, 1), (2, 2) and (3, 3) ∉ R.
Note: There are total n pairs of (x, x) are present in the Cartesian
product which should not be included in an irreflexive relation.
Therefore, for the remaining (n2–n) elements, each element has
23
two choices i.e., either to include or exclude it in the subset. Hence,
the total number of possible irreflexive relations is given by 2(n2 –
n)
Ex. Consider the relation R on the set A={1,2,3,4} defined by
R={(1,1),(2,3),(2,4),(3,3),(3,4)}. Since(2, 2) ∉R, and (1, 1)∈R,
the relation is neither reflexive nor irreflexive.
24
there (All Main Diagonal Elements "0" or All Main Diagonal Elements "1"),
That's why (2n−1−1) ... And We are free to assign any one of
0 or 1 to the remaining "n2 - n" positions, that's why 2(n2– n)
25
3. Symmetric Relation:
26
Total numbers Symmetric Relation?
4. Antisymmetric Relation:
A relation R on a set A is antisymmetric iff (a, b) ∈ R and (b, a) ∈ R then
a = b.
∀a, b∈A, if (a, b) ∈R then (b, a) ∉R or a = b,
This means if an ordered pair of elements “a” to “b” (aRb) is present in
relation R then an ordered pair of elements “b” to “a” (bRa) should not
be present in relation R unless a = b.
Ex. Consider set A = {a, b}
• R = {(a, b), (b, a)} is not anti-symmetric relation as for (a, b) tuple
(b, a) tuple is present but
28
R = {(a, a), (a, b)} is an anti-symmetric relation.
Example: Let A = {1, 2, 3} and R = {(1, 1), (2, 2)}. Is the relation R
antisymmetric?
Solution: The relation R is antisymmetric as a = b when (a, b) and (b, a)
both belong to R.
29
Total number of Anti-Symmetric Relation?
30
30
Asymmetric Relation
31
R = {(a, b), (b, a)} is not asymmetric relation but
R = {(a, b)} is asymmetric relation.
Total no of Asymmetric Relation:
34
• There is No general formula to counts the number of transitive relations on a
finite set.
Types of Relations (CO1)
35
Types of Relations (CO1)
36
Closure Properties of Relations (CO1)
(1) Reflexive and Symmetric Closures: The next theorem tells us how
to obtain the reflexive and symmetric closures of a relation easily.
37
Closure Properties of Relations (CO1)
39
Closure Properties of Relations (CO1)
40
Closure Properties of Relations (CO1)
Example1: Consider the relation R = {(1, 2), (2, 3), (3, 3)} on A = {1,
2, 3}.
Then
R2 = R◦ R = {(1, 3), (2, 3), (3, 3)} and
R3 = R2 ◦ R = {(1, 3), (2, 3), (3, 3)}
Accordingly,
Transitive (R) = {(1, 2), (2, 3), (3, 3), (1, 3)}
41
Closure Properties of Relations (CO1)
Example2: Let A = {4, 6, 8, 10} and R = {(4, 4), (4, 10), (6, 6), (6, 8),
(8, 10)} is a relation on set A. Determine transitive closure of R.
Solution: The matrix of relation R is shown in fig:
42
Closure Properties of Relations (CO1)
Now, find the powers of MR as in fig:
43
44
Equivalence Relation(CO1)
Consider the set of every person in the world
Now consider a R relation such that (a,b) R if a and b are siblings.
Clearly this relation is
➢ Reflexive
➢ Symmetric, and
➢ Transitive
Such as relation is called an equivalence relation.
Definition: A relation on a set A is an equivalence relation if it is
reflexive, symmetric, and transitive
Example: Let R={ (a,b) | a, b R and a b}
➢ Is R
reflexive?
45
➢ Is it
transitive?
➢ Is it
symmetric?
No, it is not. 4 is related to 5
(4 5) but 5 is not related to 4
Thus R is not an equivalence relation
46
Equality of a relation(CO1)
•For example, let R1 = {(1, 2) , (1, 2)} {1, 2} x {1, 2} and R2 = {(a, b) ,
(a, b)} {a, b} x {a, b} . Then R1 = R2 if and only if a = 1 and b = 2.
47
Recursive definition of Relation
48
Recursive Step: Rules for generating new elements from existing
elements
Terminal Step: Guarantees that the first two basis and recursive clauses,
are the only way the elements can be obtained.
49
How to solve linear recurrence relation
Suppose, a two ordered linear recurrence relation is Fn=A Fn-1+B Fn-2 where A and
B are real numbers.
The characteristic equation for the above recurrence relation is x2−Ax−B=0
Case 1: If this equation factors as (x−x1)(x−x2)=0 and it produces two distinct real
roots x1 and x2, then Fn =a x1n + b x2n is the solution. [Here, a and b are constants]
Case 2: If this equation factors as (x−x1)2=0 and it produces single real root x1 then
Fn= a x1n + b n x1n is the solution.
Prob1: Solve the recurrence relation Fn =5 Fn−1−6 Fn−2 where F0=1 and F1=4
Solution is Fn=2.3n+(−1).2n
Prob2: Solve the recurrence relation Fn =10 Fn−1−25 Fn−2where F0 =3 and F1=17
50
Imp questions on Relation (CO1)
51
52
Imp questions on Relation (CO1)
53
Imp questions on Relation (CO1)
54
Imp questions on Relation (CO1)
55
Imp questions on Relation (CO1)
56
Imp questions on Relation (CO1)
57
Imp questions on Relation (CO1)
THANKS
58