MFCS Unit - 2
MFCS Unit - 2
Set Theory
A set is an unordered collection of different elements. A set can be written explicitly by listing its
elements using set bracket. If the order of the elements is changed or any element of a set is
repeated, it does not make any changes in the set.
Representation of a Set
The set is represented by listing all the elements comprising it. The elements are enclosed within
braces and separated by commas.
The set is defined by specifying a property that elements of the set have in common. The set is
described as A = { x : p(x)}
Cardinality of a Set
Cardinality of a set S, denoted by |S|, is the number of elements of the set. If a set has an infinite
number of elements, its cardinality is ∞.
• |X| = |Y| represents two sets X and Y that have the same cardinality, if there exists a
bijective function ‘f’ from X to Y.
• |X| ≤ |Y| represents set X has cardinality less than or equal to the cardinality of Y, if there
exists an injective function ‘f’ from X to Y.
• |X| < |Y| represents set X has cardinality less than the cardinality of Y, if there is an
injective function f, but no bijective function ‘f’ from X to Y.
• If |X| ≤ |Y| and |X| ≤ |Y| then |X| = |Y|
Types of Sets
Sets can be classified into many types. Some of which are finite, infinite, subset, universal,
proper, singleton set, etc.
Finite Set
Subset
Example 2 − Let, X = {1, 2, 3} and Y = {1, 2, 3}. Here set Y is a subset (Not a proper subset) of
set X as all the elements of set Y is in set X. Hence, we can write Y ⊆ X.
Proper Subset
The term “proper subset” can be defined as “subset of but not equal to”. A Set X is a proper
subset of set Y (Written as X ⊂ Y) if every element of X is an element of set Y and |X| < |Y|.
Example − Let, X = {1, 2, 3, 4, 5, 6} and Y = {1, 2}. Here set Y is a proper subset of set X as at
least one element is more in set X. Hence, we can write Y ⊂ X.
Universal Set
It is a collection of all elements in a particular context or application. All the sets in that context
or application are essentially subsets of this universal set. Universal sets are represented as U.
A can be considered as the universal set for this particular example. Universal set is generally
denoted by U.
In a particular problem a set U is said to be a universal set if all the sets in that problem are
subsets of U.
Example1 − We may define U as the set of all animals on earth. In this case, set of all mammals
is a subset of U, set of all fishes is a subset of U, set of all insects is a subset of U, and so on.
1. Universal set does not mean a set containing all objects of the universe.
2. A set which is a universal set for one problem may not be a universal set for another
problem.
Example2 :
Which of the following set can be considered as a universal set ?
X = {x : x is a real number}
Y= {y : y is a negative integer}
Z = {z : z is a natural number}
Solution : As it is clear that both sets Y and Z are subset of X
∴ X is the universal set for this problem
Empty Set or Null Set
Singleton set or unit set contains only one element. A singleton set is denoted by {s}.
Equal Set
If two sets contain the same elements they are said to be equal.
Example − If A = {1, 2, 6} and B = {6, 1, 2}, they are equal as every element of set A is an
element of set B and every element of set B is an element of set A.
Equivalent Set
If the cardinalities of two sets are same, they are called equivalent sets.
Example − If A = {1, 2, 6} and B = {16, 17, 22}, they are equivalent as cardinality of A is equal
to the cardinality of B. i.e. |A| = |B| = 3
Overlapping Set
Two sets that have at least one common element are called overlapping sets.
Example − Let, A = {1, 2, 6} and B = {6, 12, 42}. There is a common element ‘6’, hence these
sets are overlapping sets.
Disjoint Set
If two sets C and D are disjoint sets as they do not have even one element in common. Therefore,
n(A ∪ B) = n(A) + n(B)
Example − Let, A = {1, 2, 6} and B = {7, 9, 14}, there is no common element; hence these sets
are overlapping sets.
Venn Diagrams
Venn diagram, invented in 1880 by John Venn, is a schematic diagram that shows all possible logical
relations between different mathematical sets. Diagrammatical representation of sets is known as a Venn
diagram. According to him universal set is represented by the interior of a rectangle and other sets
are represented by interior of circles.
Examples
Set Operations
Set Operations include Set Union, Set Intersection, Set Difference, Complement of Set, and
Cartesian Product.
Set Union
The union of sets A and B (denoted by A ∪ B) is the set of elements which are in A, in B, or in
both A and B. Hence, A ∪B = {x | x ∈ A OR x ∈ B}.
Example − If A = {10, 11, 12, 13} and B = {13, 14, 15}, then A ∪B = {10, 11, 12, 13, 14, 15}.
(The common element occurs only once)
The intersection of sets A and B (denoted by A ∩ B) is the set of elements which are in both A
and B. Hence, A ∩ B = {x | x ∈ A AND x ∈ B}.
Example − If A = {11, 12, 13} and B = {13, 14, 15}, then A ∩ B = {13}.
The set difference of sets A and B (denoted by A − B) is the set of elements which are only in A
but not in B. Hence, A − B = {x | x ∈A AND x ∈ B}.
Example − If A = {10, 11, 12, 13} and B = {13, 14, 15}, then (A− B) = {10, 11, 12} and (B −
A) = {14, 15}. Here, we can see (A − B) ≠ (B − A)
The complement of a set A (denoted by A’) is the set of elements which are not in set A. Hence,
A' = {x | x ∈ A}.
More specifically, A'= (U − A) where U is a universal set which contains all objects.
Example − If A = {x | x belongs to set of odd integers} then A' = {y | y does not belong to set of
odd integers}
The Cartesian product of n number of sets A1, A2 .....An, defined as A1 × A2 ×..... × An, are the
ordered pair (x1, x2,....xn) where x1 ∈ A1, x2 ∈ A2, ..............xn ∈An
The Cartesian product of A and B is written as − A × B = {(a, 1), (a, 2), (b, 1), (b, 2)}
The Cartesian product of B and A is written as − B × A = {(1, a), (1, b), (2, a), (2, b)}
Power Set
Power set of a set S is the set of all subsets of S including the empty set. The cardinality of a
power set of a set S of cardinality n is 2n. Power set is denoted as P(S).
Example −
| P(S) | = 24 = 16
Note − The power set of an empty set is also an empty set. | P ({∅}) | = 20 = 1.
Any set of elements in a mathematical system may be defined with a set of operators and a
number of postulates.
SUB- SET
Let set A be a set containing all students of your school and B be a set containing all students of
class XII of the school. In this example each element of set B is also an element of set A. Such a
set B is said to be subset of the set A. It is written as B⊆ A.
Consider
D ={1, 2, 3, 4,. ......}
E = {.....−3,−2,−1, 0, 1, 2, 3, ....... }
Remarks
(i) Each set is a subset of itself i.e. A⊆ A
(ii) Null set has no element so the condition of becoming a subset is automatically
satisfied. Therefore null set is a subset of every set.
(iii) If A⊆ B and B⊆ A then A = B.
(iv) If A⊆ B and A≠ B then A is said to be a proper subset of B and B is said to
be a super set of A. i.e. A⊂ B or B⊃A.
Binary Operator
A binary operator defined on a set of elements is a rule that assigns to each pair of elements a
unique element from that set. For example, given the set A = {1, 2, 3, 4, 5}, we can say ⊗ is a
binary operator for the operation c = a ⊗ b, if it specifies a rule for finding c for the pair of (a,b),
such that a, b, c ∈ A.
Closure
A set is closed with respect to a binary operator if for every pair of elements in the set, the
operator finds a unique element from that set.
This set is closed under binary operator into (*), because for the operation c = a + b, for any a, b
∈A, the product c ∈ A.
The set is not closed under binary operator divide (÷), because, for the operation c = a + b, for
any a, b ∈ A, the product c may not be in the set A. If a = 7, b = 2, then c = 3.5. Here a, b ∈ A but
c ∈ A.
Associative Laws
− (x ⊗ y) ⊗ z = x ⊗ (y ⊗ z), where x, y, z ∈ A
Example − Let A = { 1, 2, 3, 4 }
The operator plus ( + ) is associative because for any three elements, x, y, z ∈ A, the property (x
+ y) + z = x + ( y + z ) holds.The operator minus ( − ) is not associative since
(x−y)−z≠x−(y−z)
Commutative Laws
Example − Let A = { 1, 2, 3, 4 }
The operator plus ( + ) is commutative because for any two elements, x, y ∈ A, the property x +
y = y + x holds.
Distributive Laws
Two binary operators ⊗ and ⊛on a set A, are distributive over operator ⊛when the following
property holds −
Example − Let A = { 1, 2, 3, 4 }
The operators into ( * ) and plus ( + ) are distributive over operator + because for any three
elements, x, y, z ∈ A, the property x * (y + z) = (x * y) + (x * z) holds.
x+(y*z)≠(x+y)*(x+z)
Identity Element
A set A has an identity element with respect to a binary operation ⊗ on A, if there exists an
element e ∈A, such that the following property holds −
e ⊗ x = x ⊗ e, where x ∈ A
The element 1 is an identity element with respect to operation * since for any element x ∈ Z,
1*x=x*1
On the other hand, there is no identity element for the operation minus ( − )
Inverse
If a set A has an identity element e with respect to a binary operator ⊗, it is said to have an
inverse whenever for every element x ∈ A, there exists another element y ∈ A, such that the
following property holds −
Given the operation plus ( + ) and e = 0, the inverse of any element x is (−x) since x + (− x) = 0
De Morgan’s Law
De Morgan’s Laws gives a pair of transformations between union and intersection of two (or
more) sets in terms of their complements. The laws are −
(A ∪ B)′ = A′ ∩ B′
(A ∩ B)′ = A′∪ B′
A′ = { 5, 6, 7, 8, 9, 10}
B′ = { 2, 4, 6, 8, 9, 10}
A ∪ B = {1, 2, 3, 4, 5, 7}
A ∩ B = { 1, 3}
(A ∪ B)′ = { 6, 8, 9, 10}
A′ ∩ B′ = { 6, 8, 9, 10}
(A ∩ B)′ = { 2, 4, 5, 6, 7, 8, 9, 10}
A′ ∪ B′ = { 2, 4, 5, 6, 7, 8, 9, 10}
Partitioning of a Set
Partition of a set, say S, is a collection of n disjoint subsets, say P1, P2,........... Pn, that satisfies the
following three conditions –
• The union of the subsets must equal the entire original set.
The number of partitions of the set is called a Bell number denoted as Bn.
Example
Let S = {a, b, c, d, e, f, g, h}
A binary relation R from set x to y (written as xRy or R(x,y)) is a subset of the Cartesian product
x × y. If the ordered pair of G is reversed, the relation also changes.
Generally an n-ary relation R between sets A1, ... , and An is a subset of the n-ary product A1 × ...
× An. The minimum cardinality of a relation R is Zero and maximum is n2 in this case.
For two distinct sets, A and B, having cardinalities m and n respectively, the maximum
cardinality of a relation R from A to B is mn.
If there are two sets A and B, and relation R have order pair (x, y), then −
Examples
The number of vertices in the graph is equal to the number of elements in the set from which the
relation has been defined. For each ordered pair (x, y) in the relation R, there will be a directed
edge from the vertex ‘x’ to vertex ‘y’. If there is an ordered pair (x, x), there will be self- loop on
vertex ‘x’.
Types of Relations
Example − If R = {(1, 2), (2, 3)} then R’ will be {(2, 1), (3, 2)}
Example − The relation R = {(a, a), (b, b)} on set X = {a, b} is reflexive
Example − The relation R = {(a, b), (b, a)} on set X = {a, b} is irreflexive
• A relation R on set A is called Symmetric if xRy implies yRx, ∀x∈A and ∀y∈A.
Example − The relation R = {(1, 2), (2, 1), (3, 2), (2, 3)} on set A = {1, 2, 3} is
symmetric.
Example − The relation R = {(1, 2), (3, 2)} on set A = {1, 2, 3} is antisymmetric.
• A relation R on set A is called Transitive if xRy and yRz implies xRz, ∀x,y,z ∈ A.
Example − The relation R = {(1, 1), (2, 2), (3, 3), (1, 2), (2,1), (2,3), (3,2), (1,3), (3,1)}
on set A = {1, 2, 3} is an equivalence relation since it is reflexive, symmetric, and
transitive.
A partially ordered set consists of a set with a binary relation which is reflexive, antisymmetric
and transitive. "Partially ordered set" is abbreviated as POSET.
Examples
• The set of real numbers under binary operation less than or equal to (≤) is a poset.
The relations will be {(1, 1), (2, 2), (3, 3), (1, 2), (1, 3), (2, 3)}
{(1, 2), (1, 3), (2, 3)} ∈ R and {(1, 2), (1, 3), (2, 3)} ∉ R
• The vertex set of a directed acyclic graph under the operation ‘reachability’ is a poset.
Relations
Consider the following example :
A={Mohan, Sohan, David, Karim}
B={Rita, Marry, Fatima}
Suppose Rita has two brothers Mohan and Sohan, Marry has one brother David, and Fatima has
one brother Karim. If we define a relation R " is a brother of" between the elements of A and B
then clearly.
Mohan R Rita, Sohan R Rita, David R Marry, Karim R Fatima. After omiting R between two
names these can be written in the form of ordered pairs as : (Mohan, Rita), (Sohan, Rita), (David,
Marry), (Karima, Fatima).
Void Relation
If (i) R = , R is called a void relation.
(ii) R=A×B, R is called a universal relation.
(iii) If R is a relation defined from A to A, it is called a relation defined on A.
(iv) R = (a,a) a A , is called the identity relation.
If R is a relation between two sets then the set of its first elements (components) of all the
ordered pairs of R is called Domain and set of 2nd elements of all the ordered pairs of R is
called range, of the given relation. Consider previous example given above.
Domain = {Mohan, Sohan, David, Karim}
Range = {Rita, Marry, Fatima}
Example1: Given that A = {2, 4, 5, 6, 7}, B = {2, 3}.R is a relation from A to B defined by
R = {(a, b) : a A, bB and a is divisible by b} find (i) R in the roster form (ii) Domain of R (iii)
Range of R (iv) Repersent R diagramatically.
Solution : (i) R = {(2, 2), (4, 2), (6, 2), (6, 3)}
(ii) Domain of R = {2, 4, 6}
(iii) Range of R = {2, 3}
Function – Definition
Function ‘f’ is a relation on X and Y s.t for each x ∈ X, there exists a unique y ∈ Y such that
(x,y) ∈ R. x is called pre-image and y is called image of function f.
A function can be one to one, many to one (not one to many). A function f: A→B is said to be
invertible if there exists a function g: B→A
A function f: A→B is injective or one-to-one function if for every b ∈ B, there exists at most one
a ∈ A such that f(s) = t.
Example
A function f: A→B is surjective (onto) if the image of f equals its range. Equivalently, for every
b ∈ B, there exists some a ∈A such that f(a) = b. This means that for any y in B, there exists
some x in A such that y = f(x).
Example
A function f: A→B is bijective or one-to-one correspondent if and only if f is both injective and
surjective.
Problem
Hence, f is injective.
Here, 2x − 3 = y
Hence, f is surjective.
Composition of Functions
Two functions f: A→B and g: B→C can be composed to give a composition g o f. This is a
function from A to C defined by (gof)(x) = g(f(x))
Solution
Types of functions
A relation is a function if for every x in the domain there is exactly one y in the codomain. A
vertical line through any element of the domain should intersect the graph of the function exactly
once. (one to one or many to one but not all the Bs have to be busy)
A function is injective if for every y in the codomain B there is at most one x in the domain. A
horizontal line should intersect the graph of the function at most once (i.e.not at all or once). (one to
one only but not all the Bs have to be busy)
A function is surjective if for every y in the codomain B there is at least one x in the domain. A
horizontal line intersects the graph of the function at least once (i.e.once or more). The range
and the codomain are identical. (one to one or many to one and all the Bs must be busy)
( )
x13 − x23 = 0 ( x2 − x1 ) x12 + x1x2 + x2 2 = 0 x1 = x2 or x12 + x1x2 + x2 2 = 0
(rejected). It has no real value of x1 and x2 . F is a one-one function.
Again let y = ( x3 ) where y codomain, x domain.
We have y = 4x −5 or x= 𝑦+5 1 / 3
( 𝑛 )
For each y codomain x domain such that f ( x ) = y .
Thus F is onto function.
F is a bijection.
Range = f ( x ) : 0 f ( x ) 9
A lattice is a poset (L, ≤) for which every pair {a, b} ∈ L has a least upper bound
(denoted by a ∨ b) and a greatest lower bound (denoted by a ∧ b). LUB ({a,b}) is called the join
of a and b. GLB ({a,b}) is called the meet of a and b.
Example
This above figure is a lattice because for every pair {a, b} ∈ L, a GLB and a LUB exists.
Bounded Lattice
A lattice L becomes a bounded lattice if it has a greatest element 1 and a least element 0.
Complemented Lattice
A lattice L becomes a complemented lattice if it is a bounded lattice and if every element in the
lattice has a complement. An element x has a complement x’ if ∃x(x ∧ x’= 0 and x ∨ x’ = 1)
Distributive Lattice
If a lattice satisfies the following two distribute properties, it is called a distributive lattice.
• a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c)
• a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c)
Modular Lattice
a ∧( b ∨ (a ∧ d)) = (a ∧ b) ∨ (a ∧ d)
Properties of Lattices
Idempotent Properties
• a ∨a = a
• a ∧a = a
• a ∨ (a ∧ b) = a
• a ∧ (a ∨ b) = a
Commutative Properties
• a ∨b = b ∨a
• a ∧b = b ∧a
Associative Properties
• a ∨ (b ∨ c) = (a ∨ b) ∨ c
• a ∧ (b ∧ c) = (a ∧ b) ∧ c
Dual of a Lattice
The dual of a lattice is obtained by interchanging the ‘∨’ and ‘∧’ operations.
Example
A partially ordered set consists of a set with a binary relation which is reflexive, antisymmetric
and transitive. "Partially ordered set" is abbreviated as POSET.
Examples
• The set of real numbers under binary operation less than or equal to (≤) is a poset.
The relations will be {(1, 1), (2, 2), (3, 3), (1, 2), (1, 3), (2, 3)}
{(1, 2), (1, 3), (2, 3)} ∈ R and {(1, 2), (1, 3), (2, 3)} ∉ R
• The vertex set of a directed acyclic graph under the operation ‘reachability’ is a poset.
The Hasse diagram of a poset is the directed graph whose vertices are the element of that poset
and the arcs covers the pairs (x, y) in the poset. If in the poset x<y, then the point x appears lower
than the point y in the Hasse diagram.If x<y<z in the poset, then the arrow is not shown between
x and z as it is implicit.
Example
The poset of subsets of {1, 2, 3} = {φ, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}} is shown
by the following Hasse diagram −
A Linearly ordered set or Total ordered set is a partial order set in which every pair of element is
comparable. The elements a, b ∈ S are said to be comparable if either a ≤ b or b ≤ a holds.
Trichotomy law defines this total ordered set. A totally ordered set can be defined as a
distributive lattice having the property {a ∨ b, a ∧ b} = {a, b} for all values of a and b in set S.
Example
The powerset of {a, b} ordered by ⊆ is a totally ordered set as all the elements of the
power set P = {φ, {a}, {b}, {a, b}} are comparable.
Here, for all (x, y) ∈ S, x ≤ y have to hold but it is not true that 2 ≤ 3, as 2 does not divide 3 or 3
does not divide 2. Hence, it is not a total ordered set.
Boolean algebra has now become an indispensable tool in computer science for its wide
applicability in switching theory, building basic electronic circuits and design of digital
computers.
Algebraic Systems
1. Algebraic Systems
Semigroup
A finite or infinite set ‘S’ with a binary operation ‘0’ (Composition) is called semigroup if it
holds following two conditions simultaneously −
• Closure − For every pair (a, b) ∈S, (a 0 b) has to be present in the set S.
• Associative − For every element a, b, c ∈ S, (a 0 b) 0 c = a 0 (b 0 c) must hold.
Example
The set of positive integers (excluding zero) with addition operation is a semigroup. For
example, S = {1, 2, 3,...}
Here closure property holds as for every pair (a, b) ∈ S, (a + b) is present in the set S. For
example, 1 + 2 = 3 ∈ S]
Monoid
Example
The set of positive integers (excluding zero) with multiplication operation is a monoid. S = {1, 2,
3,...}
Here closure property holds as for every pair (a, b) ∈ S, (a × b) is present in the set S. [For
example, 1 × 2 = 2 ∈S and so on]
A group is a monoid with an inverse element. The inverse element (denoted by I) of a set S is an
element such that (a 0 I) = (I 0 a) = a, for each element a ∈ S. So, a group holds four properties
simultaneously − i) Closure, ii) Associative, iii) Identity element, iv) Inverse element. The
order of a group G is the number of elements in G and the order of an element in a group is the
least positive integer n such that an is the identity element of that group G.
A binary operation * on a set G is a function that associates with every ordered pair of elements a,
b ∈ G, a unique element of G, denoted by a * b.
A group (G, *) is a set G together with a binary operation * such that:
(1) Closure Law: a * b ∈ G for all a, b ∈ G.
(2) Associative Law: (a * b) * c = a * (b * c) for all a, b, c ∈ G.
(3) Identity Law: There exists e ∈ G such that a * e = a = e * a for all a ∈ G.
(4) Inverse Law: For all a ∈ G there exists b ∈ G such that a * b = e = b * a.
Examples
The set of N × N non-singular matrices form a group under matrix multiplication operation.
The set of N × N non-singular matrices contains the identity matrix holding the identity element
property.
As all the matrices are non-singular they all have inverse elements which are also non-singular
matrices. Hence, inverse property also holds.
Abelian Group
An abelian group G is a group for which the element pair (a, b) ∈ G always holds commutative
law. So, a group holds five properties simultaneously − i) Closure, ii) Associative, iii) Identity
element, iv) Inverse element, v) Commutative.
Example
The set of positive integers (including zero) with addition operation is an abelian group. G = {0,
1, 2, 3,…}
Here closure property holds as for every pair (a, b) ∈ S, (a + b) is present in the set S. [For
example, 1 + 2 = 2 ∈ S and so on]
A cyclic group is a group that can be generated by a single element. Every element of a cyclic
group is a power of some specific element which is called a generator. A cyclic group can be
generated by a generator ‘g’, such that every other element of the group can be written as a
power of the generator ‘g’.
Example
The set of complex numbers {1, −1, i, − i} under multiplication operation is a cyclic group.
There are two generators − i and −i as i1 = i, i2 = −1, i3 = −i, i4 = 1 and also (−i)1 = −i, (−i)2 = −1,
(−i)3 = i, (−i)4 = 1 which covers all the elements of the group. Hence, it is a cyclic group.
Note − A cyclic group is always an abelian group but not every abelian group is a cyclic group.
The rational numbers under addition is not cyclic but is abelian.
Subgroup
A subgroup H of a group G that does not include the whole group G is called a proper subgroup
(Denoted by H<G). A subgroup of a cyclic group is cyclic and a abelian subgroup is also abelian.
Notation: H ≤ G.
Example1:
Let a group G = {1, i, −1, −i}
Then some subgroups are H1 = {1}, H2 = {1, −1},
This is not a subgroup: H3 = {1, i} because that (i)−1 = −i is not in H3
Associative: Unlike the examples in exercise 1, this is a totally new operation that we have never
encountered before. We must therefore carefully check the associative law.
(a * b) * c = (a * b)c − (a * b) − c + 2
= (ab − a − b + 2)c − (ab − a − b + 2) − c + 2
= abc − ac − bc + 2c − ab + a + b − 2 − c + 2
= abc − ab − ac − bc + a + b + c
Similarly a * (b * c) has the same value (we can actually see this by the symmetry of the expression.