SlideShare una empresa de Scribd logo
1 de 77
RELATIONS
TAHSIN AZIZ
COMPUTER SCIENCE AND ENGINEERING
AHSANULLAH UNIVERSITY OF SCIENCE AND TECHNOLOGY
REFERENCE BOOK
DISCRETE MATHEMATICS AND ITS APPLICATIONS
BY KENNETH H. ROSEN
Tahsin Aziz 2
RELATIONS
• Relationships between elements of sets are represented using the structure called a
relation, which is just a subset of the Cartesian product of the sets.
• 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.
• Two types
• Binary Relation
• N-ary Relation
Tahsin Aziz 3
BINARY RELATION
• Let A and B be two sets. A binary relation from A to B is a subset of A × B
• 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 aRb to denote that (a, b) ∈ R and aRb to denote that (a, b) ∉ R.
• Moreover, when (a, b) belongs to R, a is said to be related to b by R.
Tahsin Aziz 4
BINARY RELATION
• Example
• 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.
Tahsin Aziz 5
RELATIONS
• Two types
• Binary Relation √
• N-ary Relation
Tahsin Aziz 6
N-ARY RELATION
• Let there are n number of sets such that A1, A2,…….,An.
• An N-ary relation on these sets is a subset of A1 × A2 ×…… × An.
• The sets A1, A2,……,An are called the domains of the relation and n is called its degree.
• It is used in database applications.
Tahsin Aziz 7
RELATIONS
• Two types
• Binary Relation √
• N-ary Relation √
Tahsin Aziz 8
RELATIONS
• If R = ∅ , it is called an empty relation.
• If R = A × B, it is called an universal relation.
Tahsin Aziz 9
REPRESENTATIONS OF BINARY RELATIONS
• Relation can be represented in four ways.
1. Set Representation
2. Arrow Diagram
3. Tabular Matrix
4. Co-ordinate/Graph
Tahsin Aziz 10
SET REPRESENTATION
• Let there are two sets A and B. Set A = {1, 2, 3, 4} and B = {x, y, z}. R is the relation from
set A to B.
• The set representation of R is:
R = { (1, y), (1, z), (3, y), (3, z), (4, x), (4, z) }
Tahsin Aziz 11
REPRESENTATIONS OF BINARY RELATIONS
• Relation can be represented in four ways.
1. Set Representation √
2. Arrow Diagram
3. Tabular Matrix
4. Co-ordinate/Graph
Tahsin Aziz 12
ARROW DIAGRAM
• Let there are two sets A and B. A = {1, 2, 3, 4} and B = {x, y, z}. R is the relation from set A to B.
• R = { (1, y), (1, z), (3, y), (3, z), (4, x), (4, z) }.
• The arrow diagram of R is:
Tahsin Aziz 13
1
2
3
4
z
y
x
REPRESENTATIONS OF BINARY RELATIONS
• Relation can be represented in four ways.
1. Set Representation √
2. Arrow Diagram √
3. Tabular Matrix
4. Co-ordinate/Graph
Tahsin Aziz 14
TABULAR MATRIX
• Let there are two sets A and B. A = {1, 2, 3, 4} and B = {x, y, z}. R is the relation from set A to B.
• R = { (1, y), (1, z), (3, y), (3, z), (4, x), (4, z) }.
• The tabular matrix form of R is:
Tahsin Aziz 15
x y z
1 0 1 1
2 0 0 0
3 0 1 1
4 1 0 1
REPRESENTATIONS OF BINARY RELATIONS
• Relation can be represented in four ways.
1. Set Representation √
2. Arrow Diagram √
3. Tabular Matrix √
4. Co-ordinate/Graph
Tahsin Aziz 16
CO-ORDINATE/GRAPH
• Let there are two sets A and B. A = {1, 2, 3, 4} and B = {x, y, z}. R is the relation from set A to B.
• R = { (1, y), (1, z), (3, y), (3, z), (4, x), (4, z) }.
• The co - ordinate or graph form of R is:
Tahsin Aziz 17
z x x x
y x x
x x
1 2 3 4
REPRESENTATIONS OF BINARY RELATIONS
• Relation can be represented in four ways.
1. Set Representation √
2. Arrow Diagram √
3. Tabular Matrix √
4. Co-ordinate/Graph √
Tahsin Aziz 18
RELATIONS AND FUNCTIONS
• Relations represent one-to-many relationships between the elements of the sets A and B,
where an element of A may be related to more than one element of B.
• A function on sets A, B represents a relation where exactly one element of B is related to
each element of A.
Tahsin Aziz 19
RELATIONS AND FUNCTIONS
• Relations represent one-to-many relationships between the elements of the sets A and B,
where an element of A may be related to more than one element of B.
Tahsin Aziz 20
0
1
2
b
a
RELATIONS AND FUNCTIONS
• A function on sets A, B represents a relation where exactly one element of B is related to
each element of A.
Tahsin Aziz 21
0
1
2
b
a
RELATIONS ON A SET
• A relation on a set A is a relation from A to A.
• In other words, a relation on a set A is a subset of A × A
• Example
• Let A be the set {1, 2, 3, 4}, which ordered pairs are in the relation R = {(a, b) | a divides b}?
• Solution
• R = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}.
Tahsin Aziz 22
PROPERTIES OF BINARY RELATION
• Reflexivity
• Symmetry
• Transitivity
Tahsin Aziz 23
REFLEXIVITY
• Reflexive
• A relation R on a set A is called reflexive if (a, a) ∈ R for every element a ∈ A.
• Using quantifiers it can be written that, the relation R on the set A is reflexive if ∀a a, a ∈
Tahsin Aziz 24
REFLEXIVITY
• The following relations on {1, 2, 3, 4} is reflexive.
• R1 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)}
• R2 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)},
• Tabular matrix representation of reflexive relation:
Tahsin Aziz 25
1 2 3
1 1 1/0 1/0
2 1/0 1 1/0
3 1/0 1/0 1
REFLEXIVITY
• Irreflexive
• A relation R on a set A is called irreflexive if (a, a) ∉ R for every element of a ∈ A.
• Using quantifiers it can be written that, the relation R on the set A is irreflexive if ∀a a, a ∉
Tahsin Aziz 26
REFLEXIVITY
• The following relations on {1, 2, 3, 4} are irreflexive.
• R3 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)}
• R4 = {(3, 4)}
• Tabular matrix representation of irreflexive relation:
Tahsin Aziz 27
1 2 3
1 0 1/0 1/0
2 1/0 0 1/0
3 1/0 1/0 0
REFLEXIVITY
• Not Reflexive
• A relation R on a set A is called not reflexive if (a, a) ∉ R for some or at least one element of a
∈ A.
• Using quantifiers it can be written that, the relation R on the set A is not reflexive if ∃a a, a ∈
Tahsin Aziz 28
REFLEXIVITY
• The following relations on {1, 2, 3, 4} are not reflexive.
• R5 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)}
• R6 = {(1, 1), (1, 2), (2, 1)}
• Tabular matrix representation of not reflexive relation:
Tahsin Aziz 29
1 2 3
1 0 1/0 1/0
2 1/0 1 1/0
3 1/0 1/0 1
PROPERTIES OF BINARY RELATION
• Reflexivity √
• Symmetry
• Transitivity
Tahsin Aziz 30
SYMMETRY
• Symmetric
• A relation R on a set A is called symmetric if (b, a) ∈ R whenever (a, b) ∈ R, for all a, b ∈ A.
• Whenever aRb, then there should be bRa for every a, b ∈ A.
• Using quantifiers, it can be written as the relation R on the set A is symmetric if ∀a∀b a, b ∈
Tahsin Aziz 31
SYMMETRY
• Antisymmetric
• A relation R on a set A such that for all a, b ∈ A, if (a, b) ∈ R and (b, a) ∈ R, then a = b is called
antisymmetric.
Or
• If aRb with a ≠ b exists, then bRa must not hold.
• Similarly, the relation R on the set A is antisymmetric if ∀a∀b a, b ∈ R ∧ b, a ∈ R → a = b .
• Some examples of antisymmetric relation can be:
• <, ≤ on Z (Set of all integers)
• ⊂ on P(Z) (Power set of Z)
Tahsin Aziz 32
SYMMETRY
• The following relations on {1, 2, 3, 4} are antisymmetric.
• R3 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)}
• R4 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)}
• R5 = {(3, 4)}.
Tahsin Aziz 33
SYMMETRY
• Not symmetric
• A relation R on a set A is called not symmetric if it is not both symmetric and antisymmetric.
• The following Relation R6 on {1, 2, 3, 4} is not symmetric as it is not both symmetric and
antisymmetric.
• R6 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)}
• R6 is not symmetric because for (3, 4) and (4, 1), (4, 3) and (1, 4) not in R respectively.
• R6 is not antisymmetric because for (1, 2), (2, 1) holds.
Tahsin Aziz 34
SYMMETRY
• Both symmetric and antisymmetric
• A relation R on a set A can be both symmetric and antisymmetric.
• The following Relation R7 on {1, 2, 3, 4} is both symmetric and antisymmetric.
• R7 = {(1, 1), (3, 3)}
• R7 is symmetric because for all (a, b), (b, a) holds.
• R7 is antisymmetric because for there is no (a, b) and (b, a) where a ≠ b.
• So a relation is not symmetric does not mean it is antisymmetric.
Tahsin Aziz 35
PROPERTIES OF BINARY RELATION
• Reflexivity √
• Symmetry √
• Transitivity
Tahsin Aziz 36
TRANSITIVITY
• Transitive
• 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.
• Using quantifiers it can be written as the relation R on a set A is transitive if we have
∀a∀b∀c a, b ∈ R ∧ b, c ∈ R → a, c ∈ R .
• That is whenever aRb and bRc holds, then there must be aRc.
• The following relations on {1, 2, 3, 4} are transitive.
• R1 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)}
• R2 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)}
• R3 = {(3, 4)}
Tahsin Aziz 37
PROPERTIES OF BINARY RELATION
• Reflexivity √
• Symmetry √
• Transitivity √
Tahsin Aziz 38
COMBINING RELATIONS
• Relations from A to B are subsets of A × B.
• Two relations from A to B can be combined in any way two sets can be combined.
• So if there are two relations R1 and R2 then the following operations can be done on the sets:
• R1 ⋃ R2
• R1 ⋂ R2
• R1 − R2
• R2 − R1
• R1 ⊕ R2
Tahsin Aziz 39
COMBINING RELATIONS
• Let R be a relation from a set A to a set B and S be a relation from set 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.
• Example:
• Let 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)}.
• The composite of the relations R and S, 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.
• So, S ∘ R = {(1, 0), (1, 1), (2, 1), (2, 2), (3, 0), (3, 1)}.
Tahsin Aziz 40
REPRESENTING RELATIONS
• A relation can be represent by two ways:
• By using Matrix
• By using Digraph
Tahsin Aziz 41
MATRIX REPRESENTATION
• A relation between finite sets can be represented using a zero–one matrix.
• Suppose that R is a relation from A = {a1, a2,……,am} to B = {b1, b2,……,bn}.
• The elements of the sets A and B have been listed in a particular, but arbitrary order. Furthermore,
when A = B we use the same ordering for A and B.
• The relation R can be represented by the matrix MR = mij , where
• mij =
1 if ai, bj ∈ R,
0 if ai, bj ∉ R.
• In other words, the zero–one matrix representing R has a 1 as its (i, j) entry when ai is related to bj , and
a 0 in this position if ai is not related to bj .
Tahsin Aziz 42
MATRIX REPRESENTATION
• 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 if a1 = 1, a2 = 2, and a3 =
3, and b1 = 1 and b2 = 2?
• Solution:
• R = {(2, 1), (3, 1), (3, 2)}. It can be represented as
Tahsin Aziz 43
Set B
1 2
SetA
1 0 0
2 1 0
3 1 1
MATRIX REPRESENTATION
• So the Matrix for R is MR =
0 0
1 0
1 1
.
• Here, 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.
Tahsin Aziz 44
MATRIX REPRESENTATION
• The square matrix of a relation on a set can be used to determine whether the relation
has certain properties.
• Reflexivity
• Symmetry
Tahsin Aziz 45
MATRIX REPRESENTATION
• Reflexive
• A relation R on A is reflexive if(a, a) ∈ R whenever a ∈ A.
• So it can be said, R is reflexive if and only if ai, ai ∈ R for i = 1, 2,……,n.
• R is reflexive if and only if mii = 1, for i = 1, 2,…….,n.
• R is reflexive if all the elements on the main diagonal of MR are equal to 1.
1 0/1 0/1
0/1 1 0/1
0/1 0/1 1
Tahsin Aziz 46
MATRIX REPRESENTATION
• Symmetric
• The relation R is symmetric if (a, b) ∈ R implies that (b, a) ∈ R.
• The relation R on the set A = {a1, a2,...,an} is symmetric if and only if (aj , ai) ∈ R whenever (ai,
aj ) ∈ R.
• R is symmetric if and only if mji = 1 whenever mij = 1. and mji = 0 whenever mij = 0.
• So, R is symmetric if and only if mij = mji, for all pairs of integers i and j with i = 1, 2,……,n
and j = 1, 2,…….,n.
• According to the definition of Transpose Matrix it can be conclude, R is symmetric if and only
if MR = (MR)t
Tahsin Aziz 47
MATRIX REPRESENTATION
• Antisymmetric
• The relation R is antisymmetric if and only if (a, b) ∈ R and (b, a) ∈ R imply that a = b.
• The matrix of an antisymmetric relation has the property that if mij = 1 with i ≠ j , then mji =
0.
• That means either mij = 0 or mji = 0 when i ≠ j .
Tahsin Aziz 48
MATRIX REPRESENTATION
• Relation R on a set is represented by the following matrix. Determine whether R is
reflexive, symmetric, and/or antisymmetric?
MR =
1 1 0
1 1 1
0 1 1
.
• All the diagonal elements of this matrix are equal to 1, so R is reflexive.
• MR is symmetric, so R is symmetric.
• R is not antisymmetric.
Tahsin Aziz 49
MATRIX REPRESENTATION
• The boolean operations AND, OR can be used to find the matrices representing the union and the
intersection of two relations.
• If R1 and R2 are relations on a set A represented by the matrices MR1
and MR2
, respectively.
• The matrix representing the union of these relations has a 1 in the positions where either MR1
or MR2
has
a 1.
• The matrix representing the intersection of these relations has a 1 in the positions where both MR1
and
MR2
have a 1.
• The matrices representing the union and intersection of these relations are
• M R1 ⋃ R2
= MR1
⋁ MR2
• M R1 ⋂ R2
= MR1
∧ MR2
.
Tahsin Aziz 50
MATRIX REPRESENTATION
• The matrix for the composite of relations can be found using the boolean product of the
matrices for these relations.
• Let R is a relation from A to B and S is a relation from B to C. Suppose that A, B, and C have
m, n, and p elements, respectively. Let the zero– one matrices for S ∘ R, R, and S be MS∘R = [tij
], MR = [rij ], and MS = [sij ], respectively. These matrices have sizes m × p, m × n, and n × p
respectively.
• The ordered pair (ai, cj ) belongs to S ∘ R if and only if there is an element bk such that (ai, bk)
belongs to R and (bk, cj ) belongs to S. It follows that tij = 1 if and only if rik = skj = 1 for some
k.
• MS∘R = MR ⨀ MS.
Tahsin Aziz 51
REPRESENTING RELATIONS
• A relation can be represent by two ways:
• By using Matrix √
• By using Digraph
Tahsin Aziz 52
DIGRAPH REPRESENTATION
• Presenting a relation using a pictorial representation is known as Digraph representation.
• Each element of the set is represented by a point, and each ordered pair is represented using
an arc with its direction indicated by an arrow.
• A directed graph, or digraph, consists of a set V of vertices (or nodes) together with a set E of
ordered pairs of elements of V called edges (or arcs).
• The vertex a is called the initial vertex of the edge (a, b), and the vertex b is called the
terminal vertex of this edge.
• An edge of the form (a, a) is represented using an arc from the vertex a back to itself which is
known as loop.
Tahsin Aziz 53
DIGRAPH REPRESENTATION
• The relation R on a set A is represented by the directed graph that has the elements of A as
its vertices and the ordered pairs (a, b), where (a, b) ∈ R, as edges.
• This assignment sets up a one-to-one correspondence between the relations on a set A and
the directed graphs with A as their set of vertices.
• Every statement about relations corresponds to a statement about directed graphs, and vice
versa.
• Directed graphs give a visual display of information about relations.
• The relations from a set A to a set B can be represented by a directed graph where there is a
vertex for each element of A and a vertex for each element of B.
Tahsin Aziz 54
DIGRAPH REPRESENTATION
• Directed graph can be used to determine properties of relations.
• Reflexive
• A relation is reflexive if and only if there is a loop at every vertex of the directed graph, so
that every ordered pair of the form (x, x) occurs in the relation.
• Symmetric
• 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, so that (y, x) is in the relation whenever (x, y) is in
the relation.
Tahsin Aziz 55
DIGRAPH REPRESENTATION
• Antisymmetric
• A relation is antisymmetric if and only if there are never two edges in opposite directions
between distinct vertices.
• Transitive
• Finally, a relation is transitive if and only if whenever there is an edge from a vertex x to a
vertex y and an edge from a vertex y to a vertex z, there is an edge from x to z. Which means
completing a triangle where each side is a directed edge with the correct direction.
Tahsin Aziz 56
DIGRAPH REPRESENTATION
• The directed graph or digraph with vertices a, b, c, d and some edges.
• Edges (a, b), (a, d), (b, b), (b, d), (c, a), (c, b), and (d, b) will be look like
a
c d
b
Tahsin Aziz 57
REPRESENTING RELATIONS
• A relation can be represent by two ways:
• By using Matrix √
• By using Digraph √
Tahsin Aziz 58
CLOSURES OF RELATIONS
• Let R be a relation on a set A.
• R may or may not have some property P, such as reflexivity, symmetry, or transitivity.
• If there is a relation S with property P containing R such that S is a subset of every
relation with property P containing R, then S is called the closure of R with respect to P.
• There are three types of closures:
• Reflexive Closure
• Symmetric Closure
• Transitive Closure
Tahsin Aziz 59
CLOSURES OF RELATIONS
• Reflexive Closure
• Let R is a relation on a set A
• The reflexive closure of R can be formed by adding to R all pairs of the form (a, a) with a ∈ A,
not already in R.
• The addition of these pairs produces a new relation that is reflexive, contains R, and is
contained within any reflexive relation containing R.
• The reflexive closure of R equals R ∪ ∆ , where = ∆ {(a, a) | a ∈ A} is the diagonal relation on
A.
Tahsin Aziz 60
CLOSURES OF RELATIONS
• Example:
• The relation R = {(1, 1), (1, 2), (2, 1), (3, 2)} on the set A = {1, 2, 3} is not reflexive. This can be
make reflexive by adding (2, 2) and (3, 3) to R, because these are the only pairs of the form (a,
a) that are not in R. Clearly, this new relation contains R.
• Furthermore, any reflexive relation that contains R must also contain (2, 2) and (3, 3). Because
this relation contains R, is reflexive, and is contained within every reflexive relation that
contains R, it is called the reflexive closure of R.
Tahsin Aziz 61
CLOSURES OF RELATIONS
• Symmetric Closure
• The symmetric closure of a relation R can be constructed by adding all ordered pairs of the
form (b, a), where (a, b) is in the relation, that are not already present in R.
• Adding these pairs produces a relation that is symmetric, that contains R, and that is
contained in any symmetric relation that contains R.
• The symmetric closure of a relation can be constructed by taking the union of a relation with
its inverse
• The symmetric closure of R is R ⋃ R−1
, where R−1 = {(b, a) | (a, b) ∈ R}.
Tahsin Aziz 62
CLOSURES OF RELATIONS
• Example
• The relation {(1, 1), (1, 2), (2, 2), (2, 3), (3, 1), (3, 2)} on {1, 2, 3} is not symmetric.
• To make this a symmetric relation we need to only add (2, 1) and (1, 3), because these are the
only pairs of the form (b, a) with (a, b) ∈ R that are not in R.
• This new relation is symmetric and contains R. Furthermore, any symmetric relation that
contains R must contain this new relation, because a symmetric relation that contains R must
contain (2, 1) and (1, 3). Consequently, this new relation is called the symmetric closure of R.
Tahsin Aziz 63
CLOSURES OF RELATIONS
• Transitive Closure
• A transitive relation S containing R such that S is a subset of every transitive relation containing R. Here, S is the
smallest transitive relation that contains R. This relation is called the transitive closure of R.
• A computer network has data centers in boston, chicago, denver, detroit, new york, and san diego.
• There are direct, one-way telephone lines from boston to chicago, from boston to detroit, from chicago to detroit, from
detroit to denver, and from new york to san diego.
• Let R be the relation containing (a, b) if there is a telephone line from the data center in a to that in b. How can we
determine if there is some (possibly indirect) link composed of one or more telephone lines from one center to another?
• Because not all links are direct, such as the link from boston to denver that goes through detroit, R cannot be used
directly to answer this. In the language of relations, R is not transitive, so it does not contain all the pairs that can be
linked.
• We can find all pairs of data centers that have a link by contructing a transitive closure.
Tahsin Aziz 64
EQUIVALENCE RELATIONS
• A relation on a set A is called an equivalence relation if it is reflexive, symmetric, and transitive.
• Two elements that are related by an equivalence relation are called equivalent.
• The notation a ~ b is often used to denote that a and b are equivalent elements with respect to a
particular equivalence relation.
• Suppose an equivalence relation is transitive, if a and b are equivalent and b and c are equivalent, it
follows that a and c are equivalent.
• Example
• = in general algebra
• ≡ in propositional calculus
Tahsin Aziz 65
EQUIVALENCE RELATIONS
• Suppose that R is the relation on the set of strings of English letters such that aRb if and
only if l(a) = l(b), whenever l(x) is the length of the string x. Is R an equivalence relation?
• Solution:
• Let a is a string and aRa which means l(a) = l(a), it follows that R is reflexive.
• Suppose that aRb, then l(a) = l(b). Again let bRa, then l(b) = l(a). Therefore, R is symmetric.
• Let aRb and bRc, then l(a) = l(b) and l(b) = l(c) which imply that l(a) = l(c) that means aRc.
Therefore, R is transitive.
• Because R is reflexive, symmetric, and transitive, it is an equivalence relation.
Tahsin Aziz 66
EQUIVALENCE RELATIONS
• Prove that, “=” is an equivalence relation.
• Solution:
• It is true for a = a. So “=” is reflexive.
• Suppose a = b, then it is also true for b = a. Therefore, “=” is symmetric.
• Suppose a = b and b = c, which show that a = c. So “=” is transitive.
• Because “=” is reflexive, symmetric, and transitive, it is an equivalence relation.
Tahsin Aziz 67
EQUIVALENCE RELATIONS
• Congruence Modulo
• If a and b are two integers and m is an positive integer, then a is congruent to b modulo m if
m divides a − b.
• We use the notation a ≡ b (mod m) to indicate that a is congruent to b modulo m.
• If a and b are not congruent to modulo m, we write a ≢ b (mod m)
• Example: Whether 17 is congruent to 5 modulo 6.
• 17 ≡ 5 (mod 6), 17 − 5 =12 which is divided by 6.
• So we can say 17 is congruent to 5 modulo 6.
Tahsin Aziz 68
EQUIVALENCE RELATIONS
• Congruence modulo m, let m be an integer with m > 1. Show that the relation R = {(a, b) | a ≡ b (mod m)} is
an equivalence relation on the set of integers.
• Solution:
• We know a ≡ b (mod m) if and only if m divides a − b.
• Here a − a = 0 is divisible by m. Hence a ≡ a (mod m), so congruence modulo m is reflexive.
• Next, suppose that a ≡ b (mod m). Then m divides a − b. So a − b = km, where k is an integer. We can write a = b + km. It
follows that b − a = (−k)m means b = a + (-k)m. So b ≡ a (mod m). Hence, congruence modulo m is symmetric.
• Again, suppose that a ≡ b (mod m) and b ≡ c (mod m). Then m divides both a − b and b − c. Therefore, there are integers
k and l with a − b = km and b − c = lm. So we can write a = b + km and c = b - lm. Subtracting c from a we obtain, a - c =
b + km – b + lm. Which equals to km + lm = (k + l)m. Here (k + l) is an integer. Thus, a ≡ c (mod m). Therefore,
congruence modulo m is transitive.
• It follows that congruence modulo m is an equivalence relation.
Tahsin Aziz 69
EQUIVALENCE CLASSES
• Let R be an equivalence relation on a set A. The set of all elements that are related to an
element a of A is called the equivalence class of a.
• The equivalence class of a with respect to R is denoted by [a]R.
• When only one relation is under consideration, the subscript R is often deleted and [a] is
used to denote the equivalence class.
• These classes are disjoint.
Tahsin Aziz 70
EQUIVALENCE CLASSES
• If R is an equivalence relation on a set A, the equivalence class of the element a is
• [a]R = {s | (a, s) ∈ R}.
• If b ∈ [a]R, then b is called a representative of this equivalence class.
• Any element of a class can be used as a representative of this class. That is, there is
nothing special about the particular element chosen as the representative of the class.
Tahsin Aziz 71
EQUIVALENCE CLASSES
• Example
• We can group all the numbers that are equivalent to each other.
• 0 ≡ 2 ≡ 4 ≡ …………(mod 2) and 1 ≡ 3 ≡ 5 ≡ …………(mod 2)
• We can write as
• [0] = {0, 2, 4, ………..} and [1] = {1, 3, 5, ………..}
• [0] and [1] is known as equivalence class.
• 0, 1 are representatives of these equivalence class.
Tahsin Aziz 72
EQUIVALENCE CLASSES
• Consider the relation R = {(a, b) | a ≡ b (mod 2)}. Now find out the equivalence classes from it.
Or,
• What are the equivalence classes of 0 and 1 for congruence modulo 2?
• Solution:
• The equivalence class of 0 contains all integers a such that a ≡ 0 (mod 2). The integers in this class are those
divisible by 2. Hence, the equivalence class of 0 for this relation is [0]={……., −4, −2, 0, 2, 4, …….}.
• The equivalence class of 1 contains all the integers a such that a ≡ 1 (mod 2). The integers in this class are those
that have a remainder of 1 when divided by 2. Hence, the equivalence class of 1 for this relation is [1]={……, -5,
−3, −1, 1, 3, 5, ,…….}.
Tahsin Aziz 73
EQUIVALENCE CLASSES
• If R is an equivalence relation on a set A then there are A1, A2, A3,……. such that
• Ai ⊆ A
• ∀ 𝑎, 𝑏 ∈ 𝐴𝑖
𝑎𝑅𝑏
• Ai ∩ Aj = ∅, when i ≠ j
• A1 ∪ A2 ∪ A3 ∪ ……….. = A
• Here, Ai is an equivalence class. {A1, A2, A3,……. } is a partition of A. e, for e ∈ Ai is a
representative of Ai
• Representative of different classes are not equivalent to each other.
• An equivalence relation on A partitions A into disjoint non- empty sets.
Tahsin Aziz 74
PARTITIONS
• Consider the relation r = {(a, b)| a ≡ b mod 2}.
• This splits the integers into two equivalence classes: even numbers and odd numbers.
• These two sets together form a partition of the integers.
• A partition of a set is a collection of non-empty disjoint subsets of S whose union in S.
• In this example, the partition is {[0], [1]} or {{….., -3, -1, 1, 3,…..}, {….., -4, -2, 0, 2, 4,…..}}
• We have partitioned Z into equivalence classes [0] and [1], under the relation of
congruence modulo 2 = set of integers = {….., -4, -3, -2, -1, 0, 1, 2, 3, 4,…..}
Tahsin Aziz 75
ORDER OF RELATION
• Partial order:
• A binary relation R on a set is a partial order if and only if it is reflexive, antisymmetric and
transitive.
• Total order:
• A binary relation R on a set A is a total order if and only if it is a partial order and for any pair of
elements a and b of A, (a, b) ∈ R or (b, a) ∈ R.
• That is every element is related with every element one way or the other.
• A total order is also called a linear order.
• Quasi order:
• A binary relation R on a set A is a quasi order if and only if it is irreflexive and transitive.
Tahsin Aziz 76
THANK YOU ALL
Tahsin Aziz 77

