Unit I and II Discrete Math Before Lattice
Unit I and II Discrete Math Before Lattice
Unit I and II Discrete Math Before Lattice
Set Theory
Function
Relation, Poset
Propositional Calculus
k-map
Hitesh Kag
Medi-Caps University, Indore
Hitesh Kag 1
Syllabus
• UNIT-I
Sets, sub-sets & operations on sets, Finite and infinite sets, principle of
inclusion and exclusion Relations & Properties of relations –
equivalence relation, Functions: Definition, Classification of functions,
Composition of functions, Growth of Functions, Pigeon hole principle.
• UNIT-II
Partial order relation, Poset, least upper bound, greatest lower bound,
maximal and minimal elements of a poset – Definition & example of
Boolean algebra – Lattices, Distributive laws in lattices –
Complemented lattices – Propositional Calculus – Boolean functions,
minimum & maximum terms, simplification of Boolean function with
Karnaugh map & Quiane Mc Clusky method. Applications in computer
Science.
Hitesh Kag 2
• UNIT-III
Binary composition, algebraic structure, Semi group, Monoid, Groups, Abelian Group,
properties of groups, Coset Decomposition, Subgroup, Cyclic Group, Normal
subgroup, Rings and Fields (definition and standard results). Applications in Computer
Science.
• UNIT-IV
Trees : Definition , Binary tree , Binary tree traversal , Binary search tree. .Graphs:
Definition and terminology , Representation of graphs , Multigraphs , Bipartite graphs ,
Planar graphs , Isomorphism and Homeomorphism of graphs , Euler and Hamiltonian
paths , Graph coloring. Application in Computer Science.
• UNIT – V
Recurrence Relation & Generating function: Recursive definition of functions,
Recursive algorithms, Method of solving recurrence relation. Combinatorics:
Introduction, Counting Techniques -Basic theorems on permutations & combinations.
Applications in Computer Science.
Hitesh Kag 3
Discrete mathematics
• Discrete mathematics is the study
of mathematical structures that are
fundamentally discrete rather than continuous.
• In contrast to real numbers that have the
property of varying "smoothly", the objects
studied in discrete mathematics – such
as integers, graphs, and statements in logic– do
not vary smoothly in this way, but have
distinct, separated values.
Hitesh Kag 4
Applications
• Computers run software and store files.
• Networks
• Doing web searches
• Google Maps
• Scheduling problems
• Wiring a computer network
• Encryption and decryption are part of cryptography,
which is part of discrete.
• Area codes
• Designing password criteria is a counting problem
Hitesh Kag 5
• Machine Job Scheduling
• Railway planning uses discrete math
• Computer graphics (such as in video games) use linear
algebra in order to transform (move, scale, change perspective)
objects.
• Bankruptcy proceedings can involve lots of different
reasonable ways to resolve claims. Some involve discrete
optimization. Cell phone communications: Making efficient
use of the broadcast spectrum for mobile phones uses linear
algebra and information theory. Assigning frequencies so
that there is no interference with nearby phones can use graph
theory or can use discrete optimization.
Hitesh Kag 6
• Digital image processing uses discrete
mathematics to merge images or apply filters.
• Electronic health care records are kept as parts
of databases, and there is a lot of discrete
mathematics involved in the efficient and
effective design of databases.
• Compact discs store a lot of data, which is
encoded using a modified Reed-Solomon code (a
binary code, and thus discrete math) to
automatically correct transmission errors.
• Voting systems
Hitesh Kag 7
• Methods of encoding data and reducing the
error in data transmission-mathematics.
• Hidden Markov models, which are part of
linear algebra, are used for large vocabulary
continuous speech recognition.
• Delivery Route Problems:
Hitesh Kag 8
Discrete Mathematics in AI
• Many of the structures in AI are discrete. For
example a neural network has an integer number
of nodes and links. It can’t really have 0.45 of a
node or a tenth of a link.
• So the mathematical modelling of a neural net
must include a discrete element, the integer that
is the number of nodes and links.
• Often in the mathematics of AI there are elements
that are discrete, thus discrete mathematics is a
very important component of AI.
Hitesh Kag 9
Set
• A set is an unordered collection of different
elements
• Examples:
– A set of all positive integers
– A set of all the planets in the solar system
– A set of all the states in India
– A set of all the lowercase letters of the alphabet
Hitesh Kag 10
Representation of a Set
• Roster or Tabular Form
• Set Builder Notation
Roster form
The set is represented by listing all the
elements comprising it.
• Ex 1 Set of vowels in English
alphabet, A={a,e,i,o,u}
Hitesh Kag 11
• Set Builder
Ex 1- The set {a,e,i,o,u} is written as
A={x: x is a vowel in English alphabet}
Ex 2- The set {1,3,5,7,9} is written as
B={x: 1≤x<10 and (x%2)≠0}
Ex 3- C= {x | x is prime and 3 ≤ x ≤ 10}
Hitesh Kag 12
• A = {x : x is an integer and- 1≤ x < 5}
• In roster form: A = {-1, 0,1, 2, 3, 4}
Hitesh Kag 13
Standard Set
If an element x is a member of any set S, it is
denoted by x∈S
• N − the set of all natural numbers = {1,2,3,4,.....}
• Z − the set of all integers
= {.....,−3,−2,−1,0,1,2,3,.....}
• Z+ − the set of all positive integers
• Q − the set of all rational numbers
• R − the set of all real numbers
• W − the set of all whole numbers
Hitesh Kag 14
Cardinality
• 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 ∞.
• So there are finite sets and infinite sets.
Hitesh Kag 15
Types of Set
Hitesh Kag 16
Subset
• A set X is a subset of set Y (Written as X⊆Y) if every
element of X is an element of set Y.
• Example 1 − Let, X={1,2,3,4,5,6}and Y={1,2}. Here
set Y is a subset of set X as all the elements of set Y is
in set X.
Hence, we can write Y⊆X.
• 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
Hitesh Kag 17
Proper Subset
• The term “proper subset” can be defined as
“subset of but not equal to”.
• 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⊂X since all elements in Y are
contained in X too and X has at least one
element is more than set Y.
Hitesh Kag 18
Universal Set
• It is a collection of all elements in a particular
context or application.
Ex 1: we have defines all the students of your
class as universal.
Ex 2: All integers.
Hitesh Kag 19
Empty Set or Null Set
• An empty set contains no elements. It is
denoted by ∅
Ex: integers between 7 and 8
Singleton Set or Unit Set
• Singleton set or unit set contains only one
element.
Ex: S={x|x∈Z, 7<x<9}= {8}
Hitesh Kag 20
Equal Set:
• If two sets contain the same elements they are said to be equal.
Ex 1- If A={1,2,6}and B={6,1,2}
Ex 2- If A = {b, o, y} and B = {b, o, b, y, y} then also A = B
because both contain same elements.
Equivalent Set:
• Equivalent sets are those which have an equal number of
elements irrespective of what the elements are.
• Ex − 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
Hitesh Kag 21
Disjoint Set
• Two sets A and B are called disjoint sets if they
do not have even one element in common.
Therefore, disjoint sets have the following
properties −
• n(A∩B)=∅
• n(A∪B)=n(A)+n(B)
Hitesh Kag 22
Power Set
• The collection of ALL the subsets of a given
set is called a power set of that set under
consideration.
Ex:
• A = {a, b} then,
• Power set – P (A) = {φ,{a},{b},{a, b}}.
Hitesh Kag 25
Union
Let A = {2, 4, 6, 8} and B = {6, 8, 10, 12}. Then, A U B is
represented as the set containing all the elements that belong to
both the sets individually. Mathematically,
A U B = {x : x ϵ A or x ϵ B}
So, A U B = {2, 4, 6, 8, 10, 12},
Properties of (A U B)
• Commutative law (A U B) = (B U A)
• Associative law (A U B) U {C} = {A} U (B U C)
• A U φ = A (Law of identity element)
• Idempotent Law – A U A = A
• Law of the Universal set (U): (A U U) = U
Hitesh Kag 26
• Let A = {1, 2} B = {3, 4} and C = {5, 6}
• A U B = {1, 2, 3, 4}
and (A U B) U C = {1, 2, 3, 4, 5, 6}
• B U C = {3, 4, 5, 6}
and A U (B U C) = {1, 2, 3, 4, 5, 6}
Hitesh Kag 27
Intersection
An intersection is the collection of all the elements that are common to
all the sets under consideration.
Ex: Let A = {2, 4, 6, 8} and B = {6, 8, 10, 12} then A ∩ B or
“A intersection B” is given by:
A ∩ B = {6, 8}
Mathematically, A ∩ B = {x : x ϵ A and x ϵ B}
Properties of the Intersection
• Commutative law – A ∩ B = B∩ A
• Associative law – (A ∩ B)∩ C = A ∩ (B∩ C)
• φ∩A=φ
• U∩A=A
• A∩ A = A; Idempotent law.
• Distributive law – A ∩ (BU C) = (A ∩ B) U (A ∩ C)
Hitesh Kag 28
Difference
The difference of set A and B is represented as:
A – B = {x : x ϵ A and x ϵ B}
Ex: Let, A = {1, 2, 3, 4, 5, 6} and B = {2, 4, 6, 8}
then A – B = {1, 3, 5}
and B – A = {8}.
The sets (A – B), (B – A) and (A ∩ B) are mutually
disjoint sets; it means that there is NO element
common to any of the three sets and the intersection
of any of the two or all the three sets will result in a
null or void or empty set.
Hitesh Kag 29
Complement
• If U represents the Universal set and any set A is the subset of
A then the complement of set A (represented as A’) will
contain ALL the elements which belong to the Universal set U
but NOT to set A.
• Mathematically, A’ = U – A
• Properties of Complement Sets
• A U A’ = U
• A ∩ A’ = φ
• De Morgan’s Law – (A U B)’ = A’ ∩ B’ OR (A ∩ B)’ = A’ U B’
• (A’)’ = A
• φ’ = U
• U’ = φ
Hitesh Kag 30
Cartesian Product
The Cartesian product of sets A and B, written A x
B, is expressed as:
A x B = {(a,b)│a is every element in A, b is
every element in B}
Ex:
A = {1,2}
B = {4,5,6}
The Cartesian product of A and B (i.e. A x B) is
{(1,4), (1,5), (1,6), (2,4), (2,5), (2,6)}
• Theory
Hitesh Kag 31
Venn Diagram
• A Venn diagram is a diagrammatic
representation of ALL the possible
relationships between different sets of a finite
number of elements. Venn diagrams were
conceived around 1880 by John Venn.
Hitesh Kag 32
Overlapping Set: Two sets that have at least one
common element are called overlapping sets.
In case of overlapping sets −
• n(A∪B)=n(A)+n(B)−n(A∩B)
• n(A∪B)=n(A−B)+n(B−A)+n(A∩B)
• n(A)=n(A−B)+n(A∩B)
• n(B)=n(B−A)+n(A∩B)
Hitesh Kag 33
Principle of inclusion and exclusion
• The inclusion–exclusion principle is a counting
technique which generalizes the familiar method
of obtaining the number of elements in the union
of two finite sets; symbolically expressed as
∣A∪B∣=∣A∣+∣B∣−∣A∩B∣
• If there are three sets, the principle of inclusion
and exclusion states
∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣A∩C∣−∣B∩
C∣+∣A∩B∩C∣
Hitesh Kag 34
1. Let A and B be two finite sets such that n(A) = 20,
n(B) = 28 and n(A ∪ B) = 36, find n(A ∩ B).
Hitesh Kag 35
3. A large software development company employs 100 computer
programmers. Of them, 45 are proficient in Java, 30 in C#, 20 in
Python, six in C# and Java, one in Java and Python, five in C#
and Python, and just one programmer is proficient in all three
languages above.
Determine the number of computer programmers that are not
proficient in any of these three languages.
Hitesh Kag 36
4. In a competition, a school awarded medals in different
categories. 36 medals in dance, 12 medals in dramatics and 18
medals in music. If these medals went to a total of 45 persons and
only 4 persons got medals in all the three categories, how many
received medals in exactly two of these categories?
Hitesh Kag 37
5. There are 350 farmers in a large region. 260 farm beetroot, 100
farm yams, 70 farm radish, 40 farm beetroot and radish, 40 farm
yams and radish, and 30 farm beetroot and yams. Let B, Y, and R
denote the set of farms that farm beetroot, yams and radish
respectively.
Determine the number of farmers that farm beetroot,
yams, and radish.
Hitesh Kag 38
6. In a group of 100 persons, 72 people can speak
English and 43 can speak French. How many can speak
English only? How many can speak French only and
how many can speak both English and French?
Hitesh Kag 39
7. In a higher secondary examination, 80% of the examinees have passed in
English and 85% in mathematics, while 75% passed in both English and
mathematics. If 45 candidates failed in both the subjects, find the total number
of candidates.
Hitesh Kag 40
Functions
Hitesh Kag 41
Functions
• Given any sets A, B,
• A function f from (or “mapping”) A to B (f :
AB) is an assignment of exactly one element
f(x)B to each element xA
• Or Function is a mapping from one set to
another.
Hitesh Kag 42
Graphical Representations
• Functions can be represented graphically in
several ways:
f A B
• •
f • •
a• • • y
b •
•
•
• x
A Graph
B Plot
Like Venn diagrams
43 Hitesh Kag
Some Function Terminology
• If f:AB, and f(a)=b (where aA & bB),
then:
– A is the domain of f.
– B is the codomain of f.
– b is the image of a under f.
– a is a pre-image of b under f.
• In general, b may have more than one pre-image.
– The range of f is the set of all images of elements
in A.
RB of f is {b | a f(a)=b }.
44 Hitesh Kag
• f(x)=x^2
• x=-1,1 therefore f(x)=1
Hitesh Kag 45
Range vs. Codomain - Example
• Suppose that: “f is a function mapping
students in this class to the set of grades
{A,B,C,D,E}.”
• At this point, you know f’s codomain is:
{A,B,C,D,E}, and its range is unknown.
• Suppose the grades turn out all As and Bs.
• Then the range of f is {A,B}, but its
codomain is {A,B,C,D,E}.
46 Hitesh Kag
Inverse of a function
if f(a)=b ⟺f (b)=a
-1
Hitesh Kag 47
Example
• Let, f(x)=3x+2
• Assume f(x)=y
• y=3x+2
• x=(y-2)/3 or
• y=(x-2)/3 or
• f-1(x)=(x-2)/3
So, if f(2)=8 then f-1(8)=2
0
• Note that if xZ, 1 .
.
1.4
1.4= 1
x = x = x. 2 .
1.4= 2
3 3 .. .
3=3= 3
49 Hitesh Kag
Plots with floor/ceiling: Example
• Plot of graph of function f(x) = x/3:
f(x)
3 +3 x
2
50 Hitesh Kag
Function Composition
51 Hitesh Kag
Function Composition
52 Hitesh Kag
• f(x)=2x+3
• g(x)=3x+4
• Find fOg and gOf
Hitesh Kag 53
• How many functions are possible from a set A
to B, where A has m elements and B has n
elements.
nm
Hitesh Kag 54
Injective / One-to-one function
• A function f:A→B is injective or one-to-one
function if for every b∈B, there exists at most
one a∈A
• This means a function f is injective
if a1≠a2 implies f(a1)≠f(a2).
Examples
1) f: N→N,f(x)=5x is injective
2) f(x)=x^2 is not injective
3) X = {2, 3, 5, 7} and Y = {3, 4, 6, 8, 9, 11}
• Domain and Range have same Cardinality
• Co domain may be larger.
Hitesh Kag 55
One-to-One Illustration
56
Sufficient Conditions for 1-1ness
Hitesh Kag 59
• If X has m elements and Y has n elements, the
number if onto functions are,
Hitesh Kag 60
Illustration of Onto
• Some functions that are or are not onto their
codomains:
•
• • • • • • • •
• • • • • •
• •
• • • •
• • • •
• • • •
• • • •
• •
Onto Not Onto Both 1-1 1-1 but
(but not 1-1) (or 1-1) and onto not onto
61
Bijective
• A function f is bijection, or reversible, or
invertible, iff it is both one-to-one and onto.
• Cardinality of both sets will be equal.
• Total number of functions
Hitesh Kag 62
Que Let X, Y, Z be sets of sizes x, y and z
respectively. Let W = X x Y. Let E be the set of
all subsets of W. The number of functions from Z
to E is:
(A) z2xy
(B) z x 2xy
(C) z2x + y
(D) 2xyz
Hitesh Kag 63
Hitesh Kag 64
• A function is said to be ______________ if and only if f(a) = f(b) implies that a = b
for all a and b in the domain of f.
a) One-to-many
b) One-to-one
c) Many-to-many
d) Many-to-one
• The function f(x)=x+1 from the set of integers to itself is onto. Is it True or False?
a) True
b) False
• The value of ⌊1/2⌋ is ______________
a) 1
b) 2
c) 3
d) 0
• The value of ⌊1/2.⌊7/2⌋ ⌋ is ______________
a) 1
b) 2
c) 3
d) 0.5
Hitesh Kag 65
• Which of the following function f: Z X Z → Z is not onto?
a) f(a, b) = a + b
b) f(a, b) = a
c) f(a, b) = |b|
d) f(a, b) = a – b
• The inverse of function f(x) = x3 + 2 is ____________
a) f -1 (y) = (y – 2) 1/2
b) f -1 (y) = (y – 2) 1/3
c) f -1 (y) = (y) 1/3
d) f -1 (y) = (y – 2)
• The function f(x) = x3 is bijection from R to R. Is it True or
False?
a) True
b) False
Hitesh Kag 66
• The number of subsets of any set can be 5.
a) True
b) False
• Let the set be A= {a, b, c, {a,b}} then which of the following is
false?
a) {a, b} Є A
b) a Є A
c) {a} Є A
d) b, c ЄA
• If A={1, 2, 3, 4}, then the number of the subsets of A that contain
the element 2 but not 3, is?
a) 16
b) 4
c) 8
d) 24
Hitesh Kag 67
• If set A has 4 elements and B has 3 elements then set n(A X B) is?
a) 12
b) 14
c) 24
d) 7
• If set A and B have 3 and 4 elements respectively then the number of
subsets of set (A X B) is?
a) 1024
b) 2048
c) 512
d) 4096
• If set C is {1, 2, 3, 4} and C – D = Φ then set D can be ___________
a) {1, 2, 4, 5}
b) {1, 2, 3}
c) {1, 2, 3, 4, 5}
d) Φ
Hitesh Kag 68
• Let C = {1,2,3,4} and D = {1, 2, 3, 4} then which of the
following hold not true in this case?
a) C – D = D – C
b) C U D = C ∩ D
c) C ∩ D = C – D
d) C – D = Φ
• Let a set be A then A ∩ φ and A U φ are __________
a) φ, φ
b) φ, A
c) A, φ
d)None of the mentioned
Hitesh Kag 69
• What is the domain of a function?
a) the maximal set of numbers for which a function is defined
b) the maximal set of numbers which a function can take values
c) it is a set of natural numbers for which a function is defined
d) none of the mentioned
• What is domain of function f(x)= x1/2?
a) (2, ∞)
b) (-∞, 1)
c) [0, ∞)
d) None of the mentioned
• The range of function f(x) = sin(x) is (-∞, ∞).
a) True
b) False
Hitesh Kag 70
Growth of the functions
• The growth of a function is determined by the
highest order term: if you add a bunch of
terms, the function grows about as fast as the
largest term (for large enough input values).
f(x)=x2+1
g(x)=3x2
h(x)=x2+x+1
• All the above functions have same growth rate
Hitesh Kag 71
Asymptotic notation
• Growth of the functions gives the
characterization of algorithm’s efficiency or
running time.
• Asymptotic notation allows us to compare the
relative performance of the algorithm
• Big Oh Notation
f(x) = O(g(x))
f(x)<=c1 g(x)
Hitesh Kag 72
Hitesh Kag 73
Hitesh Kag 74
Growth of the functions
Hitesh Kag 75
Increasing order of the functions
• Constant
• Logarithm
• Linear
• Super Linear
• Polynomial
• Exponential
• Factorial
Hitesh Kag 76
• If f(x) = (x3 – 1) / (3x + 1) then f(x) is?
a) O(x2)
b) O(x)
c) O(x2 / 3)
d) O(1)
• If f1(x) is O(g(x)) and f2(x) is o(g(x)), then f1(x) +
f2(x) is?
a) O(g(x))
b) o(g(x))
c) O(g(x)) + o(g(x))
d) None of the mentioned
Hitesh Kag 77
Relation
Let A and B be sets. A binary relation from A to
B is a subset of AB.
•In other words, for a binary relation R we have
R AB. We use the notation aRb to denote that
(a, b)R and aRb to denote that (a, b)R.
Hitesh Kag 78
Difference
• Relation- Two or more sets can be related to each other
by any means. Consider for an example two sets A and
B having m and n elements respectively, we can have a
relation with any ordered pair which shows a relation
between the two sets.
• Functions- A functions can have the same Range
mapped as that of in Relation, such that a set of inputs
is related with exactly one output.
• Note: All functions are relations but all relations are not
functions.
• Relations are the generalization of the function.
Hitesh Kag 79
Differentiating Parameter Relations Functions
Definition A relation is a relationship A function is a relation in
between sets of values. Or, it which there is only one output
is a subset of the Cartesian for each input.
product
Hitesh Kag 80
•When (a, b) belongs to R, a is said to be related
to b by R.
•Example: Let S be a set of students, C be a set
of courses, and D be the relation describing
which students have taken the course.
•S={Ravi, Ram}
•C={DM, DBMS, C}
•D={(Ravi,DM),(Ravi, C),(Ram,C)}
Hitesh Kag 81
•Definition: A relation on the set A is a relation
from A to A.
•In other words, a relation on the set A is a subset
of AA.
Hitesh Kag 82
• How many different relations can we define
on a set A with n elements?
There are n2 elements in AA
n 2
Then number of subsets 2
Hitesh Kag 83
Properties of Relations
Hitesh Kag 84
Reflexive
•A relation R on a set A is called reflexive if (a,
a)R for every element aA.
•Are the following relations on {1, 2, 3, 4}
reflexive?
•R = {(1, 1), (1, 2), (2, 3), (3, 3), (4, 4)}
•R = {(1, 1), (2, 2), (2, 3), (3, 3), (4, 4)}
•R = {(1, 1), (2, 2), (3, 3)}
•Irreflexive: A relation on a set A is called
irreflexive if (a, a)R for every element aA.
Hitesh Kag 85
• Is the “divide” relation on the set of positive
integers is Reflexive?
• Is the “divide” relation on the set of integers is
Reflexive?
Hitesh Kag 86
Symmetric
•A relation R on a set A is called symmetric if
(b, a)R whenever (a, b)R for all a, bA.
–Self pair accepted.
•A relation R on a set A is called antisymmetric
if a = b whenever (a, b)R and (b, a)R.
•A relation R on a set A is called asymmetric if
(a, b)R implies that (b, a)R for all a, bA.
–It doesn’t accept self pair.
Hitesh Kag 87
• Are the following relations on {1, 2, 3, 4}
symmetric, antisymmetric, or asymmetric?
• R = {(1, 1), (1, 2), (2, 1), (3, 3), (4, 4)}
• R = {(1, 1)}
• R = {(1, 3), (3, 2), (2, 1)}
• R = {(4, 4), (3, 3), (1, 4)}
Hitesh Kag 88
• Symmetric and anti-symmetric relations are
not opposite because a relation R can contain
both the properties or may not.
• A relation is asymmetric if and only if it is
both anti-symmetric and irreflexive.
Hitesh Kag 89
Transitive
•A relation R on a set A is called transitive if
whenever (a, b)R and (b, c)R, then (a, c)R
for a, b, cA.
•Are the following relations on {1, 2, 3, 4}
transitive?
• R = {(1, 1), (1, 2), (2, 2), (2, 1), (3, 3)}
• R = {(1, 3), (3, 2), (2, 1)}
• R = {(2, 4), (4, 3), (2, 3), (4, 1)}
Hitesh Kag 90
Equivalence Relation
• A relation is an Equivalence Relation if it is
reflexive, symmetric, and transitive.
• Example
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 equivalence relation as it is reflexive,
symmetric, and transitive.
Hitesh Kag 91
Counting Relations
•A reflexive relation, however, must contain the
n elements (a, a) for every aA.
•Consequently, we can only choose among n2 – n
= n(n – 1) elements to generate reflexive
relations, so there are 2n(n – 1) of them.
Hitesh Kag 92
Counting number of relation
• Number of Reflexive Relations on a set with n elements
: 2n(n-1)
• Irreflexive Relations on a set with n elements : 2n(n-1)
• Number of Symmetric Relations on a set with n
elements : 2n(n+1)/2
• Reflexive and symmetric Relations on a set with n
elements : 2n(n-1)/2
• Number of Asymmetric Relations on a set with n
elements : 3n(n-1)/2
• Number of Anti-Symmetric Relations on a set with n
elements: 2n 3n(n-1)/2
Hitesh Kag 93
Pigeonhole principle
• The pigeonhole principle states that if n items
are put into m containers, with n>m, then at least
one container must contain more than one item.
• In layman's terms, if you have more "objects"
than you have "holes," at least one hole must have
multiple objects in it.
• If n=km+1 objects are distributed among m sets,
then the pigeonhole principle asserts that at least
one of the sets will contain at least k+1 objects.
Hitesh Kag 94
Partial Order Relation
• A relation is Partial Order Relation if it is
Reflexive, Antisymmetric and Transitive.
Que: Show that ≥ is a partial order on the set of
integers
– It is reflexive: a ≥ a for all a Z
– It is antisymmetric: if a ≥ b then the only way that
b ≥ a is when b = a
– It is transitive: if a ≥ b and b ≥ c, then a ≥ c
Hitesh Kag 95
• Ex 1: A={2,3,4,……..,20}
aRb if a divides b is PO Relation
How many pairs are there in this relation
With 2={(2,2)(2,4),(2,6),(2,8)……..(2,20)}
With 3={(3,3),(3,6),(3,9)…….(3,18)}
With 4={(4,4),(4,8),(4,12),(4,16),(4,20)}
With 5= {(5,5),(5,10),(5,15),(5,20)}
With 6=6,12,18
With 7=7,14
With 8=8,16
With 9=9,18
With 10=10,20
Hitesh Kag 96
Hasse Diagram
• A Hasse diagram is a graphical representation of
the relation of elements of a partially ordered set
(poset) with an implied upward orientation. A
point is drawn for each element of the partially
ordered set (poset) and joined with the line
segment according to the following rules:
• If p<q in the poset, then the point corresponding
to p appears lower in the drawing than the point
corresponding to q.
• The two points p and q will be joined by line
segment iff p is related to q.
Hitesh Kag 97
Hitesh Kag 98
• Self loops are not allowed
• There are no arrows
• Transitive is implicit
• Maximal elements are those which are not succeeded
by another element.
• Minimal elements are those which are not preceded by
another element.
• Greatest element (if it exists) is the element
succeeding all other elements.
• Least element (if it exists) is the element that precedes
all other elements.
Hitesh Kag 99
Ex 2: Draw Hasse diagram for ({3, 4, 12, 24, 48,
72}, /)
a b
D E
B C
A
Hitesh Kag 107
Thank You
Subscribe to my youtube channel
“hit education” for Computer Science Lectures