0% found this document useful (0 votes)
43 views36 pages

DM - CH 1 (Set, Relation - Functions)

The document provides an introduction to the concepts of sets, relations, and functions in discrete mathematics, focusing on definitions, representations, types of sets, and operations on sets. It covers essential topics such as union, intersection, and the Cartesian product, along with properties and applications of these operations. Additionally, it introduces Venn diagrams and De Morgan's laws, highlighting their relevance in understanding set relationships.

Uploaded by

shaikaaweez3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views36 pages

DM - CH 1 (Set, Relation - Functions)

The document provides an introduction to the concepts of sets, relations, and functions in discrete mathematics, focusing on definitions, representations, types of sets, and operations on sets. It covers essential topics such as union, intersection, and the Cartesian product, along with properties and applications of these operations. Additionally, it introduces Venn diagrams and De Morgan's laws, highlighting their relevance in understanding set relationships.

Uploaded by

shaikaaweez3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

Lecture 1

PARUL UNIVERSITY - FACULTY OF ENGINEERING & TECHNOLOGY


Department of Applied Science & Humanities
3rd Semester B. Tech (CSE, IT)
Discrete Mathematics (203191202)
UNIT-1 Sets, Relation & Functions

I. Introduction:
In everyday life, we often speak of collections of objects of a particular kind, such as, a pack of
cards, a crowd of people, a cricket team, etc. In mathematics also, we come across collections,
for example, of natural numbers, points, prime numbers, etc. More specially, we examine the
following collections:
a. Odd natural numbers less than 10, i.e., 1, 3, 5, 7, 9
b. The rivers of India.
c. The vowels in the English alphabet, namely, a, e, i, o, u
d. Various kinds of triangles
e. Prime factors of 210, namely, 2,3,5 and 7
f. The solution of the equation: x2 – 5x + 6 = 0, viz., x=2 and x=3.

We give below a few more examples of sets used particularly in mathematics


N: the set of all natural numbers
Z: the set of all integers
Q: the set of all rational numbers
R: the set of real numbers
Z+: the set of positive integers
Q+: the set of positive rational numbers
R+: the set of positive real numbers.

Definition:
SET: A set is a well-defined collection of objects.

II. Representations of a set


There are two methods of representing a set:
a. Roster or tabular form
In roster form, all the elements of a set are listed, the elements are being separated by commas
and are enclosed within braces { }.
For example:
i. The set of all even positive integers less than 7 is described in roster form as {2, 4, 6}.

b. Set-builder form
In set-builder form, all the elements of a set possess a single common property which is not
possessed by any element outside the set.
For example
1. In the set {a, e, i, o, u}, all the elements possess a common property, namely, each of
them is a vowel in the English alphabet, and no other letter possess this property.
i.e. V = {x: x is a vowel in English alphabet}

III. Types of Sets:


i. The Empty Set
A set which does not contain any element is called the empty set or the null set or the void set.
It is denoted by the symbol φ or { }.

For Example:
(i) B = { x : x is a student presently studying in both Classes X and XI }={}
A student cannot study simultaneously in both Classes X and XI. Thus, the
set B contains no element at all.

ii. Finite and Infinite Sets


A set which is empty or consists of a definite number of elements is called finite otherwise, the
set is called infinite.

Examples:
(i) Let W be the set of the days of the week. Then W is finite.
(ii) Let G be the set of points on a line. Then G is infinite.

iii. Equal Sets


Two sets A and B are said to be equal if they have exactly the same elements and we write A =
B. Otherwise, the sets are said to be unequal and we write A ≠ B.

For examples:
(i) Let A = {1, 2, 3, 4} and B = {3, 1, 4, 2}. Then A = B.

iv. Subsets
A set A is said to be a subset of a set B if every element of A is also an element of B.
A is subset of B is expressed in symbols as A ⊂ B.

A  B if a  A ⇒ a  B

NOTE:
1. Every set A is a subset of itself.
2. φ is a subset of every set.

v. Proper Subset and Superset


Let A and B be two sets. If A  B and A ≠ B, then A is called a proper subset of B and B is
called superset of A.

For example:
A = {1, 2, 3} is a proper subset of B = {1, 2, 3, 4}.

vi. Singleton Set


If a set A has only one element, we call it a singleton set. A={a} is a singleton set.

Example 9: Consider the sets φ, A = {1, 3 }, B = {1, 5, 9}, C = {1, 3, 5, 7, 9}.

(i) φ  B (ii) A  B (iii) A  C (iv) B  C

Subsets of set of real numbers


The set of natural numbers N = {1, 2, 3, 4, 5 . . .}
The set of integers Z = {. . ., –3, –2, –1, 0, 1, 2, 3 . . .}
p
The set of rational numbers Q = {x: x = , p, q  Z , q  0 }
q
N  Z  Q,
QR

vii. Power Set:


The collection of all subsets of a set A is called the power set of A. It is denoted by P(A).
In P(A), every element is a set.
Thus, as in above, if A = { 1, 2 }, then P( A ) = { φ,{ 1 }, { 2 }, { 1,2 }}
Also, note that n[P(A)]=4= 2 2
NOTE: If A is a set with n (A) =m, then it can be shown that n [P (A)] = 2m .

viii. Universal Set:


While studying the system of numbers, we are interested in the set of natural numbers and its
subsets such as the set of all prime numbers, the set of all even numbers, and so forth. This basic
set is called the “Universal Set”. The universal set is usually denoted by U and all its subsets by
the letters A, B, C, etc.

IV. Venn Diagrams:


Most of the relationships between sets can be represented by means of diagrams which are
known as Venn diagrams. Venn diagrams are named after the English logician, John Venn
(1834-1883). These diagrams consist of rectangles and closed curves usually circles. The
universal set is represented usually by a rectangle and its subsets by circles.
In Venn diagrams, the elements of the sets are written in their respective circles.

Example: U = {1,2,3, ..., 10} is the universal set of which A = {2,4,6,8,10} is a subset.
Figure:1-1
Example: U = {1,2,3, ..., 10} is the universal set of which A = {2,4,6,8,10} and B = {4, 6} are
subsets, and also B  A .

Figure:1-2

V. Operations on Sets

1. Union of sets
The union of two sets A and B is the set which consists of all those elements which are either in
A or in B (including those which are in both).
A ∪ B = {x : x ∈A or x ∈B}

Figure:1-3

Some Properties of the Operation of Union