Más contenido relacionado

La actualidad más candente

Relations
RelationsRelations
RelationsGaditek
 
CMSC 56 | Lecture 14: Representing Relations
CMSC 56 | Lecture 14: Representing RelationsCMSC 56 | Lecture 14: Representing Relations
CMSC 56 | Lecture 14: Representing Relationsallyn joy calcaben
 
Chapter 2: Relations
Chapter 2: RelationsChapter 2: Relations
Chapter 2: Relationsnszakir
 
Section 9: Equivalence Relations & Cosets
Section 9: Equivalence Relations & CosetsSection 9: Equivalence Relations & Cosets
Section 9: Equivalence Relations & CosetsKevin Johnson
 
Discrete-Chapter 08 Relations
Discrete-Chapter 08 RelationsDiscrete-Chapter 08 Relations
Discrete-Chapter 08 RelationsWongyos Keardsri
 
Relation matrix & graphs in relations
Relation matrix &  graphs in relationsRelation matrix &  graphs in relations
Relation matrix & graphs in relationsRachana Pathak
 
Poset in Relations(Discrete Mathematics)
Poset in Relations(Discrete Mathematics)Poset in Relations(Discrete Mathematics)
Poset in Relations(Discrete Mathematics)Rachana Pathak
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Himanshu Dua
 
