Professional Documents
Culture Documents
Discrete Mathametics Notes Based On Syllabus PDF
Discrete Mathametics Notes Based On Syllabus PDF
Discrete Mathametics Notes Based On Syllabus PDF
Semester-2
BCA 204
https://dpmishrakidiary.blogspot.in/
2
Unit-1
Set Relation & Function
Sets And Subsets-
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.
Example:
https://dpmishrakidiary.blogspot.in/
3
https://dpmishrakidiary.blogspot.in/
4
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.
Example-
A={10,11,12,13), B={13,14,15}
then A∩B={13}.
https://dpmishrakidiary.blogspot.in/
5
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: For a set S={a,b,c,d} let us calculate the subsets −
Subsets with 0 elements −{∅} (the empty set)
Subsets with 1 element − {a},{b},{c},{d}
Subsets_with_2_elements− {a,b},{a,c},{a,d},{b,c},{b,d},{c,d}
Subsets_with_3_elements− {a,b,c},{a,b,d},{a,c,d},{b,c,d}
|P({∅})|=20=1
https://dpmishrakidiary.blogspot.in/
6
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∪B)′={6,8,9,10}
A′∩B′={6,8,9,10}
Thus, we see that (A∪B)′=A′∩B′
(A∩B)′={2,4,5,6,7,8,9,10}
A′∪B′={2,4,5,6,7,8,9,10}
Thus, we see that (A∩B)′=A′∪B′
where x1 ∈ A1 , x2 ∈ A2,…xn ∈ An
https://dpmishrakidiary.blogspot.in/
7
Relation-
Let A and B be two non-empty set.
Then, a relation R from A to B is a subset of (AxB)
Thus, R is a relation from A to B R ∈ (AxB).
If (a,b) ∈ R then we say that A is related to B and we write,
ARB.
If (A,B) ∈ R then A is not related to B and we write AꞦB.
A={x,y}
B={1,2,3}
AxB={(x,1), (x,2), (x,3), (4,1), (4,2), (4,3)}
R={(x,1), (x,3), (y,3)}
Domain and Range -
If there are two sets A and B, and relation R have order pair (x, y), then
−
Examples
Let, A={1,2,9} and B={1,3,7}
Case 1 − If relation R is 'equal to' then R={(1,1),(3,3)}
Dom(R) = {1,3},Ran(R)={1,3}
Case 2 − If relation R is 'less than' then R={(1,3),(1,7),(2,3),(2,7)}
Dom(R) = {1,2},Ran(R)={3,7}
Case 3 − If relation R is 'greater than' then R={(2,1),(9,1),(9,3),(9,7)}
Dom(R) = {2,9},Ran(R)={1,3,7}
Types of Relations –
Empty Relation: A relation R on a set A is called Empty if the
set A is empty set.
Full Relation: A binary relation R on a set A and B is called full
if AXB.
https://dpmishrakidiary.blogspot.in/
8
https://dpmishrakidiary.blogspot.in/
9
Function-
A function or mapping (Defined as f:X→Y) is a rela onship from
elements of one set X to elements of another set Y (X and Y are
non-empty sets). X is called Domain and Y is called Codomain
of function ‘f’.
Function ‘f’ is a relation on X and Y such that 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 or many to one but not one to
many.
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 such that f(s)=t.
This means a function f is injective if a1≠a2 implies f(a1)≠f(a2).
Example
f:N→ N,f(x)=5x is injective.
2
f:N→ N,f(x)=x is injective.
2 2 2
f:R→ R,f(x)=x is not injective as (−x) =x
https://dpmishrakidiary.blogspot.in/
10
Here, 2x–3=y
So, x=(y+5)/3 which belongs to R and f(x)=y.
Hence, f is surjective.
Inverse of a Function
The inverse of a one-to-one corresponding function f:A→B, is the
function g:B→A, holding the following property –
f(x)=y⇔g(y)=x
The function f is called invertible, if its inverse function g exists.
Example
A Function f:Z→Z,f(x)=x+5, is invertible since it has the inverse
function g:Z→Z,g(x)=x−5.
A Function f:Z→Z,f(x)=x2 is not invertiable since this is not one-to-one
as (−x)2=x2.
https://dpmishrakidiary.blogspot.in/
11
Subgroup-
A subgraph S of a graph G is a graph whose set of vertices and set of
edges are all subsets of G. (Since every set is a subset of itself, every
graph is a subgraph of itself.) ... An edge-induced subgraph consists
of some of the edges of the original graph and the vertices that are
at their endpoints.
https://dpmishrakidiary.blogspot.in/
12
Cyclic Group-
A cyclic group is a group that can be generated by a single element
X (the group generator). Cyclic groups are Abelian.
A cyclic group of finite group order n is denoted C_n, Z_n, Z_n, or
C_n; Shanks 1993, p. 75), and its generator X satisfies
X^n=I,
(1)
where I is the identity element.
The ring of integers Z form an infinite cyclic group under addition,
and the integers 0, 1, 2, ..., n-1 (Z_n) form a cyclic group of order n
under addition (mod n). In both cases, 0 is the identity element.
Permutation group-
A permutation group is a group G whose elements
are permutations of a given set M and whose group operation is the
composition of permutations in G (which are thought of as bijective
functions from the set M to itself).
The group of all permutations of a set M is the symmetric
group of M, often written as Sym(M).[1] The term permutation
https://dpmishrakidiary.blogspot.in/
13
Homomorphism-
A homomorphism is a map between two groups which respects the
group structure. More formally, let G and H be two group, and f a
map from G to H (for every g ∈G, f(g) ∈H). Then f is a
homomorphism if for every g1,g2 ∈G, f(g1g2)=f(g1)f(g2). For
example, if H<G, then the inclusion map i(h)=h ∈G is a
homomorphism. Another example is a homomorphism from Z to Z
given by multiplication by 2, f(n)=2n. This map is a homomorphism
since f(n+m)=2(n+m)=2n+2m=f(n)+f(m).
Isomorphism-
Isomorphism, in modern algebra, a one-to-one correspondence
(mapping) between two sets that preserves binary relationships
between elements of the sets. For example, the set of natural
numbers can be mapped onto the set of even natural numbers by
multiplying each natural number by 2. The binary operation of
adding two numbers is preserved—that is, adding two natural
numbers and then multiplying the sum by 2 gives the same result as
multiplying each natural number by 2 and then adding the products
together—so the sets are isomorphic for addition.
https://dpmishrakidiary.blogspot.in/
14
Automorphism-
An automorphism of a group is any of the following equivalent
things:
Endomorphism-
An endomorphism is a morphism (or homomorphism) from
a mathematical object to itself. For example, an endomorphism of
a vector space V is a linear map f: V → V, and an endomorphism of
a group G is a group homomorphism f: G → G. In general, we can
talk about endomorphisms in any category. In the category of sets,
endomorphisms are functions from a set S to itself.
https://dpmishrakidiary.blogspot.in/
15
Coset-
if G is a group, and H is a subgroup of G, and g is an element of G,
then:
gH = { gh : h an element of H } is the left coset of H in G with respect
to g, and
Hg = { hg : h an element of H } is the right coset of H in G with
respect to g.
Field-
In mathematics, a field is a set on which addition, subtraction,
multiplication, and division are defined, and behave as when they
are applied to rational and real numbers. A field is thus a
fundamental algebraic structure, which is widely used in algebra,
number theory and many other areas of mathematics.
https://dpmishrakidiary.blogspot.in/
16
https://dpmishrakidiary.blogspot.in/
17
Unit-2
Mathematical Logic
Statement and Notations-
A statement (or proposition) is a sentence that is either true or false
(both not both). So '3 is an odd integer' is a statement. But 'π is a
cool number' is not a (mathematical) statement. Note that '4 is an
odd integer' is also a statement, but it is a false statement.
A mathematical notation is a writing system used for recording
concepts in mathematics. The notation uses symbols or symbolic
expressions which are intended to have a precise semantic
meaning. In the history of mathematics, these symbols have
denoted numbers, shapes, patterns, and change.
Connectives-
A function, or the symbol representing a function, which
corresponds to English conjunctions such as "and," "or," "not," etc.
that takes one or more truth values as input and returns a single
truth value as output. The terms "logical connective" and
"propositional connective" (Mendelson 1997, p. 13) are also used.
The following table summarizes some common connectives and
their notations-
connective symbol
AND , , , , ,
https://dpmishrakidiary.blogspot.in/
18
equivalent , ,
implies , ,
NAND , ,
nonequivalent , ,
NOR , ,
NOT , , ,
OR , , ,
XNOR XNOR
XOR ,
Normal Forms-
Normal form (scientific notation) is a way to write very large or very
small numbers in a more compact form. It has two parts:
https://dpmishrakidiary.blogspot.in/
19
https://dpmishrakidiary.blogspot.in/
20
Socrates is a man.
Solution:
Example 2:
Solution:
https://dpmishrakidiary.blogspot.in/
21
Predicate calculus-
Predicate calculus, also called Logic Of Quantifiers, that part of
modern formal or symbolic logic which systematically exhibits
the logical relations between sentences that hold purely in
virtue of the manner in which predicates or noun expressions
are distributed through ranges of subjects by means of
quantifiers such as “all” and “some” without regard to the
meanings or conceptual contents of any predicates in
particular.
Such predicates can include both qualities and relations; and, in
a higher-order form called the functional calculus, it also
includes functions, which are “framework” expressions with
one or with several variables that acquire definite truth-values
only when the variables are replaced by specific terms.
The predicate calculus is to be distinguished from the
propositional calculus, which deals with unanalyzed whole
propositions related by connectives (such as “and,” “if . . .
then,” and “or”).
https://dpmishrakidiary.blogspot.in/
22
Unit-3
Basic concept of Graph
Basics of Graph-
A graph is a diagram of points and lines connected to the points. It
has at least one line joining a set of two vertices with no vertex
connecting itself.
Example Here, ‘a’ and ‘b’ are the points. The link between these two
points is called a line.
https://dpmishrakidiary.blogspot.in/
23
Pseudograph-
A pseudograph is a non-simple graph in which both graph
loops and multiple edges are permitted
Multigraph-
In mathematics, and more specifically in graph theory, a multigraph
(in contrast to a simple graph) is a graph which is permitted to have
multiple edges (also called parallel edges), that is, edges that have
the same end nodes. Thus two vertices may be connected by more
than one edge.
https://dpmishrakidiary.blogspot.in/
24
Simple graph-
A simple graph, also called a strict graph is an un-weighted,
undirected graph containing no graph loops or multiple edges . A
simple graph may be either connected or disconnected.
https://dpmishrakidiary.blogspot.in/
25
https://dpmishrakidiary.blogspot.in/
26
Sub graphs-
A spanning subgraph is a subgraph that contains all the vertices of
the original graph. A spanning tree is a spanning subgraph that is
often of interest. A cycle in a graph that contains all the vertices of
the graph would be called a spanning cycle.
A subgraph S of a graph G is a graph whose set of vertices and set of
edges are all subsets of G. (Since every set is a subset of itself, every
graph is a subgraph of itself.)
All the edges and vertices of G might not be present in S; but if a
vertex is present in S, it has a corresponding vertex in G and any
edge that connects two vertices in S will also connect the
https://dpmishrakidiary.blogspot.in/
27
Operations on graph –
Graph Operations – Extracting sub graphs
In this section we will discuss about various types of sub graphs we
can extract from a given Graph.
Sub graph
Getting a sub graph out of a graph is an interesting operation. A sub
graph of a graph G(V,E) can be obtained by the following means:
Removing one or more vertices from the vertex set.
Removing one or more edges from the edge family.
Removing either vertices or edges from the graph.
Points worth noting
We can extract sub graphs for simple graphs, directed graphs, multi
edge graphs and all types of graphs.
The Null Graph is always a sub graph of all the graphs. There can be
many sub graphs for a graph.
https://dpmishrakidiary.blogspot.in/
28
Neighbourhood graph
The neighbourhood graph of a graph G(V,E) only makes sense when
we mention it with respect to a given vertex set. For e.g. if V =
{1,2,3,4,5} then we can find out the Neighbourhood graph of G(V,E)
for vertex set {1}.
Spanning Tree
A spanning tree of a connected graph G(V,E) is a sub graph that is
also a tree and connects all vertices in V. For a disconnected graph
the spanning tree would be the spanning tree of each component
respectively.
https://dpmishrakidiary.blogspot.in/
29
Walk–
For a graph G=(V(G),E(G)), a Walk is defined as a sequence of
alternating vertices and edges such as v0,e1,v1,e2,...,ek,vk where
each edge ei={vi−1,vi}. The Length of this walk is k.
For example, the graph below outlines a possibly walk (in blue). The
walk is denoted as abcdb. Note that walks can have repeated edges.
For example, if we had the walk abcdcbce, then that would be
perfectly fine even though some edges are repeated.
https://dpmishrakidiary.blogspot.in/
30
Dijkstra algorithm-
https://dpmishrakidiary.blogspot.in/
31
Unit-4
Eulerian & Hamiltonian Graph
Unicursal and Eulerian graph-
Euler Graphs –
A closed walk in a graph G containing all the edges of G is called an
Euler line in G. A graph containing an Euler line is called an Euler
graph. We know that a walk is always connected. Since the Euler
line (which is a walk) contains all the edges of the graph, an Euler
graph is connected except for any isolated vertices the graph may
contain. As isolated vertices do not contribute anything to the
understanding of an Euler graph, it is assumed now onwards that
Euler graphs do not have any isolated vertices and are thus
connected.
Example
Consider the graph shown in Figure Clearly, v1 e1 v2 e2 v3 e3
v4 e4 v5 e5 v3 v6 e7 v1 in (a) is an Euler line, whereas the graph
shown in (b) is non-Eulerian.
Unicursal Graphs
An open walk that includes (or traces) all edges of a graph without
retracing any edge is called a unicursal line or open Euler line. A
connected graph that has a unicursal line is called a unicursal
graph. Figure 3.6 shows a unicursal graph.
https://dpmishrakidiary.blogspot.in/
32
Fleury’s Algorithm-
Fleury's algorithm shows you how to find an Euler path or circuit. It
begins with giving the requirement for the graph. The graph must
have either 0 or 2 odd vertices. An odd vertex is one where the
number of edges connecting the vertex to other vertices is odd.
If we have 2 odd vertices, then we will have an Euler path. If we
have 0 odd vertices, then we will have an Euler circuit. If we have 2
odd vertices, then we start at one of those two vertices. If we have
0 odd vertices, then we can start anywhere.
https://dpmishrakidiary.blogspot.in/
33
Hamiltonian Graph-
A Hamiltonian graph, also called a Hamilton graph, is a graph
possessing a Hamiltonian cycle. A graph that is not Hamiltonian is
said to be non-hamiltonian.
A Hamiltonian graph on n nodes has graph circumference n.
While it would be easy to make a general definition of
"Hamiltonian" that goes either way as far as the singleton graph
K_1 is concerned, defining "Hamiltonian" to mean "has a
Hamiltonian cycle" and taking "Hamiltonian cycles" to be a subset
of "cycles" in general would lead to the convention that the
singleton graph is non-hamiltonian.
https://dpmishrakidiary.blogspot.in/
34
https://dpmishrakidiary.blogspot.in/
35
For example, consider the graph shown in figure. A TSP tour in the
graph is 1-2-4-3-1.
The cost of the tour is 10+25+30+15 which is 80.
https://dpmishrakidiary.blogspot.in/
36
Unit-5
Trees & Spanning Trees
Tree-
Tree is non-linear type of data structure.
Tree is a discrete structure that represents hierarchical
relationships between individual elements or nodes. A tree in
which a parent has no more than two children is called a binary
tree.
Properties of Tree-
There are various properties of tree such as –
https://dpmishrakidiary.blogspot.in/
37
https://dpmishrakidiary.blogspot.in/
38
Distance-
Distance between two nodes is the minimum number of edges to
be traversed to reach one node from other.
Diameter of a Tree-
The diameter of a tree (sometimes called the width) is the
number of nodes on the longest path between two end nodes.
The diagram below shows two trees each with diameter nine,
the leaves that form the ends of a longest path are shaded (note
https://dpmishrakidiary.blogspot.in/
39
that there is more than one path in each tree of length nine, but
no path longer than nine nodes).
Spanning Tree-
A spanning tree of a connected undirected graph G is a tree that
minimally includes all of the vertices of G. A graph may have
many spanning trees.
https://dpmishrakidiary.blogspot.in/
40
Fundamenta circuit –
A circuit formed by adding a chord to spanning tree is called a
fundamental circuit.
https://dpmishrakidiary.blogspot.in/
41
Kruskal's Algorithm-
Kruskal's algorithm is a minimum-spanning-tree
algorithm which finds an edge of the least possible weight that
connects any two trees in the forest. It is a greedy algorithm in
graph theory as it finds a minimum spanning tree for a
https://dpmishrakidiary.blogspot.in/
42
Remove all loops and parallel edges from the given graph.
In case of parallel edges, keep the one which has the least cost associated
and remove all others.
https://dpmishrakidiary.blogspot.in/
43
The next step is to create a set of edges and weight, and arrange them in
an ascending order of weightage (cost).
Now we start adding edges to the graph beginning from the one which has
the least weight. Throughout, we shall keep checking that the spanning
properties remain intact. In case, by adding one edge, the spanning tree
property does not hold then we shall consider not to include the edge in the
graph.
The least cost is 2 and edges involved are B,D and D,T. We add them.
Adding them does not violate spanning tree properties, so we continue to
our next edge selection.
Next cost is 3, and associated edges are A,C and C,D. We add them again –
Next cost in the table is 4, and we observe that adding it will create a circuit
in the graph. –
https://dpmishrakidiary.blogspot.in/
44
We ignore it. In the process we shall ignore/avoid all edges that create a
circuit.
We observe that edges with cost 5 and 6 also create circuits. We ignore
them and move on.
Now we are left with only one node to be added. Between the two least cost
edges available 7 and 8, we shall add the edge with cost 7.
https://dpmishrakidiary.blogspot.in/
45
By adding edge S,A we have included all the nodes of the graph and we now
have minimum cost spanning tree.
Remove all loops and parallel edges from the given graph. In case of parallel
edges, keep the one which has the least cost associated and remove all
others.
https://dpmishrakidiary.blogspot.in/
46
Now, the tree S-7-A is treated as one node and we check for all edges going
out from it. We select the one which has the lowest cost and include it in the
tree.
https://dpmishrakidiary.blogspot.in/
47
After this step, S-7-A-3-C tree is formed. Now we'll again treat it as a node
and will check all the edges again. However, we will choose only the least
cost edge. In this case, C-3-D is the new edge, which is less than other
edges' cost 8, 6, 4, etc.
After adding node D to the spanning tree, we now have two edges going out
of it having the same cost, i.e. D-2-T and D-2-B. Thus, we can add either
one. But the next step will again yield edge 2 as the least cost. Hence, we
are showing a spanning tree with both edges included.
We may find that the output spanning tree of the same graph using two
different algorithms is same.
https://dpmishrakidiary.blogspot.in/
48
Example 1
In the following graph, it is possible to travel from one vertex to
any other vertex. For example, one can traverse from vertex ‘a’ to
vertex ‘e’ using the path ‘a-b-e’.
Example 2
In the following example, traversing from vertex ‘a’ to vertex ‘f’ is
not possible because there is no path between them directly or
indirectly. Hence it is a disconnected graph.
Seperability -
A graph G is said to be separable if it is either disconnected or
can be disconnected by removing one vertex, called articulation.
A graph that is not separable is said to be biconnected (or
nonseparable).
https://dpmishrakidiary.blogspot.in/
49
Network Flow
In graph theory, a flow network (also known as a
transportation network) is a directed graph where each edge has
a capacity and each edge receives a flow. The amount of flow on
an edge cannot exceed the capacity of the edge.
Supply = sourse
Use for commodity = sink
Cuts in a Network-
In a flow network, an s–t cut is a cut that requires the source and
the sink to be in different subsets, and its cut-set only consists of
edges going from the source's side to the sink's side.
The capacity of an s–t cut is defined as the sum of capacity of
each edge in the cut-set.
If s and t are specified vertices of the graph G, then an s–t cut is a
cut in which s belongs to the set S and t belongs to the set T.
https://dpmishrakidiary.blogspot.in/
50
Augmenting path-
Augmenting path is a directed path from a source node s to a
sink node t in the residual network. The residual capacity of an
augmenting path is the minimum residual capacity of any arc in
the path. Obviously, we can send additional flow from the source
to the sink along an augmenting path.
An augmenting path is a simple path - a path that does not
contain cycles - through the graph using only edges with
positive capacity from the source to the sink.
So the statement above is somehow obvious - if you can not find
a path from the source to the sink that only uses positive
capacity edges, then the flow can not be increased.
https://dpmishrakidiary.blogspot.in/
51
https://dpmishrakidiary.blogspot.in/
52
https://dpmishrakidiary.blogspot.in/
53
The following graph shows a set of vertices and edges. Each edge
shows two numbers: its current flow divided by its capacity-
Menger’s Theorems –
In the mathematical discipline of graph theory and related areas,
Menger's theorem is a characterization of the connectivity in
finite undirected graphs in terms of the maximum number of
disjoint paths that can be found between any pair of vertices.
Let G be a directed graph. The minimum number of edges whose
removal disconnects s from t (the minimum-cut between s and
t) is equal to the maximum number of edge-disjoint paths in G
between s and t.
Proof : Max flow-min cut theorem and integrality of flow.
https://dpmishrakidiary.blogspot.in/