(i) A  B = B  A (Commutative law)
(ii) ( A  B )  C = A  ( B  C ) (Associative law )
(iii) A   = A (Law of identity element, φ is the identity of ∪)
(iv) A  A = A (Idempotent law)
(v) U  A = U (Law of U)

2. Intersection of sets

The intersection of two sets A and B is the set of all those elements which belong to bothA and
B.A ∩ B = {x : x  A and x  B }

Figure:1-4

3. Disjoint Sets: If A and B are two sets such that A ∩ B = φ, then A and B are called
disjoint sets.

Figure:1-5

Some Properties of Operation of Intersection


(i) A ∩ B = B ∩ A (Commutative law).
(ii) (A ∩ B) ∩ C = A ∩ (B ∩ C) (Associative law).
(iii) φ ∩ A = φ, U ∩ A = A (Law of φ and U).
(iv) A ∩ A = A (Idempotent law)
(v) A ∩ ( B  C ) = (A ∩ B)  (A ∩ C) (Distributive law )i. e., ∩ distributes over 
Figure:1-6

4. Difference of sets
The difference of the sets A and B is the set of elements which belong to A but not to B.
A – B = { x : x  A and x  B }

Figure:1-7
Figure:1-8

5. Complement of a Set
Let U be the universal set and A a subset of U. Then the complement of A is the set of all
elements of U which are not the elements of A.
A′ = {x: x U and x  A }

Figure:1-9

Some Properties of Complement Sets


1. Complement laws: (i) A  A' = U (ii) A  A' = φ
2. Law of double complementation: (A′ )′ = A
3. Laws of empty set and universal set φ′ = U and U′ = φ.

Note: If A is a subset of the universal set U, then its complement A′ is also a subset of U.

VI. De Morgan’s Laws


The complement of the union of two sets is the intersection of their complements and the
complement of the intersection of two sets is the union of their complements. These are called
De Morgan’s laws.
(i) ( A  B)' = A' B'
(ii) ( A  B)' = A' B'

Applications:
1. Let A and B be finite sets. If A ∩ B = φ, then n(A∪B)=n(A)+n(B)
2. In general, if A and B are finite sets, then n(A∪B)=n(A)+n(B)–n(A∩B)
3. The sets A – B, A ∩ B and B – A are disjoint and their union is A  B
n(A  B)=n(A–B)+n(A∩B)+n(B–A)
= n(A–B)+n(A∩B)+n(B–A)+n(A∩B)–n(A∩B)
= n(A)+n(B)–n(A∩B)
4. If A, B and C are finite sets, then
n(A∪B∪C)=n(A)+n(B)+n(C)–n(A∩B)–n(B∩C)–n(A∩C)+n(A∩B∩C)

Example: If X and Y are two sets such that X  Y has 50 elements, X has 28 elements and Y
has 32 elements, how many elements does X ∩ Y have?
Solution: Given that n(X  Y)=50, n(X)=28, n(Y)=32, n(X∩Y) = ?
By using the formula
n ( X  Y ) = n ( X ) + n ( Y ) – n ( X ∩ Y ),

n ( X ∩ Y ) = n ( X ) + n ( Y ) – n ( X Y )
= 28 + 32 – 50 = 10

Figure:1-10

Example:

Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} and A = {1, 3, 5, 7, 9}, B={2, 4, 5, 8, 9, 10}, C={1, 5, 9}.
Find
(i) A, B, C 
(ii) A  B
(iii) A  B
(iii) Verify DeMorgan's Laws

( A  B ) = ( A  B ) and ( A  B ) = ( A  B )

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 a1,a2,…,an that has a1 as its first element, a2 as its
second element,…, and an 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, a1,a2,…,an=(b1,b2,…,bn) if and only if ai=bi for i = 1, 2, . . . , n.

Definition
Let P and Q be two sets. The Cartesian product P × Q is the set of all ordered pairs p,q, where
p∈P and q∈Q
i.e. P×Q=p,q:p∈P, q∈Q
Note the following:
• The Cartesian product of the sets A1,A2,…,An denoted by A1A2An is the set of ordered n-
tuples a1,a2,…,an, where ai belongs to Ai for i = 1, 2, . . . , n.
In other words, A1A2An=aiAi, for i=1,2,…,nThe ordered pairs (a, b) and c, d are equal if
and only if a = c and b = d.
• 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.
• An=A×A××A=ai∈A, for i=1,2,…,n

Illustration
Consider the two sets: A={DL, MP, KA}, where DL, MP, KA represent Delhi, Madhya Pradesh
and Karnataka, respectively and B = 01,02, 03 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, R = a, 0, a, 1, a, 3, b, 1, b, 2, c, 0, c, 3 is a relation from the set {a, b, c} to the set
{0, 1, 2, 3}.
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.

Note the following:


• Range ⊆ Codomain.
• If (a,b)∈R, then we say that a is related to b, which can also be written as aRb.
• The total number of relations that can be defined from a set A to a set B is the number of
possible subsets of A × B.
• If n(A ) = p and n(B) = q, then n (A × B) = pq and the total number of relations = 2pq
• A relation R in a set A is called empty relation (void relation), if no element of A is related
to any element of A, i.e., R = φ⊂ A × A.
• A relation R in a set A is called universal relation, if each element of A is related to every
element of A, i.e., R = A × A.
• Both the empty relation and the universal relation are sometimes called trivial relations.
• A relation R in a set A is called identity relation, if each element of A is related to itself
only. i.e., R={(a,a)|a∈A}
• In case of relations from a set A to a set B, A×B is considered as the universal relation. The
complement relation of a relation R is denoted and given as R'=A×B-R.
• If R=a∈A,b∈B then the inverse relation is denoted and given as R-1=a∈A,b∈B.
• Union, intersection, difference and other operations of sets are all applicable to relations as
they are for sets.
Problem.1
What is the largest possible relation from the set A=1,2,3,4,5 to the set B=1,2,3?
Write the relations from A to B in each of the following cases when
1) a is related to b if and only if a≥b
2) a is related to b if and only if a>b
3) a is related to b if and only if a<b
4) aRb if and only if a + b>4
5) (a,b)∈R if and only if a is a devisor of b
Solution:
The largest possible relation from A to B is
A×B={1,1,1,2,1,3,2,1,2,2,2,3, 3,1,3,2,3,3,
4,1,4,2,4,3,5,1,5,2,5,3}
R={a,b|a≥b,a∈A,b∈B}={1,1,2,1,2,2,3,1,3,2,3,3,4,1,4,2,4,3,5,1,5,2,5,3}
1. R={a,b|a>b,a∈A,b∈B}={2,1,3,1,3,2,4,1,4,2,4,3,5,1,5,2,5,3}
2. R={a,b|a<b,a∈A,b∈B}={1,2,1,3,2,3}
3. R={a,b|a+b>4,a∈A,b∈B}={2,3, 3,1,3,2,3,3,4,1,4,2,4,3,5,1,5,2,5,3}
4. R={a,b|a is a devisor of b,a∈A,b∈B}={1,1,1,2,1,3,2,2,(3,3)}