Relations digraphs
Relations  digraphsRelations  digraphs
Relations digraphsIIUM
 
Presentation2 vijayan pillai
Presentation2 vijayan pillaiPresentation2 vijayan pillai
Presentation2 vijayan pillaiunni2012
 
Partial-Orderings in Discrete Mathematics
 Partial-Orderings in Discrete Mathematics Partial-Orderings in Discrete Mathematics
Partial-Orderings in Discrete MathematicsMeghaj Mallick
 
Relation and function
Relation and functionRelation and function
Relation and functionAadityaGera
 
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and ordering
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and orderingBCA_Semester-II-Discrete Mathematics_unit-ii_Relation and ordering
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and orderingRai University
 
93 geometric sequences
93 geometric sequences93 geometric sequences
93 geometric sequencesmath126
 
Geometric sequences
Geometric sequencesGeometric sequences
Geometric sequencesmooca76
 

La actualidad más candente (19)

Relations
RelationsRelations
Relations
 
CMSC 56 | Lecture 14: Representing Relations
CMSC 56 | Lecture 14: Representing RelationsCMSC 56 | Lecture 14: Representing Relations
CMSC 56 | Lecture 14: Representing Relations
 
Chapter 2: Relations
Chapter 2: RelationsChapter 2: Relations
Chapter 2: Relations
 
