Unit 2
Unit 2
Basic Definitions – Venn Diagrams and set operations – Laws of set theory – Principle of
inclusion and exclusion – Partitions – Permutation and Combination – Relations –
Properties of Relations – Matrices of Relations – Closure Operations on Relations –
Functions – injective, surjective and bijective functions.
2.1 INTRODUCTION:
Sets are one of the building blocks in Mathematics and is an important language and tool
for reasoning. Set theory deals with operations between relations among sets and
statements about sets. The knowledge of set theory increases your ability to think
abstractly. It is useful for formalizing and reasoning about computation and the objects of
computation.
61
Symbols used :
Symbol meaning example Read as
∈ Element of x∈ A x belongs to A
∉ Not an element of x ∉A x does not belongs to A
⊂ Subset or contained in A⊂ B A is a subset of B or
A is contained in B
U union AU B A union B
I intersection AI B A intersection B
- complement A A complement
∃ There exists ∃x ∈ A There exists an element
belonging to A
∀ For every ∀x For every x
CARDINALITY OF A SET :
Number of elements in a set A is called the cardinality of the set A and is denoted by |A|.
If |A| is finite then the set is said to be finite otherwise it is called as an infinite set.
If |A| = 1 , then A is called a singleton set.
If A has no elements then A is called an empty set or null set and is denoted by φ .
Example:
If A = {x / 1< x < 12 and x divisible by 13} then A = φ .
The set of real numbers is an infinite set.
B = {x / x a vowel in English alphabets} , |B| = 5.
SET NOTATION WITH QUANTIFIERS:
At times we specify the universe of discourse of a statement explicitly in the notation.
Example: The statement ∀x ∈ R ( x 2 ≥ 0 ) states that for every real number x, x 2 ≥ 0 .
UNIVERSAL SET :
The universal set,denoted by U is the set of elements under discussion for possible
membership in a set.
SUBSET:
Let A and B be two sets.
A is called a subset of B if every element in A is an element in B and is denoted by
A ⊆ B.
A is called a proper subset of B if A is a subset of B and there exists an element in B
which is not an element in A and is denoted by A ⊂ B.
Set A is said to be equal to set B denoted by A = B, if and only if A ⊆ B. and B ⊆ A.
Clearly φ is subset of every set A and A is a subset of universal set U.
Example:
Set of all integers is a proper subset of the set of all real numbers.
Let A = {x ∈ N / x2 – 5x + 6 = 0} and B = { 2 , 3}. Clearly A = B.
POWER SET
The set of all subsets of a set A is called the power set of A and is denoted by P( A) .
62
Note: If A = n then P( A) = 2n .
UNION OF SETS:
Let A and B be given sets, then union of A and B is denoteby A ∪ B = { x / x ∈ A or x ∈ B} .
Clearly A ∪ B ⊇ A, A ∪ B ⊇ B.
INTERSECTION OF SETS
Intersection of A and B is denoted by A ∩ B = { x / x ∈ A and x ∈ B} .
Clearly A ∩ B ⊆ A, A ∩ B ⊆ B.
SET DIFFERENCE:
Difference of A and B is denoted by A − B = { x ∈ A and x ∉ B} .
DISJOINT SETS:
Two sets A and B are disjoint if A ∩ B = φ .
NOTE: If A and B are disjoint, then A ∪ B = A + B .
Example:
A = { x ∈ N / x even integer}
B = { x ∈ N / x odd integer}
C = { x ∈ R / − 4 < x < 3}
D = { x / − 1 < x < 7 and x real}
A ∩ B = φ , C ∪ D = −4 < x < 7
C − D = { x / − 4 < x ≤ −1, x real}
COMPLEMENT OF A SET:
If U is universal set containing the set A, then U − A = { x ∈ U / x ∉ A} is called the
complement of A and is denoted by A .
If A and B are two subsets of the universal set U, then the difference of B in A is denoted
by A − B = { x / x ∈ A and x ∉ B} . This is also called as complement of B in A.
SYMMETRIC DIFFERENCE:
If A and B are two sets then the symmetric difference is denoted by
A ⊕ B = { x / x ∈ A ∪ B and x ∉ A ∩ B}
= ( A ∪ B ) − ( A ∩ B ) = complement of A ∩ B in A ∪ B .
63
CARTESIAN PRODUCT:
The ordered n tuple (a1 ,...an ) is the ordered collection that has ai as ith element.
Two ordered n-tuple (a1 ,...an ) and (b1 ,...bn ) are equal if and only if ai = bi for i = 1, …, n.
If A and B are two sets, then the cartesian product of A and B, denoted by
A x B = {(a,b)/ a ∈ A and b ∈ B }.
Example :
A = {a , b} and B = {1 , 2}.
A x B = { (a,1), (a,2), (b,1), (b,2) }.
Clearly | A x B | = |A| |B|.
Note:
The cartesian product is not commutative. A x B need not be equal to B x A.
The cartesian product can be extended to sets A1 , . A2, … An
IDENTITY LAW
A ∪φ = A
Identity Law
A ∩U = A
A ∪U = U
Domination Law
A ∩φ = φ
A∪ A = A
Idempotent Law
A∩ A = A
( A) = A Complement Law
A∪ B = B ∪ A
Commutative Law
A∩ B = B ∩ A
A ∪ ( B ∪ C ) = ( A ∪ B) ∪ C
Associative Law
A ∩ ( B ∩ C ) = ( A ∩ B) ∩ C
A ∩ ( B ∪ C ) = ( A ∩ B) ∪ ( A ∩ C )
Distributive Law
A ∪ ( B ∩ C ) = ( A ∪ B) ∩ ( A ∪ C )
A∪ B = A∩ B
De Morgan’s Law
A∩ B = A∪ B
64
A ∪ ( A ∩ B) = A
Absorption Law
A ∩ ( A ∪ B) = A
A∪ A =U
Complement Law
A∩ A =φ
A B A∪ B ( A ∪ B) − B A− B
0 0 0 0 0
0 1 1 0 0
1 0 1 1 1
1 1 1 0 0
Example:
1. Prove De Morgan’s laws namely A ∪ B = A ∩ B and A ∩ B = A ∪ B
Solution:
x ∈ ( A ∩ B) ⇒ x ∉ A ∩ B
⇒ x ∉ A or x ∉ B
⇒ x ∈ A or x ∈ B
⇒ x∈ A∪ B
∴ ( A ∩ B) ⊆ ( A ∪ B ).........( I )
On the other hand
x ∈ A ∪ B ⇒ x ∈ A or x ∈ B
⇒ x ∉ A or x ∉ B
⇒ x ∈ ( A ∩ B)
∴ A ∪ B ⊆ ( A ∩ B)...........( II )
65
From ( I ) and ( II ) we get ( A ∩ B) = A ∪ B .
Similarly we can show that ( A ∪ B) = A ∩ B .
Solution:
x ∈ A ∩ ( B ∪ C ) ⇒ x ∈ A and x ∈ ( B ∪ C )
⇒ x ∈ A and x ∈ B or x ∈ C
⇒ ( x ∈ A and x ∈ B ) or ( x ∈ A and x ∈ C )
⇒ x ∈ ( A ∩ B) ∪ ( A ∩ C )
∴ A ∩ ( B ∪ C ) ⊆ ( A ∩ B) ∪ ( A ∩ C )
On the other hand,
x ∈ ( A ∩ B) ∪ ( A ∩ C ) ⇒ x ∈ ( A ∩ B) or x ∈ A ∩ C
⇒ ( x ∈ A and x ∈ B ) or ( x ∈ A and x ∈ C ) ⇒ x ∈ A ∩ (B ∪ C)
∴ ( A ∩ B) ∪ ( A ∩ C ) ⊆ A ∩ ( B ∪ C )
Thus we get, A ∩ ( B ∪ C ) = ( A ∩ B) ∪ ( A ∩ C )
66
n
A1 ∩ ... ∩ An = I Ai denotes the intersection of the sets A1 ,..., An
i =1
Ai = {i, i + 1, i + 2,...}
n
U A = {1, 2,3,...}
i =1
i
I A = {n, n + 1, n + 2,...}
i =1
i
A ⊆ B can be represented as
67
A ⊄ B can be represented as
A ∪ B can be represented as
Example:
1. Using Venn diagram prove the distributive law A ∩ ( B ∪ C ) = ( A ∩ B) ∪ ( A ∩ C ) for 3
sets.
Solution:
68
2. Draw Venn diagram for the symmetric difference of the sets A and B and show that
Note: A Venn diagram with n sets divide the universal set into 2n regions.
A Venn diagram with 3 sets divide the universal set into 23 = 8 regions.
Example:
Represent the regiong given below in terms of the sets A, B, C and select the
numbered regions that make up the set A ∪ ( B ∩ C )
Solution:
69
6 A∩ B ∩C
7 A∩ B ∩C
8 A∩ B ∩C
A = 1, 4, 7, 8 B = 1, 2, 6, 8
B = 2, 4, 5, 7 C = 5, 6, 7, 8
C = 1, 2, 3, 4 B ∩ C = 6, 8
B ∩ C = 2, 4 A ∪ ( B ∩ C ) = 1, 4, 6, 7, 8
A ∪ ( B ∩ C ) = (1, 4, 7, 8, 2) = (1, 2, 4, 7, 8)
1. If A ∪ B = A then
(a) B ⊆ A (b) A ⊂ B (c) A = B (d) B = φ
Ans: (a)
3. If S = { x ∈ Z / x 2 + 5 = 0} then S is
(a) φ (b) S = {−5,5} (c) S is an infinite set (d) S = {0} Ans: (a)
4. If the set A has p elements, b has q elements, then the number of elements in
A x B is
(a) p + q + 1 (b) pq (c) p2 (d) p + q Ans: (b)
(a) ( R × P ) ∩ ( R × Q ) (b) ( R × Q ) ∩ ( R × P )
(c) ( R × P ) ∪ ( R × Q ) (d) None of these Ans: (a)
70
6. Two finite sets have m and n elements, the total number of subsets of the first set
is 56 more than the total number of subsets of the second. The values of m and n
are,
(a) 7,6 (b) 6,3 (c) 5,1 (d) 8,7 Ans: (b)
SUM RULE:
Let m be the number of ways to do one task and n be the number of ways to do the
second task and if both the tasks cannot be performed simultaneously, then the task “do
either task 1 or task 2 , but not both” can be done in m + n ways.
Example:
A student can choose a computer project from one of three lists. The 3 lists contain 24,
15, 10 possible projects,. How many possible are there to choose from?
Solution:
The students can choose a project from the first list in 24 ways, form the second list in 15
ways and from the third in 10 ways. Hence there are 24 + 15 + 10 = 49 projects to choose
from.
PRODUCT RULE:
The task “do both task 1 and task 2” can be done in mn ways.
In set theoretic version:
If A is the set of ways to do task 1 and B is the set of ways to do task 2, and if A and B are
disjoint, then the ways to do either task 1 or task 2 are A ∪ B and A ∪ B = A + B .
The ways to do both task 1 and 2 can be represented as A × B and A × B = A . B .
Example:
How many different bit strings are there of length 7 ?
Solution:
Each of the seven bits can be chosen in 7 ways, since each bit is either 0 or 1. Hence by
product rule there are a total of 27 = 128 different bit strings of length 7.
2.4.1 PERMUTATIONS:
A permutation of a set S of objects is an ordered arrangement of these objects
Note:
An ordered arrangement of r distinct elements of S is called an r-permutation of S.
The number of r-permutations of a set with n = S elements is
P ( n, r ) = n ( n − 1) ... ( n − r + 1) = n !/ ( n − r ) !
Example:
How many permutations of the letter JKLMNOPQ contain the string JKL.
71
Solution:
Since the letter JKL must occur in a block, we must consider six objects namely JKL as
one block and M,N,O,P,Q. the six objects can occur in any order and there are 6! = 720
permutations of the letters JKLMNOPQ in which JKL occurs as a block.
Example:
A committee of 16 persons is to be formed out of 29 persons. In how many ways the
committee can be formed?
Solution:
It is clear that we need to fill up 16 positions as P1 ,..., P16 .
Note that the positions P1 can be filled in 29 ways, P2 can be filled in 28 ways, …, P16
in 14 ways.
CIRCULAR PERMUTATIONS:
Suppose n persons are seated about a round table. How many distinct circular
arrangements possible. Note that two arrangements are circularly equivalent, if one can
be got from the other by means of rotation.
The number of ways of arranging n distinct objects around a cycle is ( n − 1) ! .
Example:
How many three-letter “words” can be formed from letters in the set {a, b, y, z}.
(i) if repetition of letters are allowed? (ii) if repetition not allowed?
Solution:
(i) Here n = 4 and r = 3.
Therefore the total number of words of length three from the 4 letters with repetition
= 43 = 64 words.
(ii) The total number of words of length 3 from 4 distinct letters
72
= P(4,3)
=4x3x2
= 24.
2.4.2 COMBINATIONS:
An r-combination of elements of a set S is simply a subset T ⊆ S with r members. In
other words T = r.
Note:
1. The number of r-combinations of a set with n = S elements is
⎛ n ⎞ P ( n, r ) n !( n − r ) ! n!
C ( n, r ) = ⎜ ⎟ = = =
⎝ r ⎠ P ( r, r ) r! r !( n − r ) !
2. C ( n, r ) = C ( n, n − r ) since choosing the r members of T is the same as choosing the
n – r non-members of T.
Example:
1. How many bit strings of length n contain exactly r 1’s.
Solution
The position of r 1’s in a bit string of length n form an r-combination of the set
{1,2,3,…,n}. Hence there are C(n,r) bit strings of length n that contain exactly r 1’s.
2. How many ways are there to select a committee to develop a discrete mathematics
course if the committee is to consists of three faculty members from the mathematics
department and 4 from the computer science department, if there are 9 faculty members
of the mathematics department and 11 of the computer science department.
Solution
By the product rule the required answer is the product of the number of 3-combinations
of a set with 9 elements and number of 4-combinations of a set with 11 elements. Hence
9! 11!
the number of ways to select the committee is C ( 9,3) .C (11, 4 ) = . = 27, 720.
3!6! 4!7!
COMBINATIONS WITH REPETITIONS:
There are C ( n + r − 1, r ) r -combinations from a set with n elements when repetition of
elements is allowed.
Examples:
1. How many solutions does the equation x1 + x2 + x3 = 11 have, where x1 , x2 and x3 are
non-negative integers.
Solution:
To count the number of solutions, we note that a solution corresponds to a way of
selecting 11 items form a set with three elements, so that x1 items of type one, x2 items
of type two, and x3 items of type three are chosen. Hence, the number of solution is
equal to the number of 11-combinations with repetition allowed form a set with three
elements. Hence it follows that there are
13.12
C ( 3 + 11 − 1,11) = C (13,11) = C (13, 2 ) = = 78 solutions.
1.2
73
2. How many solutions does the equation x1 + x2 + x3 = 11 have, where x1 , x2 and x3 are
nonnegative integers with x1 ≥ 1, x2 ≥ 2 and x3 ≥ 3 .
Solution:
A solution to the equation subject to these constraints corresponds to a selection
of 11 items with x1 items of type one, x2 items of type two and x3 items of type three
where, in addition, there is at least one item of type one, two items of type two and three
items of type three. So choose one item of type one, two items of type two and three
items of type three. Then select five additional items. This can be done in
7.6
C ( 3 + 5 − 1,5 ) = C ( 7,5 ) = C ( 7, 2 ) = = 21 ways.
1.2
Thus, there are 21 solutions of the equation subject to the given constraints.
3. How many different strings can be made by reordering the letter of the word
SUCCESS?
Solution
Because some of the letters of SUCCESS are the same, the answer is not given by the
number of permutations of seven letters. This word contains three Ss, two Cs, one U and
one E. To determine the number of different strings that can be made by reordering the
letters, first note that the three Ss can be placed among the seven position in C(7,3)
different ways, leaving four positions free. Then the two Cs can be placed in C(4,2) ways,
leaving two free positions. The U can be placed in C(2,1) ways, leaving just one position
free. Hence E can be placed in C(1,1) ways. Consequently, from the product rule, the
number of different strings that can be made is
7! 4! 2! 1! 7!
C ( 7,3) C ( 4, 2 ) C ( 2,1) C (1,1) = . . . = = 420 .
3!4! 2!2! 1!1! 1!0! 3!2!1!1!
2.4.3 PARTITION:
Let S be a non-empty set. The collection B = { A1 , A2 ,..., Ar } of non empty subsets of S is
a partition of S if and only if
(i) S = A1 ∪ A2 ∪ ... ∪ Ar
(ii) For any Ai , Aj ∈ B either Ai = Aj or Ai ∩ Aj = ∅
Each Ai is called a block of the partition.
Example:
Let S = {a, b, c, d , e, f , g , h} and A1 = {a, d , e} , A2 = {b, c} , A3 = { f } , A4 = { g , h} then
{ A1 , A2 , A3 , A4 } forms a partition of S since
(i) A1 ∪ A2 ∪ A3 ∪ A4 = S and
(ii) Ai ∩ Aj = ∅ for . i ≠ j
74
Exercise:
Show that for any two finite sets S and T, S ∪ T = S + T − S ∩ T using Venn diagram.
Clearly S ∪ T = ( S − T ) ∪ ( S ∩ T ) ∪ (T − S )
Let S − T = m, S ∩ T = n, T − S = k
S = ( S − T ) ∪ ( S ∩ T ) and ( S − T ) ∪ ( S ∩ T ) = φ
∴ S = S + T + S ∩T = m + n
S ∪T = S − T + S ∩T + T − S = m + n + k
Similarly, T = k + n
S + T = m+k +n+n
S ∪T = S + T − n = S + T − S ∩T
INCLUSION AND EXCLUSION PRINCIPLE FOR THREE SETS:
Let A1 , A2 , A3 be three non empty sets.
3 3
| A1 ∪ A2 ∪ A3 | = ∑| A | − ∑ | A ∩ A
i =1
i
i ≠ j =1
i j | + | A1 ∩ A2 ∩ A3 |
Examples:
1. Passwords must be 2 characters long. Each character must be a letter a – z , a digit
0 – 9, or one of the 10 punctuation characters ! @ # $ % ^ & * ( ) . Each
password must contain at least 1 digit or punctuation character. Find the number
of legal passwords.
Solution:
Password has a digit or punctuation character in position 1 or in position 2.The
inclusion and exclusion principle applies as these cases overlap.
Let A be the set of all Passwords that has a digit or punctuation character in position 1.
Let B be the set of all Passwords that has a digit or punctuation character in position 2.
Then A ∩ B is the set of all passwords, which has a digit or punctuation character in
position 1 and 2.
75
|A| = (10+10) (10+10+26) = 920
|B| = (10+10+26) (10+10) = 920
| A ∩ B |= 20x 20 = 400
By the principle of inclusion and exclusion,
A ∪ B = A + B − A ∩ B =920+920-400 = 1440
2. In a language survey of students it is found that 80 students know English, 60 know
French, 50 know German, 30 know English and French, 20 know French and German, 15
know English and German and 10 students know all the three languages. Using Venn
diagram find out how many students know (i) at least one language (ii) English only (iii)
at least two languages?
Solution:
Let E, F, G denote respectively, the sets of students knowing English, French and
German.
76
S8 = G − S6 − S5 − S7 = 50 – 5 – 10 – 10 = 25
Therefore
(i) the number of students who know at least one language is
S 2 + S 3 + S 4 + S 5 + S 6 + S 7 + S8
= 45 + 20 + 20 + 10 + 5 + 10 + 25 = 135
(ii) the number of students who know English only is
S2 = 45
(iii) the number of students who know at least two language is
S3 + S5 + S6 + S7 = 20 + 10 + 5 + 10 = 45
3. In a language survey of students it is found that 80 students know English, 60 know
French, 50 know German, 30 know English and French, 20 know French and German, 15
know English and German and 10 students know all the three languages. Find the number
of students who knows (i) at least one language (ii) English only (iii) at least two
languages using the principle of inclusion and exclusion.
(i) Using principle of inclusion and exclusion number of students who know at
least one language is given by
E ∪ F ∪G = E + F + G − E ∩ F − F ∩G − E ∩G + E ∩ F ∩G
= 80 + 60 + 50 -30 – 20 – 15 + 10 = 135
(ii) Let A = E ∩ F and B = E ∩ G
∴ A ∪ B = A + B − A ∩ B = 30 + 15 – 10 = 35
Therefore the number of students who know English alone is given by
E − A ∪ B = 80 – 35 = 45
(iii) Let A = E ∩ F , B = E ∩ G , C = F ∩ G
Clearly A ∩ C = A ∩ B = B ∩ C = A ∩ B ∩ C = E ∩ F ∩ G
By principle of inclusion and exclusion we get
A∪ B ∪C = A + B + C − A∩ B − A∩C − B ∩C + A∩ B ∩C
A∪ B ∪C = A + B + C − A∩ B − A∩C
A ∪ B ∪ C = A + B + C − E ∩ F ∩ G = 30 + 20 + 15 – 20 = 45
( Ai ∩ Aj ) + ∑ (A ∩ A ∩ Ak ) − ... + ( −1)
n n n
= ∑ ( Ak ) − ∑ ( A1 ∩ ... ∩ An )
n −1
i j
i =1 i ≠ j =1 i , j , k =1
77
ANOTHER VERSION OF THE PRINCIPLE OF INCLUSION AND
EXCLUSION:
Let S be any non-empty set with | S |= N . Let Ci ,1 ≤ i ≤ t be conditions satisfied by
some elements of S .
N ( Ci ) = { x ∈ S / x satisfy Ci } and
N ( Ci1 , Ci 2 ,...Cik ) = { x ∈ S / x satisfy the conditions Ci1 , Ci 2 ,..., Cik }
N ( Ci ) = { x ∈ S / x do not satisfy Ci } .
N = N ( C1 , C2 ,...Ct ) ,
Examples:
1. Determine the number of positive integers n, 1 ≤ n ≤ 1729 that are not divisible by
the Prime factors of 1720.
Solution:
The prime factors of 1729 are 7, 13 and 19.
Let C1 denote “an integer divisible by 7”
Let C2 denote “an integer divisible by 13”
Let C3 denote “an integer divisible by 19”
⎡1729 ⎤
N ( C1 ) = ⎢ = 247
⎣ 7 ⎥⎦
⎡1729 ⎤
N ( C2 ) = ⎢ = 133
⎣ 13 ⎥⎦
⎡1729 ⎤
N ( C3 ) = ⎢ = 91
⎣ 19 ⎥⎦
⎡ 1729 ⎤
N ( C1C2 ) = ⎢ = 19
⎣ 7 *13 ⎦⎥
⎡ 1729 ⎤
N ( C2C3 ) = ⎢ =7
⎣13*19 ⎥⎦
⎡ 1729 ⎤
N ( C3C1 ) = ⎢ = 13
⎣19*7 ⎥⎦
⎡ 1729 ⎤
N ( C1C2C3 ) = ⎢ = 1.
⎣ 7 *13*19 ⎥⎦
Hence the required “number of numbers” is
N = N − ∑ N ( Ci ) + ∑ N ( Ci C j ) − N ( C1C2C3 )
=1729 – [247 + 133 + 91] + (19 + 7 + 13) – 1.
= 1729 – 471 + 39 – 1 = 1258 + 38 =1296.
78
2. Determine the number of positive integers x where x ≤ 1729 and the sum of the
digits in x is equals to 29.
Solution:
Let x = x1 x2 x3 x4
Be such that x1 + x2 + x3 + x4 = 29
with 0 ≤ xi ≤ 9 . The problem can be restated as finding the number of integer
solutions of the equation
x1 + x2 + x3 + x4 = 29
subject to the conditions 0 ≤ xi ≤ 9 (1 ≤ i ≤ 4 ) .
Hence,
4
S2 = ∑ N ( C C ) = C ( 4, 2 ) C (12,9 )
i ≠ j =1
i j
79
Hence the required number of solutions by the principle of inclusion and exclusion is
S − S1 + S 2 − S3 + S 4
C ( 32, 29 ) − C ( 4,1) C ( 22,9 ) + C (4, 2)C (12,9 )
3. In a group of 70 people, 37 like coffee, 52 like tea and each person like at least
one of the two drinks. The number of persons liking both coffee and tea is
(a) 16 (b) 13 (c) 19 (d) None of these Ans: (c)
5. Suppose A1,A2,…A30 are thirty sets, each with five elements and B1,B2,…Bn are n
30 n
sets each with three elements. Let U Ai = U B j = S
i =1 j =1
If each elements of S belongs to exactly ten of the Ai’s and exactly nine of the
Bj’s then n =
(a) 45 (b) 35 (c) 40 (d) None of these Ans: (a)
6. Consider the set of all determinants of order 3 with entries 0 or 1 only. Let B be
subset of A consisting of all determinants with value 1. Let C be the subset of the
set of all determinants with value – 1. Then
(a) C is empty (b) B has as many elements as C
(c) A = B ∪ C (d) B has twice as many elements as C. Ans: (b)
7. Out of 800 boys in a school, 224 played cricket, 240 played hockey and 336
played basket ball. Of the total, 64 played both basketball and hockey; 80 played
cricket and basketball and 40 played cricket and hockey; 24 played all the three
games. The number of boys who did not play any game is:
(a) 160 (b) 240 (c) 216 (d) 128 Ans: (a)
80
2.5.1 RELATIONS:
Let A and B be non-empty set, then any subset R of A x B is called a binary relation
from A to B.
Example: Let A = {1,2,3}, B = {a,b}, then A x B = {(1,a), (1,b), (2,a),(2,b), (3,a), (3,b)}
R1 = {(1,a), (2,b),(2,a),(2,b)}
R2 = {(1,1),(3,b)}
R1 and R2 are binary relations from A to B.
If ( a, b ) ∈ R then we write aRb and we may say “a is related to b by the relation R”.
COMPLEMENTARY RELATIONS:
Let R be any relation from A to B.
Then, the binary relation R , the complement of R is the binary relation defined by
R ≡ {( a, b ) | ( a, b ) ∉ R} = ( A × B ) − R .
Let R be any binary relation, then the domain D(R) of R is defined as
D(R) = {a / a ∈ A and (a, b) ∈ R for some b ∈ B}
The range E(R) of R is defined as E(R) = {b / b ∈ B and (a, b) ∈ R for some a ∈ A} .
Note: If R ⊆ A × B , then clearly D ( R ) ⊆ A and of E ( R ) ⊆ B .
Example:
Given A = {1,2,3}, B = {a,b} and R = {(1,a), (2,b),(2,a),(2,b)} we get D(R) = (1,2) and
E( R ) = (a,b).
TRANSITIVE:
A relation R defined on a set X is transitive if, whenever ( x, y ) ∈ R and ( y, z ) ∈ R , then
( x, z ) ∈ R
81
In other words if xRy and yRz ⇒ xRz , then R is said to be transitive.
Example:
Let X = {1, 2, 3}
R = {(1,1) , (1, 2 ) , ( 2, 2 ) , (1,3) , ( 2,3) , ( 2,1)}
S = {(1, 2 ) , ( 2,3) , (1,3) , ( 3,3) , ( 2,1)}
Then R is transitive, but S is not transitive. Since 2 S1 and 1S 2 but ( 2, 2 ) ∉ S .
IRREFLEXIVE:
A relation R in a set X is irreflexive if, for every x ∈ X , ( x, x ) ∉ R .
Example:
Let X = {1, 2,3}
R = {( 2,1) , (1, 2 ) , ( 3, 2 ) , ( 2,3) , (1,3)}
S = {(1,1) , ( 2,3) , ( 2, 2 ) , (1,3)}
Clearly R is irreflexive.
S is not reflexive as ( 3,3) ∉ S and not irreflexive as (1,1) ∈ S .
ANTISYMMETRIC:
A relation R on a set X is anti-symmetric if, whenever ( x, y ) ∈ R and ( y, x ) ∈ R ,
then x = y .
In other words xRy and yRx ⇒ x = y , then R is said to be antisymmetric.
Example:
Let A be a set and P (A) the power set of A.
R be the inclusion relation ( ⊆ ) defined on P (A).
A ⊆ B and B ⊆ A ⇒ A = B
Hence the relation R defined on P(A) is antisymmetric.
EQUIVALENCE RELATION:
A relation R on a set A is called an equivalence relation on A if it is reflexive, symmetric
and transitive.
82
2.5.3 EQUIVALENCE CLASSES:
Let R be any equivalence relation on a set A. Let a ∈ A
The equivalence class of a, denoted by [ a ]R ≡ {b | aRb} which is equal to the set of all
elements of A that are equivalent to a according to the equivalent relation R. Each b in
[ a ]R is called a representative of [ a ]R .
Example:
1. Consider the real numbers R. Define a relation S on R as a R b if and only if a − b ∈ Z
where Z is the set of all integers. Clearly S is an equivalence relation on R.
Let a ∈ R then [ a ]R = the set {..., a − 2, a − 1, a, a + 1, a + 2,...}
2. Consider the set of all integers Z. Let m be a positive integer >1. Define a relation S on
Z as a R b if and only if a – b is an integral multiple of m. Then S is an equivalence
relation on Z.
Let a ∈ Z then [ a ]R = the set {..., a − 2m, a − m, a, a + m, a + 2m,...}
83
Every equivalence relation R on a non-empty set X determines a unique partition on X,
whose members are equivalence classes of R.
Solution:
Let R be an equivalence relation on a non-empty set X. P = {[ a ]R | a ∈ X } be the
collection of all equivalence classes of R.
Each element of P is a non-empty subset of X as a ∈ [ a ]R for all a ∈ X .
If [ a ]R ≠ [b ]R , then by the properties of equivalence classes, we have [ a ]R ∩ [b ]R = φ .
If x ∈ X , then x ∈ [ x ]R . So X = ∪ [ a ]R .
Hence P is a partition of X and each member of P is an equivalence class of R.
This partition P, whose elements are equivalence classes of R, is unique as R –
equivalence class of any element is unique and is denoted by X | R = {[ x ]R / x ∈ X } .
Now we observe that a partition P on a set X determines an equivalence relation R on
X.
Note:
Let P be a partition on a non-empty set X. Then there is an equivalent relation R on X
such that P = X | R.
Solution:
Let P be a partition on a non-empty set X. Define a relation R on X as a R b ⇔ a, b ∈ A
for some block A ∈ P .
To show that R is an equivalence relation.
As X = U A, given any a ∈ X , we can find a block A ∈ P such that a ∈ A . Thus aRa,
A∈P
Solution:
84
The blocks of P are {1}, {2,4} and {3}. If R is the equivalence relation determined by P,
then to each element a ∈ A , only the elements of the block in which a is an element, are
related to a under R. So as 1 ∈ {1}, we have (1,1) ∈ R .
As {2, 4} is a block, 2 and 4 are related only to the elements of {2, 4}. So (2, 2), (2, 4),
(4, 2), (4, 4) ∈ R .
Similarly (3, 3) ∈ R .
So the equivalence relation R determined by P is R = (1, 1), (2, 2), (2, 4), (4, 2), (4, 4),
(3, 3)}
2. Find the unique partition P on A = {1, 2, 3, 4, 5} determined by the equivalence
relation R, where R = {(1, 1), (1, 3), (1, 5), (2, 2), (2, 4), (3, 1), (3, 3), (3, 5), (4, 2), (4, 4),
(5, 1), (5, 3),(5, 5)}
Solution:
Now R(1) = {1, 3, 5} and R(2) = {2, 4}
Note that R(1) = R(3) = R(5) and R(2) = R(4).
The partition P is {{1, 3, 5}, {2, 4}}.
⎛1 ⎞ ⎛0 ⎞ ⎛ 1 ⎞ ⎛ 0 ⎞
⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟
⎜ 1 ⎟ ⎜ 0 ⎟ ⎜1 0⎟ ⎜1 1⎟
⎜ 1 ⎟ ⎜ 0 ⎟ ⎜ ⎟ ⎜ ⎟
⎜⎜ ⎟ ⎜⎜ ⎟ ⎜⎜ ⎟⎟ ⎜⎜ ⎟⎟
⎝ 1 ⎟⎠ ⎝ 0 ⎟⎠ ⎝ 0 ⎠ ⎝ 0 ⎠
85
Reflexive: Irreflexive Symmetric Antisymmetric
All 1’s on diagonal all 0’s on diagonal all identical across all 1’s are across
Diagonal from 0’s.
a c
The in degrees and out degrees of all vertices are given in the following table.
a b c d
In degrees 2 1 2 2
Out degrees 3 1 2 1
2. What are the ordered pairs in the relation R represented by the directed graph.
86
1 2
4 3
Solution: R = {(1,3), (1,4), (2,1), (2,2), (2,3), (3,1), (3,3), (4,1), (4,3)}
x R y S z x RoS z
87
For example, Let R = {(1, 2 ) , ( 2,3) , ( 3, 4 ) , ( 2, 2 )} and S = {( 2,3) , ( 4,1) , ( 4,3) , ( 2,1)}
Then R o S = {(1,3) , (1,1) , ( 3,1) , ( 3,3) , ( 2,3) , ( 2,1)} , S o R = {( 2, 4 ) , (4, 2), ( 4, 4 ) , ( 2, 2 )}
Note:
Let R be a relation on a set A. The Rn, n = 1, 2, 3…. are defined recursively by R1 = R,
Rn+1 = Rn o R.
Example:
1. Let R = {(1, 1), (2, 1), (3, 2), (4, 3)}. Show that R4 = R3.
Solution:
R2 = R o R and hence R2 = {(1, 1), (2, 1), (3, 1), (4, 2)}, R3 = R2 o R. Hence R3 = {(1, 1),
(2, 1), (3,1), (4,1)}, R4 = R3 o R. Hence R4 = {(1, 1), (2, 1), (3, 1), (4, 1)}. Therefore
R4 = R3.
2. Show that the relation R on a set A is transitive if and only if R n ⊆ R for n = 1, 2, 3…
Solution:
Assume R n ⊆ R for all n . In particular R 2 ⊆ R . To prove R is transitive. Let ( a, b ) ∈ R
and ( b, c ) ∈ R , then by the definition of composition, ( a, c ) ∈ R 2 . Since R 2 ⊆ R , this
means that ( a, c ) ∈ R . Hence R is transitive.
On the other hand assume that R is transitive. To show that R n ⊆ R for all n. We shall
prove this by induction on n. The result is true for n = 1.
Assume that R n ⊆ R where n is a positive integer. To show that R n +1 ⊆ R . Assume
that ( a, b ) ∈ R n +1 . Then, since R n +1 = R n o R , there is an element x with x ∈ A such that
( a, x ) ∈ R and ( x, b ) ∈ R n . The inductive hypothesis, namely that R n ⊆ R , implies that
( x, b ) ∈ R . Since R is transitive, and ( a, x ) ∈ R and ( x, b ) ∈ R , it follows that ( a, b ) ∈ R .
This shows that R n +1 ⊆ R . Hence if R is transitive, then R n ⊆ R for all n.
Example:
1. Suppose R is a relation on A. If R is symmetric and transitive, then R is reflexive. Is the
statement true? Justify your answer.
Solution:
No. Consider relation R = {( a, a ) , ( a, b ) , ( b, a ) , ( b, b )} on the set A = {a, b, c).This is not
reflexive since (c, c) is not in R. However R is symmetric and transitive.
88
first letter as x . There are 26 equivalence classes, one for each letter of the English
alphabet.
(b) R = {( x, y ) ∈ W × W | the words x and y have at least one letter in common}.
Solution:
Clearly S is reflexive and symmetric. Let w1 be the word “eat”, w2 be the word “and”,
and w3 be the word “throw”. In this case w3 Sw1 and w1 Sw2 , but it does not imply
w3 Sw2 . Therefore S is not transitive. Hence S is not an equivalence relation.
(c) R = {( x, y ) ∈ × and x ≤ y .
Solution:
R is reflexive and transitive. It is not symmetric as 2R3 ⇒ 3R2. It is not antisymmetric
either since -3R3 and 3R-3 but 3 ≠ -3.
(d) R = {( x, y ) ∈ B × B} , where B is the set of all bit strings of same length and x and
y have the same number of 1s}.
Solution:
R is reflexive, symmetric and transitive and therefore an equivalence relation. There is a
n equivalence class for each natural number corresponding to bit strings with that number
of 1s.
3. Let A and B be two subsets of the set of all integers and consider the cartesian product
C = A × B . Define a relation R on C as ( a, b ) R ( c, d ) if and only if a + d = b + c.
a) Show that R is an equivalence relation..
b) Partition the set {0, 1, 2} x {0, 1, 2} into the distinct equivalence classes under R.
c) How many equivalence classes under R are there on the set {0,1,…,n} x {0,1,…,n}.
Explain.
Solution:
a) To prove that R is an equivalence relation.
( a, b ) R ( c, d ) since a + b = b + a. Hence R is reflexive.
( a , b ) R ( c, d ) ⇒ a + d = b + c ⇒ c + b = d + a ⇒ ( c, d ) R ( a , b )
Let ( a, b ) R ( c, d ) and ( c, d ) R ( e, f ) . This implies a + d = b + c and c + f = d + e.
Adding we get a + d + c + f = b + c + d + e ⇒ a + f = b + e ⇒ ( a, b ) R ( e, f ) .
Hence ( a, b ) R ( c, d ) and ( c, d ) R ( e, f ) ⇒ ( a, b ) R ( e, f ) ⇒ R is transitive.
Since R is reflexive, symmetric and transitive it is an equivalence relation
b) ( a, b ) R ( c, d ) ⇒ a + d = b + c ⇒ a-b = c – d. This shows that with any equivalence
class C we can associate a difference h, such that ( a, b ) ∈ C ⇔ a − b = h. This gives us an
easy way to list the equivalence classes of {0,1,2} x {0,1,2}.
h = -2 : {(0,2)}
h = -1 : {(0,1), {1,2)}
h = 0 : {(0,0), (1,1), (2,2)}
h = 1 : {(1,0), (2,1)}
h = 2 : {(2,0)}
89
c) Using the observation from part b), it is enough to count the number of possible
differences. This is 2n + 1 since the difference can be any value in { - n, …,n}.
4. For any function f: A→B, define a binary relation, Rf, on A by the condition:
a1 R f a2 ⇔ f(a1) = f(a2).
(a) Show that R f is an equivalence relation.
Solution:
R f is reflexive since for any a ∈ A, f ( a ) = f ( a ) ⇒ aR f a
aR f b ⇒ f (a) = f (b) ⇒ f (b) = f (a) ⇒ bR f a . Hence R f is symmetric.
Let aR f b and bR f c . Then f (a) = f (b) and f (b) = f (c) ⇒ aR f c . Hence R f is
transitive.
Hence R f is an equivalence relation.
(b) Show that for every equivalence relation E on A, there exists a set B and a function f:
A→B such that E = R f .
Solution: Let B be the blocks of the partition of A defined by E, that is ,
B: = {[a ]E | a ∈ A} .
Define f: A→B by the rule
f(a): = [a ]E .
So
a1 R f a2 ⇔ f(a1) = f(a2)
⇔ [ a1 ]E = [ a2 ]E
⇔ a1 Ea2
which means that R f = E as required.
Solution:
2
2n . We look at the matrix that corresponds to the relations such that the element of the
n x n matrix is 1 if the corresponding pair is in the relation and it is 0 otherwise. There are
2
2n many different possible Boolean (0 – 1) n x n matrices. Another way of reasoning
about this is to say that there are n2 possible ordered pairs, and any subset of those pairs is
a possible relation. If A is the set of all pairs, then all possible relations are just all
possible subsets of A, and we know that P ( A ) = 2 = 2n .
A 2
90
number of entries in n2. The number of entries on the diagonal is n and the number
of entries on the upper side of the diagonal is ( n 2 − n ) / 2 . Therefore, there are
n( n+1) / 2
n(n – 1)/2 + n = n(n + 1)/2 entries that can be set. Hence, there are 2 different
symmetric matrices / relations.
8. How many symmetric and reflexive binary relation are there on set S of n elements?
Solution:
The matrix associated with a symmetric and reflexive relation is symmetric and has 1’s
along the main diagonal. The total number of entries is n2 and there are (n 2 − n) / 2 that
are on the upper side of the diagonal. Hence the number of such relations is 2(
n( n−1) ) / 2
.
9. How many symmetric or reflexive binary relations are there on set S of n elements?
Solution:
By inclusion-exclusion, the number of symmetric or reflexive relations equals the number
of reflexive relations plus the number of symmetric relations minus the number of
reflexive and symmetric relations, which equals 2(
n( n −1) ) / 2
+ 2 n − n − 2(
2 n ( n −1) ) / 2
.
91
Solution:
⎡0 0 1 0 1⎤ ⎡0 0 1 0 0⎤
⎢0 0 1 0 0 ⎥⎥ ⎢0 0 0 0 1 ⎥⎥
⎢ ⎢
Then M R = ⎢ 0 0 0 1 0⎥ , M s = ⎢1 0 0 0 0⎥
⎢ ⎥ ⎢ ⎥
⎢0 0 0 0 0⎥ ⎢0 1 0 1 0⎥
⎢⎣1 0 0 0 1 ⎥⎦ ⎢⎣0 1 1 0 0 ⎥⎦
⎡0 1 0 0 1⎤ ⎡0 0 1 0 0⎤ ⎡0 1 1 0 1⎤
⎢0 1 0 0 0 ⎥⎥ ⎢0 0 0 0 1 ⎥⎥ ⎢0 0 0 0 1 ⎥⎥
⎢ ⎢ ⎢
M RoS = M R M S = ⎢0 0 0 1 0⎥ ⎢1 0 0 0 0 ⎥ ∴ M RoS = ⎢0 1 0 1 0⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢0 0 0 0 0⎥ ⎢0 1 0 1 0⎥ ⎢0 0 0 0 0⎥
⎢⎣1 0 0 0 1 ⎥⎦ ⎢⎣0 1 1 0 0 ⎥⎦ ⎢⎣ 0 1 1 0 0 ⎥⎦
and M R 2 = M R M R
⎡0 1 0 01 ⎤ ⎡ 0 1 0 0 1 ⎤ ⎡1 1 0 0 1⎤
⎢0 1 0 00 ⎥⎥ ⎢⎢0 1 0 0 0 ⎥⎥ ⎢⎢0 1 0 0 0 ⎥⎥
⎢
= ⎢0 0 0 10 ⎥ ⎢0 0 0 1 0 ⎥ = ⎢0 0 0 0 0⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢0 0 0 00 ⎥ ⎢0 0 0 0 0⎥ ⎢0 0 0 0 0⎥
⎢⎣1 0 0 01 ⎥⎦ ⎢⎣1 0 0 0 1 ⎥⎦ ⎢⎣1 1 0 0 1 ⎥⎦
∴ R 2 = {(1,1) , (1, 2 ) , (1,5 ) , ( 2, 2 ) , ( 5,1) , ( 5, 2 ) , ( 5,5 )}
REFLEXIVE CLOSURE:
Let R be a relation on A. The reflexive closure of R is obtained by adding ( a , a ) to R
for each a ∈ A . If IA = ((a,a) / a ∈ A )
R1 = R ∪ I A
Examples:
1. Let X = {2, 4, 6}
R = {( 2, 2 ) , ( 2, 4 ) , ( 4, 2 ) , ( 6, 4 )} be a relation on X. Find the reflexive closure of R.
Solution:
Clearly R is not reflexive.
Add (4,4), (6,6) to R.
Reflexive closure of R is
R ∪ I A = {( 2, 2 ) , ( 2, 4 ) , ( 4, 2 ) , ( 6, 4 ) , ( 4, 4 ) , ( 6, 6 )}
92
Solution:
The reflexive closure of R = {( x, y ) | x ≤ y} .
SYMMETRIC CLOSURE:
Symmetric closure R1 of a relation R is obtained by adding (b,a) to R for each (a,b) in R
R1 = ( R ∪ R −1 ) .
Example:
1. Let X = {1, 2,3, 4}
R = {(1, 2 ) , ( 2,3) , (1,3) , ( 3, 4 )} . What is the symmetric closure of R.
Solution:
R −1 = {( 2,1) , ( 3, 2 ) , ( 3,1) , ( 4,3)}
Symmetric closure of R1 = ( R ∪ R −1 ) = {(1, 2 ) , ( 2,3) , (1,3) , ( 3, 4 ) , ( 2,1) , ( 3, 2 ) , ( 3,1) , ( 4,3)}
2. What is the symmetric closure of the relation R = {(a, b) | a > b} on the set of positive
integers.
Solution:
The symmetric closure of R is given by :
( R ∪ R −1 ) = {( a, b ) | a > b} ∪ {( b, a ) | a > b} = {( a, b ) | a ≠ b} .
TRANSITIVE CLOSURE:
Transitive closure R + of a relation R on a set X is obtained by repeatedly adding (a,c) to
R for each (a,b) and (b,c) in R.
Note: R+is the transitive closure of R, if
(i) R ⊆ R +
(ii) R+ is transitive on X.
(iii) There is no transitive relation R1 on X, such that R ⊂ R1 ⊂ R + .
Remarks: If X is a finite set with n elements, then R + = R ∪ R 2 ∪ ... ∪ R n and the matrix
of R + = R ∪ R 2 ∪ ... ∪ R n is M R+ = M R ∨ M R2 ... ∨ M Rn .
Exercise:
Let A = {1,2,3,4} and R = {(1,2), (2,3), (3,3), (3,4),(4,2)} be a relation defined on A.
find the transitive closure of R?
Solution: The matrix of the relation R is given by
⎛0 1 0 0⎞
⎜ ⎟
0 0 1 0⎟
MR = ⎜
⎜0 0 1 1⎟
⎜⎜ ⎟⎟
⎝0 1 0 0⎠
93
⎛0 1 0 0⎞ ⎛0 1 0 0⎞
⎜ ⎟ ⎜ ⎟
0 0 1 0⎟ ⎜0 0 1 0⎟
M R2 = M R MR = ⎜
⎜0 0 1 1⎟ ⎜0 0 1 1⎟
⎜⎜ ⎟ ⎜⎜ ⎟
⎝0 1 0 0 ⎟⎠ ⎝0 1 0 0 ⎟⎠
⎛0 0 1 0⎞
⎜ ⎟
0 0 1 1⎟
=⎜
⎜0 1 1 1⎟
⎜⎜ ⎟
⎝0 0 1 0 ⎟⎠
⎛0 0 1 0⎞ ⎛0 1 0 0⎞ ⎛0 0 1 0⎞
⎜ ⎟ ⎜ ⎟ ⎜ ⎟
0 0 1 1⎟ ⎜0 0 1 0⎟ ⎜0 0 1 1⎟
M R3 = M R 2 MR = ⎜ =
⎜0 1 1 1⎟ ⎜0 0 1 1⎟ ⎜0 1 1 1⎟
⎜⎜ ⎟ ⎜⎜ ⎟ ⎜ ⎟
⎝0 0 1 0 ⎟⎠ ⎝0 1 0 0 ⎟⎠ ⎜⎝ 0 0 1 0 ⎟⎠
⎛0 0 1 0⎞ ⎛0 1 0 0⎞ ⎛0 0 1 1⎞
⎜ ⎟ ⎜ ⎟ ⎜ ⎟
0 0 1 1⎟ ⎜0 0 1 0⎟ ⎜0 0 1 1⎟
M R 4 = M R3 MR = ⎜ =
⎜0 1 1 1⎟ ⎜0 0 1 1⎟ ⎜0 1 1 1⎟
⎜⎜ ⎟ ⎜⎜ ⎟ ⎜ ⎟
⎝0 0 1 0 ⎟⎠ ⎝0 1 0 0 ⎟⎠ ⎜⎝ 0 1 1 1⎟⎠
∴ As A = 4, we get M R+ = M R ∨ M R2 ∨ M R3 ∨ M R4
⎛ 0 1 0 0 ⎞ ⎛ 0 0 1 0 ⎞ ⎛ 0 0 1 0 ⎞ ⎛ 0 0 1 1⎞
⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟
0 0 1 0 ⎟ ⎜ 0 0 1 1 ⎟ ⎜ 0 1 1 0 ⎟ ⎜ 0 0 1 1⎟
i.e., M R+ = ⎜ ∨ ∨ ∨
⎜ 0 0 1 1 ⎟ ⎜ 0 1 1 1 ⎟ ⎜ 0 1 1 1 ⎟ ⎜ 0 1 1 1⎟
⎜⎜ ⎟⎟ ⎜⎜ ⎟⎟ ⎜⎜ ⎟⎟ ⎜⎜ ⎟⎟
⎝ 0 1 0 0 ⎠ ⎝ 0 0 1 0 ⎠ ⎝ 0 0 1 1 ⎠ ⎝ 0 1 1 1⎠
⎛ 0 1 1 1⎞
⎜ ⎟
0 1 1 1⎟
=⎜
⎜ 0 1 1 1⎟
⎜⎜ ⎟⎟
⎝ 0 1 1 1⎠
∴ Hence R+ = {1,2), (1,3), (1,4), (2,2), (2,3), (2,4), (3,2), (3,3), (3,4), (4,2), (4,3), (4,4)}
2.5.9 WARSHALL’S ALGORITHM:
We now describe a more efficient algorithm to compute the transitive closure of a
relation, called Warshall algorithm.
Let X = { x1 , x2 ,...xn } and R be a relation on X.
For each k ,1 ≤ k ≤ n . We define a matrix Wk = ( wij ) as follows
where wij is 1 if and only if there is a chain from xi to x j in R whose interior vertices, if
any, come from the set { x1 , x2 ,..., xk } , otherwise wij = 0 .
Note that Wn = M R+
We define W0 to be M R .
We compute Wk from Wk −1 as follows:
94
Let Wk = ( tij ) and
Wk −1 = ( sij )
If tij = 1 , then there must be a chain from xi to x j in R whose interior vertices come from
the set { x1 , x2 ,..., xk } . So, we can obtain a path, (whose interior vertices are all distinct),
from xi to x j in R whose interior vertices are from { x1 , x2 ,..., xk } .
If xk is not an interior vertex of the path, then all the interior vertices of the path must
actually come from the set { x1 , x2 ,..., xk −1} . So sij = 1 .
If xk is an interior vertex of this path, then xk appears only once in this path as an
interior vertex and all other interior vertices come from { x1 , x2 ,..., xk −1} .
If the path is x1a1a2 ...al −1al al +1...am x j and al = xk , then the sub paths x1a1a2 ...al −1 ( = xk )
and ( xk = ) a p al +1...am x j are paths from xi to xk and xk to x j respectively.
Also the interior vertices of these sub paths are from { x1 , x2 ,..., xk −1}
xk
x2
xi xj
95
Example:
Let X = {1, 2,3, 4} and
R = {(1,1) , (1,3) , (1, 4 ) , ( 2, 2 ) , ( 3, 4 ) , ( 4,1)}
We find the transitive closure of R by using Warshall’s algorithms.
⎛1 0 1 1⎞
⎜ ⎟
⎜ 0 1 0 0⎟
Let W0 = M R =
⎜0 0 0 1⎟
⎜⎜ ⎟⎟
⎝1 0 0 0⎠
In Wk −1
New position
k Position of 1’s on Position of 1’s Wk
of 1’s in Wk
column k in row k
1 1,4 (in the 1st column) 1,3,4 (in the 1st (1,1), (1,3), ⎛1 0 1 1⎞
row) (1,4), (4,1), ⎜ ⎟
(4,3), (4,4) ⎜0 1 0 0⎟
⎜0 0 0 1⎟
⎜⎜ ⎟
⎝1 0 1 1 ⎟⎠
2 2 2 (2,2) ⎛1 0 1 1⎞
⎜ ⎟
⎜0 1 0 0⎟
⎜0 0 0 1⎟
⎜⎜ ⎟
⎝1 0 1 1 ⎟⎠
3 1,4 4 (1,4), (4,4) ⎛1 0 1 1⎞
⎜ ⎟
⎜0 1 0 0⎟
⎜0 0 0 1⎟
⎜⎜ 1 0 1
⎟
1 ⎟⎠
⎝
4 1,3,4 1,3,4 (1,1), (1,3), ⎛1 0 1 1⎞
(1,4), (3,1), ⎜ ⎟
(3,3), (3,4), ⎜0 1 0 0⎟
(4,1), (4,3), ⎜1 0 1 1⎟
(4,4) ⎜⎜ 1 0 1
⎟
1 ⎟⎠
⎝
∴W4 = M R+
∴ the transitive closure of R is given by
R + = {(1,1) , (1,3) , (1, 4 ) , ( 2, 2 ) , ( 3,1) , ( 3,3) , ( 3, 4 ) , ( 4,1) , ( 4,3) , ( 4, 4 )}
Example:
1. X = {2, 4, 6} , R = {( 2, 4 ) , ( 4, 6 ) , ( 6, 6 )} . Find the transitive closure of R.
As |X| = 3, we have
R 2 = ( R.R ) = {( 2, 4 ) , ( 4, 6 ) , ( 6, 6 )}
R 3 = R 2 .R = {( 2, 4 ) , ( 4, 6 ) , ( 6, 6 )}
96
∴ R = R ∪ R 2 ∪ R 3 = {( 2, 4 ) , ( 4, 6 ) , ( 6, 6 )}
2. X = {( a, b, c, d )}
R = {( b, a ) , ( b, c ) , ( c, a ) , ( c, d ) , ( d , a ) , ( d , c )} Find the transitive closure of R.
⎛0 0 0 0⎞
⎜ ⎟
1 0 1 0⎟
MR = M0 = ⎜
⎜1 0 0 1⎟
⎜⎜ 1 0 1
⎟
0 ⎟⎠
⎝
In Wk −1
New position
k Position of 1’s on Position of 1’s of 1’s in W Wk
k
column k in row k
1 2, 3, 4 Nil ⎛0 0 0 0⎞
(in the 1st column) st
(in the 1 row) ⎜ ⎟
⎜1 0 1 0⎟
⎜1 0 0 1⎟
⎜⎜ ⎟
⎝1 0 1 0 ⎟⎠
2 - 1,3 - ⎛0 0 0 0⎞
⎜ ⎟
⎜1 0 1 0⎟
⎜1 0 0 1⎟
⎜⎜ ⎟
⎝0 0 1 0 ⎟⎠
3 2,4 1,4 (2,1), ⎛0 0 0 0⎞
(2,4),(4,1) ⎜ ⎟
(4,4) ⎜1 0 1 1⎟
⎜1 0 0 1⎟
⎜⎜ ⎟
⎝1 0 1 1 ⎟⎠
4 3,4 1,3,4 (3,1), (3,3), ⎛ 0 0 0 0⎞
(3,4), (4,1), ⎜ 1 0 1 1⎟
⎟
(4,3), (4,4) ⎜
⎜1 0 1 1⎟
⎜⎜ ⎟
⎝1 0 1 1 ⎟⎠
∴W4 = M R+
Hence the transitive closure of R is given by {(b,a), (b,c), (b,d), (c,a),(c,c),(c,d),
(d,a),(d,c),(d,d)}
97
HASSE DIAGRAM:
A Hasse Diagram is a pictorial representation of a partially ordering on a finite set.
PROCEEDURE:
• Let ( A , R) be given partial ordered set.
• Consider the digraph of this relation.
• Since R is reflexive a loop will be present at every vertex. Remove these loops.
• Remove the edges present because of transitivity.
• Arrange each edge so that its initial vertex is below its terminal vertex.
• Remove all the arrows in the directed graph.
The resulting diagram is called a Hasse Diagram for the relation R.
Example:
1. Let X = {1,2,3,4} and let R be the relation given by xRy if x ≤ y. Draw the Hasse
diagram of R.
Solution:
R = {(1,1) , (1, 2 ) , (1,3) , (1, 4), (2, 2), (2,3), (2, 4), (3,3), (3, 4), (4, 4)}
Digraph of R is Fig (i).
Removing the loops gives Fig (ii)
Removing the edges present because of transitivity; arranging each edge so that its initial
vertex is below its terminal vertex and remove all arrows gives Fig (iii)
The Hasse diagram of R is given by Fig (iii)
4 4 4
3 3 3
2
2 2
1
1 1
Fig (i) Fig (ii) Fig (iii)
2. Construct Hasse diagram of the partal order R given by aRb if and only if a divides b
for a,b in the set A = {1,2,3,4,6,8,12}.
Solution:
⎧⎪(1,1) , (1, 2 ) , (1,3) , (1, 4), (1, 6), (1,8), (1,12), (2, 2), (2, 4), (2, 6), (2,8), (2,12), (3,3), (3, 6), ⎫⎪
R=⎨ ⎬
⎪⎩(3,12), (4, 4), (4,8), (4,12), (6, 6), (6,12), (8,8), (12,12) ⎪⎭
98
Digraph of R is Fig (i).
Removing the loops gives Fig (ii)
Removing the edges present because of transitivity; arranging each edge so that its initial
vertex is below its terminal vertex and remove all arrows gives Fig (iii)
The Hasse diagram of R is given by Fig (iii)
8 12
8 12 8 12
4 6 4 6
4 6
2 3
2 3
2 3
1
1 1
Fig (i) Fig (ii) Fig (iii)
3. Let P be the power set of the set {a,b,c}. Consider the partial ordering on P given by
set inclusion. Contruct its Hasse diagram.
Solution:
{a,b,c}
{a} {b}
{c}
φ
MAXIMAL AND MINIMAL ELEMENTS:
Given a partially ordered set (S,R) an element a in S is called maximal if there is no b
in S such that aRb. An element a is called the greatest element if bRa for all b in S. An
element a in S is called manimal if there is no b in S such that bRa. An element a is called
the least element if aRb for all b in S.
Note:
99
Maximal and minimal elements can be identified using Hasse diagram since they are the
top and bottom elements in the diagram.
1. Let P be the set of the set {2,4,5,10,12,20,25}. Consider the partial ordering R on P
given by aRb if and only if a divides b. Construct its Hasse diagram. Write down the
maximal and minimal elements.
Solution:
12 20
2 5
The maximal elements are 12,20 and 25 and the minimal elements are 2 and 5.
2. Determine the greatest element and the least element for the poset given by
Solution:
The Hasse diagram for the given poset is given by
a b
LATTICES:
100
A partially ordered set in which every pair of elements has both least upper bound and
greatest lower bound is called a lattice.
Example:
The set A = {1,2,4,8,16} with partial ordering given by aRb for a,b in A if and only if a
divides b is a lattice whereas the set A = {1,2,3,4,5} with partial ordering given by aRb
for a,b in A if and only if a divides b is not a lattice.
2.5.11 FUNCTIONS:
A special case of relation is that which associates to each member of the first set only
one member of the second set. Such a relation is called a function from one set into the
other.
A relation from A to B is said to be a function from A to B if to each a ∈ A , there is
exactly one b ∈ B such that ( a, b ) ∈ f . When ( a, b ) ∈ f , we write b = f ( a ) . A function
from A to B is also written as f : A → B which is read as “ f is a function of A into B”.
Here A is called the domain of f , denoted by D( f ) and B is called the codomain of f ,
y is the image of a under f , x is a pre-image of y under f .
Examples :
1. Let R be the set of all real numbers and B be the set of all non-negative real
numbers. Define f : R → B as f ( x) = x 2 . f defines a function from R to B.
2. Let A be the set of all countries in the world and let f assign to each member of A
its capital city. Let B be the set of capital cities in the world. Then f is a function
from A to B. Since the capital of India is New Delhi, we have f(India) = New
Delhi.
In this example, the correspondence between the two sets A and B is geographical.
101
a x
b y
c z
d w
Here A = {a,b,c,d}, B = {x,y,z,w} and f : A→B is defined by f(a) = y, f(b) = x, f(c) = z and
f(d) = y. We can also write this f as the set of ordered pairs f = {(a,y), (b,x), (c,z), (d,y)}.
Given an element a in A there is exactly one ordered pair whose first element is a.
Hence f is a function. Even though the element y ∈ B appears as the second element of
two different ordered pairs in f, the definition of f holds good. Thus a function may take
the same value at two different elements of A.
RANGE:
Let f be a mapping of A into B i.e., let f: A→B. Each element in B need not appear as
an image of some element in A. The range of f contains of exactly those elements in B
which appear as the image of at least one element in A. We denote the range of f: A→B
by f(A). It is also denoted by R(f) = f(A) = {f(a) ∈ B | a ∈ A }. Clearly R(f) ⊆ B.
Note:
1. f: A→B is one-to-one if any one of the following equivalent conditions hold:
(i) No two members of A correspond to the same member of B.
(ii) For x, y ∈ A , x ≠ y implies f(x) ≠ f(y).
(iii) If f(x) = f(y) then x = y.
(iv) No two distinct ordered pairs of f have the same second element when f is
described as a relation (i.e. a subset of A x B).
(v) The pre-image of each element in the range is a singleton.
2. Conditions (iii) given in the above note will be useful for proving that a given function
is one -one.
3. A one-one function is also known as injective.
102
Example:
Consider the graph representations of functions given below.
A E E
A A
E
F B F B F
B
•G C
C G C G
•H
D D H
I D
H
•I I
ONTO FUNCTION:
Let f be a function of A into B. then the range f(A) of the function f is a subset of B.
i.e. f(A) ⊂ B.
If f(A) = B i.e. the range of f is equal to the entire co-domain B or if every member of
B appears as the image of at least one element of A, then we say “f is a function of A onto
B” or “f maps A onto B” or f is an onto function.
Note:
An onto function f is also known as a surjective function. If f: A→B is both one-to-one
and onto, then f is called a bijection. In this case, every element of B has exactly one
pre-image in A.
Fig 1, Fig 2: Domain {A, B, C, D, E}, Range {F, G, H, I}, Fig 3 Domain {A, B, C, D}, Range {F, G, H, I}
Fig 4 Domain {A, B, C, D}, Range {F, G, H, I, J}
A F A F A A
F F
B G
B G B G B G
C H C H
103
•H C
D D C H I
I I D
•J
E E D I
Example:
1. Given a f : A → B , where A and B are finite. If f is injective, then A ≤ B . If f is
surjective then B ≤ A . If f is bijective, then A = B .
Solution:
Put n = A , A = { x1 , x2 ,..., xn } and m = B , B = { y1 , y2 ,..., ym } .
If f were injective then f ( x1 ) , f ( x2 ) ,..., f ( xn ) are all distinct, and among the yk .
Hence n ≤ m .
If f were surjective then each yk is hit, and for each, there is an xi with f ( xi ) = yk .
Thus there are at least m different images, and so n ≥ m .
3. Let A = {1, 2, 3, 4} and B = {a, b, c}. How many functions are there from A to B and
how many injective functions are there from B to A?
Solution:
There are 34 = 81function from A to B and none are injective.
From B to A there are 43 = 64 functions and 4.3.2 = 24 are injective.
Note:
Let A and B be two finite sets with |A| = n and |B| = m. If n < m then there are no
surjections form A to B, If n ≥ m then the number of surjective function from A to B is
mn – C(m,1)(m – 1)n + C(m,2)(m – 2 )n…+(-1)m-1C(m,m – 1)(1)n.
104
Example:
Find the number of surjections from A = {a,b,c,d} to B = {1,2,3}.
Solution:
|A| = 4 and |B| = 3. Hence the number of surjections from A to B is
34 – C(3,1)(2)4 + C(3,2)(1)4 = 81 – 3 x 16 + 3 = 36.
INVERTIBLE FUNCTION:
A function f: A→B is invertible if its inverse relation f −1 is also a function from the
range of f into A.
Consider the following Example:
Let A = {a,b,c,d} and B = {1,2,3,4}
Let f = {(a,1), (b,1), (c,4), (d,3)} be a relation from A to B.
Now the inverse relation is given by
f −1 = {(1,a), (1,b), (4,c), (3,d)}
As the element 1 of B is associated with both a and b of A, f −1 is not a function.
This establishes that a function is not necessarily invertible, but is always invertible as a
relation.
We shall establish the conditions for a function to be invertible.
COMPOSITION OF FUNCTIONS:
Let f: A→B and g: B→C, then the function (g o f) : A→C defined by
(g o f) (a) = g(f(a)) is called the composition of f and g.
Example: Let f and g be function from 2 to Z defined by f(x) = 2x + 3 and g(x) = 3x + 2.
What is the composition of f and g and the composition of g and f.
Solution:
(f o g)(x) = f(g(x)) = f(3x + 2) = 2 (2x+2) + 3 = 6x +3
(g o f)(x) = g(f(x)) = g(2x + 3) – 3 (2x + 3) + 2 = 6x – 1
Example:
The floor function f is from set of real numbers to integers f ( x ) = ⎢⎣ x ⎥⎦ the largest
integer that is ≤ x .
The ceiling function g : R → show that g ( x ) = ⎢⎡ x ⎥⎤ the smallest integers ≥ x .
Example: Data stored on a computer disk or transmitted over a data network are usually
represented as a string of bytes. Each byte is made up of 8 bits. How many bytes are
required to encode 100 bits of data?
Solution:
To determine the number of bytes needed, we determine the smallest integer that is at
least as large as the quotient when 100 divided by 8, the number of bits in a byte.
Consequently, ⎢⎡100 / 8⎥⎤ = ⎢⎡12.5⎥⎤ = 13 bytes are required.
105
Example: In asynchronous transfer mode (ATM) (a communications protocol used no
backbone networks), data are organized into cells of 53 bytes. How many ATM cells can
be transmitted in 1 minute over a connection that transmits data at the rate of 500 kilobits
per second?
Solution:
In 1 minute, this connection can transmit 500,000.60 = 30,000,000 bits. Each ATM
cells is 53 bytes long, which means that it is 53.8 = 424 bits long. To determine the
number of cells that can be transmitted in 1 minute, we determine the largest
integer not exceeding the quotient when 30,000,000 is divided by 424.
Consequently, ⎢⎣30, 000, 000 / 424 ⎥⎦ = 70, 754 ATM cells can be transmitted in 1 minute
over a 500 kilobit per second connection.
1. Let p be the relation on the set R of all real numbers defined by setting apb if
1
and only if a − b ≤ . Then, p is
2
(a) reflexive and symmetric but not transitive.
(b) Symmetric and transitive but not reflexive
(c) Transitive but neither reflexive nor symmetric
(d) None of these Ans (a)
106
(a) reflexive (b) symmetric (c) transitive (d) None of these Ans: (b)
6. If R and R ′ are symmetric relations (not disjoint) on a set A, then the relation
R ∩ R ′ is
(a) reflexive (b) symmetric (c) transitive (d) None of these Ans: (b)
SUMMARY:
• Sets are used to group object together. A set is a well defined collection of objects
or also called as elements. We can describe a set by using roaster notation, set
builder notation or using quantifiers.
• Union of sets, intersection of sets, complementation of a set, difference of two sets,
symmetric difference of two sets are defined.
• Venn diagram, a pictorial representation of a sets is used to indicate relationship
between sets. Set identity can be proved using membership table. The operation of
computing the union, intersection, difference of two sets is time consuming.
Computer representation of set make computing combination of sets easy.
• The rules of counting can solve a variety of problems. Permutation and
combinations are used in many counting problems. Given a set A, |A| denotes a
number of elements in A. The principle of inclusion and exclusion for n sets states
that : Let A1 , A2 ,... An be any n non-empty sets. Then, A1 ∪ A2 ∪ ... ∪ An
∑ (A ∩ A ) + ∑ (A ∩ A ∩ Ak ) − ... + ( −1)
n n n
= ∑ ( Ak ) − ( A1 ∩ ... ∩ An ) .
n −1
i j i j
i =1 i ≠ j =1 i , j , k =1
This tells how many elements are there in the union of finite number of finite sets.
• Given two sets A, B, the cartesian product of A and B is defined as
A x B = {(a,b)|a∈A , b∈B}.
The Cartesian product is not commutative. Further |A x B| = |A| |B|.
• Any subset of A x B is called a binary relation R. A binary relation R on a set A is
said to be reflexive if aRa for every a∈A. R is said to be symmetric if aRb implies
bRa for every a,b∈A. R is said to be transitive if aRb and bRc implies aRc for
a,b,c∈A. A relation R which is reflexive, symmetric and transitive is called an
equivalence relation.
• A relation can be represented by means of matrices and also by means of digraphs.
Let R be a relation on A. The reflexive closure of R is obtained by adding (a,a) to R
for each a∈A. The symmetric closure is obtained by adding (b,a) to R for each
a,b∈R. The transitive closure of R is obtained by repeatedly adding (a,c) to R for
each (a,b) and (b,c) in R.
• Warshall algorithm is used to find the transitive closure of a relation. A function is a
special case of a relation. A function f : A → B is injective if f ( x ) = f ( y ) implies
107
that x = y for all x and y ; surjective if for every element b ∈ B , there exists an
element a ∈ A such that f ( a ) = b and bijective if it is injective and surjective. When
A and B are finite sets, the number of surjective, injective and bijective functions can
be calculated.
EXERCISE:
PART A:
1. Draw the Venn diagram for each of these combinations of the sets A, B and C.
(i) A ∩ ( B ∪ C )
(ii) A′ ∩ B ′ ∩ C ′
(iii) ( A − B) ∪ ( B − C ) ∪ ( A − C )
2. If A = {0, 2, 4, 6, 8, 10}
B = {0, 1, 2, 3, 4, 5, 6}
C = {4, 5, 6, 7, 8, 9, 10}
Find A ∩ B ∩ C , A ∪ B ∪ C , ( A ∪ B) ∩ C , ( A ∩ B) ∪ C
6. Let f be a function from set of integers Z to Z with f(x) = x2. Is f invertible? Find the
inverse of the function f(x) = x3 + 1.
108
12. Given an example of a function which is one-one and not onto.
15. Let R be the relation on the set {1,2,3,4,5} containing the ordered pairs (1,1),
(1,2), (1,3), (2,3), (2,4), (3,1), (3,4), (3,5), (4,2), (4,5), (5,1), (5,2) and (5,4). Find
(a) R2 (b) R3 (c) R4 (d) R5
16. 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 the
(a) reflexive closure of R (b) symmetric closure of R.
EXERCISE:
PART-B
4. Which of the following function are one-to-one, onto and bijections? Find the inverse
for any function, if exists.
109
f1 : R → R f1 ( x ) = x 3 − x
f2 : Z → Z f2 ( x ) = x
f3 : Z → Z f3 ( x ) = x3
f4 : R → R f4 ( x ) = 2x + 1
5. Let f and g be two functions. When is the composite function gof is defined
when R f ⊆ D f .
12. How many different strings can be made from the letters in MISSISSIPPI, using
all the letters?
13. How many strings with seven or more characters can be formed from the letters in
EVERGREEN?
14. There are 2504 computer science students at a school. Of these, 1876 have taken a
course in Pascal, 999 have taken a course in Fortran, and 345 have taken a course
in C. further, 876 have taken course in both Pascal and Fortran, 231 have taken
110
course in both Fortran and C, and 290 have taken course in both Pascal and C. If
189 of these students have taken courses in Fortran, Pascal and C, how many of
these 2504 students have not taken a course in any of these three programming
languages?
15. Determine whether the relation R on the set of all real numbers is reflexive,
symmetric, antisymmetric, and/or transitive, where ( x, y ) ∈ R if and only if
(a) x + y = 0 (b) x = ± y (c) x − y is a rational number (d) x = 2 y
(e) xy ≥ 0 (f) xy = 0 (g) x = 1 (h) x = 1 or y = 1
17. Let A = {(1,2), (2,3), (3,4)} and B = {(1,1), (1,2), (2,1), (2,2), (2,3), (3,1), (3,2),
(3,3), (3,4)} be relations from {1,2,3} to {1,2,3,4}. Find
(a) A ∪ B (b) A ∩ B (c) A – B (d) B – A
19. How many different functions are there from a set with 10 elements to sets with
the following numbers of elements?
(a) 2 (b) 3 (c) 4 (5)
21. Seven women and nine men are on the faculty in the mathematics department at a
school.
(a) How many ways are there to select a committee of five members of the
department if at least one woman must be on the committee?
(b) How many ways are there to select a committee of five members of the
department if at least one woman and at least one man must be on the
committee?
22. Suppose that the relation R is reflexive. Is R2 necessarily reflexive? Give a reason
for your answer?
111
23. Represent each of these relations on {1,2,3} with a matrix (with the elements of
this set listed in increasing order).
(a) {(1,1), (1,2), (1,3)} (b) {(1,2), (2,1), (2,2), (3,3)}
(c) {(1,1), (1,2), (1,3), (2,2), (2,3), (3,3)} (d) {(1,3), (3,1)}
⎛0 1 1⎞
24. Let R be the relation represented by the matrix M R = ⎜⎜ 1 1 0 ⎟⎟
⎜1 0 1⎟
⎝ ⎠
Find the matrix representing
(a) R-1 (b) R (c) R2
25. Use Warshall’s algorithm to find the transitive closures of these relations on
{1,2,3,4}.
(a) {(1,2), (2,1), (2,3), (3,4), (4,1)}
(b) {(2,1), (2,3), (3,1), (3,4), (4,1), (4,3)}
(c) {(1,2), (1,3), (1,4), (2,3), (2,4), (3,4)}
(d) {(1,1), (1,4), (2,1), (2,3), (3,1), (3,2), (3,4), (4,2)}
27. Which of these relations on the set of all people are equivalence relations?
Determine the properties of an equivalence relation that the others lack.
(a) {(a,b) | a and b are the same age}
(b) {(a,b) | a and b have the same parents}
(c) {(a,b) | a and b share a common parent}
(d) {(a,b) | a and b have met}
(e) {(a,b) | a and b speak a common language}
28. Which of these relations on the set of all functions from Z to Z are equivalence
relations? Determine the properties of an equivalent relation that the others lack.
(a) {(f,g) | f (1) = g (1) }
(b) {(f,g) | f (0) = g (0) or f (1) = g (1)}
(c) {(f,g) | f (x) – g (x) = 1 for all x ∈ Z }
(d) {(f,g) | f (x) – g (x) = c for some c ∈ Z for all x ∈ Z }
(e) {(f,g) | f (0) = g (1) and f (1) = g (0)}
112
30. Determine whether the relations represented by these zero-one matrices are
equivalence relations.
⎛1 0 1 0⎞ ⎛1 1 1 0⎞
⎛ 1 1 1⎞ ⎜ ⎟ ⎜ ⎟
⎜ ⎟ ⎜ 0 1 0 1⎟ ⎜ 1 1 1 0⎟
(a) ⎜ 0 1 1⎟ (b) (c)
⎜ 1 1 1⎟ ⎜ 1 0 1 0 ⎟ ⎜1 1 1 0⎟
⎝ ⎠ ⎜⎜ ⎟⎟ ⎜⎜ ⎟⎟
⎝0 1 0 1⎠ ⎝0 0 0 1⎠
33. Which of these collections of subsets are partitions on the set of bit strings of
length 8?
(a) The set of bit strings that begin with 1, the set of bit strings that begin with 00,
and the set of bit strings that begin with 01.
(b) The set of bit strings that contain the string 00, the set of bit strings that
contain the string 01, the set of bit strings that contain the string 11.
(c) The set of bit strings that end with 00, the et of bit strings that end with 01, the
set of bit strings that end with 10, and the set of bit strings that end with 11.
(d) The set of bit strings that end with 111, the set of bit strings that end with 011,
and the set of bit strings that end with 00.
(e) The set of bit strings that have 3k ones, where k is a nonnegative integer, the
set of bit strings that contain 3k + 1 ones, where k is an nonnegative integer,
and the set of bit strings that contain 3k = 2 ones, where k is a positive integer.
113
114