You are on page 1of 15

RELATIONS

OBJECTIVESwersdf
1. To understand relations, their properties, equivalance and order relation.
2. To understand basic notions of function, special types of function and their properties.
3. To use relation, function and their properties in solving problems.
RELATIONS
Definition: If A and B are nonempty sets, a subset of AxB is called a relation from A to B.
Example:eqweqweqw
A = 2, 4
B = 1, 3, 5
AxB = ( 2, 1 ), ( 2, 3 ), ( 2, 5 ), ( 4, 1 ), ( 4, 3 ), (4, 5 ) }
Now lets write any subsets of AxB
R1 = ( 2, 1 ), ( 4, 1 )
R2 = ( 2, 3 ) , ( 4, 3 ), ( 4, 5 )
R3 = ( 2, 1 ), ( 2, 5 ), ( 4, 3 ), ( 4, 5 )
These are relations from A to B.
Example:
Let A = B = 1, 2, 3, 4, 5
The relation R is ( greater than ) on A
a R b if a > b
R = ( 2, 1 ), ( 3, 1 ), ( 4, 1 ), ( 5, 1), ( 3, 2 ), ( 4, 2 ), ( 5, 2 ), ( 4, 3 ), ( 5, 3) ( 5, 4 )
Example:
Let R be the relation " is located in" from the set X of cities to the set Y of countries.
Paris R France Paris is located in France.
Moscow R Italy Moscow is not located in Italy.
London R England London is located in England.
Ankara R Turkey Ankara is located in Turkey.
( Moscow, Italy ) R
Definition: Domain - Range
The set of all first components of the ordered pairs of relation is called the DOMAIN of the
relation.
The set of all second components of the ordered pairs of the relation is called the RANGE of the
relation.
Example:
R1 = ( a, 1 ), ( b, 2 ), ( c, 3 )
Dom of R1 = a, b, c
Ran of R1 = 1, 2, 3
Example:
Let A be the set of all men in the world and B be the set of all women.
Let R be a relation from A to B " is a father of "
The Domain of R is the set of all men who have daughter in B.
The Range of R is the set of all women whose fathers are alive.
The MATRIX of a Relation
If A = a1, a2, ..., am and B = b1, b2, ..., bn are finite sets, containing m & n elements, respectively,
and R is a relation from A to B, we can represent R by the mxn matrix MR = [ mij ] which is
defined as follows:
mij = 1 if (aibj) R
0 if (aibj) R
The matrix MR is called the matrix of R.
Example:
Let A = a, b, c , B = 1, 2 & R = ( a, 2 ), ( b, 1 )
Then MR is a 3x2 matrix.
12

a01
b10
c00
Example:
Let A = B = 1, 2, 3, 4, 5 & let R be the relation " > "
12345
100000
210000
MR = 3 1 1 0 0 0
411100
511110
DIGRAPHS
We can use a picture to represent R on A. For each element of A, we draw a circle and label it
with the element. These circles are called vertices. Draw a line from ai to aj, with an arrow at the
end, If ai R aj. These directed lines are called edges. The picture that represents R is called a
directed graph or digraph of R.
Example:
Let A = 1, 2, 3, 4
R = (1, 1), (1, 2), (2, 1), ( 2,2), (2, 3), (2, 4), (3, 4), (4, 1)
Then the digraph of R is:

O v a l:2

Example:
Find the relation determined by the following figure.
R = (1, 1), (1, 3), (2, 3), (3, 2), (3, 3), (4, 3)
Example:
Let A = a, b, c, d and let R be the relation on A that has the matrix
abcd

a1000
MR = b 0 1 0 0
c1110
d0101
Construct the digraph of R, and list in-degrees & out-degrees of all vertices.
a b c d

In-degree 2 3 1 1

Out-degree 1 1 3 2

Example:
Let A = 1, 4, 5
and R be given by the digraph shown in the following figure.
Find MR & R

145

1011
MR = 4 1 1 0
5011
R = (1, 4), (1, 5), (4, 1), (4, 4), (5, 4), (5, 5)
PATHS IN RELATIONS AND DIGRAPHS
Let R be a relation on a set A. A path of length n in R from a to b is a finite sequence = a, x1,
x2, . . ., xn-1, b beginning with a and ending with b such that a R x1, x1 R x2, x2 R x3, . . . , xn-1 R b
A path of length n involves n+1 elements of A, but they are not necessarily distinct.
In a digraph, a path is a sequence of edges, where the direction of the edges are followed. The
length of the path is the number of edgesin the path.
Example:

1 = 1, 2, 5, 4, 3 is a path from 1 to 3 of length 4.