Section 9: Equivalence Relations & Cosets
Section 9: Equivalence Relations & CosetsSection 9: Equivalence Relations & Cosets
Section 9: Equivalence Relations & Cosets
 
Introductions to Relations
Introductions to RelationsIntroductions to Relations
Introductions to Relations
 
Discrete-Chapter 08 Relations
Discrete-Chapter 08 RelationsDiscrete-Chapter 08 Relations
Discrete-Chapter 08 Relations
 
Relations
RelationsRelations
Relations
 
Relation matrix & graphs in relations
Relation matrix &  graphs in relationsRelation matrix &  graphs in relations
Relation matrix & graphs in relations
 
Relations
RelationsRelations
Relations
 
Poset in Relations(Discrete Mathematics)
Poset in Relations(Discrete Mathematics)Poset in Relations(Discrete Mathematics)
Poset in Relations(Discrete Mathematics)
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)
 
Relations digraphs
Relations  digraphsRelations  digraphs
Relations digraphs
 
Presentation2 vijayan pillai
Presentation2 vijayan pillaiPresentation2 vijayan pillai
Presentation2 vijayan pillai
 
Partial-Orderings in Discrete Mathematics
 Partial-Orderings in Discrete Mathematics Partial-Orderings in Discrete Mathematics
Partial-Orderings in Discrete Mathematics
 