Problem.2
Let A=1, 2, 5 and B=3, 5,7 and let R=7≤a+b<10, a∈A,b∈B.
1) Write all the elements of R and R’ 2) Write the inverse relation of R.
3) Find the Domain and Range of R and R-1 .
Solution:
1. R=1,7,2,5,2,7,5,3 R'={1,3,1,5,2,3,5,5,5,7}
2. R-1=7,1,5,2,7,2,3,5
3. DomR=1,2,5, RangeR=3,7,5DomR-1=3,7,5, RangeR=1,2,5

Problem.3
Consider these relations on the set of integers:
R1 ={(a,b) | a ≤ b},
R2 ={(a,b) | a>b },
R3 ={(a,b) | a = b or a =- b},
R4 ={(a,b) | a = b},
R5 ={(a,b) | a = b+1},
R6 ={(a,b) | a+b ≤ 3}.
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 A = {1, 2, 3,...,14}. Let a relation R on A be defined as
R={(x, y) :3x-y=0, where x, y ∈A}. Write down its domain, codomain and range.
2. Let A={x, y, z} and B={1, 2}. Find the number of relations from A to B. Which of the
following is not a relation from A to ? Justify your answer.
i.x,1,y,2,(z,3)
ii.x,1,x,2
iii.x,2,y,2,z,2
iv.1,x,2,x
3. If R = 1,2,2,4,3,3 and S = 1,3,2,4,4,2 represents some relations on some sets then what is
1) R ∪ S 2) R ∩ S 3) R -S 4) S –R 5) R⊕S
Also verify if (i) Domain of R∪ S=Domain of RDomain ofS
and (ii)Range(R ∩ S) ⊆ Range (R) ∩ Range(S)
Lecture 2
PARUL UNIVERSITY - FACULTY OF ENGINEERING & TECHNOLOGY
Department of Applied Science & Humanities 3rd Semester B. Tech (CSE, IT)
Discrete Mathematics (203191202)
UNIT-1 Sets, Relation & Functions

CARTESIAN PRODUCTS OF SETS


The ordered n-tuple is the ordered collection (𝑎1 , 𝑎2 , … , 𝑎𝑛 ) that has 𝑎1 as its first element,
𝑎2 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, (𝑎1 , 𝑎2 , … , 𝑎𝑛 ) = (𝑏1 , 𝑏2 , … , 𝑏𝑛 ) if and only if 𝑎𝑖 = 𝑏𝑖 for 𝑖 = 1, 2, . . . , 𝑛.

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 𝐴1 , 𝐴2 , … , 𝐴𝑛 denoted by 𝐴1 × 𝐴2 × … × 𝐴𝑛 is the set
of ordered n-tuples (𝑎1 , 𝑎2 , … , 𝑎𝑛 ), where 𝑎𝑖 belongs to 𝐴𝑖 for 𝑖 = 1, 2, . . . , 𝑛.
In other words, 𝐴1 × 𝐴2 × … × 𝐴𝑛 = {(𝑎1 , 𝑎2 , … , 𝑎𝑛 )|𝑎𝑖 ∈ 𝐴𝑖 , 𝑓𝑜𝑟 𝑖 = 1,2, … , 𝑛}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.
• 𝐴𝑛 = 𝐴 × 𝐴 × … × 𝐴 = {(𝑎1 , 𝑎2 , … , 𝑎𝑛 )|𝑎𝑖 ∈ 𝐴, 𝑓𝑜𝑟 𝑖 = 1,2, … , 𝑛}

Illustration
Consider the two sets: 𝑨 = {𝐷𝐿, 𝑀𝑃, 𝐾𝐴}, where 𝐷𝐿, 𝑀𝑃, 𝐾𝐴 represent Delhi, Madhya
Pradesh and Karnataka, respectively and 𝑩 = {01,02, 03} 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, 𝑅 = {(𝑎, 0), (𝑎, 1), (𝑎, 3), (𝑏, 1), (𝑏, 2), (𝑐, 0), (𝑐, 3)} is a relation from the set
{𝑎, 𝑏, 𝑐} to the set {0, 1, 2, 3}.
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.

Note the following:


• Range ⊆ Codomain.
• If (𝑎, 𝑏) ∈ 𝑅, then we say that 𝑎 𝑖𝑠 𝑟𝑒𝑙𝑎𝑡𝑒𝑑 𝑡𝑜 𝑏, which can also be written as 𝑎𝑅𝑏.
• The total number of relations that can be defined from a set A to a set B is the number of
possible subsets of A × B.
• If n(A ) = p and n(B) = q, then n (A × B) = pq and the total number of relations = 𝟐𝒑𝒒
• A relation R in a set A is called empty relation (void relation), if no element of A is related
to any element of A, i.e., R = φ⊂ A × A.
• A relation R in a set A is called universal relation, if each element of A is related to every
element of A, i.e., R = A × A.
• Both the empty relation and the universal relation are sometimes called trivial relations.
• A relation R in a set A is called identity relation, if each element of A is related to itself
only. i.e., 𝑹 = {(𝒂, 𝒂)|𝒂 ∈ 𝑨}
• In case of relations from a set 𝐴 to a set 𝐵, 𝐴 × 𝐵 is considered as the universal relation.
The complement relation of a relation 𝑅 is denoted and given as 𝑅 ′ = (𝐴 × 𝐵) − 𝑅.
• If 𝑅 = {(𝑎, 𝑏)|𝑎 ∈ 𝐴, 𝑏 ∈ 𝐵} then the inverse relation is denoted and given as 𝑅 −1 =
{(𝑏, 𝑎)|𝑎 ∈ 𝐴, 𝑏 ∈ 𝐵}.
• Union, intersection, difference and other operations of sets are all applicable to relations as
they are for sets.
Problem.1
What is the largest possible relation from the set 𝐴 = {1,2,3,4,5} to the set 𝐵 = {1,2,3}?
Write the relations from 𝐴 to 𝐵 in each of the following cases when
1) 𝑎 is related to 𝑏 if and only if 𝑎 ≥ 𝑏
2) 𝑎 is related to 𝑏 if and only if 𝑎 > 𝑏
3) 𝑎 is related to 𝑏 if and only if 𝑎 < 𝑏
4) 𝑎𝑅𝑏 if and only if 𝑎 + 𝑏 > 4
5) (𝑎, 𝑏) ∈ 𝑅 if and only if 𝑎 𝑖𝑠 𝑎 𝑑𝑒𝑣𝑖𝑠𝑜𝑟 𝑜𝑓 𝑏
Solution:
The largest possible relation from 𝐴 to 𝐵 is
𝐴 × 𝐵 = {(1,1), (1,2), (1,3), (2,1), (2,2), (2,3), (3,1), (3,2), (3,3),
(4,1), (4,2), (4,3), (5,1), (5,2), (5,3)}
1) 𝑅 = {(𝑎, 𝑏)|𝑎 ≥ 𝑏, 𝑎 ∈ 𝐴, 𝑏 ∈ 𝐵}
= {(1,1), (2,1), (2,2), (3,1), (3,2), (3,3), (4,1), (4,2), (4,3), (5,1), (5,2), (5,3)}
2) 𝑅 = {(𝑎, 𝑏)|𝑎 > 𝑏, 𝑎 ∈ 𝐴, 𝑏 ∈ 𝐵} =
{(2,1), (3,1), (3,2), (4,1), (4,2), (4,3), (5,1), (5,2), (5,3)}
3) 𝑅 = {(𝑎, 𝑏)|𝑎 < 𝑏, 𝑎 ∈ 𝐴, 𝑏 ∈ 𝐵} = {(1,2), (1,3), (2,3)}
4) 𝑅 = {(𝑎, 𝑏)|𝑎 + 𝑏 > 4, 𝑎 ∈ 𝐴, 𝑏 ∈ 𝐵} =
{(2,3), (3,1), (3,2), (3,3), (4,1), (4,2), (4,3), (5,1), (5,2), (5,3)}
5) 𝑅 = {(𝑎, 𝑏)|𝑎 𝑖𝑠 𝑎 𝑑𝑒𝑣𝑖𝑠𝑜𝑟 𝑜𝑓 𝑏, 𝑎 ∈ 𝐴, 𝑏 ∈ 𝐵} = {(1,1), (1,2), (1,3), (2,2), (3,3)}

Problem.2
Let 𝐴 = {1, 2, 5} and 𝐵 = {3, 5,7} and let 𝑅 = {(𝑎, 𝑏)|7 ≤ 𝑎 + 𝑏 < 10, 𝑎 ∈ 𝐴, 𝑏 ∈ 𝐵}.
1) Write all the elements of 𝑅 and 𝑅’ 2) Write the inverse relation of R.
−1
3) Find the Domain and Range of 𝑅 and 𝑅 .
Solution:
1) 𝑅 = {(1,7), (2,5), (2,7), (5,3)}
𝑅 ′ = {(1,3), (1,5), (2,3), (5,5), (5,7)}
2) 𝑅 −1 = {(7,1), (5,2), (7,2), (3,5)}
3) 𝐷𝑜𝑚(𝑅) = {1,2,5}, 𝑅𝑎𝑛𝑔𝑒(𝑅) = {3,7,5}
𝐷𝑜𝑚(𝑅 −1 ) = {3,7,5}, 𝑅𝑎𝑛𝑔𝑒(𝑅) = {1,2,5}

Problem.3
Consider these relations on the set of integers:
𝑅1 = {(𝑎, 𝑏) | 𝑎 ≤ 𝑏},
𝑅2 = {(𝑎, 𝑏) | 𝑎 > 𝑏 },
𝑅3 = {(𝑎, 𝑏) | 𝑎 = 𝑏 𝑜𝑟 𝑎 = − 𝑏},
𝑅4 = {(𝑎, 𝑏) | 𝑎 = 𝑏},
𝑅5 = {(𝑎, 𝑏) | 𝑎 = 𝑏 + 1},
𝑅6 = {(𝑎, 𝑏) | 𝑎 + 𝑏 ≤ 3}.
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 𝐴 = {1, 2, 3, . . . ,14}. Let a relation 𝑅 on 𝐴 be defined as
𝑅 = {(𝑥, 𝑦) ∶ 3𝑥 − 𝑦 = 0, 𝑤ℎ𝑒𝑟𝑒 𝑥, 𝑦 ∈ 𝐴}. Write down its domain, codomain and range.
2. Let 𝐴 = {𝑥, 𝑦, 𝑧} and 𝐵 = {1, 2}. Find the number of relations from 𝐴 to 𝐵. Which of the
following is not a relation from 𝐴 to ? Justify your answer.
(i) {(𝑥, 1), (𝑦, 2), (𝑧, 3)}
(ii) {(𝑥, 1), (𝑥, 2)}
(iii) {(𝑥, 2), (𝑦, 2), (𝑧, 2)}
(iv) {(1, 𝑥), (2, 𝑥)}
3. If 𝑅 = {(1,2), (2,4), (3,3)} and 𝑆 = {(1,3), (2,4), (4,2)} 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 𝑹𝒏 , 𝑛 = 1,2,3, . ..are defined recursively by
𝑹𝟏 = 𝑹 and 𝑹𝒏+𝟏 = 𝑹𝒏 ∘ 𝑹.
Thus, R2 = R ◦R, R3 = R2 ◦R = (R ◦R)◦R, and so on.

Problem.1
Let 𝑅 = {(1,1), (1,4), (2,3), (3,1), (3,4)} and 𝑆 = { (1,0), (2,0), (3,1), (3,2), (4,1)} 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, 𝑐𝑜𝑑𝑜𝑚(𝑅) = {1,3,4} is a subset of 𝑑𝑜𝑚(𝑆) = {1,2,3,4}
Hence, 𝑆 ∘ 𝑅 is Possible.
Further, 𝑆 ∘ 𝑅 = {(1,0), (1,1), (2,1), (2,2), (3,0), (3,1)}

