Unit 1
Unit 1
Overview:
Cartesian product of sets
Relations and their properties
Composition of relations
POSets and equivalence sets
Matrix representation of relations
Digraph of relations
Closures of relations
n-tuples
Database and Relations
Cantor‘s diagonal argument
The Power set theorem
Schroder-Bernstein Theorem
Introduction:
Much of mathematics is about finding a pattern – a recognisable link between quantities that change.
In our daily life, we come across many patterns that characterise relations such as brother and sister,
father and son, teacher and student.
In mathematics also, we come across many relations such as
number m is less than number n,
line is parallel to line ,
set A is a subset of set B.
In all these, we notice that a relation involves pairs of objects in certain order.
In this Chapter, we will learn how to link pairs of objects from two sets and then introduce relations
between the two objects in the pair. Finally, we will learn about special relations which will qualify
to be functions. The concept of function is very important in mathematics since it captures the idea of
a mathematically precise correspondence of one quantities with the other.
Prerequisites:
Theory of sets: Definition
Operations on sets
Cardinality of sets
Subset and Power set
Application:
The time required to manipulate information in a database depends on how this information is stored.
The operations of adding and deleting records, updating records, searching for records, and
combining records from overlapping databases are performed millions of times each day in a large
database. Because of the importance of these operations, various methods for representing databases
have been developed. One of these methods, called the relational data model is based on the
concept of a relation.
The database query language SQL (short for Structured Query Language) can be used to carry out
the operations we have described in this section. Example 12 illustrates how SQL commands are
related to operations on n-ary relations.
CARTESIAN PRODUCTS OF SETS
The ordered n-tuple is the ordered collection ( ) that has as its first element, as its
second element,…, and as its nth element.
Two ordered n-tuples are equal if and only if each corresponding pair of their elements is equal.
In other words, ( ) ( ) if and only if for
Definition
Let P and Q be two sets. The Cartesian product P × Q is the set of all ordered pairs ( ), where
and
i.e. *( ) +
Note the following:
The Cartesian product of the sets denoted by is the set of
ordered n-tuples ( ), where belongs to for .
In other words, *( )| +The ordered
pairs ( ) and ( ) are equal if and only if and .
If either P or Q is the null set, then P × Q will also be empty set.
If A and B are non-empty sets and either A or B is an infinite set, then so is A × B .
If there are p elements in A and q elements in B, then there will be pq elements in A × B,
i.e., if n(A) = p and n(B) = q, then n(A × B) = pq.
*( )| +
Illustration
Consider the two sets: * +, where represent Delhi, Madhya Pradesh and
Karnataka, respectively and * + representing codes for the licence plates of vehicles
issued by DL, MP and KA .
If the three states, Delhi, Madhya Pradesh and Karnataka were making codes for the licence plates of
vehicles, with the restriction that the code begins with an element from set A, which are the pairs
available from these sets and how many such pairs will there be ?
The available pairs are:
(DL,01), (DL,02), (DL,03), (MP,01), (MP,02), (MP,03), (KA,01), (KA,02), (KA,03) and the product
of set A and set B is given by
A × B = {(DL,01), (DL,02), (DL,03), (MP,01), (MP,02), (MP,03), (KA,01), (KA,02), (KA,03)}.
It can easily be seen that there will be 9 such pairs in the Cartesian product, since there are 3
elements in each of the sets A and B. This gives us 9 possible codes.
Also note that the order in which these elements are paired is crucial.
For example, the code (DL, 01) will not be the same as the code (01, DL).
RELATIONS AND THEIR PROPERTIES
Definition
A relation R from a non-empty set A to a non-empty set B is a subset of the Cartesian product A × B.
The subset is derived by describing a relationship between the first element and the second element
of the ordered pairs in A × B.
The second element is called the image of the first element.
For example, *( )( )( )( ) ( ) ( ) ( )+ is a relation from the set * +
to the set * +.
A relation from a set A to itself is called a relation on A.
Definition
The set of all first elements of the ordered pairs in a relation R from a set A to a set B is called the
domain of the relation R.
Definition
The set of all second elements in a relation R from a set A to a set B is called the range of the
relation R. The whole set B is called the codomain of the relation R.
Problem.2
Let * + and * + and let *( )| +.
1) Write all the elements of and 2) Write the inverse relation of R.
3) Find the Domain and Range of and .
Solution:
1) *( ) ( ) ( ) ( )+
* ( ) ( ) ( ) ( ) ( )+
2) *( ) ( ) ( ) ( )+
3) ( ) * + ( ) * +
( ) * + ( ) * +
Problem.3
Consider these relations on the set of integers:
*( )| +,
*( )| +
*( )| +
*( )| +
*( )| +
*( )| +
Which of these relations contain each of the pairs (1,1), (1,2), (2,1), (1,−1), and (2,2)?
Solution:
The pair (1,1) is in R1, R3, R4, and R6; (1,2) is in R1 and R6; (2,1) is in R2, R5, and R6; (1,−1) is in R2,
R3, and R6; and finally, (2,2) is in R1, R3, and R4.
Exercise
1. Let * + Let a relation on be defined as
*( ) +. Write down its domain, codomain and range.
2. Let * + and * + . Find the number of relations from to . Which of the
following is not a relation from to ? Justify your answer.
(i) *( )( ) ( )+
(ii) *( ) ( )+
(iii) *( )( ) ( )+
(iv) *( )( )+
3. If *( ) ( ) ( )+ and *( ) ( ) ( )+ represents some relations on some
sets then what is 1) 2) 3) 4) – 5) R⊕S
Also verify if (i) ( ) ( ) ( )
and (ii) ( ) ⊆ ( ) ( )
COMPOSITE OF RELATIONS
Definition
Let be a relation from a set to a set and a relation from B to a set .
The composite of and given by is the relation from to consisting of ordered pairs ( )
where , , and for which there exists an element such that ( ) and
( ) S.
Thus, *( )|( ) ( ) +.
In other words ( ) if and only if and for some .
Note:
1. The powers of a relation R can be recursively defined from the definition of a composite of
two relations.
Let R be a relation on the set A. The powers are defined recursively by
and
Thus, R2 = R ◦R, R3 = R2 ◦R = (R ◦R)◦R, and so on.
Problem.1
Let *( ) ( ) ( ) ( ) ( )+ and * ( ) ( ) ( ) ( ) ( )+ be two relations
on some sets. Check if is possible or not. If it is possible then write the elements of the relation
.
Solution
Here, ( ) * + is a subset of ( ) * +
Hence, is Possible.
Further, *( ) ( ) ( ) ( ) ( ) ( )+
Problem.2
Let *( )( )( )( )}. Find the powers Rn, n= 2,3,4,....
Solution
*( )( ) ( ) ( )+
Further, *( ) ( ) ( ) ( )+
Similarly, *( ) ( ) ( ) ( )+
It follows that for
Exercise:
1. Let *( ) ( ) ( ) ( ) ( ) ( )+ and * ( ) ( ) ( ) ( )+ be two
relations on some sets. Check if is possible or not. If it is possible then write the elements
of the relation .
PROPERTIES OF RELATIONS
Let be a set. Let be a relation on it.
The relation is said to be reflexive if ( ) for every
In other words, a relation on A is reflexive if every element of A is related to itself.
The relation is said to be transitive, if ( ) ( ) ( ) , for
all
The relation is said to be symmetric ( ) ( ) for all
The relation is said to be anti-symmetric if ( ) ( ) ,for all
In other words, a relation R on a set A is anti-symmetric if and only if there are no pairs of
distinct elements and with related to and related to .
i.e. the only way to have related to and related to is for and to be the same
element.
Definition
A relation R on a set A is said to be equivalence relation, if R is reflexive, transitive and symmetric.
A relation R on a set A is said to be partially ordered relation, if R is reflexive, transitive and anti-
symmetric.
A set with a partially ordered operation ,(i.e. ( )) is said to be Partially Ordered Set (POSet).
Note:
(i) The terms symmetric and antisymmetric are not opposites.
(ii) If R is an equivalence relation, and ( ) , then and are called equivalent. The notation
is often used to denote that and are equivalent elements with respect to a particular
equivalence relation.
Problem.2
Show that the ―greater than or equal‖ relation (≥) is a partial ordering on the set of integers.
Solution:
Because a ≥ a for every integer a, ≥ is reflexive.
If a ≥ b and b ≥ a, then a = b.
Hence, ≥is antisymmetric.
Finally, ≥is transitive because a ≥ b and b ≥ c imply that a ≥ c.
It follows that ≥is a partial ordering on the set of integers and (Z,≥) is a poset.
Problem.3
Show that the inclusion relation ⊆ is a partial ordering on the power set of a set S.
Solution:
Because A ⊆A whenever A is a subset of S,⊆ is reflexive.
It is antisymmetric because A ⊆ B and B ⊆ A imply that A = B.
Finally, ⊆is transitive, because A ⊆ B and B ⊆ C imply that A ⊆ C.
Hence, ⊆is a partial ordering on P(S), and (P(S),⊆ )is a POset.
Exercise
1. Check whether the following relations are equivalence relation or not on the set of all integers
Where if and only if 1) 2)
2. Check whether from the following relation sets, which are satisfying the transitive, reflexive
or symmetric property which relation is an Equivalence relation and partially ordered
relation.
1) R1 = {(1, 1), (2, 2), (3, 3)}
2) R2 = {(1, 1), (2, 2), (1, 2), (2, 1), (3, 1)}
3) R3= {(1, 1), (1, 2), (2, 1), (1, 3), (3, 1)}
4) R4= {(1, 1), (2, 2), (3, 3), (1, 2), (2, 1), (1, 3), (3, 1), (2, 3), (3, 2)}
3. Prove that ( ) is a partially ordered set where Z is the set of integers.
4. Check if with the ‗ ‘ relation is a POSet.
Function
We can, visualise a function as a rule, which produces new elements out of some given elements.
There are many terms such as ‗map‘ or ‗mapping‘ used to denote a function.
Definition
A relation f from a set A to a set B is said to be a function if every element of set A has one and only
one image in set B.
In other words,
A relation f is a function from a non-empty set A to a non-empty set B if
(i) the domain of f is A
(ii) no two distinct ordered pairs in f have the same first elements.
Note:
If is a function from A to B and ( ) , then we write ( ) , where is called the image
of under and is called the preimage of under f.
Problem.1
Examine each of the following relations given below and state in each case, giving reasons whether
it is a function or not on the given domain?
(i) R = {(2,1),(3,1), (4,2)}, Domain * +
(ii) R = {(2,2),(2,4),(3,3), (4,4)} , Domain * +
(iii) R = {(1,2),(2,3),(3,4), (4,5), (5,6), (6,7)}, Domain * +
REPRESENTION OF RELATIONS
Representing Relations Using Matrices
A relation between finite sets can be represented using a zero–one matrix.
Suppose that R is a relation from * + to * +.
(Here 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 , - where {
( )
In other words, the zero–one matrix representing R has a 1 as its( )th entry when is related to
, and a 0 in this position if is not related to .
Note: Such a representation depends on the orderings used for A and B.
Problem.1
Suppose that * +and * +
Let R be the relation from A to B containing ( ) if .
What is the matrix representing R?
Solution
Because *( )( )( )+, the matrix for R is MR = [ ]
Problem.2
Let * + and * +
Solution:
Because R consists of those ordered pairs ( ) with , it follows that
*( )( )( )( )( )( )( )+
Remark
R is reflexive if and only if for .
In other words, R is reflexive if all the elements on the main diagonal of MR are equal to 1.
Note that the elements off the main diagonal can be either 0 or 1.
Problem.3
Suppose that the relations R and S on a set A are represented by the matrices
=[ ]and =[ ]
Solution:
The matrices of these relations are
[ ] and [ ]
Problem.4
Find the matrix representing the relation , where the matrices representing R and S are
MR =[ ]and MS =[ ]
Solution:
Exercise
1. Let R be the relation represented by the matrix [ ]. Find the matrix representing
(a) (b) ( )
Definition
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. Such an edge
is called a loop.
REMARKS
A relation R 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 ( ) occurs in the relation.
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 (completing a triangle
where each side is a directed edge with the correct direction).
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 ( ) is in the relation whenever ( ) is in
the relation.
A relation is antisymmetric if and only if there are never two edges in opposite directions
between distinct vertices.
(a) (b)
Solution.
(a) *( )( )( )( )( )( )( )( )( )+
[ ]
(b) *( )( )( )( )( )( )( )( )+
[ ]
Exercise
1. Write the relation represented by the following matrices and also draw the corresponding
digraph.
(a) (b) (c)
[ ] [ ]
[ ]
CLOSURES OF RELATIONS
Introduction
Let be a relation on a set .
may or may not have some property , such as reflexivity, symmetry, or transitivity. If there is a
relation with property containing such that is a subset of every relation with property
containing , then is called the closure of .
In other words, is the smallest superset of with the property .
Reflexive closure of R
For given a relation R on a set A, the reflexive closure of R can be formed by adding to R all pairs of
the form ( ) with , 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. Consequently, it is the reflexive closure of .
Thus, the reflexive closure of R can be given by R Δ, where *( )| +is the diagonal
relation on A.
Problem.2
The relation *( )( )( )( )+on the set * + is not reflexive. Obtain the
reflexive closure of R.
Solution Here, diagonal relation on is *( )( )( )+
Therefore, the reflexive closure of is *( )( )( )( )( )( )+
Problem.2
What is the reflexive closure of the relation *( )| +on the set of integers?
Solution: The reflexive closure of R is
*( )| + *( )| + *( )| +
Symmetric closure of R
The symmetric closure of a relation R can be constructed by adding all ordered pairs of the form
( ) for all ( ) 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. Consequently, it is the symmetric closure of .
The symmetric closure of a relation can be constructed by taking the union of a relation with its
inverse
i.e., is the symmetric closure of R, where *( )|( ) +
Problem.1
Find the symmetric closure of the relation*( )( )( )( )( )( )+on* +.
Solution.
*( )( )( )( )( )( )+
Therefore, symmetric closure of is
*( )( )( )( )( )( )( )( )+
Problem.2
What is the symmetric closure of the relation *( )| + on the set of positive integers?
Solution:
*( )| + *( )| + *( )| +
The symmetric closure of R is the relation
*( )| + *( )| + *( )| +
Transitive closure of R
Suppose that a relation R is not transitive.
Let be the zero–one matrix of the relation R on a set with elements.
Let be the transitive closure of .
Then the zero–one matrix of the transitive closure is
, - , - , -
[ ]
Solution:
The zero–one matrix of is , - , - .
Now, , - is the matrix of the composite relation
, - [ ]
and , - is the matrix of the composite relation
, - [ ]
Hence,
[ ] [ ] [ ] [ ]
Exercise:
1. Let R be the relation on the set {0,1,2,3} containing the ordered pairs (0,1), (1,1), (1,2), (2,0),
(2,2), and (3,0). Find a) reflexive closure of R.
b) symmetric closure of R.
Exercise:
1. Consider the following Tables.
a. What do you obtain when you apply the selection operator , where C is the condition
( ) ( ), to the database in the table of Parts_inventory.?
b. Construct the table obtained by applying the join operator J2 to the relations in the following
tables
CANTOR’S DIAGONAL ARGUMENT
Finite and infinite sets:
Let S be a set. If there are exactly n distinct elements in S where n is a nonnegative integer, we say
that S is a finite set and that n is the cardinality of S. The cardinality of S is denoted by |S|.
A set is said to be infinite if it is not finite.
The highlighted digits are 0.37210 . . . . Suppose that we add 1 to each of these digits, to get the
number
0.48321 . . . . then this number can‘t be in the table. Because
• it differs from f(1) in its first digit;
• it differs from f(2) in its second digit;
•...
• it differs from f(n) in its nth digit;
•...
So it can‘t equal f(n) for any n — that is, it can‘t appear in the table
This looks like a trick, but in fact there are lots of numbers that are not in the table.
As long as we highlight at least one digit in each row and at most one digit in each column, we can
change each the digits to get another number not in the table.
Therefore, there does not exist a bijection between and , -.
Hence, , - is not a countable set.
Since, cardinality of and , - is same, is also uncountable.
Schroder-Bernstein Theorem
If A and B are sets with | | | | and | | | |, then | | | |. In other words, if there are one-
to-one functions f from A to B and g from B to A, then there is a one-to-one correspondence between
A and B.