Lemh101
Lemh101Lemh101
Lemh101
 
Relation and function
Relation and functionRelation and function
Relation and function
 
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and ordering
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and orderingBCA_Semester-II-Discrete Mathematics_unit-ii_Relation and ordering
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and ordering
 
93 geometric sequences
93 geometric sequences93 geometric sequences
93 geometric sequences
 
Geometric sequences
Geometric sequencesGeometric sequences
Geometric sequences
 

Similar a Relations

Relational Algebra (1).pptx
Relational Algebra (1).pptxRelational Algebra (1).pptx
Relational Algebra (1).pptxSarowarSuman
 
dm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdfdm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdfSanjanaAdri
 
dm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptxdm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptxRockyIslam5
 
Relations and functions
Relations and functions Relations and functions
Relations and functions Seyid Kadher
 
Relation in Discrete Mathematics
Relation in Discrete Mathematics Relation in Discrete Mathematics
Relation in Discrete Mathematics NANDINI SHARMA
 
Inverse of Relations Presentation.pptx
Inverse of Relations   Presentation.pptxInverse of Relations   Presentation.pptx
Inverse of Relations Presentation.pptxMuhammadArishImran
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Himanshu Dua
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Himanshu Dua
 
Toc chapter 1 srg
Toc chapter 1 srgToc chapter 1 srg
Toc chapter 1 srgShayak Giri
 

Similar a Relations (19)

Relational Algebra (1).pptx
Relational Algebra (1).pptxRelational Algebra (1).pptx
Relational Algebra (1).pptx
 
dm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdfdm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdf
 
dm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptxdm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptx
 
Relations and functions
Relations and functions Relations and functions
Relations and functions
 
Relation in Discrete Mathematics
Relation in Discrete Mathematics Relation in Discrete Mathematics
Relation in Discrete Mathematics
 
Set theory
Set theorySet theory
Set theory
 
Per5 relasi
Per5 relasiPer5 relasi
Per5 relasi
 
Inverse of Relations Presentation.pptx
Inverse of Relations   Presentation.pptxInverse of Relations   Presentation.pptx
Inverse of Relations Presentation.pptx
 
Relations
RelationsRelations
Relations
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)
 
Toc chapter 1 srg
Toc chapter 1 srgToc chapter 1 srg
Toc chapter 1 srg
 
Sets and relations
Sets and relationsSets and relations
Sets and relations
 
Relations in Discrete Math
Relations in Discrete MathRelations in Discrete Math
Relations in Discrete Math
 
Types of RELATIONS
Types of RELATIONSTypes of RELATIONS
Types of RELATIONS
 
RELATION
RELATIONRELATION
RELATION
 
Sadat sumon
Sadat sumonSadat sumon
Sadat sumon
 
Relation and function_xii
Relation and function_xiiRelation and function_xii
Relation and function_xii
 
G-1-SETS.pdf
G-1-SETS.pdfG-1-SETS.pdf
G-1-SETS.pdf
 

Último

latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answersdalebeck957
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationNeilDeclaro1
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 

Último (20)

latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 