Problem.2
Let 𝑅 = {(1,1), (2,1), (3,2), (4,3)}. Find the powers Rn, n= 2,3,4,....
Solution
𝑅 2 = 𝑅 ∘ 𝑅 = {(1,1), (2,1), (3,1), (4,2)}
Further, 𝑅 3 = 𝑅 2 ∘ 𝑅 = {(1,1), (2,1), (3,1), (4,1)}.
Similarly, 𝑅 4 = 𝑅 3 ∘ 𝑅 = {(1,1), (2,1), (3,1), (4,1)}.
It follows that 𝑅 𝑛 = 𝑅 3 for 𝑛 = 5,6,7, …

Exercise:
1. Let 𝑅 = {(0,1), (1,2), (1,4), (2,3), (3,1), (4,3)} and 𝑆 = { (1,0), (2,1), (3,1), (3,2)} 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 1: Consider 𝐴 = {1,2,3} and a relation 𝑅 on 𝐴 in each of the following cases.


Check whether they are reflexive, symmetric, anti-symmetric or transitive.
Also check which of them is equivalence relation or partially ordered relation.
(1) 𝑎𝑅𝑏, 𝑖𝑓 𝑎 = 𝑏 [R, T, S, AS]
(2) 𝑎𝑅𝑏 𝑖𝑓 𝑎 ≤ 𝑏 [R, T, AS ]
(3) 𝑎𝑅𝑏 𝑖𝑓 𝑎 ≠ 𝑏 [S]
(4) 𝑅 = {(1,1), (2,2), (3,3), (1,2), (2,1)} [R, T, S]
(5) 𝑅 = {(1,1), (2,2), (1,2), (2,1)} [T, S]
(6) 𝑅 = {(1,1), (2,2)} [T, S, AS]
(7) 𝑅 = {(1,1), (2,2), (3,3), (2,1), (1,3)} [R]
Lecture 3

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) 𝑎𝑏 ≥ 0
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.