2 = 1, 2, 5, 1 is a path from 1 to 1 of length 3.
3 = 2, 2 is a path of length 1 from 2 to itself.
4 = 5, 4 is a path from 5 to 4 of length 1.
Definition: A path which begins & ends at the same vertex is called a cycle.
In the above example 2 is acycle of length 3 & 3 is acycle of length 1.
We can find the powers of a relation R by looking at the paths in the digraph of R. If x Rn y, then
there is a path of length n from x to y.
For example; R2 contains all the ordered pairs (a, b) where there is a path of length 2 from a to b.
From the above example,
R2 = ( 1, 2), (1, 5), (1, 3), (1, 4), (2, 2), (2, 4), (2, 5), (2, 3), (2, 1), (5, 3)
Example:
Let A = 1, 2, 3, 4, 5, 6 Let R be a relation whose digraph is shown in the following figure. The
right fiigure shows the digraph of the relation R2 on A.
1 R2 2 since 1 R 2 & 2 R 2
1 R2 4 since 1 R 2 & 2 R 4
1 R2 5 since 1 R 2 & 2 R 5
2 R2 2 since 1 R 2 & 2 R 2
2 R2 4 since 2 R 2 & 2 R 4
2 R2 5 since 2 R 2 & 2 R 5
2 R2 6 since 2 R 5 & 5 R 6
3 R2 5 since 3 R 4 & 4 R 4 R2 6 since 4 R 5 & 5 R
Example:
Let A = a, b, c, d, e
R = (a, a), (a,b), (b,c), (c,e), (c,d), (d,e)}
compute a) R2
b) R∞
ab

dc

e
a) a R2 a since a R a & a R a
a R2 b since a R a & a R b
a R2 c since a R b & a R c
b R2 e since b R c & c R e
b R2 d since b R c& c R d
c R2 e since c R d & d R e
R2 = {(a,a), (a,b), (a,c), (b,e), (b,d), (c,e)}
b) To compute R∞ , we need all ordered pairs o vertices for which there is a path of any length
from the first vertex to the second one.
R∞ = {(a,a,), (a,b), (a,c), (a,d), (a,e), (b,c), (b,c), (b,d), (b,e), (c,d), (c,e), (d,e)}
For ex: (a,d) Î R∞ - path of length 3 from a to d : a,b,c,d
(a,e) Î R∞ - there is a path of length 3 from a to e: a,b,c,e
or length 4 : a,b,c,d,e
Theorem 1:

If R is a relation on A = { a1 , a2 , …..,an } then MR2 = MR · MR


Remember that MR is the matrix which represents the relation R.
Mij = 1 if aI R aj
If we find the boolean product of MR with itself, we get the matrix for the relation R2 from our
previous example
A = {a, b, c, d, e} & R = {(a,a), (a,b), (b,c), (c,e), (c,d), (d,e)}
abcde

a110001100011100
b001000010000011

c 0 0 0 1 1 · 0 0 0 1 1 = 0 0 0 0 1 = MR 2
d000010000100000
e000000000000000

Remember in · operation, if aik = 1 & bkj = 1 for some k, then cij = 1

It is easier to compute R2 by computing MR 2 = MR · MR instead of searching the digraph


of R for all vertices that can be joined by a path of length 2.
The theorem is also true for n ≥ 2 that is MRn = MR · MR · …..MR

*Let π1 = a, x1, x2, … ……,xn-1, b be apath in relation R of length n from a to b & let π2 = b, y1,
y2, ……. ym-1, c be a path in R of length m from b to c. Then the composition of π1 &π2 is the path
a, x1, x2, ……… , b, y1, y2, ……. ym-1, c of length n + m, which is denoted by π1 · π2
Example:
Consider the relation whose digraph is given infig, and the paths π1 = 1,2,3 & π2 = 3,5,6,2,4
The composition of π1 & π2 is the path
π 2 o π1 = 1, 2, 3, 5, 6, 2, 4 from 1 to 4 of length 6
EXERCISES

O v a l:1 O v a l:4
O v a l:3 O v a l:2 O v a l:6 O v a l:5

1)
1) List all paths of length 1
2) List all paths of length 2 starting from vertex 2
3) List all paths of length 3 starting from vertex 3
4) Find a cycle starting at vertex 2
5) Find a cycle starting at vertex 6
6) List all paths of length 2
7) List all paths of length 3
8) Draw the digraph of R2
9) Find MR2
10)Find R∞
11)Find MR∞
123

75