Relations

  • 1. RELATIONS TAHSIN AZIZ COMPUTER SCIENCE AND ENGINEERING AHSANULLAH UNIVERSITY OF SCIENCE AND TECHNOLOGY
  • 2. REFERENCE BOOK DISCRETE MATHEMATICS AND ITS APPLICATIONS BY KENNETH H. ROSEN Tahsin Aziz 2
  • 3. RELATIONS • Relationships between elements of sets are represented using the structure called a relation, which is just a subset of the Cartesian product of the sets. • 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. • Two types • Binary Relation • N-ary Relation Tahsin Aziz 3
  • 4. BINARY RELATION • Let A and B be two sets. A binary relation from A to B is a subset of A × B • 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 aRb to denote that (a, b) ∈ R and aRb to denote that (a, b) ∉ R. • Moreover, when (a, b) belongs to R, a is said to be related to b by R. Tahsin Aziz 4
  • 5. BINARY RELATION • Example • 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. Tahsin Aziz 5
  • 6. RELATIONS • Two types • Binary Relation √ • N-ary Relation Tahsin Aziz 6
  • 7. N-ARY RELATION • Let there are n number of sets such that A1, A2,…….,An. • An N-ary relation on these sets is a subset of A1 × A2 ×…… × An. • The sets A1, A2,……,An are called the domains of the relation and n is called its degree. • It is used in database applications. Tahsin Aziz 7
  • 8. RELATIONS • Two types • Binary Relation √ • N-ary Relation √ Tahsin Aziz 8
  • 9. RELATIONS • If R = ∅ , it is called an empty relation. • If R = A × B, it is called an universal relation. Tahsin Aziz 9
  • 10. REPRESENTATIONS OF BINARY RELATIONS • Relation can be represented in four ways. 1. Set Representation 2. Arrow Diagram 3. Tabular Matrix 4. Co-ordinate/Graph Tahsin Aziz 10
  • 11. SET REPRESENTATION • Let there are two sets A and B. Set A = {1, 2, 3, 4} and B = {x, y, z}. R is the relation from set A to B. • The set representation of R is: R = { (1, y), (1, z), (3, y), (3, z), (4, x), (4, z) } Tahsin Aziz 11
  • 12. REPRESENTATIONS OF BINARY RELATIONS • Relation can be represented in four ways. 1. Set Representation √ 2. Arrow Diagram 3. Tabular Matrix 4. Co-ordinate/Graph Tahsin Aziz 12
  • 13. ARROW DIAGRAM • Let there are two sets A and B. A = {1, 2, 3, 4} and B = {x, y, z}. R is the relation from set A to B. • R = { (1, y), (1, z), (3, y), (3, z), (4, x), (4, z) }. • The arrow diagram of R is: Tahsin Aziz 13 1 2 3 4 z y x
  • 14. REPRESENTATIONS OF BINARY RELATIONS • Relation can be represented in four ways. 1. Set Representation √ 2. Arrow Diagram √ 3. Tabular Matrix 4. Co-ordinate/Graph Tahsin Aziz 14
  • 15. TABULAR MATRIX • Let there are two sets A and B. A = {1, 2, 3, 4} and B = {x, y, z}. R is the relation from set A to B. • R = { (1, y), (1, z), (3, y), (3, z), (4, x), (4, z) }. • The tabular matrix form of R is: Tahsin Aziz 15 x y z 1 0 1 1 2 0 0 0 3 0 1 1 4 1 0 1
  • 16. REPRESENTATIONS OF BINARY RELATIONS • Relation can be represented in four ways. 1. Set Representation √ 2. Arrow Diagram √ 3. Tabular Matrix √ 4. Co-ordinate/Graph Tahsin Aziz 16
  • 17. CO-ORDINATE/GRAPH • Let there are two sets A and B. A = {1, 2, 3, 4} and B = {x, y, z}. R is the relation from set A to B. • R = { (1, y), (1, z), (3, y), (3, z), (4, x), (4, z) }. • The co - ordinate or graph form of R is: Tahsin Aziz 17 z x x x y x x x x 1 2 3 4
  • 18. REPRESENTATIONS OF BINARY RELATIONS • Relation can be represented in four ways. 1. Set Representation √ 2. Arrow Diagram √ 3. Tabular Matrix √ 4. Co-ordinate/Graph √ Tahsin Aziz 18
  • 19. RELATIONS AND FUNCTIONS • Relations represent one-to-many relationships between the elements of the sets A and B, where an element of A may be related to more than one element of B. • A function on sets A, B represents a relation where exactly one element of B is related to each element of A. Tahsin Aziz 19
  • 20. RELATIONS AND FUNCTIONS • Relations represent one-to-many relationships between the elements of the sets A and B, where an element of A may be related to more than one element of B. Tahsin Aziz 20 0 1 2 b a
  • 21. RELATIONS AND FUNCTIONS • A function on sets A, B represents a relation where exactly one element of B is related to each element of A. Tahsin Aziz 21 0 1 2 b a
  • 22. RELATIONS ON A SET • A relation on a set A is a relation from A to A. • In other words, a relation on a set A is a subset of A × A • Example • Let A be the set {1, 2, 3, 4}, which ordered pairs are in the relation R = {(a, b) | a divides b}? • Solution • R = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}. Tahsin Aziz 22
  • 23. PROPERTIES OF BINARY RELATION • Reflexivity • Symmetry • Transitivity Tahsin Aziz 23
  • 24. REFLEXIVITY • Reflexive • A relation R on a set A is called reflexive if (a, a) ∈ R for every element a ∈ A. • Using quantifiers it can be written that, the relation R on the set A is reflexive if ∀a a, a ∈ Tahsin Aziz 24
  • 25. REFLEXIVITY • The following relations on {1, 2, 3, 4} is reflexive. • R1 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)} • R2 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)}, • Tabular matrix representation of reflexive relation: Tahsin Aziz 25 1 2 3 1 1 1/0 1/0 2 1/0 1 1/0 3 1/0 1/0 1
  • 26. REFLEXIVITY • Irreflexive • A relation R on a set A is called irreflexive if (a, a) ∉ R for every element of a ∈ A. • Using quantifiers it can be written that, the relation R on the set A is irreflexive if ∀a a, a ∉ Tahsin Aziz 26
  • 27. REFLEXIVITY • The following relations on {1, 2, 3, 4} are irreflexive. • R3 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)} • R4 = {(3, 4)} • Tabular matrix representation of irreflexive relation: Tahsin Aziz 27 1 2 3 1 0 1/0 1/0 2 1/0 0 1/0 3 1/0 1/0 0
  • 28. REFLEXIVITY • Not Reflexive • A relation R on a set A is called not reflexive if (a, a) ∉ R for some or at least one element of a ∈ A. • Using quantifiers it can be written that, the relation R on the set A is not reflexive if ∃a a, a ∈ Tahsin Aziz 28
  • 29. REFLEXIVITY • The following relations on {1, 2, 3, 4} are not reflexive. • R5 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)} • R6 = {(1, 1), (1, 2), (2, 1)} • Tabular matrix representation of not reflexive relation: Tahsin Aziz 29 1 2 3 1 0 1/0 1/0 2 1/0 1 1/0 3 1/0 1/0 1
  • 30. PROPERTIES OF BINARY RELATION • Reflexivity √ • Symmetry • Transitivity Tahsin Aziz 30
  • 31. SYMMETRY • Symmetric • A relation R on a set A is called symmetric if (b, a) ∈ R whenever (a, b) ∈ R, for all a, b ∈ A. • Whenever aRb, then there should be bRa for every a, b ∈ A. • Using quantifiers, it can be written as the relation R on the set A is symmetric if ∀a∀b a, b ∈ Tahsin Aziz 31
  • 32. SYMMETRY • Antisymmetric • A relation R on a set A such that for all a, b ∈ A, if (a, b) ∈ R and (b, a) ∈ R, then a = b is called antisymmetric. Or • If aRb with a ≠ b exists, then bRa must not hold. • Similarly, the relation R on the set A is antisymmetric if ∀a∀b a, b ∈ R ∧ b, a ∈ R → a = b . • Some examples of antisymmetric relation can be: • <, ≤ on Z (Set of all integers) • ⊂ on P(Z) (Power set of Z) Tahsin Aziz 32
  • 33. SYMMETRY • The following relations on {1, 2, 3, 4} are antisymmetric. • R3 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)} • R4 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)} • R5 = {(3, 4)}. Tahsin Aziz 33
  • 34. SYMMETRY • Not symmetric • A relation R on a set A is called not symmetric if it is not both symmetric and antisymmetric. • The following Relation R6 on {1, 2, 3, 4} is not symmetric as it is not both symmetric and antisymmetric. • R6 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)} • R6 is not symmetric because for (3, 4) and (4, 1), (4, 3) and (1, 4) not in R respectively. • R6 is not antisymmetric because for (1, 2), (2, 1) holds. Tahsin Aziz 34
  • 35. SYMMETRY • Both symmetric and antisymmetric • A relation R on a set A can be both symmetric and antisymmetric. • The following Relation R7 on {1, 2, 3, 4} is both symmetric and antisymmetric. • R7 = {(1, 1), (3, 3)} • R7 is symmetric because for all (a, b), (b, a) holds. • R7 is antisymmetric because for there is no (a, b) and (b, a) where a ≠ b. • So a relation is not symmetric does not mean it is antisymmetric. Tahsin Aziz 35
  • 36. PROPERTIES OF BINARY RELATION • Reflexivity √ • Symmetry √ • Transitivity Tahsin Aziz 36
  • 37. TRANSITIVITY • Transitive • 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. • Using quantifiers it can be written as the relation R on a set A is transitive if we have ∀a∀b∀c a, b ∈ R ∧ b, c ∈ R → a, c ∈ R . • That is whenever aRb and bRc holds, then there must be aRc. • The following relations on {1, 2, 3, 4} are transitive. • R1 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)} • R2 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)} • R3 = {(3, 4)} Tahsin Aziz 37
  • 38. PROPERTIES OF BINARY RELATION • Reflexivity √ • Symmetry √ • Transitivity √ Tahsin Aziz 38
  • 39. COMBINING RELATIONS • Relations from A to B are subsets of A × B. • Two relations from A to B can be combined in any way two sets can be combined. • So if there are two relations R1 and R2 then the following operations can be done on the sets: • R1 ⋃ R2 • R1 ⋂ R2 • R1 − R2 • R2 − R1 • R1 ⊕ R2 Tahsin Aziz 39
  • 40. COMBINING RELATIONS • Let R be a relation from a set A to a set B and S be a relation from set 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. • Example: • Let 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)}. • The composite of the relations R and S, 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. • So, S ∘ R = {(1, 0), (1, 1), (2, 1), (2, 2), (3, 0), (3, 1)}. Tahsin Aziz 40
  • 41. REPRESENTING RELATIONS • A relation can be represent by two ways: • By using Matrix • By using Digraph Tahsin Aziz 41
  • 42. MATRIX REPRESENTATION • A relation between finite sets can be represented using a zero–one matrix. • Suppose that R is a relation from A = {a1, a2,……,am} to B = {b1, b2,……,bn}. • The elements of the sets A and B have been listed in a particular, but arbitrary order. Furthermore, when A = B we use the same ordering for A and B. • The relation R can be represented by the matrix MR = mij , where • mij = 1 if ai, bj ∈ R, 0 if ai, bj ∉ R. • In other words, the zero–one matrix representing R has a 1 as its (i, j) entry when ai is related to bj , and a 0 in this position if ai is not related to bj . Tahsin Aziz 42
  • 43. MATRIX REPRESENTATION • 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 if a1 = 1, a2 = 2, and a3 = 3, and b1 = 1 and b2 = 2? • Solution: • R = {(2, 1), (3, 1), (3, 2)}. It can be represented as Tahsin Aziz 43 Set B 1 2 SetA 1 0 0 2 1 0 3 1 1
  • 44. MATRIX REPRESENTATION • So the Matrix for R is MR = 0 0 1 0 1 1 . • Here, 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. Tahsin Aziz 44
  • 45. MATRIX REPRESENTATION • The square matrix of a relation on a set can be used to determine whether the relation has certain properties. • Reflexivity • Symmetry Tahsin Aziz 45
  • 46. MATRIX REPRESENTATION • Reflexive • A relation R on A is reflexive if(a, a) ∈ R whenever a ∈ A. • So it can be said, R is reflexive if and only if ai, ai ∈ R for i = 1, 2,……,n. • R is reflexive if and only if mii = 1, for i = 1, 2,…….,n. • R is reflexive if all the elements on the main diagonal of MR are equal to 1. 1 0/1 0/1 0/1 1 0/1 0/1 0/1 1 Tahsin Aziz 46
  • 47. MATRIX REPRESENTATION • Symmetric • The relation R is symmetric if (a, b) ∈ R implies that (b, a) ∈ R. • The relation R on the set A = {a1, a2,...,an} is symmetric if and only if (aj , ai) ∈ R whenever (ai, aj ) ∈ R. • R is symmetric if and only if mji = 1 whenever mij = 1. and mji = 0 whenever mij = 0. • So, R is symmetric if and only if mij = mji, for all pairs of integers i and j with i = 1, 2,……,n and j = 1, 2,…….,n. • According to the definition of Transpose Matrix it can be conclude, R is symmetric if and only if MR = (MR)t Tahsin Aziz 47
  • 48. MATRIX REPRESENTATION • Antisymmetric • The relation R is antisymmetric if and only if (a, b) ∈ R and (b, a) ∈ R imply that a = b. • The matrix of an antisymmetric relation has the property that if mij = 1 with i ≠ j , then mji = 0. • That means either mij = 0 or mji = 0 when i ≠ j . Tahsin Aziz 48
  • 49. MATRIX REPRESENTATION • Relation R on a set is represented by the following matrix. Determine whether R is reflexive, symmetric, and/or antisymmetric? MR = 1 1 0 1 1 1 0 1 1 . • All the diagonal elements of this matrix are equal to 1, so R is reflexive. • MR is symmetric, so R is symmetric. • R is not antisymmetric. Tahsin Aziz 49
  • 50. MATRIX REPRESENTATION • The boolean operations AND, OR can be used to find the matrices representing the union and the intersection of two relations. • If R1 and R2 are relations on a set A represented by the matrices MR1 and MR2 , respectively. • The matrix representing the union of these relations has a 1 in the positions where either MR1 or MR2 has a 1. • The matrix representing the intersection of these relations has a 1 in the positions where both MR1 and MR2 have a 1. • The matrices representing the union and intersection of these relations are • M R1 ⋃ R2 = MR1 ⋁ MR2 • M R1 ⋂ R2 = MR1 ∧ MR2 . Tahsin Aziz 50
  • 51. MATRIX REPRESENTATION • The matrix for the composite of relations can be found using the boolean product of the matrices for these relations. • Let R is a relation from A to B and S is a relation from B to C. Suppose that A, B, and C have m, n, and p elements, respectively. Let the zero– one matrices for S ∘ R, R, and S be MS∘R = [tij ], MR = [rij ], and MS = [sij ], respectively. These matrices have sizes m × p, m × n, and n × p respectively. • The ordered pair (ai, cj ) belongs to S ∘ R if and only if there is an element bk such that (ai, bk) belongs to R and (bk, cj ) belongs to S. It follows that tij = 1 if and only if rik = skj = 1 for some k. • MS∘R = MR ⨀ MS. Tahsin Aziz 51
  • 52. REPRESENTING RELATIONS • A relation can be represent by two ways: • By using Matrix √ • By using Digraph Tahsin Aziz 52
  • 53. DIGRAPH REPRESENTATION • Presenting a relation using a pictorial representation is known as Digraph representation. • Each element of the set is represented by a point, and each ordered pair is represented using an arc with its direction indicated by an arrow. • A directed graph, or digraph, consists of a set V of vertices (or nodes) together with a set E of ordered pairs of elements of V called edges (or arcs). • The vertex a is called the initial vertex of the edge (a, b), and the vertex b is called the terminal vertex of this edge. • An edge of the form (a, a) is represented using an arc from the vertex a back to itself which is known as loop. Tahsin Aziz 53
  • 54. DIGRAPH REPRESENTATION • The relation R on a set A is represented by the directed graph that has the elements of A as its vertices and the ordered pairs (a, b), where (a, b) ∈ R, as edges. • This assignment sets up a one-to-one correspondence between the relations on a set A and the directed graphs with A as their set of vertices. • Every statement about relations corresponds to a statement about directed graphs, and vice versa. • Directed graphs give a visual display of information about relations. • The relations from a set A to a set B can be represented by a directed graph where there is a vertex for each element of A and a vertex for each element of B. Tahsin Aziz 54
  • 55. DIGRAPH REPRESENTATION • Directed graph can be used to determine properties of relations. • Reflexive • A relation is reflexive if and only if there is a loop at every vertex of the directed graph, so that every ordered pair of the form (x, x) occurs in the relation. • Symmetric • 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, so that (y, x) is in the relation whenever (x, y) is in the relation. Tahsin Aziz 55
  • 56. DIGRAPH REPRESENTATION • Antisymmetric • A relation is antisymmetric if and only if there are never two edges in opposite directions between distinct vertices. • Transitive • Finally, a relation is transitive if and only if whenever there is an edge from a vertex x to a vertex y and an edge from a vertex y to a vertex z, there is an edge from x to z. Which means completing a triangle where each side is a directed edge with the correct direction. Tahsin Aziz 56
  • 57. DIGRAPH REPRESENTATION • The directed graph or digraph with vertices a, b, c, d and some edges. • Edges (a, b), (a, d), (b, b), (b, d), (c, a), (c, b), and (d, b) will be look like a c d b Tahsin Aziz 57
  • 58. REPRESENTING RELATIONS • A relation can be represent by two ways: • By using Matrix √ • By using Digraph √ Tahsin Aziz 58
  • 59. CLOSURES OF RELATIONS • Let R be a relation on a set A. • R may or may not have some property P, such as reflexivity, symmetry, or transitivity. • If there is a relation S with property P containing R such that S is a subset of every relation with property P containing R, then S is called the closure of R with respect to P. • There are three types of closures: • Reflexive Closure • Symmetric Closure • Transitive Closure Tahsin Aziz 59
  • 60. CLOSURES OF RELATIONS • Reflexive Closure • Let R is a relation on a set A • The reflexive closure of R can be formed by adding to R all pairs of the form (a, a) with a ∈ A, not already in R. • The addition of these pairs produces a new relation that is reflexive, contains R, and is contained within any reflexive relation containing R. • The reflexive closure of R equals R ∪ ∆ , where = ∆ {(a, a) | a ∈ A} is the diagonal relation on A. Tahsin Aziz 60
  • 61. CLOSURES OF RELATIONS • Example: • The relation R = {(1, 1), (1, 2), (2, 1), (3, 2)} on the set A = {1, 2, 3} is not reflexive. This can be make reflexive by adding (2, 2) and (3, 3) to R, because these are the only pairs of the form (a, a) that are not in R. Clearly, this new relation contains R. • Furthermore, any reflexive relation that contains R must also contain (2, 2) and (3, 3). Because this relation contains R, is reflexive, and is contained within every reflexive relation that contains R, it is called the reflexive closure of R. Tahsin Aziz 61
  • 62. CLOSURES OF RELATIONS • Symmetric Closure • The symmetric closure of a relation R can be constructed by adding all ordered pairs of the form (b, a), where (a, b) is in the relation, that are not already present in R. • Adding these pairs produces a relation that is symmetric, that contains R, and that is contained in any symmetric relation that contains R. • The symmetric closure of a relation can be constructed by taking the union of a relation with its inverse • The symmetric closure of R is R ⋃ R−1 , where R−1 = {(b, a) | (a, b) ∈ R}. Tahsin Aziz 62
  • 63. CLOSURES OF RELATIONS • Example • The relation {(1, 1), (1, 2), (2, 2), (2, 3), (3, 1), (3, 2)} on {1, 2, 3} is not symmetric. • To make this a symmetric relation we need to only add (2, 1) and (1, 3), because these are the only pairs of the form (b, a) with (a, b) ∈ R that are not in R. • This new relation is symmetric and contains R. Furthermore, any symmetric relation that contains R must contain this new relation, because a symmetric relation that contains R must contain (2, 1) and (1, 3). Consequently, this new relation is called the symmetric closure of R. Tahsin Aziz 63
  • 64. CLOSURES OF RELATIONS • Transitive Closure • A transitive relation S containing R such that S is a subset of every transitive relation containing R. Here, S is the smallest transitive relation that contains R. This relation is called the transitive closure of R. • A computer network has data centers in boston, chicago, denver, detroit, new york, and san diego. • There are direct, one-way telephone lines from boston to chicago, from boston to detroit, from chicago to detroit, from detroit to denver, and from new york to san diego. • Let R be the relation containing (a, b) if there is a telephone line from the data center in a to that in b. How can we determine if there is some (possibly indirect) link composed of one or more telephone lines from one center to another? • Because not all links are direct, such as the link from boston to denver that goes through detroit, R cannot be used directly to answer this. In the language of relations, R is not transitive, so it does not contain all the pairs that can be linked. • We can find all pairs of data centers that have a link by contructing a transitive closure. Tahsin Aziz 64
  • 65. EQUIVALENCE RELATIONS • A relation on a set A is called an equivalence relation if it is reflexive, symmetric, and transitive. • Two elements that are related by an equivalence relation are called equivalent. • The notation a ~ b is often used to denote that a and b are equivalent elements with respect to a particular equivalence relation. • Suppose an equivalence relation is transitive, if a and b are equivalent and b and c are equivalent, it follows that a and c are equivalent. • Example • = in general algebra • ≡ in propositional calculus Tahsin Aziz 65
  • 66. EQUIVALENCE RELATIONS • Suppose that R is the relation on the set of strings of English letters such that aRb if and only if l(a) = l(b), whenever l(x) is the length of the string x. Is R an equivalence relation? • Solution: • Let a is a string and aRa which means l(a) = l(a), it follows that R is reflexive. • Suppose that aRb, then l(a) = l(b). Again let bRa, then l(b) = l(a). Therefore, R is symmetric. • Let aRb and bRc, then l(a) = l(b) and l(b) = l(c) which imply that l(a) = l(c) that means aRc. Therefore, R is transitive. • Because R is reflexive, symmetric, and transitive, it is an equivalence relation. Tahsin Aziz 66
  • 67. EQUIVALENCE RELATIONS • Prove that, “=” is an equivalence relation. • Solution: • It is true for a = a. So “=” is reflexive. • Suppose a = b, then it is also true for b = a. Therefore, “=” is symmetric. • Suppose a = b and b = c, which show that a = c. So “=” is transitive. • Because “=” is reflexive, symmetric, and transitive, it is an equivalence relation. Tahsin Aziz 67
  • 68. EQUIVALENCE RELATIONS • Congruence Modulo • If a and b are two integers and m is an positive integer, then a is congruent to b modulo m if m divides a − b. • We use the notation a ≡ b (mod m) to indicate that a is congruent to b modulo m. • If a and b are not congruent to modulo m, we write a ≢ b (mod m) • Example: Whether 17 is congruent to 5 modulo 6. • 17 ≡ 5 (mod 6), 17 − 5 =12 which is divided by 6. • So we can say 17 is congruent to 5 modulo 6. Tahsin Aziz 68
  • 69. EQUIVALENCE RELATIONS • Congruence modulo m, let m be an integer with m > 1. Show that the relation R = {(a, b) | a ≡ b (mod m)} is an equivalence relation on the set of integers. • Solution: • We know a ≡ b (mod m) if and only if m divides a − b. • Here a − a = 0 is divisible by m. Hence a ≡ a (mod m), so congruence modulo m is reflexive. • Next, suppose that a ≡ b (mod m). Then m divides a − b. So a − b = km, where k is an integer. We can write a = b + km. It follows that b − a = (−k)m means b = a + (-k)m. So b ≡ a (mod m). Hence, congruence modulo m is symmetric. • Again, suppose that a ≡ b (mod m) and b ≡ c (mod m). Then m divides both a − b and b − c. Therefore, there are integers k and l with a − b = km and b − c = lm. So we can write a = b + km and c = b - lm. Subtracting c from a we obtain, a - c = b + km – b + lm. Which equals to km + lm = (k + l)m. Here (k + l) is an integer. Thus, a ≡ c (mod m). Therefore, congruence modulo m is transitive. • It follows that congruence modulo m is an equivalence relation. Tahsin Aziz 69
  • 70. EQUIVALENCE CLASSES • Let R be an equivalence relation on a set A. The set of all elements that are related to an element a of A is called the equivalence class of a. • The equivalence class of a with respect to R is denoted by [a]R. • When only one relation is under consideration, the subscript R is often deleted and [a] is used to denote the equivalence class. • These classes are disjoint. Tahsin Aziz 70
  • 71. EQUIVALENCE CLASSES • If R is an equivalence relation on a set A, the equivalence class of the element a is • [a]R = {s | (a, s) ∈ R}. • If b ∈ [a]R, then b is called a representative of this equivalence class. • Any element of a class can be used as a representative of this class. That is, there is nothing special about the particular element chosen as the representative of the class. Tahsin Aziz 71
  • 72. EQUIVALENCE CLASSES • Example • We can group all the numbers that are equivalent to each other. • 0 ≡ 2 ≡ 4 ≡ …………(mod 2) and 1 ≡ 3 ≡ 5 ≡ …………(mod 2) • We can write as • [0] = {0, 2, 4, ………..} and [1] = {1, 3, 5, ………..} • [0] and [1] is known as equivalence class. • 0, 1 are representatives of these equivalence class. Tahsin Aziz 72
  • 73. EQUIVALENCE CLASSES • Consider the relation R = {(a, b) | a ≡ b (mod 2)}. Now find out the equivalence classes from it. Or, • What are the equivalence classes of 0 and 1 for congruence modulo 2? • Solution: • The equivalence class of 0 contains all integers a such that a ≡ 0 (mod 2). The integers in this class are those divisible by 2. Hence, the equivalence class of 0 for this relation is [0]={……., −4, −2, 0, 2, 4, …….}. • The equivalence class of 1 contains all the integers a such that a ≡ 1 (mod 2). The integers in this class are those that have a remainder of 1 when divided by 2. Hence, the equivalence class of 1 for this relation is [1]={……, -5, −3, −1, 1, 3, 5, ,…….}. Tahsin Aziz 73
  • 74. EQUIVALENCE CLASSES • If R is an equivalence relation on a set A then there are A1, A2, A3,……. such that • Ai ⊆ A • ∀ 𝑎, 𝑏 ∈ 𝐴𝑖 𝑎𝑅𝑏 • Ai ∩ Aj = ∅, when i ≠ j • A1 ∪ A2 ∪ A3 ∪ ……….. = A • Here, Ai is an equivalence class. {A1, A2, A3,……. } is a partition of A. e, for e ∈ Ai is a representative of Ai • Representative of different classes are not equivalent to each other. • An equivalence relation on A partitions A into disjoint non- empty sets. Tahsin Aziz 74
  • 75. PARTITIONS • Consider the relation r = {(a, b)| a ≡ b mod 2}. • This splits the integers into two equivalence classes: even numbers and odd numbers. • These two sets together form a partition of the integers. • A partition of a set is a collection of non-empty disjoint subsets of S whose union in S. • In this example, the partition is {[0], [1]} or {{….., -3, -1, 1, 3,…..}, {….., -4, -2, 0, 2, 4,…..}} • We have partitioned Z into equivalence classes [0] and [1], under the relation of congruence modulo 2 = set of integers = {….., -4, -3, -2, -1, 0, 1, 2, 3, 4,…..} Tahsin Aziz 75
  • 76. ORDER OF RELATION • Partial order: • A binary relation R on a set is a partial order if and only if it is reflexive, antisymmetric and transitive. • Total order: • A binary relation R on a set A is a total order if and only if it is a partial order and for any pair of elements a and b of A, (a, b) ∈ R or (b, a) ∈ R. • That is every element is related with every element one way or the other. • A total order is also called a linear order. • Quasi order: • A binary relation R on a set A is a quasi order if and only if it is irreflexive and transitive. Tahsin Aziz 76