DIFFERENCE BETWEEN RELATION AND FUNCTION

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= {1,2,3,4}
(ii) R = {(2,2),(2,4),(3,3), (4,4)} , Domain= {2,3,4}
(iii) R = {(1,2),(2,3),(3,4), (4,5), (5,6), (6,7)}, Domain= {1,2,3,4,5,7}

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 𝑨 = { 𝑎1 , 𝑎2 , . . . , 𝑎𝑚 } to 𝑩 = { 𝑏1 , 𝑏2 , . . . , 𝑏𝑛 }.
(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.)
1 𝑖𝑓 (𝑎𝑖 , 𝑏𝑗 ) ∈ 𝑹
The relation R can be represented by the matrix 𝑴𝑹 = [𝒎𝒊𝒋 ], where 𝒎𝒊𝒋 = {
0 𝑖𝑓 (𝑎𝑖 , 𝑏𝑗 ) ∉ 𝑹
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 𝐴 = {1,2,3}and 𝐵 = { 1,2}.
Let R be the relation from A to B containing (𝑎, 𝑏) if 𝑎 ∈ 𝐴, 𝑏 ∈ 𝐵, 𝑎𝑛𝑑 𝑎 > 𝑏.
What is the matrix representing R?
Solution
0 0
Because 𝑅 = {(2,1), (3,1), (3,2)}, the matrix for R is MR = [1 0]
1 1

Problem.2
Let 𝐴 = {𝑎1 , 𝑎2 , 𝑎3 } and 𝐵 = {𝑏1 , 𝑏2 , 𝑏3 , 𝑏4 , 𝑏5 }.
0 1 0 0 0
Which ordered pairs are in the relation R represented by the matrix MR =[1 0 1 1 0] ?
1 0 1 1 0
Solution:
Because R consists of those ordered pairs (𝑎𝑖 , 𝑏𝑗 ) with 𝑚𝑖𝑗 = 1, it follows that
𝑅 = {(𝑎1 , 𝑏2 ), (𝑎2 , 𝑏1 ), (𝑎2 , 𝑏3 ), (𝑎2 , 𝑏4 ), (𝑎3 , 𝑏1 ), (𝑎3 , 𝑏3 ), (𝑎3 , 𝑏5 )}.
Remark
• R is reflexive if and only if 𝑚𝑖𝑖 = 1 for 𝑖 = 1,2, . . . , 𝑛.
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.

(The matrix for a reflexive relation)


• The relation R is symmetric if and only if 𝒎𝒋𝒊 = 𝟏 whenever 𝒎𝒊𝒋 = 𝟏.
This also means 𝒎𝒋𝒊 = 𝟎 whenever 𝒎𝒊𝒋 = 𝟎.
Consequently, R is symmetric if and only if 𝒎𝒊𝒋 = 𝒎𝒋𝒊 , for all 𝑖 and 𝑗.
i.e. R is symmetric if and only if 𝑀𝑅 = 𝑀𝑅𝑇 ,
i.e, R is symmetric if MR is a symmetric matrix.
• The relation R is anti-symmetric if and only if 𝑚𝑖𝑗 = 1 with 𝑖 ≠ 𝑗,then 𝑚𝑗𝑖 = 0.
In other words, if 𝑖 ≠ 𝑗 then either 𝑚𝑖𝑗 = 0 𝑜𝑟 𝑚𝑗𝑖 = 0.
The form of the matrix for an antisymmetric relation is illustrated in Figure.
Lecture 4
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

Which ordered pairs are in the relation R represented by the matrix MR = ?

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.
(The matrix for a reflexive relation)
The relation R is symmetric if and only if whenever .
This also means whenever .
Consequently, R is symmetric if and only if , for all and .
i.e. R is symmetric if and only if ,
i.e, R is symmetric if MR is a symmetric matrix.
The relation R is anti-symmetric if and only if with ,then .
In other words, if then either .
The form of the matrix for an antisymmetric relation is illustrated in Figure.

Matrix of Union and Intersection of two relations


Suppose that R and S are relations on a set A represented by the matrices and ,
respectively.
The matrix representing the union of these relations has a 1 in the positions where either or
has a 1.
The matrix representing the intersection of these relations has a 1 in the positions where both
and have a 1.
Thus, the matrices representing the union and intersection of these relations are
and .

Problem.3
Suppose that the relations R and S on a set A are represented by the matrices

= and =

What are the matrices representing and ?


Solution:
The matrices of these relations are

and

Matrix of Composite of two relations:


Matrix of Composite of two relations can be found using the Boolean product of the matrices for
these relations.
In particular, suppose that R is a relation from A to B and S is a relation from B to C.
Suppose that A, B, and C have and elements, respectively.
Let the zero – one matrices for , and be
respectively. (Note that these matrices have sizes , and , respectively).
The ordered pair belongs to if and only if there is an element such that
and .
It follows that if and only if for some .
In other words, if and only if row of and column of has 1 at a same
position.
From the definition of the Boolean product, this means that .

Problem.4
Find the matrix representing the relation , where the matrices representing R and S are

MR = and MS =

Solution:

The matrix for S◦R is .

Exercise

1. Let R be the relation represented by the matrix . Find the matrix

representing
(a) (b) (

2. Let and be relations on a set A represented by the matrices and

. Find the matrices representing the following relations.

(a) (b) (c) (d) (e)


Representing Relations Using Digraphs
There is another important way of representing a relation using a pictorial 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.
We use such pictorial representations when we think of relations on a fi nite set as directed
graphs, or digraphs.

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.

Problem.1 Draw the directed graph of the relation

Problem.2 Draw the directed graph of the relation

Problem.3 Determine whether the relations for the directed graphs shown in the following figure
are reflexive, symmetric, antisymmetric, and/or transitive.
(a) (b) (c) (d)

Problem.4 Write the relation represented by the following digraph and also write the matrix
representing this relation.

(a) (b)

Solution.

(a)

(b)

Exercise
1. Write the relation represented by the following matrices and also draw the corresponding
digraph.
(a) (b) (c)
Lecture 5
Representing Relations Using Digraphs
There is another important way of representing a relation using a pictorial 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.
We use such pictorial representations when we think of relations on a finite set as directed
graphs, or digraphs.

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.

Problem.1 Draw the directed graph of the relation


𝑅 = {(1,1), (1,3), (2,1), (2,3), (2,4), (3,1), (3,2), (4,1)}

Problem.2 Draw the directed graph of the relation 𝑅 =


{(1, 1), (1, 3), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2), (4, 1)}
Problem.3 Determine whether the relations for the directed graphs shown in the following
figure are reflexive, symmetric, antisymmetric, and/or transitive.
(a) (b) (c) (d)

Problem.4 Write the relation represented by the following digraph and also write the matrix
representing this relation.

(a) (b)

Solution.
(a) 𝑅 = {(𝑎, 𝑎), (𝑎, 𝑏), (𝑏, 𝑎), (𝑏, 𝑏), (𝑏, 𝑐), (𝑐, 𝑏), (𝑐, 𝑎), (𝑎, 𝑐). (𝑑, 𝑑)}
1 1 1 0
1 1 1 0
𝑀𝑅 = [ ]
1 1 0 0
0 0 0 1
(b) 𝑅 = {(𝑎, 𝑎), (𝑎, 𝑏), (𝑏, 𝑎), (𝑏, 𝑏), (𝑐, 𝑐), (𝑐, 𝑑), (𝑑, 𝑐), (𝑑, 𝑑)}
1 1 0 0
1 1 0 0
𝑀𝑅 = [ ]
0 0 1 1
0 0 1 1
Exercise
1. Write the relation represented by the following matrices and also draw the
corresponding digraph.
(a) 1 1 1 0 (b) 1 1 1 0 0 (c) 1 1 0 0
1 0 1 0 1 1 1 0 0 0 1 1 0
[ ] [ ]
1 1 0 0 0 0 1 0 0 0 0 0 1
0 0 0 1 0 0 0 1 0 1 0 1 0
[1 0 0 1 1]
Lecture 6
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 𝛥 = {(1,1), (2,2), (3,3)}
Therefore, the reflexive closure of 𝑅 is 𝑆 = 𝑅 ∪ 𝛥 = {(1,1), (1,2), (2,1), (2,2), (3,2), (3,3)}
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., 𝑅 ∪ 𝑅 −1 is the symmetric closure of R, where 𝑅 −1 = {(𝑏, 𝑎) | (𝑎, 𝑏) ∈ 𝑅}.

Problem.1
Find the symmetric closure of the relation
{(𝟏, 𝟏), (𝟏, 𝟐), (𝟐, 𝟐), (𝟐, 𝟑), (𝟑, 𝟏), (𝟑, 𝟐)}on{𝟏, 𝟐, 𝟑}.
Solution.
𝑅 −1 = {(1,1), (2,1), (2,2), (3,2), (1,3), (2,3)}
Therefore, symmetric closure of 𝑅 is
𝑆 = 𝑅 ∪ 𝑅 −1 = {(𝟏, 𝟏), (𝟏, 𝟐), (𝟐, 𝟏), (𝟐, 𝟐), (𝟐, 𝟑), (𝟑, 𝟐), (𝟑, 𝟏), (𝟏, 𝟑)}

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
𝑀𝑅∗ = 𝑀𝑅 ∨ 𝑀𝑅[2] ∨ 𝑀𝑅[3] ∨···∨ 𝑀𝑅[𝑛] .

Here R is known as connectivity relation.
Problem.1
Find the zero–one matrix of the transitive closure of the relation R where
1 0 1
𝑀𝑅 = [0 1 0]
1 1 0
Solution:
The zero–one matrix of 𝑀𝑅 is 𝑀𝑅∗ = 𝑀𝑅 ∨ 𝑀𝑅[2] ∨ 𝑀𝑅[3] .
Now, 𝑴𝑹[𝟐] is the matrix of the composite relation 𝑹 ∘ 𝑹.
1 1 1
⇒ 𝑴𝑹[𝟐] = [0 1 0]
1 1 1
and 𝑴𝑹[𝟑] is the matrix of the composite relation 𝑹 ∘ 𝑹𝟐
1 1 1
⇒ 𝑴𝑹[𝟑] = [0 1 0]
1 1 1
Hence,
1 0 1 1 1 1 1 1 1 1 1 1
𝑀𝑅∗ = [0 1 0] ∨ [0 1 0] ∨ [0 1 0] = [0 1 0]
1 1 0 1 1 1 1 1 1 1 1 1
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.
Lecture 7
DATABASE & RELATIONS
Concepts of relations have a strong application in the theory of relational databases.
Definition:
Let 𝐴1, 𝐴2, … , 𝐴𝑛 be sets. An n-ary relation on these sets is a subset of 𝐴1 × 𝐴2 × … × 𝐴𝑛.
The sets 𝐴1, 𝐴2, … , 𝐴𝑛 are called the domains of the relation, and n is called its degree.
For example:
Let R be the relation on ℕ × ℕ × ℕ consisting of triples (𝑎, 𝑏, 𝑐), where 𝑎, 𝑏, 𝑎𝑛𝑑 𝑐 are integers with
𝑎 < 𝑏 < 𝑐. Then (1, 2, 3) ∈ 𝑅, but (2, 4, 3) ∉ 𝑅. The degree of this relation is 3. Its domains are
all equal to the set of natural numbers.
For example:
Let 𝑅 be the relation on ℤ × ℤ × ℤ consisting of all triples of integers (𝑎, 𝑏, 𝑐) in which 𝑎, 𝑏, 𝑎𝑛𝑑 𝑐
form an arithmetic progression. That is, (𝑎, 𝑏, 𝑐) ∈ 𝑅 if and only if there is an integer 𝑘 such that
𝑏 = 𝑎 + 𝑘 and 𝑐 = 𝑎 + 2𝑘, or equivalently, such that 𝑏 − 𝑎 = 𝑘 and 𝑐 − 𝑏 = 𝑘.
Note that (1, 3, 5) ∈ 𝑅 because 3 = 1 + 2 and 5 = 1 + 2 ・ 2, but (2, 5, 9) ∉ 𝑅 because 5 −
2 = 3 while 9 − 5 = 4. This relation has degree 3 and its domains are all equal to the set of
integers.
For example:
Let R be the relation consisting of 5 − 𝑡𝑢𝑝𝑙𝑒𝑠 (𝐴, 𝑁, 𝑆, 𝐷, 𝑇 ) representing airplane flights, where 𝐴
is the airline, 𝑁 is the flight number, 𝑆 is the starting point, 𝐷 is the destination, and 𝑇 is the
departure time.
For instance, if Nadir Express Airlines has flight 963 from Newark to Bangor at 15:00, then (Nadir,
963, Newark, Bangor, 15:00) belongs to R.
The degree of this relation is 5, and its domains are the set of all airlines, the set of flight numbers,
the set of cities, the set of cities (again), and the set of times.

Database & relations:


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. We will discuss one of these methods, called the relational data model, based
on the concept of a relation.
A database consists of records, which are n-tuples, made up of fields. The fields are the entries of
the n-tuples. For instance, a database of student records may be made up of fields containing the
name, student number, major, and grade point average of the student. The relational data model
represents a database of records as an n-ary relation.
Definition: (Selection operator)
Let R be an 𝑛 − 𝑎𝑟𝑦 relation and C be a condition that elements in 𝑅 may satisfy. Then the selection
operator 𝑆𝑐 maps the 𝑛 − 𝑎𝑟𝑦 relation 𝑅 to the 𝑛 − 𝑎𝑟𝑦 relations of all n-tuples from R that satisfy
the condition 𝐶.
Definition: (Projection operator)
The projection 𝑃𝑖1𝑖2 ,…,𝑖𝑚 where 𝑖1 < 𝑖2 < ⋯ < 𝑖𝑚 , maps the n-tuple (𝑎1 , 𝑎2 , … , 𝑎𝑛 ) to the m-tuple
(𝑎𝑖1 , 𝑎𝑖2 , . . . , 𝑎𝑖𝑚 ), where 𝑚 ≤ 𝑛.
In other words, the projection 𝑃𝑖1 𝑖2,…,𝑖𝑚 deletes 𝑛 − 𝑚 of the components of an n-tuple, leaving the
𝑖1𝑡ℎ , 𝑖2𝑡ℎ , . . ., and 𝑖𝑚
𝑡ℎ
components.
For example:
Consider the student records given by the following table.
These student records can be given using 4 − 𝑡𝑢𝑝𝑙𝑒 of the form
(𝑆𝑡𝑢𝑑𝑒𝑛𝑡 𝑛𝑎𝑚𝑒, 𝐼𝐷 𝑛𝑢𝑚𝑏𝑒𝑟, 𝑀𝑎𝑗𝑜𝑟, 𝐺𝑃𝐴).
A sample database of six such records is
(𝐴𝑐𝑘𝑒𝑟𝑚𝑎𝑛𝑛, 231455, 𝐶𝑜𝑚𝑝𝑢𝑡𝑒𝑟 𝑆𝑐𝑖𝑒𝑛𝑐𝑒, 3.88)
(𝐴𝑑𝑎𝑚𝑠, 888323, 𝑃ℎ𝑦𝑠𝑖𝑐𝑠, 3.45)
(𝐶ℎ𝑜𝑢, 102147, 𝐶𝑜𝑚𝑝𝑢𝑡𝑒𝑟 𝑆𝑐𝑖𝑒𝑛𝑐𝑒, 3.49)
(𝐺𝑜𝑜𝑑𝑓𝑟𝑖𝑒𝑛𝑑, 453876, 𝑀𝑎𝑡ℎ𝑒𝑚𝑎𝑡𝑖𝑐𝑠, 3.45)
(𝑅𝑎𝑜, 678543, 𝑀𝑎𝑡ℎ𝑒𝑚𝑎𝑡𝑖𝑐𝑠, 3.90)
(𝑆𝑡𝑒𝑣𝑒𝑛𝑠, 786576, 𝑃𝑠𝑦𝑐ℎ𝑜𝑙𝑜𝑔𝑦, 2.99).
To find the records of computer science majors in the 𝑛 − 𝑎𝑟𝑦 relation 𝑅 shown in the above table,
we use the operator 𝑆𝑐1 , where 𝑐1 is the condition 𝑀𝑎𝑗𝑜𝑟 = “𝐶𝑜𝑚𝑝𝑢𝑡𝑒𝑟 𝑆𝑐𝑖𝑒𝑛𝑐𝑒” The result is the
two 4-tuples (𝐴𝑐𝑘𝑒𝑟𝑚𝑎𝑛𝑛, 231455, 𝐶𝑜𝑚𝑝𝑢𝑡𝑒𝑟 𝑆𝑐𝑖𝑒𝑛𝑐𝑒, 3.88) and
(𝐶ℎ𝑜𝑢, 102147, 𝐶𝑜𝑚𝑝𝑢𝑡𝑒𝑟 𝑆𝑐𝑖𝑒𝑛𝑐𝑒, 3.49).
Similarly, to find the records of students who have a grade point average above 3.5 in this database,
we use the operator 𝑆𝑐2 , where 𝑐2 is the condition 𝐺𝑃𝐴 > 3.5. The result is the two 4-tuples
(𝐴𝑐𝑘𝑒𝑟𝑚𝑎𝑛𝑛, 231455, 𝐶𝑜𝑚𝑝𝑢𝑡𝑒𝑟 𝑆𝑐𝑖𝑒𝑛𝑐𝑒, 3.88) and (𝑅𝑎𝑜, 678543, 𝑀𝑎𝑡ℎ𝑒𝑚𝑎𝑡𝑖𝑐𝑠, 3.90).
Finally, to find the records of computer science majors who have a GPA above 3.5, we use the
operator 𝑆𝑐3 , where 𝐶3 is the condition (𝑀𝑎𝑗𝑜𝑟 = “𝐶𝑜𝑚𝑝𝑢𝑡𝑒𝑟 𝑆𝑐𝑖𝑒𝑛𝑐𝑒” ∧ 𝐺𝑃𝐴 > 3.5). The result
consists of the single 4-tuple (𝐴𝑐𝑘𝑒𝑟𝑚𝑎𝑛𝑛, 231455, 𝐶𝑜𝑚𝑝𝑢𝑡𝑒𝑟 𝑆𝑐𝑖𝑒𝑛𝑐𝑒, 3.88).
When the projection 𝑃1,4 is used, the second and third columns of the table are deleted, and pairs
representing student names and grade point averages are obtained. The following table displays the
results of this projection.

Definition: (Join operator)


Let 𝑅 be a relation of degree 𝑚 and 𝑆 be a relation of degree 𝑛. The join 𝐽𝑃 (𝑅, 𝑆), where 𝑝 ≤ 𝑚 and
𝑝 ≤ 𝑛, is a relation of degree 𝑚 + 𝑛 − 𝑝 that consists of all (𝑚 + 𝑛 − 𝑝) − 𝑡𝑢𝑝𝑙𝑒𝑠
(𝑎1 , 𝑎2 , … 𝑎𝑚−𝑝 , 𝑐1 , 𝑐2 , … 𝑐𝑝 , 𝑏1 , 𝑏2 , … , 𝑏𝑛−𝑝 ), where the m-tuple
(𝑎1 , 𝑎2 , … 𝑎𝑚−𝑝 , 𝑐1 , 𝑐2 , … 𝑐𝑝 ) belongs to R and the n-tuple (𝑐1 , 𝑐2 , … 𝑐𝑝 , 𝑏1 , 𝑏2 , … , 𝑏𝑛−𝑝 ) belongs to S.
In other words, the join operator 𝐽𝑃 produces a new relation from two relations by combining all m-
tuples of the first relation with all n-tuples of the second relation, where the last p components of the
m-tuples agree with the first p components of the n-tuples
For example: What relation results when the join operator J2 is used to combine the relation
displayed in the following tables?
The join 𝐽2 produces a member of relation as (𝐶𝑟𝑢𝑧, 𝑍𝑜𝑜𝑙𝑜𝑔𝑦, 335, 𝐴100,9: 00𝐴. 𝑀. ) by joining the
members (𝐶𝑟𝑢𝑧, 𝑍𝑜𝑜𝑙𝑜𝑔𝑦, 335) and (𝑍𝑜𝑜𝑙𝑜𝑔𝑦, 335, 𝐴100,9: 00𝐴. 𝑀. )
The relation thus produced is shown in the following table.

Exercise:
1. Consider the following Tables.
a. What do you obtain when you apply the selection operator SC , where C is the condition
(𝑃𝑟𝑜𝑗𝑒𝑐𝑡 = 2) ∧ (𝑄𝑢𝑎𝑛𝑡𝑖𝑡𝑦 ≥ 50), 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.
Countable and uncountable sets:
A set that is either finite or has the same cardinality as the set of positive integers is called countable.
A set that is not countable is called uncountable.
Note:
Cantor’s diagonal argument
A set 𝑆 is finite iff there is a bijection between 𝑆 and {1, 2, . . . , 𝑛} for some positive integer 𝑛, and
infinite otherwise. (i.e., if it makes sense to count its elements.)
Two sets have the same cardinality iff there is a bijection between them.
A set S is called countably infinite if there is a bijection between 𝑆 and ℕ. Such a set is countable
because elements can be counted, but unlike a finite set, counting never ends.
On the other hand, not all infinite sets are countably infinite. In fact, there are infinitely many sizes
of infinite sets.
Georg Cantor proved this astonishing fact in 1895 by showing that the set of real numbers is not
countable. That is, it is impossible to construct a bijection between ℕ and ℝ. In fact, it’s impossible
to construct a bijection between ℕ and the interval [0, 1].
Theorem:
The set of real numbers is not countable
Proof:
Suppose that 𝑓 ∶ ℕ → [0,1] is any function.
Make a table of values of 𝑓, where the 1st row contains the decimal expansion of 𝑓(1), the 2nd row
contains the decimal expansion of 𝑓(2), . . . the nth row contains the decimal expansion of 𝑓(𝑛), …
Perhaps, 𝑓(1) = 𝜋/10 , 𝑓(2) = 37/99, 𝑓(3) = 1/7, 𝑓(4) = √2/2, 𝑓(5) = 3/8, and so on, so
that the table starts out like this.

Highlighting the digits in the main diagonal of the table.

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 [0, 1].
Hence, [0,1] is not a countable set.
Since, cardinality of ℝ and [0,1] is same, ℝ is also uncountable.

The Power set theorem


Statement: For every set S, |S| < |P(S)|
Proof:
Let 𝑓: 𝑆 → 𝑃(𝑆) be any function and define 𝑋 = { 𝑠 ∈ 𝑆 | 𝑠 ∉ 𝑓(𝑠)}.
Suppose that 𝑋 = 𝑓(𝑠) for some 𝑠 ∈ 𝑆
If so, then either 𝑠 belongs to 𝑋 or it doesn’t.
But by the very definition of 𝑋, if 𝑠 belongs to 𝑋 then it doesn’t belong to 𝑋 = 𝑓(𝑠).
And if it doesn’t belong to 𝑋 then it belong to 𝑋 = 𝑓(𝑠).
This situation is impossible.
Hence,𝑋 cannot equal 𝑓(𝑠) for any 𝑠.
Using the Cantor’s diagonal argument, this proves that 𝑓 cannot be onto.|
Hence, |𝑆| ≠ |𝑃(𝑆)|. Which gives |S| < |P(S)|.

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.

You might also like