6
2) Let R be a relation & the diagraph is the following
1) If π1 = 1,2,4,3 & π2 = 3,5,6,4 find the composition of π2 о π1
2) If π1 = 1,7,5 & π2 = 5,6,7,4,3, find the composition of π2 о π1
PROPERTIES OF RELATIONS
1) Reflexive property – Irreflexive property
Let R be a relation defined on set A. The relation has reflexive property if and only if "aÎA, (a,a)Î
R
Example:
Let A = {1,2,3,4}
R = {(1,1), (1,2), (1,4), (2,1), (2,2), (3,3), (4,1), (4,4)} is reflexive since for each aÎA, the ordered
pair (a,a)ÎR
Example:
Let A be the set of integers, then, for R = {(a,b)| a ≤b} is reflexive since every integer a, a≤a is
true.
Example:
β = R ® R & β = { (x,y)| x/y = 1} is β reflexive?
"xÎR, (x,x)Î β
In the relation, If we write x instead of y, we get x/x = 1 which is true but anlasilamadi 0/0 =
undefined & the relation does not include the ordered pair (0,0) so β is not reflexive.
Definition: A relation on A is irreflexive if aR/a for every aÎA R is irreflexive if no element is
related to itself.
Examples:
1) If A = {1,2,3,4} & R = {(2,1), (3,1), (3,2), (4,1), (4,2), (4,3)} then R is irreflexive, since the
ordered pair (a,a)ÏR for every element a.
2) Let R = {(a,b)ÎAxA| a¹b}
R is irreflexive since (a,a)ÏA for any aÎA.
3) A = {1,2,3} & R = {(1,1), (1,2)}
Is R reflexive?
R is not reflexive since (2,2)ÏR & (3,3) ÏR.
Is R irreflexive?
R is not reflexive since (1,1)ÎR
2)symmetric, Asymmetric, Antisymmetric Property:
* A relation R on a set A is symmetric if whenever aRb, then bRa. R is not symmetric there is
some a,bÎA such that aRb, but bR/a.
* A relation R on set A is asymmetric if whenever aRb, then bR/a. then, R is not asymmetric if
for some a,bÎA with both aRb & bRa.
* A relation R on a set A is antisymmetric if whenever aRb & bRa, then a = b. R is not
antisymmetric if there exists a,bÎR such aRb& bRa, & a¹b.
Examples:
1) Let A = {1,2,3,4}
R1 = {(1,1), (1,2), (2,1)} is symmetric since for every ordered pair (a,b)ÎR, (b,a) ÎR
R2 = {(1,1), (1,2), (2,1), (2,2), (3,4), (4,1), (4,4)} is not symmetric since (3,4) ÎR, but (4,3) ÏR
3R4 but 4R/3
R3 = {(2,1), (3,1), (3,2), (4,1), (4,2), (4,3)} is not anti-symmetric since whenever aRb & bRa,
then a=b. Since there are no (a,b) such that aRb & bRa, the defn. holds. R3 is asymmetric since
whenever aRb, bR/a.
2) Let A = Z+ , the set of positive integers, and let R = {(a,b)ÎAxA|a divides b}
Is R symmetric, asymmetric, or antisymmetric?
If a|b, it does not follow that b|a, so R is not symmetric.
If a = b = 3 then aRb & bRa, so R is not asymmetric
If a|b & b|a, then a = b, so R is anti-symmetric.
Now we characterize symmetric, asymmeric or anti-symmetric properties of a relation by
roperties of its matrix. The matrix MR = [Mij] of a symmetric relation satisfies the property that if
Mij = 1. The matrix for a symmmeric relation has elements which are symmetric to the main
diagonal that are equal either both are 0 or both are 1 for a symmetric rel. R, MR = MRT

1100
1 0 0 0 R ={(1,1), (1,2), (2,1)}
MR = 0 0 0 0
0000
If R is asymmetric, it follows that Mij = 0 for all ij that is, the main diagonal of the matrix MR
consistentinely of 0`s.
R = {(2,1), (3,1), (3,2), (4,1), (4,2), (4,3)}

0000
MR = 1 0 0 0 If Mij = 1, then Mij = 0, since if iRJ , then jR/i
1 1 0 0 Mij = 0 for all i, all elements on the main diagonal
1 1 1 0 must be zero.
The matrix MR = [mij] of an antisymmetric relation R satisfies the property that if i¹j, then Mij =
0 or Mji = 0
Example:
A divides b
R = {(1,1), (1,2), (1,3), (1,4), (2,2), (2,4), (3,3), (4,4)}

1111
0 1 0 1 For all i¹j either Mij = 0 or Mji =0
MR = 0 0 1 0 Mij = 1=Mji only if I = j
0001

Example:
1010110
MR1 = 0 0 1 MR2 = 1 1 0 0
1111011
0011
R1 &R2 are symmetric since the matricesMR1 & MR2 are symmetric matrices.

111
MR3 = 0 1 0
001
Relation R3 is antisymmetric, since no symmetrically situated. R3 is not asymmetric because MR3
has 1`s on the main diagonal.
Not symmetric 1R3 but 3R/1

You might also like