DM UNIT - II
DM UNIT - II
Set theory is a fundamental branch of mathematics that studies collections of objects, called
sets. It provides the foundation for various mathematical disciplines, including logic, algebra,
and probability.
Definition of a Set:
A set is a well-defined collection of distinct objects, called elements or members of the set.
Sets are usually denoted by capital letters (e.g., A, B, C), and elements are enclosed in curly
brackets { }.
Examples of Sets:
Representation of Sets:
A set can be represented in various ways depending on how its elements are defined or listed.
Below are the primary methods of representing sets:
In this method, all the elements of a set are explicitly listed, separated by commas, and
enclosed in curly braces { }.
Example:
2. Set-Builder Notation:
Instead of listing all elements, a property or condition is used to define the set. It is written in
the form:
A={x ∣ condition on x}
Example:
A Venn diagram is a graphical representation of sets using circles within a universal set. It
helps visualize relationships like union, intersection, and complement.
Example:
A set of students who like math and a set of students who like science can be
represented using overlapping circles.
The overlap represents students who like both subjects.
Used mainly for representing continuous sets of numbers, such as real number intervals.
A set is a well-defined collection of distinct objects. Different types of sets exist based on
their properties.
1. Finite Set:
✅ Example:
2. Infinite Set:
✅ Example:
✅ Example:
4. Singleton Set:
✅ Example:
A={7}
B={Apple}
5. Equal Sets:
Two sets are equal if they have the same elements. Order does not matter.
✅ Example:
6. Equivalent Sets:
Two sets are equivalent if they have the same number of elements (cardinality).
✅ Example:
A={a,b,c}
B={1,2,3}
Since both have three elements, A∼B.
7. Subset:
✅ Example:
A={1,2,3} B={1,2,3,4,5}
Since all elements of A are in B, A⊆B.
8. Power Set
The power set of a set A is the set of all subsets of A, including the empty set and A itself. It
is denoted as P(A).
✅ Example:
If A={1,2} then P(A)={∅,{1},{2},{1,2}}
9. Universal Set
The universal set (U) is the set that contains all elements under discussion.
✅ Example:
The complement of a set A (AC) is the set of elements that are in the universal set but not in
A.
✅ Example:
If U={1,2,3,4,5} and A={1,2}, then AC={3,4,5}
✅ Example:
A={1,2,3} B={4,5,6}
Since A∩B=∅ , A and B are disjoint.
Two sets are overlapping if they have at least one common element.
✅ Example:
A={1,2,3}, B={3,4,5}
Since A∩B={3}, A and B overlap.
The Cartesian product of two sets A and B is the set of all ordered pairs (a,b), where a∈A
and b∈B. It is denoted as A×B.
✅ Example:
If A={1,2} and B={a,b}, then:
A×B={(1,a),(1,b),(2,a),(2,b)}
Set operations:
Set operations are the basic ways we combine or modify sets. Here are the primary set
operations with examples:
1. Union ( ∪ )
The union of two sets A and B, denoted A∪B, is the set of all elements that are in A, in B, or
in both.
Example:
Let:
A={1,2,3}
B={2,3,4}
A∪B={1,2,3,4}
Explanation: The union includes all distinct elements from both sets A and B.
2. Intersection ( ∩ )
The intersection of two sets A and B, denoted A∩B, is the set of all elements that are
common to both sets.
Example:
Let:
A={1,2,3}
B={2,3,4}
A∩B={2,3}
Explanation: The intersection includes only the elements that are present in both sets, i.e., 2
and 3.
3. Difference ( − )
The difference of two sets A and B, denoted A−B, is the set of elements that are in A but not
in B.
Example:
Let:
A={1,2,3}
B={2,3,4}
Explanation: The set A−B contains only the elements that are in A but not in B. In this case, 1
is the only element in A but not in B.
4. Complement ( ′ )
The complement of a set A, denoted A′, is the set of all elements in the universal set U that
are not in A. The universal set U is typically defined in the context of the problem.
Example:
Explanation: The complement of A consists of the elements in the universal set U that are not
in A. So, the complement of A={1,2,3} is {4,5}, which are the remaining elements in U.
5. Symmetric Difference ( △ )
The symmetric difference of two sets A and B, denoted AΔB, is the set of elements that are
in either A or B, but not both. It is the union of the differences (A−B) ∪ (B−A).
Example:
Let:
A={1,2,3}
B={2,3,4}
AΔB={1,4}
Explanation: The symmetric difference includes elements that are only in one of the sets, but
not in both. So, 1 is in A but not in B, and 4 is in B but not in A.
6. Cartesian Product ( × )
The Cartesian product of two sets A and B, denoted A×B, is the set of all ordered pairs
where the first element is from A and the second element is from B.
Example:
Let:
A={1,2}
B={a,b}
Explanation: The Cartesian product consists of all possible ordered pairs where the first
element comes from A and the second from B.
7. Power Set ( P )
The power set of a set A, denoted P(A), is the set of all subsets of A, including the empty set
and A itself.
Example:
Let:
A={1,2}
Explanation: The power set includes all possible subsets of A, including the empty set, the
individual elements, and the set A itself.
Example:
A={1,2,3,4,5,7,9,11,15}
B={5,7,9,11}
1. Union ( A∪B )
A∪B={1,2,3,4,5,7,9,11,15}∪{5,7,9,11}
A∪B={1,2,3,4,5,7,9,11,15}
2. Intersection (A∩B )
A∩B={1,2,3,4,5,7,9,11,15}∩{5,7,9,11}
A∩B={5,7,9,11}
Explanation: The elements that are common to both A and B are 5,7,9,11.
3. Difference (A−B)
A−B={1,2,3,4,5,7,9,11,15}−{5,7,9,11}
A−B={1,2,3,4,15}
4. Difference (B−A)
B−A={5,7,9,11}−{1,2,3,4,5,7,9,11,15}
B−A=∅
Explanation: All elements of B are already in A, so the difference is the empty set.
5. Complement (A′)
The complement A′ contains all elements that are in the universal set U but not in A. To find
A′, we need to define the universal set.
A={1,2,3,4,5,7,9,11,15}
A′=U−A={6,8,10,12,13,14}
AΔB=(A−B)∪(B−A)
A−B={1,2,3,4,15}
B−A=∅
Thus:
AΔB={1,2,3,4,15}
A={1,2,3,4,5,7,9,11,15}
B={5,7,9,11}
A×B={(1,5),(1,7),(1,9),(1,11),(2,5),(2,7),(2,9),(2,11),(3,5),(3,7),(3,9),(3,11),(4,5),(4,7),(4,9),(
4,11),(5,5),(5,7),(5,9),(5,11),(7,5),(7,7),(7,9),(7,11),(9,5),(9,7),(9,9),(9,11),(11,5),(11,7),(11,9)
,(11,11),(15,5),(15,7),(15,9),(15,11)}
Explanation: Every element of A is paired with every element of B, forming ordered pairs.
The cardinality of A−B is simply the number of elements in the set A−B.
A−B={1,2,3,4,15}
n(A−B)=5
B−A=∅
n(B−A)=0
B={5,7,9,11}
A={1,2,3,4,5,7,9,11,15}
B×A={(5,1),(5,2),(5,3),(5,4),(5,5),(5,7),(5,9),(5,11),(5,15),(7,1),(7,2),(7,3),(7,4),(7,5),(7,7),(7,
9),(7,11),(7,15),(9,1),(9,2),(9,3),(9,4),(9,5),(9,7),(9,9),(9,11),(9,15),(11,1),(11,2),(11,3),(11,4),
(11,5),(11,7),(11,9),(11,11),(11,15)}
Explanation: This is the reverse of the Cartesian product A×B, where each element of B is
paired with every element of A.
Relation or Binary relation:
This means R consists of a collection of ordered pairs (a,b), where a∈A and b∈B. If an
ordered pair (a,b) is in the relation R, we say "a is related to b" or "a is in relation with b."
Example:
A={1,2,3},B={a,b,c}
A binary relation R from A to B can be a subset of A×B. For example, let R be:
R={(1,a),(2,b),(3,c)}
1 is related to a,
2 is related to b,
3 is related to c.
In discrete mathematics, relations (or binary relations) can have various properties that help
in classifying and understanding the relationship between elements of sets. These properties
are important in the study of equivalence relations, partial orders, and other structures.
1. Reflexive Relation
o A relation R on a set A is reflexive if every element in A is related to itself.
o Formally, for all a∈A, (a,a)∈R.
o Example: The relation "is equal to" = on integers is reflexive, because for any
integer n, n=n.
2. Symmetric Relation
o A relation R on a set A is symmetric if whenever an element a is related to an
element b, then b is also related to a.
o Formally, if (a,b)∈R, then (b,a)∈R
o Example: The relation "is married to" is symmetric because if a is married to
b, then b is married to a.
3. Antisymmetric Relation
o A relation R on a set A is antisymmetric if whenever both (a,b)∈R and
(b,a)∈R, it must follow that a=b.
o Formally, if (a,b)∈R and (b,a)∈R, then a=b.
o Example: The relation "is less than or equal to" on integers is antisymmetric
because if a≤b and b≤a, then a=b.
4. Transitive Relation
o A relation R on a set A is transitive if whenever a is related to b and b is
related to c, then a must be related to c.
o Formally, if (a,b)∈R and (b,c)∈R, then (a,c)∈R.
o Example: The relation "is greater than or equal to" on real numbers is
transitive, because if a≥b and b≥c, then a≥c.
Irreflexive Relation
Definition:
Example:
R={(1,2),(2,3)}.
In this case:
(1,1)∉R
(2,2)∉R
(3,3)∉R
Definition:
Example:
R={(1,2),(2,3)}.
Combination of Properties
Some relations can have combinations of these properties, and when they do, they are often
given specific names:
1. Equivalence Relation
o A relation R on a set A is an equivalence relation if it is:
Reflexive: For all a∈A, (a,a)∈R.
Symmetric: If (a,b)∈R, then (b,a)∈R.
Transitive: If (a,b)∈R and (b,c)∈R, then (a,c)∈R.
o Example: The relation "is congruent to" modulo n is an equivalence relation
because it satisfies reflexivity, symmetry, and transitivity.
3. Total Order
o A total order is a partial order where every pair of elements is comparable.
In other words, for every a,b∈A, either (a,b)∈R or (b,a)∈R.
o Example: The relation "is less than or equal to" on real numbers is a total
order because for any two real numbers, one is always less than or equal to the
other.
Elements of POSET:
Note: There can be more than one maximal or more than one minimal element.
Example: Determine all the maximal and minimal elements of the poset whose Hasse diagram
is shown in fig:
Solution:
Example: The set of positive integers I+ with the usual order ≤ is a linearly ordered set.
Hasse Diagrams
It is a useful tool, which completely describes the associated partial order. Therefore, it is also
called an ordering diagram. It is very easy to convert a directed graph of a relation on a set A
to an equivalent Hasse diagram. Therefore, while drawing a Hasse diagram following points
must be remembered.
1. The vertices in the Hasse diagram are denoted by points rather than by circles.
2. Since a partial order is reflexive, hence each vertex of A must be related to itself, so the
edges from a vertex to itself are deleted in Hasse diagram.
3. Since a partial order is transitive, hence whenever aRb, bRc, we have aRc. Eliminate
all edges that are implied by the transitive property in Hasse diagram, i.e., Delete edge
from a to c but retain the other two edges.
4. If a vertex 'a' is connected to vertex 'b' by an edge, i.e., aRb, then the vertex 'b' appears
above vertex 'a'. Therefore, the arrow may be omitted from the edges in the Hasse
diagram.
The Hasse diagram is much simpler than the directed graph of the partial order.
Example: Consider the set A = {4, 5, 6, 7}. Let R be the relation ≤ on A. Draw the directed
graph and the Hasse diagram of R.
R = {{4, 5}, {4, 6}, {4, 7}, {5, 6}, {5, 7}, {6, 7}, {4, 4}, {5, 5}, {6, 6}, {7, 7}}
Example: Consider the poset A = {a, b, c, d, e, f, g} be ordered shown in fig. Also let B = {c,
d, e}. Determine the upper and lower bound of B.
Solution: The upper bound of B is e, f, and g because every element of B is '≤' e, f, and g.
The lower bounds of B are a and b because a and b are '≤' every elements of B.
If an upper bound of A precedes every other upper bound of A, then it is called the supremum
of A and is denoted by Sup (A)
If a lower bound of A succeeds every other lower bound of A, then it is called the infimum of
A and is denoted by Inf (A)
Example: Determine the least upper bound and greatest lower bound of B = {a, b, c} if they
exist, of the poset whose Hasse diagram is shown in fig:
Range of a Function: The range of a function is the set of picture of its domain. In other words,
we can say it is a subset of its co-domain. It is denoted as f (domain).
1. Let x = {1, 2, 3, 4} y = {a, b, c, d, e} f = {(1, b), (2, a), (3, d), (4, c)
Solution:
Example1:
1. Let X = {a, b, c} and Y = {x, y, z} and f: X → Y such that f= {(a, x), (b, z), (c, x)}
Then f can be represented diagrammatically as follows
Types of Functions
1. Injective (One-to-One) Functions: A function in which one element of Domain Set is
connected to one element of Co-Domain Set.
2. Surjective (Onto) Functions: A function in which every element of Co-Domain Set has
one pre-image.
Example: Consider, A = {1, 2, 3, 4}, B = {a, b, c} and f = {(1, b), (2, a), (3, c), (4, c)}.
Example:
4. Into Functions: A function in which there must be an element of co-domain Y does not
have a pre-image in domain X.
Example:
5. One-One Into Functions: Let f: X → Y. The function f is called one-one into function if
different elements of X have different unique images of Y.
Example:
Example:
7. Many-One Into Functions: Let f: X → Y. The function f is called the many-one function
if and only if is both many one and into function.
Example:
Example:
Identity Functions
The function f is called the identity function if each element of set A has an image on itself i.e.
f (a) = a ∀ a ∈ A.
It is denoted by I.
Example:
Consider, A = {1, 2, 3, 4, 5} and f: A → A such that f = {(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)}.
The function f is an identity function as each element of A is mapped onto itself. The function
f is a one-one and onto
Invertible (Inverse) Functions:
A function f: X → Y is invertible if and only if it is a bijective function.
Consider the bijective (one to one onto) function f: X → Y. As f is a one to one, therefore, each
element of X corresponds to a distinct element of Y. As f is onto, there is no element of Y
which is not the image of any element of X, i.e., range = co-domain Y.
Example:
Compositions of Functions:
Consider functions, f: A → B and g: B → C. The composition of f with g is a function from A
into C defined by (gof) (x) = g [f(x)] and is defined by gof.
To find the composition of f and g, first find the image of x under f and then find the image
of f (x) under g.
Example1:
Example: If, f(x) = x2 and g(x) = x + 3. Then calculate the composition g(f(x)) and
f(g(x)). (i.e., fog(x), gof(x))
Solution:
g(f(x)) = g(x2) = x2 + 3
Similarly, we can easily calculate the f(g(x)) or (f∘g)(x) where g(x) is computed first.
f(g(x)) = f(x + 3) = (x + 3)2
Example: If f(x) = x + 2 and g(x) = (2x)2 find, f(g(x)) and g(f(x)) (i.e., fog(x), gof(x))
Solution:
For f(g(x))
Given, g(x) = (2x) 2 = 4x2
Thus, f(g(x)) = f(4x2) = 4x2 + 2
Solution:
Note:
o If f and g are one-to-one, then the function (gof) (gof) is also one-to-one.
o If f and g are onto then the function (gof) (gof) is also onto.
o Composition consistently holds associative property but does not hold commutative
property.
1. Base Case: A condition that stops the recursion (prevents infinite calls).
2. Recursive Case: A rule that defines the function in terms of smaller inputs.
Representation of Relations
Mij = 0 if (ai,bj) ∉ R
1 if (ai,bj )∈ R
Example
1. Let P = {1, 2, 3, 4}, Q = {a, b, c, d} and R = {(1, a), (1, b), (1, c), (2, b), (2, c), (2, d)}.
The matrix of relation R is shown as fig:
Example
3. Relation as an Arrow Diagram: If P and Q are finite sets and R is a relation from P to Q.
Relation R can be represented as an arrow diagram as follows.
Draw two ellipses for the sets P and Q. Write down the elements of P and elements of Q
column-wise in three ellipses. Then draw an arrow from the first ellipse to the second ellipse if
a is related to b and a ∈ P and b ∈ Q.
Example
1. Let P = {1, 2, 3, 4} Q = {a, b, c, d} R = {(1, a), (2, a), (3, a), (1, b), (4, b), (4, c), (4, d)
4. Relation as a Table: If P and Q are finite sets and R is a relation from P to Q. Relation R
can be represented in tabular form.
Make the table which contains rows equivalent to an element of P and columns equivalent to
the element of Q. Then place a cross (X) in the boxes which represent relations of elements on
set P to set Q.
Example
1. Let P = {1, 2, 3, 4} Q = {x, y, z, k} R = {(1, x), (1, y), (2, z), (3, z), (4, k)}.
The tabular form of relation as shown in fig: