Relations Chapter 2
Relations Chapter 2
Relations
Cartesian Product & Ordered
Pairs
An ordered pair of elements is written in the form
(a, b) which is distinct from (b, a) unless a = b
Definition(Cartesian Product) :
For sets A, B U , the Cartesian product, or
cross product, of A and B is denoted by A B
and A B {( a, b) | a A, b B}.
Example:
Let A {x, y} and B {a, b, c} then
A B {(x, a), (x, b), (x, c), (y, a), (y, b), (y, c)}
& B A {(a, x), (a, y), (b, x), (b, y), (c, x), (c, y)}
A A {(x, x), (x, y), (y, x), (y, y)}
Certainly A B B A ( in general)
Example
X = { 1, 2}
Y = { a, b}
X x Y = {(1,a),(1,b),(2,a), (2,b)}
Y x X = { (a, 1), (a,2), (b,1), (b,2)}
Note:
XxYYxX
| X x Y | = |X| .|Y|
Determine:
XxX=
YxY =
Ordered lists
The ordered list does not have to be
restricted to two elements, such as in an
ordered pair.
An n-tuple, written (a1, a2, a3… an) takes order
into account.
Cartesian product of sets X1, X2, X3… Xn is
defined to be the set of all n-tuples (x1, x2, x3…
xn) where xi Xi for i = 1,2,..n
X 1 x X 2 x X 3 x… X n
Relation : Definition
Definition (Relation) : For sets A, B U , any subset of A B is called
a relation from A to B. Any subset of A A is called a binary
relation on A.
of the relation R
Example
Let R = {(1,1), (1,2), (1,3), (1,4), (2,2), (2,3),
(2,4), (3,3), (3,4),} be a relation on
A={1,2,3,4} 1 2
A Loop
4 3
Exercise:
The Relation R on X = {a, b, c, d} is
R = {(a,a), (b,c), (c,b), (d,d)}
What would the digraph to represent this relation
look like?
Representing Relations
Using Matrix
Let A = { 1 , a 2 ,..., a m } and B={b1 , b2 ,..., bn }
a
Let R be relation from A to B. Then R is represented by
a matrix M R [ mij ]mn where
1
if ( ai , b j ) R
mij
0
if (ai , b j ) R
The matrix M R is called the matrix of R.
Example : Let A {1,2,3,4} and B {x, y, z}
Let R {(1, y ), (2, z ), (3, x), (3, y ), (4, x), (4, z )} be a relation from A to B.
Then M R is given by 0 1 0
x y z 0 0 1
10
M R .
1 0 1 1 0
20 0 1
1 0 1
31 1 0
41 0 1
Types of Relations:
Symmetric
Antisymmetric
Transitive
Reflexive and Irreflexive
A relation R on a set A is called reflexive
if (a, a) R for every a A
e.g. Let A = {1,2,3,4}, then
R = { (1,1), (1,2), (1,3), (1,4), (2,2), (2,3), (2,4), (3,3), (3,4),(4,4)}
is Reflexive, while
R*={(1,1),(1,2),(1,3),(1,4),(2,3),(2,4),(3,3),(3,4)}
is not a reflexive relation on A.
A relation R on a set A is called irreflexive if
antisymmetric.
Antisymmetric (continued)
Is R2 = {(a, a), (b, c), (c, b), (d, d)} is
antisymmetric?
No. Both (b,c) and (c,b) are in R.
If a relation R on X has no members of the
form (x, y) with xy, then R is antisymmetric.
WHY?
Let R = {(a,a), (b,b), (c,c)}
then R is antisymmetric
Is R also Symmetric? Yes.
NB. “Antisymmetric” is not the same as
Transitivity
then b = a
Thus, (a,a) is allowed to be in R
Symbol usage
The symbol is used to represent any
partial order relation.
Not just the less than or equals to relation
Can represent ≤, ≥,, etc
Thus, a b denotes that (a,b) R
The poset is (S,)
Example: (Z,≤)
Is a total ordered poset (every element is comparable to
every other element)
It has no least element
Thus, it is not a well-ordered set
and u
k 1 v
k 1
2
1
Hasse Diagram