Discrete_Structure_Notes
Discrete_Structure_Notes
Discrete Structure
Syllabus of Discrete Structure
Basic Set Theory: Basic definitions, Relations, Equivalence Relations Partition, Ordered Sets. Boolean
Algebra & Lattices, Logic, Graph theory: Directed and Undirected graphs, Graph Isomorphism, Basic
Graph Theorems, Matrices; Integer and Real matrices, Boolean Matrices, Matrices med m, Path
matrices. Adjacency Vectors/Matrices: Path adjacency matrix, Numerical & Boolean Adjacency
matrices. Applications to counting, Discrete Probability Generating Functions,
Notes prepared by
Prof. (Dr.) Mahtab Alam
Mewar International University
Session 2023-24
A set is typically expressed by curly braces, { } enclosing its elements. If A is a set and a is an
element of it, we write a ∈ A.
Example
Example
Definition.
The set S that contains no element is called the empty set or the null set and is denoted
by { } or ∅.
A set that has only one element is called a singleton set.
One has three main ways for specifying a set. They are: 1. Listing all its elements (list
notation), e.g., X = {2, 4, 6, 8, 10}. Then X is the set of even integers between 0 and 12.
(a) X = {x : x is a prime number}. This is read as “X is the set of all x such that x is a prime
number”. Here, x is a variable and stands for any object that meets the criteria after the
colon.
(b) The set X = {2, 4, 6, 8, 10} in the predicate notation can be written as
or
ii. X = {x : 1 < x < 11, x is an even integer }, or iii. x = {x : 2 ≤ x ≤ 10, x is an even integer
} etc
Definition
1. Suppose X is the set such that whenever x ∈ X, then x ∈ Y as well. Here, X is said to be a
subset of the set Y , and is de ed by X ⊆ Y . When there exists x ∈ X such that x not ∈ Y ,
then we say that X is not a subset of Y ; and we write X not ⊆ Y .
Example
For any set X, we see that X ⊆ X. Thus, ∅ ⊆ ∅. Also, ∅ ⊆ X. Hence, the empty set is a subset
of every set. It thus follows that there is only one empty set.
Power Sets: The power of any given set A is the set of all subsets of A and is denoted by P
(A). If A has n elements, then P (A) has 2n elements.
Example: A = {1, 2, 3}
P (A) = {∅, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}.
Operations on Sets
The basic set operations are:
1. Union of Sets: Union of Sets A and B is defined to be the set of all those elements which
belong to A or B or both and is denoted by A∪B.
A∪B = {x: x ∈ A or x ∈ B}
Example: Let A = {1, 2, 3}, B= {3, 4, 5, 6}
A∪B = {1, 2, 3, 4, 5, 6}.
2. Intersection of Sets: Intersection of two sets A and B is the set of all those elements which
belong to both A and B and is denoted by A ∩ B.
A ∩ B = {x: x ∈ A and x ∈ B}
A ∩ B = {13}.
3. Difference of Sets: The difference of two sets A and B is a set of all those elements which
belongs to A but do not belong to B and is denoted by A - B.
A - B = {x: x ∈ A and x ∉ B}
4. Complement of a Set: The Complement of a Set A is a set of all those elements of the
universal set which do not belong to A and is denoted by Ac.
A = {1, 2, 3}
Ac = {all natural numbers except 1, 2, and 3}.
Algebra of Sets
Sets under the operations of union, intersection, and complement satisfy various laws
(identities) which are listed in Table
Relations
Definition Let X and Y be two sets. Then their Cartesian product, denoted by X × Y , is
defined as X × Y = {(a, b) : a ∈ X, b ∈ Y }. The elements of X × Y are also called ordered
pairs with the elements of X as the first entry and elements of Y as the second entry. Thus, (a1,
b1) = (a2, b2) if and only if a1 = a2 and b1 = b2.
Example
Let X = {a, b, c} and Y = {1, 2, 3, 4}. Then X × X = {(a, a),(a, b),(a, c),(b, a),(b, b),(b, c),(c,
a),(c, b),(c, c)}.
Definition
Let X and Y be two nonempty sets and let R be a relation from X to Y . Then, the inverse
relation, denoted by R−1 , is a relation from Y to X, defined by R−1 = {(y, x) ∈ Y × X : (x, y)
∈ R}. So, for all x ∈ X and y ∈ Y (x, y) ∈ R if and only if (y, x) ∈ R −1
Example
1. If R = {(1, a),(1, b),(2, c)} then R−1 = {(a, 1),(b, 1),(c, 2)}.
2. 2. Let R = {(a, b),(b, c),(a, c)} be a relation on A = {a, b, c} then R−1 = {(b, a),(c, b),(c,
a)} is also a relation on A.
3. There exists at least two elements y1, y2 ∈ Y such that (x, y1),(x, y2) ∈ R. One can ask
similar questions for an element y ∈ Y . To accommodate all these, we introduce a notation
in the following definition.
Notation.
1. For any set Z, one writes R(Z) := {y : (z, y) ∈ R for some z ∈ Z}.
2. for any set W, one writes R−1 (W) := {x ∈ X : (x, w) ∈ R for some w ∈ W}.
Example
Let a, b, c, and d be distinct symbols and let R = {1, a),(1, b),(2, c)}. Then,
2. R({1}) = {a, b}, R({2}) = {c}, R({1, 2}) = {a, b, c}, R({1, 2, 3}) = {a, b, c}, R({4}) = ∅. 3.
dom R−1 = {a, b, c}, rng R−1 = {1, 2}, 4. R−1 ({a}) = {1}, R−1 ({a, b}) = {1}, R−1 ({b, c}) =
{1, 2}, R−1 ({a, d}) = {1}, R−1 ({d}) = ∅.
Functions
Definition Let X and Y be nonempty sets and let f be a relation from X to Y
3. If f is a partial function from X to Y such that for each x ∈ X, f({x}) is a singleton then f is
called a function and is denoted by f : X → Y . Observe that for any partial function f : X * Y ,
the condition (a, b),(a, b0 ) ∈ f implies b = b 0 . Thus, if f : X * Y , then for each x ∈ X, either
f(x) is undefined, or there exists a unique y ∈ Y such that f(x) = y. Moreover, if f : X → Y is a
function, then f(x) exists for each x ∈ X, i.e., there exists a unique y ∈ Y such that f(x) = y. It
thus follows that a partial function f : X * Y is a function if and only if dom f = X, i.e., domain
set of f is X.
Example
1. Consider the relation R1 = {(a, 1),(b, 1),(c, 2)} from A to B. The following are true.
Equivalence Relation
Partial Orders
A relation can also be used to define an order on a set. For example, the words in a dictionary
are arranged according to a lexicographic ordering. So, ordering the objects according to a
particular rule brings a certain structure to the area of study. In the set of natural numbers, the
relation “less than or equal to” enables us to conclude whether a number precedes or succeeds
another number. Similarly, the relation ⊆ also brings an ordering to the set of sets. In this
section, we study the concept of “order”. The reader is already aware of what reflexive,
symmetric and transitive relations are. We now introduce a fourth relation called an
“antisymmetric” relation.
Definition :
The relation f defined on a nonempty set X is called an anti-symmetric relation if and only if,
∀ x, y ∈ X, the property (x, y) ∈ f and (y, x) ∈ f implies that x = y. It is possible to interpret an
anti-symmetric relation using the arrow diagrams of relations. In this context, a relation is
called anti-symmetric if, whenever there is an arrow going from one element to an element
different from it, there does not exist an arrow going back from the second element to the first.
(b) Show that R2 is not an anti-symmetric relation on the set of integers by giving a counter
example. There are two relations which play a prominent role in mathematics. One of them is
the equivalence relation, which we have already seen is a relation which is reflexive,
symmetric and transitive. We now introduce the other relation called a partial order.
Definition The Hasse diagram of a finite poset (X, ≤) is a picture drawn in the following way:
2. If a ≤ b then the point labeled a must appear at a lower height than the point labeled b and
further the two points are joined by a line.
3. If a ≤ b and b ≤ c then the line between a and c is removed. We will see later that for each
finite poset a Hasse diagram exists; see Discussion 8.1.23. Example 8.1.16. Hasse diagram for
the poset (A, ≤) with A = {1, 2, 3, 9, 18} and ≤ as the „divides‟
2. {1, 2, 3, 6, 9, 18} (all positive divisors of 18) with the relation as „divides‟.
Definition :
Lattices
In a poset, it is not necessary that two elements x, y should have a common upper bound. For
instance, consider the poset {1, 2, . . . , 6} with “a ≤ b if and only if a divides b”. The elements
5 and 3 have no common upper bound. Similarly, in a poset, if a pair {x, y} has at least one
upper bound, it is not necessary that the set {x, y} has an lub. For example, look at the poset
described by the third Hasse diagram in Figure 8.2. The set {a, b} has c and d as upper bounds,
but there is no lub of {a, b}
Definition.
1. A poset (L, ≤) is called a lattice if each pair x, y ∈ L has an lub and also a glb. An lub of x, y
is also written as x ∨ y (read as „x or y‟ / „join of x and y‟) and a glb of x, y as x ∧ y (read as „x
and y‟ / „meet of x and y‟).
2. A lattice is called a distributive lattice if for all pairs of elements x, y the following
conditions, called distributive laws, are satisfied : x ∨ (y ∧ z) = (x ∨ y) ∧ (x ∨ z), x ∧ (y ∨ z) =
(x ∧ y) ∨ (x ∧ z).
Example 1.
Consider the poset L = {0, 1}, where 0 < 1. So, L is a linearly ordered set. In this case, a ∨ b =
max{a, b} and a ∧ b = min{a, b}. Hence, L is a distributive lattice.
Boolean Algebras
In a distributive complemented lattice the binary operations ∨, ∧, and the unary operation ¬
satisfy certain properties. Taking cue from these properties, we define an algebraic structure
and later show that the algebraic structure is capable of capturing the seemingly more general
notion of a distributive complemented lattice.
Definition:. A Boolean algebra is a nonempty set S which is closed under the binary
operations ∨ (called join), ∧ (called meet), and the unary operation ¬ (called inverse or
complement) satisfying the following properties for all x, y, z ∈ S:
1. [Commutativity] : x ∨ y = y ∨ x and x ∧ y = y ∧ x.
4. [Inverse] : x ∨ ¬x = 1 and x ∧ ¬x = 0.
Groups
Before coming to the definition and its properties, let us look at the properties of the sets N, Z,
Q, R and C. We know that the set S, which may be Z, Q, R or C, satisfies the following:
Binary operation: For all a, b ∈ S, a + b, called the addition of a and b, is an element of S.
Addition is associative: For all a, b, c ∈ S, (a + b) + c = a + (b + c). Additive identity: S
contains an element, called zero, denoted 0, so that for each a ∈ S, a + 0 = a = 0 + a. Additive
inverse: For every element a ∈ S, there exists an element −a ∈ S such that a + (−a) = 0 = −a +
a. Addition is commutative: For all a, b ∈ S, a + b = b + a. Write S ∗ = S \ {0}.
Correspondingly, we write Z ∗ = Z \ {0}, Q∗ = Q \ {0}, R ∗ = R \ {0} and C ∗ = C \ {0}. As in
the previous case, we see that similar statements hold true for S ∗ with respect to the
multiplication operation, with one exception. They are as follows: Binary operation: For all a,
b ∈ S ∗ , a · b, called the multiplication of a and b, is an element of S ∗ .
Definition Let G be a nonempty set and let ∗ be a binary operation on G. The pair (G, ∗) is
called a group if the following are satisfied:
Example : Show that Cube roots of unity is an abelian group under multiplication
2
Soln: The Cube roots of unity are 1, and
2 2 3
And we know 1 X 1 = 1, 1 X = , X = and X = =1
X 1
_____________________________
2
1 1
2
1
2 2
1
The above results show that the outputs are equal under Commutative law hence it is an
abelian group.
Sub Group
Question
Solution:
We know that,
U = {2, 3, 4, 5, 6, 7, 8, 9}
A = {5, 6, 7}
B = {6, 7, 9}
A ∪ B = {5, 6, 7} ∪ {6, 7, 9}
= {5, 6, 7, 9}
Graph
Definition. Let G = (V, E) be a graph. Then the following definitions and notations are in
order. 1. we sometimes use V (G) in place of V for the vertex set and E(G) in place of E for
the edge set. 2. The number |V (G)| is called the order of the graph G, and is denoted by |G|.
By kGk, we denote the number of edges of G. A graph with n vertices and m edges is called an
(n, m) graph. 3. An edge {u, v} is sometimes denoted uv. An edge uu is called a loop. The
vertices u and v are called the end vertices of the edge uv. Let e be an edge. We say „e is
incident on u‟ to mean that „u is an end vertex of e‟. 4. If uv is an edge in G, then we say that
the vertices u and v are adjacent in G, and also that u is a neighbor of v. We write u ∼ v to
denote that u is adjacent to v. 5. If v ∈ V (G), by N(v) or NG(v), we denote the set of
neighbors of v in G and |N(v)| is called the degree of v. It is usually denoted by dG(v) or d(v).
A vertex of degree 0 is called isolated. A vertex of degree one is called a pendant vertex. 6.
Two edges e1 and e2 are called adjacent if they have a common end vertex. 7. A graph is said
to be non-trivial if it has at least one edge; else it is called a trivial graph. 8. A multigraph is a
pseudograph without loops. A multigraph is a simple graph if no edge appears twice. 9. In this
book, we consider only simple graphs with finite vertex sets. Thus, by a graph, we will mean a
simple graph with a finite vertex set, unless stated otherwise. 10. A set of vertices or edges is
said to be independent if no two of them are adjacent. The maximum size of an independent
vertex set is called the independence number of G, denoted α(G).
Definition. Let G = (V, E) be a graph on n vertices, say V = {1, . . . , n}. Then, G is said to be
a. Complete graph, denoted Kn, if each pair of vertices in G are adjacent.
Theorem In a graph G with n = |G| ≥ 2, there are two vertices of equal degree.
Proof. If G has two or more isolated vertices, we are done. First, suppose G has exactly one
isolated vertex. Then, the remaining n − 1 vertices have degrees between 1 and n − 2 and
hence by PHP, the result follows. Otherwise, G has no isolated vertex. Then G has n vertices
whose degrees lie between 1 and n − 1. Again by PHP, we get the required result.
Exercise.
Let G = (V, E) be a graph with a vertex v ∈ V of odd degree. Then, prove that there exists a
vertex u ∈ V such that there is a path from v to u and deg(u) is also odd.
2. Let G = (V, E) be a graph having exactly two vertices, say u and v, of odd degree.
Then, prove that there is a path in G connecting u and v.
1. the minimum degree of a vertex in G is denoted by δ(G) and the maximum degree of a
vertex in G is denoted by ∆(G).
Example.
1.The cycle graph Cn is 2-regular whereas the complete graph Kn is (n − 1)- regular.
1. If v ∈ V (G) then the graph G − v, called the vertex deleted subgraph, is obtained from G by
deleting v and all the edges that are incident with v.
2. If e ∈ E(G), then the graph G − e = (V, E(G) \ {e}) is called the edge deleted subgraph.
3. If u, v ∈ V (G) such that u v, then G + uv = (V, E(G) ∪{uv}) is called the graph obtained
by edge addition. 4. The complement G of a graph G is defined as (V (G), E), where E = {uv :
u 6= v, uv /∈ E(G)}.
Directed Graph
The directed graph is also known as the digraph, which is a collection of set of vertices edges.
Here the edges will be directed edges, and each edge will be connected with order pair of
vertices. In a graph, the directed edge or arrow points from the first/ original vertex to the
second/ destination vertex in the pair. In the V-vertex graph, we will represent vertices by the
name 0 through V-1. If there are two vertices, x and y, connected with an edge (x, y) in a
directed graph, it is not necessary that the edge (y, a) is also available in that graph.
According to the definition of a directed graph, the same source and destination nodes are not
allowed to have more than one arrow, but border definition is considered by some authors,
which say that the same source and destination nodes can contain multiple arrows in the
directed graph because they allow the arrow set to be a multiset. More specifically, we can
address these types of entities as directed multigraphs.
On the basis of the aforementioned definition of a directed graph, a digraph is allowed to have
loops. That means they can contain the arrows which directly connects nodes to themselves. If
the directed graph has loops, that graph will be known as the loop digraph. In the following
directed graph, there are only directed edges. It contains a directed edge from one vertex to
any other vertex and a loop.
if the digraph does not have the loops, that graph will be known as the simple directed
graph. In the following directed graph, there are only directed edges. It contains a directed
edge from one vertex to any other vertex, and it is not allowing looping.
Example
In this example, we will consider the following graph where G = {N, E}. Now we have to find
out the vertex and edges set in this graph.
Example 3
Undirected Graph
The undirected graph is also referred to as the bidirectional. The two nodes are connected with
a line, and this line is known as an edge. The undirected graph will be represented as G = (N,
E). Where N is used to show the set of edges and E is used to show the set of edges, which are
unordered pairs of elements N. The main difference between the directed and undirected graph
is that the directed graph uses the arrow or directed edge to connect the two nodes. While in
the undirected graph, the two nodes are connected with the two direction edges.
The undirected graph is very common in practice. With the help of undirected graphs, we can
easily model many real-world relationships. The relationship "is a friend of" can be called the
typical symmetric relationship, for instance. This relationship is symmetric because if there is
a case that "Mary is a friend of Harry", then "Harry is a friend of Mary" is also true.
Example
There is another way to draw the undirected graph with the help of given vertices and edges:
Euler Path:
A Euler Path through a graph is a path whose edge list contains each edge of the graph exactly
once.
Euler Circuit: An Euler Circuit is a path through a graph, in which the initial vertex appears a
second time as the terminal vertex.
Euler Graph: An Euler Graph is a graph that possesses a Euler Circuit. A Euler Circuit uses
every edge exactly once, but vertices may be repeated.
Statement: Consider any connected planar graph G= (V, E) having R regions, V vertices and
E edges. Then V+R-E=2.
Dijkstra's Algorithm:
This algorithm maintains a set of vertices whose shortest paths from source is already known.
The graph is represented by its cost adjacency matrix, where cost is the weight of the edge. In
the cost adjacency matrix of the graph, all the diagonal values are zero. If there is no path from
source vertex Vs to any other vertex Vi then it is represented by +∞.In this algorithm, we have
assumed all weights are positive.
3. Now, include that vertex in S which is nearest to Vs and find the shortest paths to all the
vertices through this vertex and update the values.
4. Repeat the step until n-1 vertices are not included in S if there are n vertices in the
graph.
After completion of the process, we got the shortest paths to all the vertices from the source
vertex.
Example: Find the shortest paths between K and L in the graph shown in fig using Dijkstra's
Algorithm.
Probability
The word 'Probability' means the chance of occurring of a particular event. It is generally
possible to predict the future of an event quantitatively with a certain probability of being
correct. The probability is used in such cases where the outcome of the trial is uncertain.
Probability Definition:
The probability of happening of an event A, denoted by P(A), is defined as
Thus, if an event can happen in m ways and fails to occur in n ways and m+n ways is equally
likely to occur then the probability of happening of the event A is given by
Note:
Example: Tossing a coin and getting head is a trial. Then the event is {HT, TH, HH}
Example:
1. Tossing a Coin
2. Rolling a die
3. Drawing a card from a pack of 52 cards.
4. Drawing a ball from a bag.
4. Sample Space: The set of all possible outcomes of an experiment is called sample space
and is denoted by S.
Now, we have A and B two mutually exclusive events. Therefore, n1+n2 is the number of cases
favorable to A or B.
Example: Two dice are tossed once. Find the probability of getting an even number on first
dice or a total of 8.
Solution: An even number can be got on a die in 3 ways because any one of 2, 4, 6, can
come. The other die can have any number. This can happen in 6 ways.
∴ P (a total of 8) =
∴ Total Probability =
Counting Principles
Sum Rule Principle: Assume some event E can occur in m ways and a second event F can
occur in n ways, and suppose both events cannot occur simultaneously. Then E or F can occur
in m + n ways.
In general, if there are n events and no two events occurs in same time then the event can
occur in n1+n2..........n ways.
Example: If 8 male processor and 5 female processor teaching DMS then the student can
choose professor in 8+5=13 ways.
Product Rule Principle: Suppose there is an event E which can occur in m ways and,
independent of this event, there is a second event F which can occur in n ways. Then
combinations of E and F can occur in mn ways.
In general, if there are n events occurring independently then all events can occur in the
order indicated as n1 x n2 x n3.........n ways.
Example: In class, there are 4 boys and 10 girls if a boy and a girl have to be chosen for the
class monitor, the students can choose class monitor in 4 x 10 = 40 ways.
Mathematical Functions:
Factorial Function: The product of the first n natural number is called factorial n. It is
denoted by n!, read "n Factorial."
Solution:
Solution: = = 10 x 9=90
Binomial Coefficients: Binomial Coefficient is represented by nCr where r and n are positive
integer with r ≤ n is defined as follows:
Generating Functions
Generating function is a method to solve the recurrence relations.
Let us consider, the sequence a0, a1, a2....ar of real numbers. For some interval of real numbers
containing zero values at t is given, the function G(t) is defined by the series
G(t)= a0, a1t+a2 t2+⋯+ar tr+............equation (i)
This function G(t) is called the generating function of the sequence ar.
It can be expressed as
Also,If a(1)r has the generating function G1(t) and a(2)r has the generating function G2(t), then
λ1 a(1)r+λ2 a(2)r has the generating function λ1 G1(t)+ λ2 G2(t). Here λ1 and λ2 are constants.
Application Areas:
Generating functions can be used for the following purposes -
By the method of generating functions with the initial conditions a0=2 and a1=3.
+2G(t)=0............equation (ii)
Now, put a0=2 and a1=3 in equation (ii) and solving, we get
= B ∴ B =1