UNIT-2 Set Theory Set: A Set Is Collection of Well Defined Objects
UNIT-2 Set Theory Set: A Set Is Collection of Well Defined Objects
UNIT-2
SET THEORY
Set: A set is collection of well defined objects.
In the above definition the words set and collections for all practical purposes are
Synonymous. We have really used the word set to define itself.
Each of the objects in the set is called a member of an element of the set. The objects
themselves can be almost anything. Books, cities, numbers, animals, flowers, etc.
53
Elements of a set are usually denoted by lower-case letters, while sets are denoted by
capital letters of English language.
The symbol ∈ indicates the membership in a set.
If a is an element of the set A, then we write a ∈ A.
The symbol ∈ is read ―is a member of ‘or ―is an element of .
The symbol ∉ is used to indicate that an object is not in the given set.
The symbol∉ is read ―is not a member of or is not an element of .
If x is not an element of the set A then we write x∉ A.
Subset:
A set A is a subset of the set B if and only if every element of A is also an element of
B. We also say that A is contained in B, and use the notation A ⊆ B.
Proper Subset:
A set A is called proper subset of the set B. If (i) A is subset of B and (ii) B is not a subset
A i.e., A is said to be a proper subset of B if every element of A belongs to the set B, but
there is atl east one element of B, which is not in A. If A is a proper subset of B, then we
denote it by A ⊂ B.
Null set: The set with no elements is called an empty set or null set. A Null set is
designated by the symbol Φ. The null set is a subset of every set, i.e., If A is any set then
Φ A.
Universal set:
In many discussions all the sets are considered to be subsets of one particular set. This
set is called the universal set for that discussion. The Universal set is often designated by
the script letter U. Universal set is not unique and it may change from one discussion to
another.
Power set:
The set of all subsets of a set A is called the power set of A.
The power set of A is denoted by P (A). If A has n elements in it, then P (A) has 2n
elements:
Disjoint sets:
Two sets are said to be disjoint if they have no element in common.
Difference of sets:
If A and B are subsets of the universal set U, then the relative complement of B in Ais
the set of all elements in A which are not in A. It is denoted by A – B thus: A – B = {x | x
∈ A and x∉ B}
Complement of a set:
If U is a universal set containing the set A, then U – A is called the complement of A. It is
54
denoted by A1 . Thus
A1 = {x: x∉A}
Inclusion-Exclusion Principle:
The inclusion–exclusion principle is a counting technique which generalizes the
familiar method of obtaining the number of elements in the unionof two finite sets;
symbolically expressed as
|A ∪ B| = |A| + |B| − |A ∩ B|.
Example: How many natural numbers n ≤ 1000 are not divisible by any of 2, 3?
Ans: Let A2 = {n ∈ N | n ≤ 1000, 2|n} and A3 = {n ∈ N | n ≤ 1000, 3|n}.
Then, |A2 ∪ A3| = |A2| + |A3| − |A2 ∩ A3| = 500 + 333 − 166 = 667.
So, the required answer is 1000 − 667 = 333.
55
Example: How many integers between 1 and 10000 are divisible by none of 2, 3, 5, 7?
Ans: For i ∈ {2, 3, 5, 7}, let Ai = {n ∈ N | n ≤ 10000, i|n}.
Therefore, the required answer is 10000 − |A2 ∪ A3 ∪ A5 ∪ A7| = 2285.
Relations
Solution: If A = {5, 6, 7} and B = {x, y}, then the subset R = {(5, x), (5, y), (6, x),
(6, y)} is a relation from A to B.
Definition: Let S be any relation. The domain of the relation S is defined as the set
of all first elements of the ordered pairs that belong to S and is denoted by D(S).
D(S) = { x : (x, y) ∈ S, for some y }
The range of the relation S is defined as the set of all second elements of the ordered
pairs that belong to S and is denoted by R(S).
R(S) = { y : (x, y) ∈ S, for some x}
Example: A = {2, 3, 4} and B = {3, 4, 5, 6, 7}. Define a relation from A to B by (a, b) ∈ R
if a divides b.
Solution: We obtain R = {(2, 4), (2, 6), (3, 3), (3, 6), (4, 4)}.
Examples: (i). If R1 = {(1, 1), (1, 2), (2, 2), (2, 3), (3, 3)} be a relation on A = {1, 2, 3},
then R1 is a reflexive relation, since for every x ∈ A, (x, x) ∈ R1.
(ii). If R2 = {(1, 1), (1, 2), (2, 3), (3, 3)} be a relation on A = {1, 2, 3}, then R2 is not a
56
reflexive relation, since for every 2 ∈ A, (2, 2) ∈ R2.
(iii). If R3 = {(1, 1), (1, 2), (1, 3), (2, 2), (2, 1), (3, 1)} be a relation on A = {1, 2, 3},
then R3 is a symmetric relation.
Example: Given S = {1, 2, ..., 10} and a relation R on S, where R = {(x, y)| x + y = 10}.
What are the properties of the relation R?
Relation Matrix: A relation R from a finite set X to a finite set Y can be repre-sented by a
matrix is called the relation matrix of R.
Let X = {x1, x2, ..., xm} and Y = {y1, y2, ..., yn} be finite sets containing m and n elements,
respectively, and R be the relation from A to B. Then R can be represented by an m × n
matrix
MR = [rij ], which is defined as follows:
1, if (xi , y j ) ∈ R
rij =
0, if (xi , y j ) ∉ R
Example. Let A = {1, 2, 3, 4} and B = {b1, b2, b3}. Consider the relation R = {(1, b2), (1,
b3), (3, b2), (4, b1), (4, b3)}. Determine the matrix of the relation.
Solution: A = {1, 2, 3, 4}, B = {b1, b2, b3}.
Relation R = {(1, b2), (1, b3), (3, b2), (4, b1),(4, b3)}.
Matrix of the relation R is written as
Solution: The relation R = {(1, 1), (1, 3), (2, 3), (3, 1), (4, 1), (4, 2), (4, 4)}.
Properties of relations:
(i). If a relation is reflexive, then there must be a loop at each node. On the other hand, if
the relation is irreflexive, then there is no loop at any node.
(ii). If a relation is symmetric and if one node is connected to another, then there must be
a return arc from the second node to the first.
(iii). For antisymmetric relations, no such direct return path
should exist. (iv). If a relation is transitive, the situation is not so
simple.
Example: Let X = {1, 2, 3, 4} and R={(x, y)| x > y}. Draw the graph of R and also give
its matrix. Solution: R = {(4, 1), (4, 3), (4, 2), (3, 1), (3, 2), (2, 1)}.
The graph of R and the matrix of R are
1
2
3 4
Graph of
R
Partition and Covering of a Set
Let S be a given set and A = {A1, A2, · · · , Am} where each Ai, i = 1, 2, · · · , m is a subset
of S.
Then the set A is called a covering of S, and the sets A1, A2, · · · , Am are said to cover S.
If, in addition, the elements of A, which are subsets of S, are mutually disjoint, then A is
called a
partition of S, and the sets A1, A2, · · · , Am are called the blocks of the partition.
Solution: The sets A, C, D, E, F are covering of S. But, the set B is not covering of S,
since their union is not S.
Solution: The sets B, C and D are partitions of S and also they are covering. Hence,
every partition is a covering.
58
The set A is a covering, but it is not a partition of a set, since the sets {a, b} and {b, c}
are not disjoint. Hence, every covering need not be a partition.
The set E is not partition, since the union of the subsets is not S. The partition C has one
block and the partition D has three blocks.
Solution:
({a}, {b}, {c, d}), ({a}, {c}, {b, d}), ({a}, {d}, {b, c}), ({b}, {c}, {a, d}), ({b}, {d}, {a, c}),
({c}, {d}, {a, b}),
({b}, {a}, {c, d}) ({c}, {a}, {b, d}) ({d}, {a}, {b, c}) ({c}, {b}, {a, d}) ({d}, {b}, {a, c})
({d}, {c}, {a, b}).
Equivalence Relations
A relation R in a set X is called an equivalence relation if it is reflexive, symmetric and
transitive. The following are some examples of equivalence relations:
1. Equality of numbers on a set of real numbers.
2. Equality of subsets of a universal set.
Example: Let X = {1, 2, 3, 4} and R == {(1, 1), (1, 4), (4, 1), (4, 4), (2, 2), (2, 3), (3,
2), (3, 3)}. Prove that R is an equivalence relation.
Solution: Let N be the set of all positive integers and m be a positive integer. We
define the relation ‖congruence modulo m‖ on N as follows:
Let x, y ∈ N. x ≡ y (mod m) if and only if x − y is divisible by m.
Let x, y, z ∈ N. Then
(i). x − x = 0.m
⇒ x ≡ x (mod m) for all x ∈ N
(ii). Let x ≡ y (mod m). Then, x − y is divisible by m.
⇒ −(x − y) = y − x is divisible by m.
i.e., y ≡ x (mod m)
∴ The relation ≡ is symmetric.
⇒ x − y and y − z are divisible by m. Now (x − y) + (y − z) is divisible by m.
i.e., x − z is divisible by m.
⇒ x ≡ z (mod m)
∴ The relation ≡ is transitive.
Since the relation ≡ is reflexive, symmetric and transitive, the relation congruence
modulo m is an equivalence relation.
Example: Let R denote a relation on the set of ordered pairs of positive integers such that
(x,y)R(u, v) iff xv = yu. Show that R is an equivalence relation.
Solution: Let R denote a relation on the set of ordered pairs of positive integers.
Let x, y, u and v be positive integers. Given (x, y)R(u, v) if and only if xv = yu.
(i). Since xy = yx is true for all positive integers
⇒ (x, y)R(x, y), for all ordered pairs (x, y) of positive integers.
∴ The relation R is reflexive. (ii). Let (x, y)R(u, v)
⇒ xv = yu ⇒ yu
= xv ⇒ uy = vx
⇒ (u, v)R(x, y)
∴ The relation R is symmetric.
(iii). Let x, y, u, v, m and n be positive integers Let
(x, y)R(u, v) and (u, v)R(m, n)
⇒ xv = yu and un = vm
60
⇒ xvun = yuvm
⇒ xn = ym, by canceling uv
⇒ (x, y)R(m, n)
∴ The relation R is transitive.
Since R is reflexive, symmetric and transitive, hence the
relation R is an equivalence relation.
Compatibility Relations
Example: Let X = {ball, bed, dog, let, egg}, and let the relation R be given by
R = {(x, y)| x, y ∈ X ∧ xRy if x and y contain some common letter}.
Then R is a compatibility relation, and x, y are called compatible if xRy. Note: ball≈bed,
bed≈egg. But ball≉egg. Thus ≈ is not transitive.
Denoting ‖ball‖ by x1, ‖bed‖ by x2, ‖dog‖ by x3, ‖let‖ by x4, and ‖egg‖ by x5, the graph of
≈ is given as follows:
Example: Let the compatibility relation on a set {x1, x2, ..., x6} be given by the matrix:
x2 1
x3 1 1
x4 0 0 1
x5 0 0 1 1
x6 1 0 1 0 1
x1 x2 x3 x4 x5
Draw the graph and find the maximal compatibility blocks of the relation.
Solution:
61
The maximal compatibility blocks are {x1, x2, x3},{x1, x3, x6},{x3, x5, x6},{x3, x4, x5}.
Example: Let R = {(1, 2), (3, 4), (2, 2)} and S = {(4, 2), (2, 5), (3, 1), (1, 3)}. Find R
◦ S, S ◦ R, R ◦ (S ◦ R), (R ◦ S) ◦ R, R ◦ R, S ◦ S, and (R ◦ R) ◦ R.
Solution: Given R = {(1, 2), (3, 4), (2, 2)} and S = {(4, 2), (2, 5), (3, 1),
(1, 3)}. R ◦ S = {(1, 5), (3, 2), (2, 5)}
S ◦ R = {(4, 2), (3, 2), (1, 4)}
≠R ◦ S (R ◦ S) ◦ R = {(3, 2)}
R ◦ (S ◦ R) = {(3, 2)} = (R ◦
S) ◦ R R ◦ R = {(1, 2), (2,
2)}
R ◦ R ◦ S = {(4, 5), (3, 3), (1, 1)}
Example: Let A = {a, b, c}, and R and S be relations on A whose matrices are as given
below:
Find the composite relations R ◦ S, S ◦ R, R ◦ R, S ◦ S and their matrices.
Solution:
R = {(a, a), (a, c), (b, a), (b, b), (b, c), (c, b)}
S= {(a, a), (b, b), (b, c), (c, a), (c, c)}. From these, we find that
R ◦ S = {(a, a), (a, c), b, a), (b, b), (b, c), (c, b), (c, c)}
S ◦ R = {(a, a), (a, c), (b, b), (b, a), (b, c), (c, a), (c, b), (c, c)}
R ◦ R = R2 = {(a, a), (a, c), (a, b), (b, a), (b, c), (b, b), (c, a),
(c, b), (c, c)} S ◦ S = S2 = {(a, a), (b, b), (b, c), (b, a), (c, a),
(c, c)}.
Transitive Closure
Let X be any finite set and R be a relation in X. The relation R+ = R∪R2∪R3 ∪· · ·∪Rn
in X is called the transitive closure of R in X.
Example: Let the relation R = {(1, 2), (2, 3), (3, 3)} on the set {1, 2, 3}. What is the
transitive closure of R?
Solution: Given that R = {(1, 2), (2, 3), (3, 3)}.
The transitive closure of R is R+ = R ∪ R2 ∪ R3 ∪ · · · =
R= {(1, 2), (2, 3), (3, 3)}
R2 = R ◦ R = {(1, 2), (2, 3), (3, 3)} ◦ {(1, 2), (2, 3), (3, 3)} = {(1, 3),
(2,3 3), 2(3, 3)}
R = R ◦ R = {(1, 3), (2, 3), (3, 3)}
R4 = R3 ◦ R = {(1, 3), (2,
3), (3, 3)} R+ = R ∪ R2 ∪
R3 ∪ R4 ∪ ...
62
= {(1, 2), (2, 3), (3, 3)} ∪ {(1, 3), (2, 3), (3, 3)} ∪ {(1, 3), (2, 3), (3, 3)}
∪ ...
={(1, 2), (1, 3), (2, 3), (3, 3)}.
Therefore R+ = {(1, 2), (1, 3), (2, 3), (3, 3)}.
Example: Let X = {1, 2, 3, 4} and R = {(1, 2), (2, 3), (3, 4)} be a relation on X. Find R+.
Solution: Given R =2{(1, 2), (2,
3), (3, 4)} R = {(1, 3),
(2,3 4)}
R4 = {(1, 4)}
R = {(1, 4)}
R+ = {(1, 2), (2, 3), (3, 4), (1, 3), (2, 4), (1, 4)}.
Partial Ordering
A binary relation R in a set P is called a partial order relation or a partial ordering
in P iff R is reflexive, antisymmetric, and transitive. i.e.,
aRa for all a ∈ P
aRb and bRa ⇒ a = b
aRb and bRc ⇒ aRc
A set P together with a partial ordering R is called a partial ordered set or poset. The
relation R is often denoted by the symbol ≤ which is diff erent from the usual less than
equal to symbol. Thus, if ≤ is a partial order in P , then the ordered pair (P, ≤) is called a
poset.
Example: Show that the relation ‖greater than or equal to‖ is a partial ordering on the set
of integers.
Solution: Let Z be the set of all integers and the relation R =′≥′
(i). Since a ≥ a for every integer a, the relation ′ ≥′ is reflexive.
(ii). Let a and b be any two integers.
Let aRb and bRa ⇒ a ≥ b and b ≥ a
⇒a=b
∴ The relation ‗≥‗ is antisymmetric.
(iii). Let a, b and c be any three integers.
Example: Show that the inclusion ⊆ is a partial ordering on the set power set of a set S.
Solution: Since (i). A ⊆ A for all A ⊆ S, ⊆ is reflexive.
(ii). A ⊆ B and B ⊆ A ⇒ A = B, ⊆ is
antisymmetric. (iii). A ⊆ B and B ⊆ C ⇒
A ⊆ C, ⊆ is transitive.
Thus, the relation ⊆ is a partial ordering on the power set of S.
Example: Show that the divisibility+
relation ′/′ is a partial ordering on the set of
positive integers. Solution: Let Z be the set of positive integers.
Since (i). a/a for all a ∈ Z+, / is reflexive.
(ii). a/b and b/a ⇒ a = b, / is
63
antisymmetric. (iii). a/b and b/c
⇒ a/c, / is transitive.
It follows that / is a partial ordering on Z+ and (Z+, /) is a poset.
Note: On the set of all integers, the above relation is not a partial order as a and −a
both divide each other, but a = −a. i.e., the relation is not antisymmetric. Definition:
Let (P, ≤) be a partially
ordered set. If for every x, y ∈ P we have either x ≤ y ∨ y ≤ x, then ≤ is called a simple
ordering or
linear ordering on P , and (P, ≤) is called a totally ordered or simply ordered set or a
chain.
Note: It is not necessary to have x ≤ y or y ≤ x for every x and y in a poset P. In fact, x
may not be related to y, in which case we say that x and y are incomparable. Examples:
(i). The poset (Z, ≤) is a totally ordered.
Since a ≤ b or b ≤ a whenever a and b are integers.
(ii). The divisibility relation / is a partial ordering on the set of positive integers.
Therefore (Z+, /) is a poset and it is not a totally ordered, since it contain elements that
are incomparable, such as 5 and 7, 3 and 5.
Hasse Diagrams
A partial order ≤ on a set P can be represented by means of a diagram known as Hasse
diagram of (P, ≤). In such a diagram,
(i) Each element is represented by a small circle or dot.
(ii) The circle for x ∈ P is drawn below the circle for y ∈ P if x < y, and a line is
drawn between x and y if y covers x.
(iii) If x < y but y does not cover x, then x and y are not connected directly by a
single line.
Note: For totally ordered set (P, ≤), the Hasse diagram consists of circles one below the
other. The poset is called a chain.
Example: Let P = {1, 2, 3, 4, 5} and ≤ be the relation ‖less than or equal to‖ then the
Hasse diagram is:
Example: Let X = {2, 3, 6, 12, 24, 36}, and the relation ≤ be such that x ≤ y if x divides
y. Draw the Hasse diagram of (X, ≤). Solution: The Hasse diagram is is shown below:
64
It is not a total order set.
Example: Draw the Hasse diagram for the relation R on A = {1, 2, 3, 4, 5} whose
relation matrix
Solution:
R= {(1, 1), (1, 3), (1, 4), (1, 5), (2, 2), (2, 3), (2, 4), (2, 5), (3, 3), (3, 4), (3, 5),
(4, 4), (5.5)}.
Hasse diagram for MR is
4 5
1
2
65
Example: Let A be a finite set and ρ(A) be its power set. Let ⊆ be the inclusion
relation on the elements of ρ(A). Draw the Hasse diagram of ρ(A), ⊆) for
A = {a}
A = {a, b}.
Solution: (i). Let A = {a}
ρ(A) = {ϕ, a}
Hasse diagram of (ρ(A), ⊆) is shown in Fig:
(ii). Let A = {a, b}. ρ(A) = {ϕ, {a}, {b}, {a, b}}. The
Hasse diagram for (ρ(A), ⊆) is shown in fig:
Example: Draw the Hasse diagram for the partial ordering ⊆ on the power set P (S)
where S = {a,b, c}.
Solution: S = {a, b, c}.
P (S) = {ϕ, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}.
Hasse diagram for the partial ordered set is shown in fig:
Example: Draw the Hasse diagram representing the positive divisions of 36 (i.e., D36).
Solution: We have D36 = {1, 2, 3, 4, 6, 9, 12, 18, 36} if and only a divides b. The Hasse
diagram for R is shown in Fig.
Minimal and Maximal elements(members): Let (P, ≤) denote a partially or-dered set.
An element y ∈ P is called a minimal member of P relative to ≤ if for no x ∈ P , is x < y.
66
Similarly an element y ∈ P is called a maximal member of P relative to the partial
ordering ≤ if for no x ∈ P , is y < x.
Note:
(i). The minimal and maximal members of a partially ordered set need not
unique.
ii). Maximal and minimal elements are easily calculated from the Hasse
diagram. They are the 'top' and 'bottom' elements in the diagram.
Example:
In the Hasse diagram, there are two maximal elements and two minimal elements.
The elements 3, 5 are maximal and the elements 1 and 6 are minimal.
Example: Let A = {a, b, c, d, e} and let
the partial order on A in the
natural way.
The element a is maximal.
The elements d and e are minimal.
Upper and Lower Bounds: Let (P, ≤) be a partially ordered set and let A ⊆ P . Any
element x ∈ P is called an upper bound for A if for all a ∈ A, a ≤ x. Similarly, any
element x ∈ P is called a
lower bound for A if for all a ∈ A, x ≤ a. Example: A = {1, 2, 3, ..., 6} be ordered as
pictured in figure.
Solution: The upper bounds of {b, d, g} are g and h. Since g < h, g is the least upper
bound. The lower bounds of {b, d, g} are a and b. Since a < b, b is the greatest lower
bound.
Example: Let A = {a, b, c, d, e, f, g, h} denote a partially ordered set whose Hasse
diagram is shown in Fig:
67
If B = {c, d, e} then f, g, h are upper bounds of B.
The element f is least upper bound.
Example: If the function f is defined by f(x)=x2 + 1 on the set {−2, −1, 0, 1, 2}, find the
range of f.
Solution: f(−2) = (−2)2 + 1 = 5
f(−1) = (−1)2 + 1 = 2
f(0) = 0 + 1 = 1
f(1) = 1 + 1 = 2
f(2) = 4 + 1 = 5
68
Therefore, the range of f = {1, 2, 5}.
Types of Functions
69
Onto(Surjection): A mapping f : X → Y is called onto if the range set Rf = Y .
If f : X → Y is onto, then each element of Y is f-image of atleast one element of
X. i.e., {f(x) : x ∈ X} = Y .
If f is not onto, then it is said to be into.
Solution:
f ◦ g = {(1, 3), (2, 2), (3, 1)}
g ◦ f = {(1, 1), (2, 3), (3, 2)} ≠ f ◦ g
f ◦ h ◦ g = f ◦ (h ◦ g) = f ◦ {(1, 2), (2, 1), (3, 1)}
= {(1, 3), (2, 2), (3, 2)}
s ◦ g = {(1, 2), (2, 1), (3, 3)} = g ◦ s =
{(1, 2), (2, 1), (3, 3)}
∴s◦g=g◦s=g
s ◦ s = {(1, 1), (2, 2), (3, 3)} =
s f ◦ s = {(1, 2), (2, 3), (3, 1)}
Thus, s ◦ s = s, f ◦ g ≠g ◦ f, s ◦ g = g ◦ s = g and h ◦ s = s ◦ h = h.
Example: Let f(x) = x + 2, g(x) = x − 2 and h(x) = 3x for x ∈ R, where R is the set of real
numbers. Find g ◦ f; f ◦ g; f ◦ f; g ◦ g; f ◦ h; h ◦ g; h ◦ f; and f ◦ h ◦ g.
Solution: f : R → R is defined by f(x) = x + 2
f: R → R is defined by g(x) = x − 2
h : R → R is defined by h(x) = 3x
g◦f:R→R
Let x ∈ R. Thus, we can write
(g ◦ f)(x) = g(f(x)) = g(x + 2) = x + 2 − 2 = x
∴ (g ◦ f)(x) = {(x, x)| x ∈ R}
(f ◦ g)(x) = f(g(x)) = f(x − 2) = (x − 2) + 2 = x
∴ f ◦ g = {(x, x)| x ∈ R}
(f ◦ f)(x) = f(f(x)) = f(x + 2) = x + 2 + 2 = x + 4
∴ f ◦ f = {(x, x + 4)| x ∈ R}
(g ◦ g)(x) = g(g(x)) = g(x − 2) = x − 2 − 2 = x − 4
⇒ g ◦ g = {(x, x − 4)| x ∈ R}
(f ◦ h)(x) = f(h(x)) = f(3x) = 3x + 2
71
∴ f ◦ h = {(x, 3x + 2)| x ∈ R}
(h ◦ g)(x) = h(g(x)) = h(x − 2) = 3(x − 2) = 3x − 6
∴ h ◦ g = {(x, 3x − 6)| x ∈ R}
(h ◦ f)(x) = h(f(x)) = h(x + 2) = 3(x + 2) = 3x + 6 h ◦ f =
{(x, 3x + 6)| x ∈ R}
(f ◦ h ◦ g)(x) = [f ◦ (h ◦ g)](x)
f(h ◦ g(x)) = f(3x − 6) = 3x − 6 + 2 = 3x − 4
∴ f ◦ h ◦ g = {(x, 3x − 4)| x ∈ R}.
Recursive Function
73
Total function: Any function f : Nn → N is called total if it is defined for every n-tuple in Nn.
Example: f(x, y) = x + y, which is defined for all x, y ∈ N and hence it is a total function.
***Example: Show that the function f(x, y) = x + y is primitive recursive. Hence compute
the value of f(2, 4).
Solution: Given that f(x, y) = x + y.
Here, f(x, y) is a function of two variables. If we want f to be defined by recursion, we
need a function g of single variable and a function h of three variables. Now,
f(x, y + 1) = x + (y + 1)
= (x + y) + 1
= f(x, y) + 1.
Also, f(x, 0) = x.
We define f(x, 0) as
f(x, 0) = x =U 11 (x)
= S(f(x, y))
=S(U 33 (x, y, f(x, y)))
If we take g(x) = U11(x) and h(x, y, z) = S(U33(x, y, z)), we get f(x, 0) = g(x) and f(x, y + 1) =
74
h(x, y, z).
Thus, f is obtained from the initial functions U11, U33, and S by applying composition once and
recursion once.
Hence f is primitive recursive.
Here,
f(2, 0) = 2
f(2, 4) = S(f(2, 3))
=S(S(f(2, 2)))
=S(S(S(f(2, 1))))
=S(S(S(S(f(2, 0)))))
=S(S(S(S(2)))))
=S(S(S(3)))
=S(S(4))
=S(5)
=6
Example: Show that f(x, y) = x ∗ y is primitive recursion.
Solution: Given that f(x, y) = x ∗ y.
Here, f(x, y) is a function of two variables. If we want f to be defined by recursion, we
need a function g of single variable and a function h of three variables. Now, f(x, 0) = 0
and
f(x, y + 1) = x ∗ (y + 1) = x ∗ y
f(x, y) + x
We can write
f(x, 0) = 0 =Z(x) and
f(x, y + 1) =f1(U33(x, y, f(x, y)), U13(x, y, f(x, y)))
where f1(x, y) = x3 + y, which 3is primitive recursive. By taking g(x) = Z(x) = 0 and h defined by
h(x, y, z) = f1(U3 (x, y, z), U1 (x, y, z)) = f(x, y + 1), we see that f defined by recursion. Since g
and h are primitive recursive, f is primitive recursive. Example: Show that f(x, y) = xy is primitive
recursive function. Solution: Note that x0 = 1 for x ≠0 and we put x0 = 0 for x = 0.
Also, xy+1 = xy ∗ x
Here f(x, y) = xy is defined as
f(x, 0) = 1 = S(0) = S(Z(x))
f(x, y + 1) = x ∗ f(x, y)
U13(x, y, f(x, y)) ∗ U33(x, y, f(x, y))
h(x, y, f(x, y) = f1(U13(x, y, f(x, y)), U33(x, y, f(x, y))) where f1(x, y) = x ∗ y, which is
primitive recursive.
∴ f(x, y) is a primitive recursive function.
Example: Consider the following recursive function definition: If x < y then f(x, y) = 0, if y ≤
x then f(x, y) = f(x − y, y) + 1. Find the value of f(4, 7), f(19, 6).
0;x < y
Solution: Given f(x, y) ={f(x -
f(4, 7) = 0 [∴ 4 < 7]
f(19, 6) = f(19 − 6, 6) +
1 = f(13, 6) + 1
f(13, 6) = f(13 − 6, 6) +
1 = f(7, 6) + 1
75
f(7, 6) = f(7 − 6, 6) +
1 = f(1, 6) +
1 =0 + 1 =1
f(13, 6) = f(7, 6) +
1 =1 + 1
=2
f(19, 6) = 2 +
1=3
Example: Consider the following recursive function definition: If x < y then f(x, y) = 0, if y ≤
x then f(x, y) = f(x − y, y) + 1. Find the value of f(86, 17)
Permutation Functions
Definition: A permutation is a one-one mapping of a non-empty set onto itself.
Let S = {a1, a2, ..., an} be a finite set and p is a permutation on S, we list the elements of S and the
corresponding functional values of p(a1), p(a2), ..., p(an) in the following form:
If p : S → S is a bijection, then the number of elements in the given set is called the degree of its
permutation.
Note: For a set with three elements, we have 3! permutations.
Identity Permutation: If each element of a permutation be replaced by itself, then such a
permutation is called the identity permutation.
Equality of Permutations: Two permutations f and g of degree n are said to be equal if and only
if f(a) = g(a) for all a ∈ S.
Example: Let S = {1, 2, 3, 4}
Note: The product of two permutations of degree n need not be commutative.
Lattices
In this section, we introduce lattices which have important applications in the theory and
design of computers.
Definition: A lattice is a partially ordered set (L, ≤) in which every pair of elements a, b ∈ L
has a greatest lower bound and a least upper bound.
Example: Let Z+ denote the set of all positive integers and let R denote the relation ‗division‗ in
Z+, such that for any two elements a, b ∈ Z+, aRb, if a divides b. Then (Z+, R) is a lattice in
which the join of a and b is the least common multiple of a and b, i.e.
a ∨ b = a ⊕ b = LCM of a and b,
and the meet of a and b, i.e. a ∗ b is the greatest common divisor (GCD) of a and b
i.e., a ∧ b = a ∗ b = GCD of a and b.
We can also write a+b = a∨b = a⊕b=LCM of a and b and a.b = a∧b = a∗b=GCD of a and b.
Example: Let n be a positive integer and Sn be the set of all divisors of n If n = 30, S30 = {1, 2,
3, 5, 6, 10, 15, 30}. Let R denote the relation division as defined in Example 1. Then (S30, R) is
a Lattice see Fig:
Example: Let A be any set and P (A) be its power set. The poset P (A), ⊆) is a lattice in which the
76
meet and join are the same as the operations ∩ and ∪ on sets respectively.
S = {a}, P (A) = {ϕ, {a}}
b ⊕ (a ∗ b) = b ⊕ a = a ⊕
b but b ⊕ (a ∗ b) = b
Hence a ⊕ b = b follows from a ∗ b = a.
77
Proof: By above theorem a ≤ b ⇔ a ∗ b = a ⇔ a ⊕ b = b.
To show that a ∗ b ≤ a ∗ c, we shall show that (a ∗ b) ∗ (a ∗ c) = a ∗ b
(a ∗ b) ∗ (a ∗ c) = a ∗ (b ∗ a) ∗ c
= a ∗ (a ∗ b) ∗ c
= (a ∗ a) ∗ (b ∗
c) = a ∗ (b ∗ c)
=a∗b
∴ If b ≤ c then a ∗ b ≤ a ∗ c.Next, let b ≤ c ⇒ b ⊕ c = c.
To show that a ⊕ b ≤ a ⊕ c. It sufficient to show that (a ⊕ b) ⊕ (a ⊕ c) = a ⊕ c.
Consider,(a ⊕ b) ⊕ (a ⊕ c) = a ⊕ (b ⊕ a) ⊕ c
= a ⊕ (a ⊕ b) ⊕ c
= (a ⊕ a) ⊕ (b ⊕ c)
= a ⊕ (b ⊕ c)
=a⊕b
∴ If b ≤ c then a ⊕ b ≤ a ⊕ c.
Note: The above properties of a Lattice are called properties of Isotonicity.
Lattice as an algebraic system:
We now define lattice as an algebraic system, so that we can apply many concepts
associated with algebraic systems to lattices.
Definition: A lattice is an algebraic system (L, ∗,⊕) with two binary operation ‗∗‘and ‗⊕‘ on L
which are both commutative and associative and satisfy absorption laws.
Bounded Lattice:
A bounded lattice is an algeb
the constants 0,1∈ L satisfy the following:
1. for all x∈
2. for all x∈
The element 1 is called the upper bound, or top of L and the element 0 is called the lower
bound or bottom of L.
Distributive lattice:
A lattice (L,∨,∧) is distributive if the following additional identity holds for all x, y, and z in
L: x ∧ (y ∨ z) = (x ∧ y) ∨ (x ∧ z)
Viewing lattices as partially ordered sets, this says that the meet peration preserves nonempty
finite joins. It is a basic fact of lattice theory that the above condition is equivalent to its dual
x ∨ (y ∧ z) = (x ∨ y) ∧ (x ∨ z) for all x, y, and z in L.
Example: Show that the following simple but significant lattices are not distributive.
78
Solution a) To see that the diamond lattice is not distributive, use the middle elements of the
lattice: a ∧ (b ∨ c) = a ∧ 1 = a, but (a ∧ b) ∨ (a ∧ c) = 0 ∨ 0 = 0, and a ≠0.
Similarly, the other distributive law fails for these three elements.
b) The pentagon lattice is also not distributive
Example: Show that lattice is not a distributive lattice.
Sol. A lattice is distributive if all of its elements follow distributive property so let we verify
the distributive property between the elements n, l and m.
GLB(n, LUB(l, m)) = GLB(n, p) [∴ LUB(l, m) = p]
= n (LHS)
also LUB(GLB(n, l), GLB(n, m)) = LUB(o, n); [∴ GLB(n, l) = o and GLB(n, m) = n]
= n (RHS)
so LHS = RHS.
But GLB(m, LUB(l, n)) = GLB(m, p) [∴ LUB(l, n) = p]
= m (LHS)
also LUB(GLB(m, l), GLB(m, n)) = LUB(o, n); [∴ GLB(m, l) = o and GLB(m, n) = n]
= n (RHS)
Thus, LHS ≠ RHS hence distributive property doesn‗t hold by the lattice so lattice is not
distributive.
Example: Consider the poset (X, ≤ ) where X = {1, 2, 3, 5, 30} and the partial ordered relation ≤
is defined as i.e. if x and y ∈X then x ≤ y means ‗x divides y‗. Then show that poset (I+, ≤) is a
lattice.
Sol. Since GLB(x, y) = x ∧ y = lcm(x, y)
and LUB(x, y) = x ∨ y = gcd(x, y)
Now we can construct the operation table I and table II for GLB and LUB respectively and
the Hasse diagram is shown in Fig.
79
Complemented lattice:
A complemented lattice is a bounded lattice (with least element 0 and greatest element 1), in
which every element a has a complement, i.e. an element b satisfying a ∨ b = 1 and a ∧ b = 0.
Complements need not be unique.
Example: Lattices shown in Fig (a), (b) and (c) are complemented lattices.
Sol.
For the lattice (a) GLB(a, b) = 0 and LUB(x, y) = 1. So, the complement a is b and vise versa.
Hence, a complement lattice.
For the lattice (b) GLB(a, b) = 0 and GLB(c, b) = 0 and LUB(a, b) = 1 and LUB(c, b) = 1;
so both a and c are complement of b.
Hence, a complement lattice.
In the lattice (c) GLB(a, c) = 0 and LUB(a, c) = 1; GLB(a, b) = 0 and LUB(a, b) = 1. So,
complement of a are b and c.
Similarly complement of c are a and b also a and c are complement of
b. Hence lattice is a complement lattice.
UNIT-III
ALGEBRAIC STRUCTURES
80