Discrete-Mathematics Step Material
Discrete-Mathematics Step Material
DEPARTMENT OF CSE(AI&ML)
Academic Year:2021-2022
1
INSTITUTE VISION AND MISSION
VISION
MISSION
VISION
To produce globally competent and industry ready graduates in Computer Science &
Engineering by imparting quality education with a know-how of cutting edge technology
and holistic personality
MISSION
2
PART –A
UNIT WISE SHORT QUESTION
AND ANSWERS
UNIT-I
1 .Define the Proposition logic with example? [2M]
Ans:
A proposition is a collection of declarative statements that has either a truth
value "true” or a truth value "false". A propositional consists of propositional
variables and connectives. We denote the propositional variables by capital
letters (A, B, C etc). The connectives connect the propositional variables.
Some examples of Propositions are given below:
"Man is Mortal", it returns truth value “TRUE” as
T.
"12 + 9 = 3 − 2", it returns truth value “FALSE” as F.
The following is not a Proposition
"A is less than 2".
It is because unless we give a specific value of A, we cannot say whether the statement is true
orfalse.
ANS:
¬(P → Q) ⇔ ¬(¬P ∨ Q) ⇔ P 𝖠
The negation of P → Q is given by ¬(P → Q).
¬(P → Q) ⇔ ¬(¬P ∨ Q) ⇔ P 𝖠
The negation of P → Q is given by ¬(P → Q).
Existential Quantifier:
Existential quantifier states that the statements within its scope are true for
some values of the specific variable. It is denoted by the symbol ∃.∃x P(x)is
read as for some values of x, P(x) is true.
(3) (C ∨ D) → (A 𝖠 ¬B)
{2} Rule P
(4) (A 𝖠 ¬B) → (R ∨ S)
{1, 2} Rule T, (1), (2), and I13
(5) (C ∨ D) → (R ∨ S)
{4} Rule P
(6) C ∨ D
{1, 2, 4} Rule T, (3), (4), and I13
(7) R ∨ S
{6} Rule P
{1, 2, 4, 6} Rule T, (5), (6), and I11
Solution:
(1) P ∨ Q
Rule T, (1) P → Q ⇔ ¬P ∨ Q
{1} Rule P
{1} (2) ¬P → Q
{3} (3) Q → S Rule P
Rule T, (4), P → Q ⇔ ¬Q →
{1, 3} (4) ¬P → S Rule T, (2), (3), and I13
{1, 3} (5) ¬S → P
¬P
{6} (6) P → R Rule P
{1, 3, 6} (7) ¬S → R Rule T, (5), (6), and I13
{1, 3, 6} (8) S∨ R Rule T, (7) and P → Q ⇔ ¬P ∨Q
P ∨ Q, Q → R, P → M, and ¬M.
Solution:
6
R 𝖠 (P ∨ Q)
{1, 2, 4, 6} (7) R Rule T, (5), (6), and I11
{1, 2, 4, 6} (8) Rule T, (4), (7) and I9
7
UNIT-II
8
UNIT-III
or a theorem is true for every natural number. The technique involves two steps to prove a statement,
as stated below −
Step 1(Base step) − It proves that a statement is true for the initial value.
Step 2(Inductive step) − It proves that if the statement is true for the nth iteration (or number n), then
3. What is Recursion
A. The process in which a function calls itself directly or indirectly is called recursion and
the corresponding function is called as recursive function. Using recursive algorithm,
certain problems can be solved quite easily. Examples of such problems are
Towers of Hanoi (TOH), Inorder/Preorder/Postorder Tree Traversals, DFS of Graph, etc.
9
5. What is Well Ordering
A. The validity of both the principle of mathematical induction and strong induction
follows from a fundamental axiom of the set of integers, the well-ordering property. The well-
ordering property states that every nonempty set of nonnegative integers has a least element.
10
UNIT-IV
9. Define Variance
A. The variance of a random variable helps us characterize how widely a random variable
is distributed. In particular, it provides a measure of how widely X is distributed about
its expected value.
A.
17. Define Generating Function
A. generating function of a sequence: the formal series that has the nth term of the sequence as
the coefficient of xn
1. Define Graph
A. A graph G = (V , E) consists of V , a nonempty set of vertices (or nodes) and E, a set of
edges. Each edge has either one or two vertices associated with it, called its endpoints. An edge is
said to connect its endpoints.
3. Define Pseudograph
A. Graphs that may include loops, and possibly multiple edges connecting the same pair of vertices or a
vertex to itself, are sometimes called pseudographs.
4. What is a Digraph
A. A directed graph (or digraph) (V , E) consists of a nonempty set of vertices V and a set of directed edges
(or arcs) E. Each directed edge is associated with an ordered pair of vertices. The directed edge associated
with the ordered pair (u, v) is said to start at u and end at v.
13. Define terms Euler Circuit , Euler path, Hamilton path , Hamilton circuit
A. An Euler circuit in a graph G is a simple circuit containing every edge of G.
An Euler path in G is a simple path containing every edge of G.
Hamilton path: a path in a graph that passes through each vertex exactly once
Hamilton circuit: a circuit in a graph that passes through each vertex exactly once
14. What is traveling salesperson problem
A. The traveling salesperson problem asks for the circuit of minimum total weight in a weighted, complete,
undirected graph that visits each vertex exactly once and returns to its starting point.
56
PART –B
UNIT WISE ESSAY QUESTION
AND ANSWERS UNIT-I
A ¬A
True False
False True
A B AB
A B AB
T T T
T F T
F T T
F F F
Implication / if-then (→) − An implication A→B is False if A is true and B is false. The
rest cases are true.
A B A→B
A B A B
ANS:
Equivalence Formulas:
1. Idempotent laws:
(a) P ∨ P ⇔ P (b) P 𝖠 P ⇔ P
2. Associative laws:
(a) (P ∨ Q) ∨ R ⇔ P ∨ (Q ∨ R) (b) (P 𝖠 Q) 𝖠 R ⇔ P 𝖠 (Q 𝖠 R)
3. Commutative laws:
(a) P ∨ Q ⇔ Q ∨ P (b) P 𝖠 Q ⇔ Q 𝖠 P
4. Distributive laws:
P ∨ (Q 𝖠 R) ⇔ (P ∨ Q) 𝖠 (P ∨ R) P 𝖠 (Q ∨ R) ⇔ (P 𝖠 Q) ∨ (P 𝖠 R)
5. Identity laws:
(a) (i) P ∨ F ⇔ P (ii) P ∨ T ⇔ T
(b) (i) P 𝖠 T ⇔ P (ii) P 𝖠 F ⇔ F
6. Component laws:
(a) P ∨ (P 𝖠 Q) ⇔ P (b) P 𝖠 (P ∨ Q) ⇔ P
8. Demorgan‘s laws:
59
¬P ∨
∨Q)
P Q P→Q ¬P (P → Q) (¬P
Q
T T T F T T
T F F F F T
F T T T T T
F F T T T T
Solution: P→ (Q → P ) ⇔ ¬P ∨ (Q → P )
- ¬P ∨ (¬Q ∨ P )
- (¬P ∨ P ) ∨ ¬Q
- T ∨ ¬Q
- T
and
¬P → (P → Q) ⇔ ¬(¬P ) ∨ (P → Q)
- P ∨ (¬P ∨ Q) ⇔ 60
(P ∨ ¬P ) ∨ Q ⇔ T
∨Q
- T
So, P → (Q → P ) ⇔ ¬P → (P → Q).
6. Show ((P ∨ Q) 𝖠 ¬(¬P 𝖠 (¬Q ∨ ¬R))) ∨ (¬P 𝖠 ¬Q) ∨ (¬P 𝖠 ¬R) is tautology.
¬P 𝖠 ¬Q ⇔ ¬(P ∨ Q)
Solution: By De Morgan‘s laws, we have
¬P ∨ ¬R ⇔ ¬(P 𝖠 R)
⇔ ¬((P ∨ Q) 𝖠 (P ∨ R))
∨(¬P 𝖠 ¬R)
61
7. Show that (P 𝖠 Q) → (P ∨ Q) is a tautology.
Solution: (P 𝖠 Q) → (P ∨ Q) ⇔ ¬(P 𝖠 Q) ∨ (P ∨ Q) [∵ P → Q ⇔ ¬P ∨ Q]
- (¬P ∨ ¬Q) ∨ (P ∨ Q) [by De Morgan‘s laws]
- (¬P ∨ P ) ∨ (¬Q ∨ Q) [by Associative laws and
- T
Hence, the result.
(p → q) → r ⇔ (¬p ∨ q) → r
Method I: Consider
- ¬(¬p ∨ q) ∨ r ⇔
(p 𝖠 ¬q) ∨ r
- (p 𝖠 r) ∨ (¬q 𝖠 r)
and
p → (q → r) ⇔ p → (¬q ∨ r)
- ¬p ∨ (¬q ∨ r) ⇔
¬p ∨ ¬q ∨ r.
(i). (P ∨ Q) 𝖠 R
formulas:
(ii). (P 𝖠 Q) ∨ T
(iii). (P 𝖠 Q) ∨ (P ∨ ¬(Q 𝖠 ¬S))
ANS: Two formulas A and A∗ are said to be duals of each other if either one can be obtained
from the other by replacing 𝖠 by ∨ and ∨ by 𝖠.
If the formula A contains the special variable T or F , then A∗, its dual is obtained by replacing
T by F and F by T in addition to the above mentioned interchanges.
P Q ¬P ¬Q P→Q ¬Q → ¬P (P → Q) → (¬Q → ¬P )
T T F F T T T
T F F T F F T
F T T F T T T
F F T T T T T
Since all the entries in the last column are true, (P → Q) → (¬Q → ¬P ) is a tautology.
Hence (P → Q) ⇒ (¬Q → ¬P ).
In order to show any of the given implications, it is sufficient to show that an assignment of the truth
value T to the antecedent of the corresponding conditional leads to the truth value T for the
consequent. This procedure guarantees that the conditional becomes tautology, thereby proving the
implication.
¬Q 𝖠 (P → Q) ⇒ ¬P .
Therefore the consequent ¬P must have the truth value T.
Another method to show A ⇒ B is to assume that the consequent B has the truth value F and then
show that this assumption leads to A having the truth value F . Then A → B must have the truth
value T .
P↑Q⇔
If P and Q are two formulas then
P ↑ P ⇔ ¬(P 𝖠 P ) ⇔ ¬P ∨ ¬P ⇔ ¬P .
equivalence:
(P ↑ Q) ↑ (P ↑ Q) ⇔ ¬(P ↑ Q) ⇔ ¬(¬(P
𝖠 Q)) ⇔ P 𝖠 Q. (P ↑ P ) ↑ (Q ↑ Q) ⇔
¬P ↑ ¬Q ⇔ ¬(¬P 𝖠 ¬Q) ⇔ P ∨
Q.
(P ↑ Q) ⇔ ¬(P 𝖠 Q)
NAND is Commutative: Let P and Q be any two statement formulas.
- ¬(Q 𝖠 P ) ⇔
(Q ↑ P )
∴ NAND is commutative.
𝖠 R)))
Consider
⇔ ¬P
∨(Q 𝖠 R)) (P ↑ Q) ↑ R
⇔ ¬(P 𝖠 Q) ↑ R
- ¬(¬(P 𝖠 Q) 𝖠 R) ⇔
(P 𝖠 Q) ∨ ¬R
Therefore the connective ↑ is not associative.
NOR: The word NOR is a combination of ‘NOT‘ and ‘OR‘ where ‘NOT‘ stands for negation and
‗OR‘ for the disjunction. It is denoted by the symbol ↓.
P↓Q⇔
If P and Q are two formulas then
P ↓ P ⇔ ¬(P ∨ P ) ⇔ ¬P 𝖠 ¬P ⇔ ¬P .
equivalence:
(P ↓ Q) ↓ (P ↓ Q) ⇔ ¬(P ↓ Q) ⇔ ¬(¬(P
∨ Q)) ⇔ P ∨ Q. (P ↓ P ) ↓ (Q ↓ Q) ⇔
¬P ↓ ¬Q ⇔ ¬(¬P ∨ ¬Q) ⇔ P 𝖠 Q.
(P ↓ Q) ⇔ ¬(P ∨ Q)
NOR is Commutative: Let P and Q be any two statement formulas.
65
- ¬(Q ∨ P ) ⇔
(Q ↓ P )
∴ NOR is commutative.
P↓ (Q ↓ R) ⇔ ¬(P ∨ (Q ↓ R))
NOR is not Associative: Let P , Q and R be any three statement formulas. Consider
- ¬(P ∨ (¬(Q ∨ R)))
⇔ ¬P
𝖠 (Q ∨ R) (P ↓ Q) ↓ R
⇔ ¬(P ∨ Q) ↓ R
- ¬(¬(P ∨ Q) ∨ R) ⇔
(P ∨ Q) 𝖠 ¬R
Therefore the connective ↓ is not associative.
ANS
Implication / if-then (→)(→) is also called a conditional statement. It has two parts −
Hypothesis, p
Conclusion, q
As mentioned earlier, it is denoted as p→qp→q.
Example of Conditional Statement − “If you do your homework, you will not be punished.”
Here, "you do your homework" is the hypothesis, p, and "you will not be punished" is the
conclusion, q.
Inverse − An inverse of the conditional statement is the negation of both the hypothesis and
the conclusion.
If the statement is “If p, then q”, the inverse will be “If not p, then not q”.
Thus the inverse of p→qp→q is ¬p→¬q¬p→¬q.
Example − The inverse of “If you do your homework, you will not be punished” is
“If you do not do your homework, you will be punished.”
Converse − The converse of the conditional statement is computed by interchanging the
hypothesis and the conclusion.
If the statement is “If p, then q”, the converse will be “If q, then p”.
The converse of p→qp→q is q→pq→p.
Example − The converse of "If you do your homework, you will not be punished" is
"If you will not be punished, you do your homework”.
Contra-positive − The contra-positive of the conditional is computed by interchanging the
hypothesis and the conclusion of the inverse statement.
If the statement is “If p, then q”, the contra-positive will be “If not q, then not p”. 66
The contra-positive of p→qp→q is ¬q→¬p¬q→¬p.
Example − The Contra-positive of " If you do your homework, you will not be punished” is
"If you are punished, you did not do your homework”.
67
68
16. Symbolize the following statements:
(a).All men are mortal
(b).All the world loves alover
( c ). X is the father of mother of Y
(d)No cats has a tail
(e).Some people who trust others are rewarded
69
17. Explain two Methods to obtain PDNF of a given formula
T T T P𝖠 Q
T F F P𝖠
¬Q
¬P 𝖠 Q
F T T
F F T
¬P 𝖠¬Q
71
The PDNF of P → Q is (P 𝖠 Q) ∨ (¬P 𝖠 Q) ∨ (¬P 𝖠 ¬Q).
∴ P → Q ⇔ (P 𝖠 Q) ∨ (¬P 𝖠 Q) ∨ (¬P 𝖠 ¬Q).
Example: Obtain the PDNF for (P 𝖠 Q) ∨ (¬P 𝖠 R) ∨
(Q 𝖠 R). Solution:
P𝖠 ¬P 𝖠 Q𝖠 (P 𝖠 Q) ∨ (¬P 𝖠 R) ∨ (Q
𝖠 R)
P Q R Minterm
Q R R
P𝖠 Q𝖠 R
P 𝖠 Q 𝖠 ¬R
T T T T F T T
P 𝖠 ¬Q 𝖠 R
T T F T F F T
P 𝖠 ¬Q 𝖠 ¬R
T F T F F F F
¬P 𝖠 Q 𝖠 R
T F F F F F F
¬P 𝖠 Q 𝖠 ¬R
F T T F T T T
¬P 𝖠 ¬Q 𝖠 R
F T F F F F F
¬P 𝖠 ¬Q 𝖠
F F T F T F T
F F F F F F F
¬R
In order to obtain the principal disjunctive normal form of a given formula is con-
structed as follows:
¬P ∨ Q ⇔ (¬P 𝖠 T ) ∨ (Q 𝖠 T ) [∵ A 𝖠 T ⇔ A]
Solution:
(a)
- (¬P 𝖠 (Q ∨ ¬Q)) ∨ (Q 𝖠 (P ∨ ¬P )) [∵ P ∨ ¬P ⇔ T ] 71
- (¬P 𝖠 Q) ∨ (¬P 𝖠 ¬Q) ∨ (Q 𝖠 P ) ∨ (Q 𝖠 ¬P )
[∵ P 𝖠 (Q ∨ R) ⇔ (P 𝖠 Q) ∨ (P 𝖠 R)
⇔ (¬P 𝖠 Q) ∨ (¬P 𝖠 ¬Q) ∨ (P 𝖠 Q) [∵ P ∨ P ⇔ P ]
(b) (P 𝖠 Q) ∨ (¬P 𝖠 R) ∨ (Q 𝖠 R)
- (P 𝖠 Q 𝖠 T ) ∨ (¬P 𝖠 R 𝖠 T ) ∨ (Q 𝖠 R 𝖠 T )
- (P 𝖠 Q 𝖠 (R ∨ ¬R)) ∨ (¬P 𝖠 R 𝖠 (Q ∨ ¬Q)) ∨ (Q 𝖠 R 𝖠 (P ∨ ¬P ))
- (P 𝖠 Q 𝖠 R) ∨ (P 𝖠 Q 𝖠 ¬R) ∨ (¬P 𝖠 R 𝖠 Q)(¬P 𝖠 R 𝖠 ¬Q)
∨ (Q 𝖠 R 𝖠 P ) ∨ (Q 𝖠 R 𝖠 ¬P )
- (P 𝖠 Q 𝖠 R) ∨ (P 𝖠 Q 𝖠 ¬R) ∨ (¬P 𝖠 Q 𝖠 R) ∨ (¬P 𝖠 ¬Q 𝖠 R)
P ∨ (P 𝖠 Q) ⇔ P
P ∨ (¬P 𝖠 Q) ⇔ P ∨ Q
Solution: We write the principal disjunctive normal form of each formula and com-pare these
(a) P ∨ (P 𝖠 Q) ⇔ (P 𝖠 T ) ∨ (P 𝖠 Q) [∵ P 𝖠 Q ⇔ P ]
normal forms.
- (P 𝖠 (Q ∨ ¬Q)) ∨ (P 𝖠 Q) [∵ P ∨ ¬P ⇔ T ]
- ((P 𝖠 Q) ∨ (P 𝖠 ¬Q)) ∨ (P 𝖠 Q) [by distributive laws]
- (P 𝖠 Q) ∨ (P 𝖠 ¬Q) [∵ P ∨ P
⇔ P ] which is the required
⇔ P𝖠 T
PDNF.
Now,
- P 𝖠 (Q ∨ ¬Q)
⇔ (P 𝖠 Q) ∨ (P
𝖠 ¬Q) which is the required PDNF.
Hence, P ∨ (P 𝖠 Q) ⇔ P .
P ∨ Q ⇔ (P 𝖠 T ) ∨ (Q 𝖠 T )
Now,
- (P 𝖠 (Q ∨ ¬Q)) ∨ (Q 𝖠 (P ∨ ¬P ))
- (P 𝖠 Q) ∨ (P 𝖠 ¬Q) ∨ (Q 𝖠 P ) ∨ (Q 𝖠 ¬P )
⇔ (P 𝖠 Q) ∨ (P 𝖠 ¬Q) ∨ (¬P 𝖠 Q) 72
which is the required PDNF.
Hence, P ∨ (¬P 𝖠 Q) ⇔ P ∨ Q.
19 . Obtain the principal disjunctive normal form of
→ ((P → Q) 𝖠 ¬(¬Q ∨ ¬P )) ⇔ ¬P
∨ ((¬P ∨ Q) 𝖠 (Q 𝖠 P ))
- ¬P ∨ ((¬P 𝖠 Q 𝖠 P ) ∨ (Q 𝖠 Q 𝖠 P )) ⇔
¬P ∨ F ∨ (P 𝖠 Q)
- ¬P ∨ (P 𝖠 Q)
- (¬P 𝖠 T ) ∨ (P 𝖠 Q)
- (¬P 𝖠 (Q ∨ ¬Q)) ∨ (P 𝖠 Q)
The dual of a minterm is called a Maxterm. For a given number of variables, the maxterm consists
of disjunctions in which each variable or its negation, but not both, appears only once. Each of the
maxterm has the truth value F for exactly one com-bination of the truth values of the variables. Now
we define the principal conjunctive normal form.
For a given formula, an equivalent formula consisting of conjunctions of the max-terms only is
known as its principle conjunctive normal form. This normal form is also called the product-of-sums
canonical form.The method for obtaining the PCNF for a given formula is similar to the one
described previously for PDNF.
(¬P → R) 𝖠 (Q ↔ P )
(¬P→R)𝖠(Q↔P) Solution:
74
PCNF of ¬S : (P ∨ Q ∨ ¬R) 𝖠 (P ∨ ¬Q ∨ R) 𝖠 (P ∨ ¬Q ∨ ¬R) 𝖠 (¬P ∨ Q ∨
Now PCNF of ¬S is the conjunction of remaining maxterms, so
R)
𝖠(¬P ∨ Q ∨ ¬R) 𝖠 (¬P ∨ ¬Q ∨ R) 𝖠(¬P ∨
¬Q ∨ ¬R) Hence the PDNF of S is
¬(PCNF of ¬S) : (¬P 𝖠 ¬Q 𝖠 R) ∨ (¬P 𝖠 Q 𝖠 ¬R) ∨ (¬P 𝖠 Q 𝖠 R) ∨ (P 𝖠
¬Q 𝖠 ¬R)
∨ ( P 𝖠 ¬Q 𝖠 R) ∨ (P 𝖠 Q 𝖠 ¬R) ∨ (P 𝖠 Q 𝖠 R)
22. Determine whether the conclusion C follows logically from the premises
H1 and H2.
(a) H1 : P → Q H2 : P C : Q
H2 : ¬(P 𝖠 Q) C : ¬P
(b) H1 : P → Q H2 : ¬P C : Q
(c) H1 : P → Q
(d) H1 : ¬P H2 : P Q C : ¬(P 𝖠 Q)
(e) H1 : P → Q H2 : Q C : P
Solution: We first construct the appropriate truth table, as shown in table.
P Q P→Q ¬P ¬(P 𝖠 P Q
Q)
T T T F F T
T F F F T F
F T T T T F
F F T T T T
75
23. Define Rules of Inference with example
I1 : P 𝖠Q ⇒ P
Implication Formulas
I2 : P 𝖠 Q ⇒
(simplification)
Q I3 : P ⇒ P
∨ Q I4 : Q ⇒
P∨ Q
I5 : ¬P ⇒ P → Q
I6 : Q ⇒ P → Q
I7 : ¬(P → Q)
⇒P
I8 : ¬(P → Q) ⇒ ¬Q
I9 : P, Q ⇒ P 𝖠 Q
¬P, P ∨ Q ⇒ Q
I :
10 (disjunctive syllogism)
: P, P → Q⇒ Q
I
11 (modus ponens)
: ¬Q, P → Q ⇒ ¬P
I
12 (modus tollens)
: P → Q, Q → R ⇒ P→ R
I
13 (hypothetical syllogism)
: P ∨ Q, P → R, Q → R ⇒ R
I
14 (dilemma)
P → (Q → S), ¬R ∨ P , and Q.
Example: Show that R → S can be derived from the premises
77
24. Show that P → S can be derived from the premises ¬P ∨ Q, ¬Q ∨ R, and R → S.
Solution: We include P as an additional premise and derive S.
{1} (1) ¬P ∨ Q Rule P
{2} (2) P Rule P (assumed premise)
(4) ¬Q ∨ R
{1, 2} (3) Q Rule T, (1), (2), and I10
{4} Rule P
{1, 2, 4} (5) R Rule T, (3), (4), and I10
{6} (6) R → S Rule P
{1, 2, 4, 6} (7) S Rule T, (5), (6), and I11
{1, 2, 4, 6} (8) P → S Rule CP
25. If there was a ball game, then traveling was difficult. If they arrived on time, then
traveling was not difficult. They arrived on time. Therefore, there was no ball game‘. Show
that these statements constitute a valid argument.
78
26. By using the method of derivation, show that following statements con-stitute a valid
argument: ‖If A works hard, then either B or C will enjoy. If B enjoys, then A will not work
hard. If D enjoys, then C will not. Therefore, if A works hard, D will not enjoy.
27. Determine the validity of the following arguments using propositional logic:
‖Smoking is healthy. If smoking is healthy, then cigarettes are prescribed by
physi- cians. Therefore, cigarettes are prescribed by physicians‖.
The method of using the rule of conditional proof and the notion of an inconsistent
set of premises is called the indirect method of proof or proof by contradiction.
In order to show that a conclusion C follows logically from the premises H1, H2, · · · ,
Hm, we assume that C is false and consider ¬C as an additional premise. If the new set of
premises is inconsistent, so that they imply a contradiction. Therefore, the assump-tion that ¬C is
true does not hold.
Hence, C is true whenever H1, H2, · · · , Hm are true. Thus, C follows logically from
the premises H1, H2, · · · , Hm.
(1) ¬¬(P 𝖠 Q)
(2) P 𝖠 Q
{1} Rule P (assumed)
⇔
{1} Rule T, (1), and ¬¬P
P
{1} (3) P Rule T, (2), and I1
{4} (4) ¬P 𝖠 ¬Q Rule P
{4} (5) ¬P Rule T, (4), and I1
{1, 4} (6) P 𝖠 ¬P Rule T, (3), (5), and I9
(6) P ∨ R
{1, 2, 4} (5) ¬P Rule T, (4), and I12
{6} Rule P
{1, 2, 4, 6} (7) R Rule T, (5), (6) and I10
{1, 2, 4, 6} (8) R 𝖠¬R Rule T, (4), (7), and I9
Hence, our assumption is wrong.
30. Show that the following set of premises are inconsistent, using proof by contradiction
P → (Q ∨ R), Q → ¬P, S → ¬R, P ⇒ P → ¬S.
Solution: We include ¬(P → ¬S) as an additional premise. Then we show that this leads to a
(3) Q ∨ R
(4) P 𝖠 S
{1, 2} Rule T, (1), (2), and Modus Ponens
{4} Rule P (assumed)
{1, 2, 4} (5) S Rule T, (4), and P 𝖠 Q ⇒ P
{6} (6) S → ¬R Rule P
{1, 2, 4, 6} (7) ¬R Rule T, (5), (6) and Modus Ponens
{1, 2, 4, 6} (8) Q Rule T, (3), (7), and P 𝖠 Q, ¬Q ⇒ P
{9} (9) Q → ¬P Rule P
Rule T, (8), (9), and P 𝖠 Q, ¬Q ⇒P
(11) P 𝖠 ¬P Rule T, (2), (10), and P, Q ⇒ P 𝖠Q
{1, 2, 4, 6} (10) ¬P
80
36. Example: Show that (x)(P (x) ∨ Q(x)) ⇒ (x)P (x) ∨
(∃x)Q(x). Solution: We shall use the indirect method of proof
by assuming
¬((x)P (x)∨(∃x)Q(x)) as an additional premise.
(∃x)¬A(x)
{1}
(5) ¬(∃x)Q(x)
Rule T, (5), and ¬(∃x)A(x) ⇔
{1} Rule T, (2), and I2
{1} (6) (x)¬Q(x)
(x)¬A(x)
{1} (7) ¬P (y) Rule ES, (5), (6) and I12
𝖠 ¬Q
{1}
81
82
UNIT-II
1. Define a set and types of sets
ANSWER
Set definition : A set is collection of well defined objects
Each of the objects in the set is called a member of an element of the set.
Books, cities, numbers, animals, flowers, etc.
Elements of a set are usually denoted by lower-case letters.
Proper Subset:
A set A is called proper subset of the set B. If (i) A is subset of B and (ii) B is not a subset A i.e., A is said to be
a proper subset of B if every element of A belongs to the set B, but there is atleast one element of B, which is
not in A. If A is a proper subset of B, then we denote it by A B.
Null set: The set with no elements is called an empty set or null set. A Null set is designated by the symbol
. The null set is a subset of every set, i.e., If A is any set then A.
Universal set:
In many discussions all the sets are considered to be subsets of one particular set. This set is called the
universal set for that discussion. The Universal set is often designated by the script letter . Universal set in
not unique and it may change from one discussion to another.
Power set:
The set of all subsets of a set A is called the power set of A.
The power set of A is denoted by P (A). If A has n elements in it, then P (A) has 2n elements:
Disjoint sets:
Two sets are said to be disjoint if they have no element in common.
Inclusion-Exclusion Principle:
The inclusion–exclusion principle is a counting technique which generalizes the familiar method of obtaining
the number of elements in the unionof two finite sets; symbolically expressed as
|A 𝖴 B| = |A| + |B| − |A ∩ B|.
Fig.Inclusion–exclusion illustrated by a
Venn diagram for three sets
This formula can be verified by counting how many times each region in the Venn diagram figure is included
in the right-hand side of the formula. In this case, when removing the contributions of over-counted elements,
the number of elements in the mutual intersection of the three sets has been subtracted too often, so must be
added back in to get the correct total.
In general, Let A1, · · · , Ap be finite subsets of a set U. Then,
84
3. a). How many natural numbers n ≤ 1000 are not divisible by any of
2, 3? Ans: Let A2 = {n ∈ N | n ≤ 1000, 2|n} and A3 = {n ∈ N | n ≤
Then, |A2 𝖴 A3| = |A2| + |A3| − |A2 ∩ A3| = 500 + 333 − 166 = 667.
1000, 3|n}.
A binary relation between two sets A and B is a rule R which decides, for any elements, whether a
is in relation R to b. If so, then we write a R b. If a is not in relation R to b, then a /R b.
We can also consider a R b as the ordered pair (a, b) in which case we can define a binary relation
from A to B as a subset of A X B. This subset is denoted by the relation R.
The definition of relation permits any set of ordered pairs to define a relation.
For example
For the relation S = {(1, 2), (3, a), (b, a)
,(b,joe)} D(S) = {1, 3, b, b} and
R(S) = {2, a, a, Joe}
Let X and Y be any two sets. A subset of the Cartesian product X * Y defines a relation, say
C. For any such relation C, we have D( C ) Í X and R( C) Í Y, and the relation C is said to from X to Y.
If Y = X, then C is said to be a relation form X to X. In such case, c is called a relation in X.
Thus any relation in X is a subset of X * X . The set X * X is called a universal relation in X,
while the empty set which is also a subset of X * X is called a void relation in X.
For example: Let L denote the relation ―less than or equal to< and D denote the relation ―divides< where x
D y means ― x divides y< . Both L and D are defined on the set {1, 2, 3, 4}
L Ç D = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)} = D
L
D == {(1,
{(1, 1),
1), (1,
(1, 2),
2), (1,
(1, 3),
3), (1,
(1, 4),
4), (2,
(2, 2),
2), (2,
(2, 3),
4), (2,
(3, 4),
3), (3,
(4, 3),
4)}(3, 4), (4,4)} 85
L Ç D = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)} = D
5. Define a relation between two sets A = {5, 6, 7} and B = {x, y}.
Solution: If A = {5, 6, 7} and B = {x, y}, then the subset R = {(5, x), (5, y),
(6, x), (6, y)} is a relation from A to B.
x or (x, x) R, ∀x ∈ X
Irreflexive relation if x
Antisymmetric relation if for every x and y in X, whenever xRy and yRx, then x = y.
(iii). If R3 = {(1, 1), (1, 2), (1, 3), (2, 2), (2, 1), (3, 1)} be a relation on A = {1, 2, 3},
then R3 is a symmetric relation.
(iv). If R4 = {(1, 2), (2, 2), (2, 3)} on A = {1, 2, 3} is an antisymmetric.
Example: Given S = {1, 2, ..., 10} and a relation R on S, where R = {(x, y)| x + y = 10}.
What are the properties of the relation R?
86
(iii). (1, 9) ∈ R and (9, 1) ∈ R
⇒ (1, 1)R
The relation R is not transitive. Hence, R is symmetric.
1, if (xi , y j ) R
r 0, if (xi , y j ) R
ij =
Example. Let A = {1, 2, 3, 4} and B = {b1, b2, b3}. Consider the relation R = {(1, b2), (1, b3),
(3, b2), (4, b1), (4, b3)}. Determine the matrix of the relation.
Solution: A = {1, 2, 3, 4}, B = {b1, b2, b3}.
Relation R = {(1, b2), (1, b3), (3, b2), (4, b1), (4, b3)}.
Matrix of the relation R is written as
0 1 1
0 0 0
That is MR =
0 0 1
1 0 1
Example: Let A = {1, 2, 3, 4}. Find the relation R on A determined by the matrix
1 0 1 0
0 0 1 0
MR =
1
0 0 0
1
1 1 0
Solution: The relation R = {(1, 1), (1, 3),
(2, 3), (3, 1), (4, 1), (4, 2), (4, 4)}.
87
8. What is Digraph. Explain with example
ANS Graph of a Relation: A relation can also be represented pictorially by drawing its graph.
Let R be a relation in a set X = {x1, x2, ..., xm}. The elements of X are represented
If (xi, xj ) ∈ R, then we connect the nodes xi and xj by means of an arc and put an arrow on
by points or circles called nodes. These nodes are called vertices.
Note: (i). If xiRxj and xj Rxi, then we draw two arcs between xi and xj with arrows pointing in
both directions.
(ii). If xiRxi, then we get an arc which starts from node xi and returns to node xi. This arc is
called a loop.
Example: Let X = {1, 2, 3, 4} and R={(x, y)| x > y}. Draw the graph of R and also give its matrix.
Solution: R = {(4, 1), (4, 3), (4, 2), (3, 1), (3, 2), (2, 1)}.
The graph of R and the matrix of R are
1 2
3 4
Graph of R
0 0 0 0
1 0 0 0
MR =
1 1 0 0
1 1 1 0
∴ xRx
⇒ R is reflexive.
(ii) For any x, y ∈ X, if xRy, then x − y is divisible by 3.
−(x − y) is divisible by 3. 88
y − x is divisible by 3.
yRx
Thus, the relationR is symmetric.
(iii). For any x, y, z ∈
X, let xRy and yRz.
(x − y) + (y − z) is divisible by 3
x − z is divisible by 3
xRz
Hence, the relation R is transitive.
Thus, the relation R is an equivalence relation.
Example: Let X = {1, 2, 3, 4} and R == {(1, 1), (1, 4), (4, 1), (4, 4), (2, 2), (2, 3), (3, 2), (3, 3)}.
Prove that R is an equivalence relation.
89
11. Define a Composition relation with example
ANS
Definition :Let R be a relation from X to Y and S be a relation from Y to Z.
Then the relation RoS is given by
R o S = {(x, z) / xÎX Ù z Î Z Ù y Î Y such that (x, y) Î R Ù (y, z) Î S)} is called the composite
relation of R and S.
The operation of obtaining R o S is called the composition of relations.
Example: Let R = {(1, 2), (3, 4), (2, 2)} and S = {(4, 2), (2, 5), (3, 1),(1,3)}
Then R o S = {(1, 5), (3, 2), (2, 5)} and S o R = {(4, 2), (3, 2), (1, 4)}
It is to be noted that R o S ≠ S o R. Also Ro(S o T) = (R o S) o T = R o S o T
Note: We write R o R as R2; R o R o R as R3 and so on.
Definition Let R be a relation from X to Y, a relation R from Y to X is called the
converse of R,
where the ordered pairs of Ř are obtained by interchanging the numbers in each of the
ordered pairs of R.
This means for x Î X and y Î Y, that x R y ó y Ř x.
Then the relation Ř is given by R = {(x, y) / (y, x) Î R} is called the converse of R
Example: Let R = {(1, 2),(3, 4),(2, 2)} Then Ř = {(2, 1),(4, 3),(2, 2)}
Note: If R is an equivalence relation, then Ř is also an equivalence relation.
Definition Let X be any finite set and R be a relation in X. Therelation R = R𝖴R 𝖴R 𝖴· · ·𝖴R in X.
+ 2 3 n
is called the transitive closure of R in X
Example: Let the relation R = {(1, 2), (2, 3), (3, 3)} on the set {1, 2, 3}.
What is the transitive closure of R?
Solution: Given that R = {(1, 2), (2, 3), (3, 3)}.
R =R𝖴 R 𝖴 R 𝖴 R 𝖴 ...
R = R ◦ R = {(1, 3), (2, 3), (3, 3)}
+ 2 3 4
90
= {(1, 2), (2, 3), (3, 3)} 𝖴 {(1, 3), (2, 3), (3, 3)} 𝖴 {(1, 3), (2, 3), (3, 3)} 𝖴 ...
={(1, 2), (1, 3), (2, 3), (3, 3)}.
+
Therefore R = {(1, 2), (1, 3), (2, 3), (3, 3)}.
+
Example: Let X = {1, 2, 3, 4} and R = {(1, 2), (2, 3), (3, 4)} be a relation on X. Find R .
Solution: Given R = {(1, 2), (2, 3), (3, 4)}
2
R = {(1, 3), (2, 4)}
3
R = {(1, 4)}
4
R = {(1, 4)}
+
R = {(1, 2), (2, 3), (3, 4), (1, 3), (2, 4), (1, 4)}.
Example: Let R = {(a, b), (b, c), (c, a)}.
Now R2 = R o R = {(a, c), (b, a), (c, b)}
R3 = R2 o R = {(a, a), (b, b), (c, c)}
R4 = R3 o R = {(a, b), (b, c), (c, a)} = R
R5= R3o R2 = R2 and so on.
Thus, R+ = R U R2 U R3 U R4 U…
= R U R2 U R3.
={(a, b),(b, c),(c, a),(a, c),(b, a),(c ,b),(a, b),(b, b),(c, c)}
12. Write a short notes on Partial Ordering and POSET explain with example
ANS. A binary relation R in a set P is called a partial order relation or a partial
ordering in
Example: Show that the relation ‖greater than or equal to‖ is a partial ordering on
the set of integers.
Solution: Let Z be the set of all integers and the relation R =′≥′
(i). Since a ≥ a for every integer a, the relation ′ ≥′ is reflexive.
⇒ a=b
∴ The relation ′ ≥′ is antisymmetric.
91
Let aRb and bRc ⇒ a ≥ b and b ≥ c
(iii). Let a, b and c be any three integers.
⇒ a≥c
∴ The relation ′ ≥′ is transitive.
Since the relation ′ ≥′ is reflexive, antisymmetric and transitive, ′ ≥′ is partial ordering on the
set of integers. Therefore, (Z, ≥) is a poset.
Example: Show that the inclusion ⊆ is a partial ordering on the set power set of a set S.
Solution: Since (i). A ⊆ A for all A ⊆ S, ⊆ is
reflexive. (ii). A ⊆ B and B ⊆ A ⇒ A = B, ⊆ is
antisymmetric.
(iii). A ⊆ B and B ⊆ C ⇒ A ⊆ C, ⊆ is transitive.
Thus, the relation ⊆ is a partial ordering on the power set of S.
Example: Show that the divisibility relation ′/′ is a partial ordering on the set
of positive
integers.
and b/c ⇒
/ is
antisymmetric. (iii). a/b
a/c, / is transitive.
+ +
It follows that / is a partial ordering on Z and (Z , /) is a poset.
93
13. Define Hasse diagram and how to construct the Hasse diagram with example
ANS;
A partial order ≤ on a set P can be represented by means of a diagram known as
Hasse diagram of (P, ≤). In such a diagram,
(ii). The circle for x ∈ P is drawn below the circle for y ∈ P if x < y, and a line is
(i). Each element is represented by a small circle or dot.
Note: For totally ordered set (P, ≤), the Hasse diagram consists of circles one below the other. The
poset is called a chain.
Example: Let P = {1, 2, 3, 4, 5} and ≤ be the relation ‖less than or equal to‖ then the Hasse diagram
is:
Example: Let X = {2, 3, 6, 12, 24, 36}, and the relation ≤ be such that x ≤ y if x divides y. Draw the
Hasse diagram of (X, ≤). Solution: The Hasse diagram is is shown below:
94
Example: Draw the Hasse diagram for the relation R on A = {1, 2, 3, 4, 5} whose relation matrix
given below:
1 0 1 1 1
0 1 1 1 1
0 0 1 1
M = 1
R
0 0 0 1 0
0 0 0 0 1
Solution:
R= {(1, 1), (1, 3), (1, 4), (1, 5), (2, 2), (2, 3), (2, 4), (2, 5), (3, 3), (3, 4), (3, 5), (4, 4), (5.5)}.
4 5
1 2
95
Example: A partial order R on the set A = {1, 2, 3, 4} is represented by the following digraph.
Draw the Hasse diagram for R.
Example: Let A be a finite set and ρ(A) be its power set. Let ⊆ be the inclusion relation on
the elements of ρ(A). Draw the Hasse diagram of ρ(A), ⊆) for
A = {a}
A = {a,
b}. Solution: (i). Let A =
{a}
Example: Draw the Hasse diagram for the partial ordering ⊆ on the power set P (S) where S =
{9a5, b, c}.
Solution: S = {a, b, c}.
P (S) = {ϕ, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}.
Hasse diagram for the partial ordered set is shown in fig:
Example: Draw the Hasse diagram representing the positive divisions of 36 (i.e., D36).
Solution: We have D36 = {1, 2, 3, 4, 6, 9, 12, 18, 36} if and only a divides b. The Hasse diagram
for R is shown in Fig.
In the Hasse diagram, there are two maximal elements and two minimal elements.
The elements 3, 5 are maximal and the elements 1 and 6 are minimal.
Example: Let A = {a, b, c, d, e} and let the partial
order on A in the natural way.
The element a is maximal.
The elements d and e are minimal.
Upper and Lower Bounds: Let (P, ≤) be a partially ordered set and let A ⊆ P . Any element x ∈ P96
is called an upper bound for A if for all a ∈ A, a ≤ x. Similarly, any element x ∈ P is called a
lower bound for A if for all a ∈ A, x ≤ a. Example: A = {1, 2, 3, ..., 6} be ordered as pictured in
figure.
Let (P, ≤) be a partial ordered set and let A ⊆ P . An element x ∈ P is a least upper bound or
Least Upper Bound and Greatest Lower Bound:
Similarly, the the greatest lower bound or in mum for A is an element x ∈ P such that x is a
supremum for A if x is an upper bound for A and x ≤ y where y is any upper bound for A.
Solution: The upper bounds of {b, d, g} are g and h. Since g < h, g is the least upper bound. The
lower bounds of {b, d, g} are a and b. Since a < b, b is the greatest lower bound.
Example: Let A = {a, b, c, d, e, f, g, h} denote a partially ordered set whose Hasse diagram is
shown in Fig:
Example: Consider the poset A = {1, 2, 3, 4, 5, 6, 7, 8} whose Hasse diagram is shown in Fig and
let B = {3, 4, 5}
Note: The definition of function requires that a relation must satisfies two additional
conditions in order to qualify as a function.
For every x ∈ X must be related to some y ∈ Y , i.e., the domain of f must be X and
These conditions are as follows:
Domain and Range of a Function: If f : X → Y is a function, then X is called the Domain of f and
2
f(−1) = (−1) + 1 = 2
f(0) = 0 + 1 = 1
f(1) = 1 + 1 = 2
f(2) = 4 + 1 = 5
98
15. Write types of functions with examples
x1 ≠ x2 ⇒ f(x1) = (fx2)or
mapped into distinct elements of Y , i.e., f is one-to-one if
is because both 3 and -3 have 9 as their image, which is against the definition of a one-to-one
function.
i.e., {f(x) : x ∈ X} = Y .
If f : X → Y is onto, then each element of Y is f-image of atleast one element of X.
99
Bijection or One-to-One, Onto: A mapping f : X → Y is called one-to-one, onto or
bijective if it is both one-to-one and onto. Such a mapping is also called a
one-to-one correspondence between X and Y .
⇒ 2x + 1 = 2y + 1
Let x and y be any two elements in R such that f(x) = f(y)
⇒ x=y
Thus, f(x) = f(y) ⇒ x = y
This implies that f is one-to-one.
⇒ f(x) = y
Let y be any element in the codomain R
⇒ 2x + 1 = y
⇒ x = (y-1)/2
Clearly, x = (y-1)/2∈ R
Thus, every element in the codomain has pre-image in the domain.
This implies that f is onto
Hence, f is a bijective map.
for all x ∈ X. Then, f is called the identity function or identity transformation on X. It can be
Identity function: Let X be any set and f be a function such that f : X → X is defined by f(x) = x
denoted by I or Ix.
Note: The identity function is both one-to-one and onto.
⇒ x=y
Let Ix(x) = Ix(y)
⇒ Ix is one-to-one
Ix is onto since x = Ix(x) for all x. 10
16. Explain omposite and Inverse functions
ANS
Example: Let X = {1, 2, 3}, Y = {p, q} and Z = {a, b}. Also let f : X → Y be
f = {(1, p), (2, q), (3,} and g : Y → Z be given by g = {(p, b), (q, b)}. Find g ◦ f.
Solution: g ◦ f = {(1, b), (2, b), (3, b).
Solution:
f ◦ g = {(1, 3), (2, 2), (3, 1)}
g ◦ f = {(1, 1), (2, 3), (3, 2)} ̸= f ◦ g
f ◦ h ◦ g = f ◦ (h ◦ g) = f ◦ {(1, 2), (2, 1), (3, 1)}
= {(1, 3), (2, 2), (3, 2)}
s ◦ g = {(1, 2), (2, 1), (3, 3)} = g
g ◦ s = {(1, 2), (2, 1), (3, 3)}
∴ s◦g=g◦s=g
s ◦ s = {(1, 1), (2, 2), (3, 3)} = s
f ◦ s = {(1, 2), (2, 3), (3, 1)}
Thus, s ◦ s = s, f ◦ g ≠g ◦ f, s ◦ g = g ◦ s = g and h ◦ s = s ◦ h = h.
10
Example: Let f(x) = x + 2, g(x) = x − 2 and h(x) = 3x for x ∈ R, where R is the set of real
numbers. Find g ◦ f; f ◦ g; f ◦ f; g ◦ g; f ◦ h; h ◦ g; h ◦ f; and f ◦ h ◦ g.
Solution: f : R → R is defined by f(x) = x + 2
f: R → R is defined by g(x) = x − 2
h : R → R is defined by h(x) = 3x
⇒ g ◦ g = {(x, x − 4)| x ∈ R}
(g ◦ g)(x) = g(g(x)) = g(x − 2) = x − 2 − 2 = x − 4
∴ f ◦ h = {(x, 3x + 2)| x ∈ R}
(f ◦ h)(x) = f(h(x)) = f(3x) = 3x + 2
{(x, 3x + 6)| x ∈ R}
(h ◦ f)(x) = h(f(x)) = h(x + 2) = 3(x + 2) = 3x + 6 h ◦ f =
(f ◦ h ◦ g)(x) = [f ◦ (h ◦ g)](x)
Inverse Functions
−1
A function f : X → Y is aid to be invertible of its inverse function f is also function
10
***Example: f : R → R is defined by f(x) = ax + b, for a, b ∈ R and a ≠ 0.
Show that fis
invertible and find the inverse of f.
⇒ ax1 + b = ax2 + b
⇒ ax1 = ax2
⇒ x1 = x2
∴ f is one-to-one.
⇒ y = ax + b
⇒ ax = y − b
⇒ x = (y-b)/a
Given y ∈ R(codomain), there exists an element x = (y-b)/a ∈ R such that f(x) = y.
∴ f is onto
−1
f is invertible and f (x)= (x-b)/a
3 −1
Example: Let f : R → R be given by f(x) = x − 2. Find f .
f(x2)
⇒ x 1−2=x 2−
3 3
2⇒ x 1=x 2
3 3
⇒ x1 = x2
∴ f is one-to-one.
⌊x⌋.
by
E
x
a
m
pl
es
⌊
:
5.
1
⌋
4
⌊
5,
⌋
5
⌊
2,
−
7.
⌋
6
=
−
⌊
8,
⌋
6
=
6,
10
Example: Let f and g abe functions from the positive real numbers to positive real
2
g ◦ f(x) = g(f(x))=g(⌊2x⌋)=(⌊2x⌋)
bound.
+
a ∨ b = a ⊕ b = LCM of a and b,
Then (Z , R) is a lattice in which the join of a and b is the least common multiple of a and b,
i.e
and the meet of a and b, i.e. a ∗ b is the greatest common divisor (GCD) of a and b
i.e., a 𝖠b = a ∗ b = GCD of a and b.
We can also write a+b = a∨b = a⊕b=LCM of a and b and a.b = a𝖠b = a∗b=GCD of a and b.
Example: Let n be a positive integer and Sn be the set of all divisors of n If n = 30, S30 = {1, 2,
3, 5, 6, 10, 15, 30}. Let R denote the relation division as defined in Example 1. Then (S30, R) is
a Lattice see Fig:
Example: Let A be any set and P (A) be its power set. The poset P (A), ⊆) is a lattice in which
the meet and join are the same as the operations ∩ and 𝖴 on sets respectively.
S = {a}, P (A) = {ϕ, {a}}
10
S = {a, b}, P (A) = {ϕ, {a}, {a}, S}.
10
Let (L, ≤) be a lattice and ∗ and ⊕ denote the two binary operation meet and join on (L,
Some Properties of Lattice
≤).
The above properties (L1) to (L4) can be proved easily by using definitions of
meet and join.
′ ′
We can apply the principle of duality and obtain (L1) to (L4) .
Bounded Lattice:
A bounded lattice is an algebraic structure (L,,,0,1) sucha that (L,,) is a lattice, and
the constants 0,1∈ L satisfy the following:
1. for all x∈ L, x1=x and x1=1
2. for all x∈ L, x0=0 and x0=x.
The element 1 is called the upper bound, or top of L and the element 0 is called the lower bound
or bottom of L.
Distributive lattice:
A lattice (L,∨,𝖠) is distributive if the following additional identity holds for all x, y, and z in
L: x 𝖠 (y ∨ z) = (x 𝖠 y) ∨ (x 𝖠 z)
Viewing lattices as partially ordered sets, this says that the meet peration preserves nonempty
Example: Show that the following simple but significant lattices are not distributive.
Similarly, the other distributive law fails for these three elements.
b) The pentagon lattice is also not distributive
Example: Show that lattice is not a distributive lattice.
Sol. A lattice is distributive if all of its elements follow distributive property so let we verify the
distributive property between the elements n, l and m.
GLB(n, LUB(l, m)) = GLB(n, p) [∴ LUB(l, m) = p]
= n (LHS)
also LUB(GLB(n, l), GLB(n, m)) = LUB(o, n); [∴ GLB(n, l) = o and GLB(n, m) = n]
= n (RHS)
so LHS = RHS.
But GLB(m, LUB(l, n)) = GLB(m, p) [∴ LUB(l, n) = p]
= m (LHS)
also LUB(GLB(m, l), GLB(m, n)) = LUB(o, n); [∴ GLB(m, l) = o and GLB(m, n) = n]
= n (RHS)
Thus, LHS ≠ RHS hence distributive property doesn‘t hold by the lattice so lattice is not
distributive.
is defined as i.e. if x and y ∈X then x ≤ y means ‗x divides y‘. Then show that poset (I+, ≤) is a
Example: Consider the poset (X, ≤ ) where X = {1, 2, 3, 5, 30} and the partial ordered relation ≤
Sol.
For the lattice (a) GLB(a, b) = 0 and LUB(x, y) = 1. So, the complement a is b and
vise versa. Hence, a complement lattice.
For the lattice (b) GLB(a, b) = 0 and GLB(c, b) = 0 and LUB(a, b) = 1 and LUB(c, b) = 1;
so both a and c are complement of b.
Hence, a complement lattice.
11
UNIT –III
Big-O Notation
Definition
Big-Theta Notation
Definition
Let f, g : R → R. We say that f is Θ(g) if f is O(g) and f is Ω(g).
We say that “f is big-Theta of g” and also that “f is of order g” and also that
“f and g are of the same order”.
f is Θ(g) if and only if there exists constants C1, C2 and k such that
C1g(x) < f(x) < C2g(x) if x > k.
Example
Show that the sum 1 + 2 + · · · + n of the first n positive integers is Θ(n 2 ).
Solution: Let f(n) = 1 + 2 + · · · + n.
We have previously shown that f(n) is O(n 2 ).
To show that f(n) is Ω(n 2 ), we need a positive constant C such that f(n) > Cn2 for
sufficiently large n.
Summing only the terms greater than n/2 we obtain the inequality
1+ 2 + · · · + n ≥ dn/2e + (dn/2e + 1) + · · · + n
≥ dn/2e + dn/2e + · · · + dn/2e = (n − dn/2e + 1)dn/2e
≥ (n/2)(n/2) = n 2/4
Taking C = 1/4, f(n) > Cn2 for all positive integers n.
Hence, f(n) is Ω(n 2 ), and we can conclude that f(n) is Θ(n 2 ).
5. Write a short notes on Complexity of Algorithms
• Given an algorithm, how efficient is this algorithm for solving a problem given input of a
particular size?
How much time does this algorithm use to solve a problem?
How much computer memory does this algorithm use to solve a problem?
• We measure time complexity in terms of the number of operations an algorithm uses
and use big-O and big-Theta notation to estimate the time complexity.
• Compare the efficiency of different algorithms for the same problem.
• We focus on the worst-case time complexity of an algorithm. Derive an upper bound
on the number of operations an algorithm uses to solve a problem with input of a
particular size. (As opposed to the average-case complexity.)
• Here: Ignore implementation details and hardware properties. −→ See courses
on algorithms and complexity.
P(k)⇒P(k+1)
in the inductive step, we need to carry out two steps: assuming that P(k)P(k) is true, then using it to
prove P(k+1)P(k+1) is also true.
So we can refine an induction proof into a 3-step procedure:
Verify that P(1) is true.
Assume that P(k) is true for some integer k≥1.
Show that P(k+1) is also true.
The second step, the assumption that P(k) is true, is sometimes referred to as the
inductive hypothesis.
Be sure to say “Assume the identity holds for some integer k≥1.” Do not say “Assume it
holds
for all integers k≥1.” If we already know the result holds for all k≥1, then there
is no need to prove anything at all.
Be sure to specify the requirement k≥1. This ensures that the chain reaction of the
falling dominoes starts with the first one.
Do not say “let n=k” or “let n=k+1.” The point is, you are not assigning the value of k and
k+1 to n. Rather, you are assuming that the statement is true when nn equals kk,
and using it to show that the statement also holds when nn equals k+1.
Example: Use mathematical induction to show that
1+2+3+⋯+n=n(n+1)/2
for all integers n≥1n≥1.
Recursion
Sometimes it is difficult to define an object explicitly. It may be easy to define this object in terms of itself. This
process is called recursion.
We can use recursion to define sequences, functions, and sets
Example: an=2n for n = 0,1,2,… 1,2,4,8,16,32,… After giving the first term, each term of
the sequence can be defined from the previous term
a1=1 an+1 = 2an
When a sequence is defined recursively, mathematical induction can be used to prove results
about the sequence.
Let P(k) be proposition about ak.
Basis step: Verify P(1).
Inductive step: Show k1 (P(k) P(k+1)).
Recursively defined functions
Assume f is a function with the set of nonnegative integers as its domain
We use two steps to define f.
Basis step: Specify the value of f(0).
Recursive step: Give a rule for f(x) using f(y) where 0y
Such a definition is called a recursive or inductive
definition. Example
Suppose f(0) = 3 f(n+1) = 2f(n)+2, n 0. Find f(1), f(2) and f(3).
Solution:
f(1) = 2f(0) + 2 = 2(3) + 2 = 8
f(2) = 2f(1) + 2 = 2(8) + 2 = 18
f(3) = 2f(2) + 2 = 2(18) + 2 = 38 6
Example Give an inductive definition of the factorial function
Solution:
Basis step: (Find F(0).) F(0)=1
Recursive step: (Find a recursive formula for
F(n+1).) F(n+1) = (n+1) F(n)
What is the value of F(5)?
F(5) = 5F(4)
= 5 . 4F(3)
= 5 . 4 . 3F(2)
= 5 . 4 . 3 . 2F(1)
= 5 . 4 . 3 . 2 . 1F(0)
= 5 . 4 . 3 . 2 . 1 . 1 = 120
UNIT –IV
Generating functions are not functions in the formal sense of a mapping from a domain to a codomain;
the name is merely traditional, and they are sometimes more correctly called generating series.
When the term generating function is used without qualification, it is usually taken to mean an
ordinary generating function.
If an is the probability mass function of a discrete random variable, then its ordinary generating
function is called a probability-generating function.
The ordinary generating function can be generalized to arrays with multiple indices. For
example, the ordinary generating function of a two-dimensional array am, n (where n and m are
natural numbers) is
Example:
Example:
Function of Sequences:
Generating functions giving the first few powers of the nonnegative integers are given in the
following table.
series
1
There are many beautiful generating functions for special functions in number theory.
A few particularly nice examples are
(2)
(3)
(4)
for the partition function P, where is a q-Pochhammer symbol,and
(5)
(6)
(7)
A recurrence relation is a formula that relates for any integer n ≥ 1, the n-th term of a
sequence A = {ar}∞r=0 to one or more of the terms a0,a1,….,an-1.
Example. If Sn denotes the sum of the first n positive integers, then
relation
with
an = an -1 + d. L kewise if pn denotes the nth term of a geometric
Thus, all the examples above are linear recurrence relations except (8), (9), and (10);
the relation (8), for instance, is not linear because of the squared term.
The relations in (3), (4) , (5), and (7) are linear with constant coefficients.
Relations (1), (2), and (3) have degree 1; (4), (5), and (6) have degree 2;
(7) has degree Relations (3) , (4), and (6) are homogeneous.
There are no general techniques that will enable one to solve all recurrence relations.
There are, nevertheless, techniques that will enable us to solve linear recurrence relations
with constant coefficients.
Example
Solve the recurrence relation an = a n-1 + f(n) for n ³1 by substitution a1=
a0 + f(1)
a2 = a1 + f(2) = a0 + f(1) + f(2))
This leads to the following theorem: the general solution to the inhomogeneous equation is
the general solution to the associated homogeneous equation, plus any particular
solution to the inhomogeneous equation.
This gives the following procedure for solving the inhomogeneous equation:
Solve the associated homogeneous equation by the method we< ve learned.
This will involve variable (or undetermined) coefficients.
Guess a particular solution to the inhomogeneous equation. It is because of the guess that
I< ve called this a procedure, not an algorithm.
For simple right-hand sides , we can say how to compute a particular solution, and in these
cases, the procedure merits the name ―algorithm.<
The general solution to the inhomogeneous equation is the sum of the answers from the two
steps
above.
Use the initial data to solve for the undetermined coefficients from step 1.
.
UNIT-V
Drawbacks
It may be difficult to insert and delete nodes in G.
If the number of edges is 0(m) or 0(m log2 m), then the matrix A will be sparse, hence a great
deal of space will be wasted.
Path Matrix Represenation
Let G be a simple directed graph with m nodes, v1,v2, . . . ,vm. The path matrix of G is the m-
square matrix P = (pij) defined as follows:
1 if there is a path from Vi to Vj Pij
=0 otherwise
Suppose e = [u, v]. Then the nodes u and v are called the endpoints of e,
and u and v are said to be adjacent nodes or neighbors. The degree of a
node u, written deg(u), is the number of edges containing u. If deg(u) = 0 —
that is, if u does not belong to any edge— then u is called an isolated node.
Path and Cycle
A path P of length n from a node u to a node v is defined as a sequence of n + 1 nodes. P
= (v0, v1, v2, . . . , vn) such that u = v0; vi-1 is adjacent to vi for i = 1,2, . . ., n and vn = v.
Types of Path
1. Simple Path
2. Cycle Path
Multiple edges: Distinct edges e and e' are called multiple edges if they connect
the same endpoints, that is, if e = [u, v] and e' = [u, v].
Loops: An edge e is called a loop if it has identical endpoints, that is, if e = [u, u].
Finite Graph:A multigraph M is said to be finite if it has a finite number of nodes
and a finite number of edges.
(a) Graph.
3. What is Directed Graphs
A directed graph G, also called a digraph or graph is the same as a multigraph except that
each edge e in G is assigned a direction, or in other words, each edge e is identified with an
ordered pair (u, v) of nodes in G.
Indegree of 1 = 1
Indegree pf 2 = 2
Outdegree :The outdegree of a node or vertex is the number of edges for which v is tail.
Example
Outdegree of 1 =1
Outdegree of 2 =2
Simple Directed
Graph
A directed graph G is said to be simple if G has no
parallel edges. A simple graph G may have loops, but it
cannot have more than one loop at a given node.
3. Explain graph traversal methods
Graph Traversal
The breadth first search (BFS) and the depth first search (DFS) are the two algorithms used for
traversing and searching a node in a graph. They can also be used to find out whether a node is
reachable from a given node or not.
The aim of DFS algorithm is to traverse the graph in such a way that it tries to go far from
the root node. Stack is used in the implementation of the depth first search. Let’s see how
depth first search works with respect to the following graph:
As stated before, in DFS, nodes are visited by going through the depth of the tree from the
starting node. If we do the depth first traversal of the above graph and print the visited node, it
will be ―A B E F C D< . DFS visits the root node and then its children nodes until it reaches the
end node, i.e. E and F nodes, then moves up to the parent nodes.
Algorithmic Steps
9. Step 4: If the node has unvisited child nodes, get the unvisited child node, mark it
as traversed and push it on stack.
10. Step 5: If the node does not have any unvisited child nodes, pop the node from
the stack.
Based upon the above steps, the following Java code shows the implementation of the
DFS algorithm:
}
}
//Clear visited property of nodes clearNodes();
}
5. Write BFS Algorithm with program
This is a very different approach for traversing the graph nodes. The aim of BFS algorithm is
to traverse the graph as close as possible to the root node. Queue is used in the implementation
of the breadth first search. Let’s see how BFS traversal works with respect to the following
graph:
If we do the breadth first traversal of the above graph and print the visited node as the output, it
will print the following output. ―A B C D E F< . The BFS visits the nodes level by level, so it will
start with level 0 which is the root node, and then it moves to the next levels which are B, C and
D, then the last levels which are E and F.
Algorithmic Steps
1. Step 1: Push the root node in the Queue.
2. Step 2: Loop until the queue is empty.
3. Step 3: Remove the node from the Queue.
4. Step 4: If the removed node has unvisited child nodes, mark them as visited
and insert the unvisited children in the queue.
Based upon the above steps, the following Java code shows the implementation of
the BFS algorithm:
Spanning forests
A spanning forest is a type of subgraph that generalises the concept of a spanning tree. However,
there are two definitions in common use. One is that a spanning forest is a subgraph that consists
of a spanning tree in each connected component of a graph. (Equivalently, it is a maximal cycle-
free subgraph.) This definition is common in computer science and optimisation. It is also the
definition used when discussing minimum spanning forests, the generalization to disconnected
graphs of minimum spanning trees. Another definition, common in graph theory, is that a
spanning forest is any subgraph that is both a forest (contains no cycles) and spanning (includes
every vertex).
7. How to count spanning trees
Counting spanning trees
The number t(G) of spanning trees of a connected graph is an important invariant.
In some cases, it is easy to calculate t(G) directly. It is also widely used in data
structures in different computer languages.
For example, if G is itself a tree, then t(G)=1, while if G is the cycle graph Cn with
n vertices, then t(G)=n.
For any graph G, the number t(G) can be calculated using Kirchhoff's matrix-tree
theorem (follow the link for an explicit example using the theorem).
Cayley's formula is a formula for the number of spanning trees in the complete graph K
wnith n
n−2
vertices. The formula states that t(Kn) = n n − 2
Another way of stating Cayley's formula is that
Cayley's formula is a formula for the number of spanning trees in the complete graph K wnith n
n−2
vertices. The formula states that t(Kn) = n n − 2
Another way of stating Cayley's formula is that there are exactly n labelled trees with n vertices.
Cayley's formula can be proved using
Kirchhoff's matrix-tree theorem or via the Prüfer code.
q−1p−1
If G is the complete bipartite graph Kp,q, then t(G) = p q , while if G is the n-dimensional
If G is a multigraph and e is an edge of G, then the number t(G) of spanning trees of G satisfies the
deletion-contraction recurrence t(G)=t(G-e)+t(G/e), where G-e is the multigraph obtained by
deleting e and G/e is the contraction of G by e, where multiple edges arising from this contraction
are not deleted.
17
Algorithms
The classic spanning tree algorithm, depth-first search (DFS), is due to Robert Tarjan. Another
important algorithm is based on breadth-first search (BFS).
Example graphs
planar non planar
Applications
Telecommunications – e.g. spanning trees
Vehicle routing – e.g. planning routes on roads without underpasses VLSI
– e.g. laying out circuits on computer chip.
The puzzle game Planarity requires the player to "untangle" a planar graph so that none of its edges
intersect
17
Graph Theory and Applications:
Graphs are among the most ubiquitous models of both natural and human-made structures. They can be
used to model many types of relations and process dynamics in physical, biological and social systems.
Many problems of practical interest can be represented by graphs.
In computer science, graphs are used to represent networks of communication, data organization,
computational devices, the flow of computation, etc.
One practical example: The link structure of a website could be represented by a directed graph. The
vertices are the web pages available at the website and a directed edge from page A to page B exists
if and only if A contains a link to B.
A similar approach can be taken to problems in travel, biology, computer chip design, and many
other fields.
The development of algorithms to handle graphs is therefore of major interest in computer science.
There, the transformation of graphs is often formalized and represented by graph rewrite systems.
They are either directly used or properties of the rewrite systems (e.g. confluence) are studied.
Complementary to graph transformation systems focussing on rule- based in-memory manipulation
of graphs are graph databases geared towards transaction-safe, persistent storing and querying of
graph-structured data
Graph-theoretic methods, in various forms, have proven particularly useful in linguistics, since
natural language often lends itself well to discrete structure.
Traditionally, syntax and compositional semantics follow tree-based structures, whose expressive
power lies in the Principle of Compositionality, modeled in a hierarchical graph.
Within lexical semantics, especially as applied to computers, modeling word meaning is easier when
a given word is understood in terms of related words; semantic networks are therefore important in
computational linguistics.
Still other methods in phonology (e.g. Optimality Theory, which uses lattice graphs) and morphology
(e.g. finite-state morphology, using finite-state transducers) are common in the analysis of language
as a graph.
Indeed, the usefulness of this area of mathematics to linguistics has borne organizations such
as TextGraphs, as well as various 'Net' projects, such as WordNet, VerbNet, and others
Graph theory is also used to study molecules in chemistry and physics. In condensed matter physics,
the three dimensional structure of complicated simulated atomic structures can be studied quantitatively
by gathering statistics on graph-theoretic properties related to the topology of the atoms. For example,
Franzblau's shortest-path (SP) rings. In chemistry a graph makes a natural model for a molecule, where
vertices represent atoms and edges bonds. This approach is especially used in computer processing of
molecular structures, ranging from chemical editors to database searching. In statistical physics, graphs
can represent local connections between interacting parts of a system, as well as the dynamics of a
physical process on such systems.
17
Graph theory is also widely used in sociology as a way, for example, to measure actors' prestige or to
explore diffusion mechanisms, notably through the use of social network analysis software.Likewise,
graph theory is useful in biology and conservation efforts where a vertex can represent regions where
certain species exist (or habitats) and the edges represent migration paths, or movement between the
regions. This information is important when looking at breeding patterns or tracking the spread of
disease, parasites or how changes to the movement can affect other species.
In mathematics, graphs are useful in geometry and certain parts of topology, e.g. Knot Theory.
Algebraic graph theory has close links with group theory.
A graph structure can be extended by assigning a weight to each edge of the graph. Graphs with
weights, or weighted graphs, are used to represent structures in which pairwise connections have some
numerical values. For example if a graph represents a road network, the weights could represent the
length of each road.
Basic Concepts Isomorphism:
Let G1 and G1 be two graphs and let f be a function from the vertex set of G1 to the vertex set of G2.
Suppose that f is one-to-one and onto & f(v) is adjacent to f(w) in G2 if and only if v is adjacent to w in
G1.
Then we say that the function f is an isomorphism and that the two graphs G1 and G2 are
isomorphic. So two graphs G1 and G2 are isomorphic if there is a one-to-one correspondence
between vertices of G1 and those of G2 with the property that if two vertices of G1 are adjacent
then so are their images in G2. If two graphs are isomorphic then as far as we are concerned they are
the same graph though the location of the vertices may be different. To show you how the program
can be used to explore isomorphism draw the graph in figure 4 with the program (first get the null
graph
on four vertices and then use the right mouse to add edges)
Save this graph as Graph 1 (you need to click Graph then Save). Now get the circuit graph with 4
vertices. It looks like figure 5, and we shall call it C(4).
17
Example:
The two graphs shown below are isomorphic, despite their different looking drawings.
ƒ(a) = 1
ƒ(b) = 6
ƒ(c) = 8
ƒ(d) = 3
ƒ(g) = 5
ƒ(h) = 2
ƒ(i) = 4
ƒ(j) = 7
Subgraphs
A subgraph of a graph G is a graph whose vertex set is a subset of that of G, and whose adjacency
relation is a subset of that of G restricted to this subset. In the other direction, a supergraph of a graph G
is a graph of which G is a subgraph. We say a graph G contains another graph H if some subgraph of G
is H or is isomorphic to H.
17
A subgraph H is a spanning subgraph, or factor, of a graph G if it has the same vertex set as G. We
say H spans G.
A subgraph H of a graph G is said to be induced if, for any pair of vertices x and y of H, xy is an edge
of H if and only if xy is an edge of G. In other words, H is an induced subgraph of G if it has all the
edges that appear in G over the same vertex set. If the vertex set of H is the subset S of V(G), then H
can be written as G[S] and is said to be induced by S.
K5, a complete graph. If a subgraph looks like this, the vertices in that subgraph form a clique of
size 5.
Multi graphs:
In mathematics, a multigraph or pseudograph 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. Formally, a multigraph G is an ordered pair
G:=(V, E) with
Multigraphs might be used to model the possible flight connections offered by an airline. In this case
the multigraph would be a directed graph with pairs of directed parallel edges connecting cities to
show that it is possible to fly both to and from these locations.
17
A multigraph with multiple edges (red) and a loop (blue). Not all authors allow multigraphs to
have loops.
Euler circuits:
In graph theory, an Eulerian trail is a trail in a graph which visits every edge exactly once. Similarly, an
Eulerian circuit is an Eulerian trail which starts and ends on the same vertex. They were first discussed
by Leonhard Euler while solving the famous Seven Bridges of Königsberg problem in 1736.
Mathematically the problem can be stated like this:
Given the graph on the right, is it possible to construct a path (or a cycle, i.e. a path starting and
ending on the same vertex) which visits each edge exactly once?
Euler proved that a necessary condition for the existence of Eulerian circuits is that all vertices in the
graph have an even degree, and stated without proof that connected graphs with all vertices of even
degree have an Eulerian circuit. The first complete proof of this latter claim was published in 1873 by
Carl Hierholzer.
The term Eulerian graph has two common meanings in graph theory. One meaning is a graph with an
Eulerian circuit, and the other is a graph with every vertex of even degree. These definitions coincide
for connected graphs.
For the existence of Eulerian trails it is necessary that no more than two vertices have an odd degree;
this means the Königsberg graph is not Eulerian. If there are no vertices of odd degree, all Eulerian
trails are circuits. If there are exactly two vertices of odd degree, all Eulerian trails start at one of them
and end at the other. Sometimes a graph that has an Eulerian trail but not an Eulerian circuit is called
semi-Eulerian.
An Eulerian trail, Eulerian trail or Euler walk in an undirected graph is a path that uses each edge exactly
once. If such a path exists, the graph is called traversable or semi-eulerian.
An Eulerian cycle, Eulerian circuit or Euler tour in an undirected graph is a cycle that uses each edge
exactly once. If such a cycle exists, the graph is called unicursal. While such graphs are Eulerian
graphs, not every Eulerian graph possesses an Eulerian cycle.
For directed graphs path has to be replaced with directed path and cycle with directed cycle.
The definition and properties of Eulerian trails, cycles and graphs are valid for multigraphs as well.
17
This graph is not Eulerian, therefore, a solution does not exist
Every vertex of this graph has an even degree, therefore this is an Eulerian graph. Following the
edges in alphabetical order gives an Eulerian circuit/cycle.
Hamiltonian graphs:
In the mathematical field of graph theory, a Hamiltonian path (or traceable path) is a path in an
undirected graph which visits each vertex exactly once. A Hamiltonian cycle (or Hamiltonian circuit) is
a cycle in an undirected graph which visits each vertex exactly once and also returns to the starting
vertex. Determining whether such paths and cycles exist in graphs is the Hamiltonian path problem
which is NP-complete.
Hamiltonian paths and cycles are named after William Rowan Hamilton who invented the Icosian
game, now also known as Hamilton's puzzle, which involves finding a Hamiltonian cycle in the edge
graph of the dodecahedron. Hamilton solved this problem using the Icosian Calculus, an algebraic
structure based on roots of unity with many similarities to the quaternions (also invented by Hamilton).
This solution does not generalize to arbitrary graphs.
17
A Hamiltonian path or traceable path is a path that visits each vertex exactly once. A graph that
contains a Hamiltonian path is called a traceable graph. A graph is Hamilton-connected if for every
pair of vertices there is a Hamiltonian path between the two vertices.
A Hamiltonian cycle, Hamiltonian circuit, vertex tour or graph cycle is a cycle that visits each
vertex exactly once (except the vertex which is both the start and end, and so is visited twice).
A graph that contains a Hamiltonian cycle is called a Hamiltonian graph.
Similar notions may be defined for directed graphs, where each edge (arc) of a path or cycle can only
be traced in a single direction (i.e., the vertices are connected with arrows and the edges traced "tail-to-head").
A Hamiltonian decomposition is an edge decomposition of a graph into Hamiltonian
circuits.
Examples a complete graph with more than two vertices is Hamiltonian every cycle graph is Hamiltonian
eve y trournament has an odd number of Hamiltonian paths every platonic solid,
considered as a graph, is Hamiltonian
Vertex coloring is the starting point of the subject, and other coloring problems can be transformed
into a vertex version. For example, an edge coloring of a graph is just a vertex coloring of its line
graph, and a face coloring of a planar graph is just a vertex coloring of its planar dual. However, non-
vertex coloring problems are often stated and studied as is. That is partly for perspective, and partly
because some problems are best studied in non-vertex form, as for instance is edge coloring.
The convention of using colors originates from coloring the countries of a map, where each face is
literally colored. This was generalized to coloring the faces of a graph embedded in the plane. By
planar duality it became coloring the vertices, and in this form it generalizes to all graphs. In
mathematical and computer representations it is typical to use the first few positive or nonnegative
integers as the "colors". In general one can use any finite set as the "color set". The nature of the
coloring problem depends on the number of colors but not on what they are.
Graph coloring enjoys many practical applications as well as theoretical challenges. Beside the
classical types of problems, different limitations can also be set on the graph, or on the way a color is
assigned, or even on the color itself. It has even reached popularity with the general public in the form
of the popular number puzzle Sudoku. Graph coloring is still a very active field of research.
17
A proper vertex coloring of the Petersen graph with 3 colors, the minimum number possible.
Vertex coloring
The terminology of using colors for vertex labels goes back to map coloring.
Labels like red and blue are only used when the number of colors is small, and
normally it is understood that the labels are drawn from the integers {1,2,3,...}.
A coloring using at most k colors is called a (proper) k-coloring. The smallest
number of colors needed to color a graph G is called its chromatic number, χ(G).
A graph that can be assigned a (proper) k- coloring is k-colorable, and it is k-
chromatic if its chromatic number is exactly k. A subset of vertices assigned to the
same color is called a color class, every such class forms an independent set.
Thus, a k-coloring is the same as a partition of the vertex set into k independent
sets, and the terms k-partite and k-colorable have the same meaning.
17
graph complete graph cycle graph ,
star graph , 2
wheel ,
graph
, 2
wheel ,
graph
17
PART- C
17
UNIT WISE UNIVERSITY PREVIOUS QUESTION PAPER
QUESTIONS
((P ∨ Q) ¬ (¬ P (¬ Q ∨ ¬ R ))) ∨ ( ¬ P¬ Q ) ∨ (¬ Q ¬ R)
4 Without using truth tables prove that
is a tautology.
[10]
17
b). Translate the given statements into propositional logic using the propositions
provided:
P: “The message is scanned for viruses”
Q:”The message was sent from an unknown system”
i) “The message is scanned for viruses whenever the message was sent from an
unknown system.”
ii) “It is necessary to scan the message for viruses whenever it was sent from an unknown
system.” [5+5]
www.ManaResults.co.in
UNIT –I PREVIOUS ASKED SHORT QUESTIONS
1. Write converse and inverse for the statement “If Sun rises in the east
then 3*7=98”. [2]
2. Express (PQ) (P↔R) in terms of , , ~ only. [3]
3. Find the negations of the following quantified statements:
x, y, p x, y q x, y r x, y [2]
4. Construct a truth table to show that (p q) → p is a tautology. [3]
5. Define well-formed formulae and clause form. [2]
6. Write the statement in symbolic form then negate statements:
a) Some Drivers do not obey the speed limit.
b) All dogs have fleas. [3]
7. Write the converse and contrapositive of the statement:
“If P is a square, then P is a rectangle”. [2]
8 . Rewrite the following statement informally, without quantifiers or variables.
x R, if x 2 then x2 4 [3]
9. Give the truth table for the propositional formula
( P Q ) ( P Q ) [2]
10. Write the sentence “It is not true that all roads lead to Rome” in the symbolic form. [3]
www.ManaResults.co.in
UNIT –II PREVIOUS ASKED ESSAY QUESTIONS
www.ManaResults.co.in
ii) A function f:AA satisfying f(f(x))=f(x) for all xϵA
g ( x )= 1/2 lo g ( x 1) are
inverses.
b). Prove that the transitive closure R of a relation R on a set A is the smallest transitive
www.ManaResults.co.in
UNIT –II PREVIOUS ASKED SHORT QUESTIONS
1. Define LUB and GLB of a lattice and give examples for each. [2]
2. Explain equivalence relation. Give suitable examples for a relation which is not equivalence relation. [3]
3. Let X 1, 2,3, 4,5,6 and R be a relation defined as (x, y) R if and only if x y is
divisible by 3. Find the elements of relation of R. [2]
4. If R is set of real numbers, then show that the function: F : R R defined by
f x 5x3 1is one-one function. [2]
www.ManaResults.co.in
UNIT –III
1
iC n,i n2n1 .
6.b) In how many ways can 4 mathematics books, 3 history books, 3 chemistry books
and 2 sociology books be arranged on the shelf so that all books of the same
subject are together. [5+5]
www.ManaResults.co.in
UNIT IV
PREVIOUS ASKED ESSAY QUESTIONS
1. a). Solve the recurrence relation an - 7an-1 + 16an-2 - 12an-3 = 0 for n 3 with the initial
conditions a0=1, a1=4, and a2=8.
b) Find the solution for an - 3an-1 - 4an-2 = 0 for n 2 and, a0 = a1 = 1. [5+5]
2.a) Find a generating function for the recurrence relation an an1 6an2 0 for n 2
b) Express Fibonacci sequence of numbers 1, 1, 2, 3, 5, 8, 13, 21, 34,... in terms of
general expression for the rth number ar and generating function. [5+5]
www.ManaResults.co.in
7. a). Find the generating function for the following sequence:
1 1 3 1 3 5 1 3 5 (2n 1)
, , , ,
2 24 246 246 (2n 2)
7 a). If the person invests Rs.10, 000 at 10% annual interest compounded quarterly, in how
Many months the money will become 15000.
b) Solve the following recurrence relation an1 2an 2n, n 0,a 1. [5+5]
www.ManaResults.co.in
UNIT –IV PREVIOUS ASKED SHORT QUESTIONS
= 11.[3]
5. From 6 boys and 4 girls, 5 are to be selected for admission for a
particular course.
In How many ways can this be done if there must be exactly 2 girls? [2]
6. Determine the co-efficient of x12 inx3 (1-2x)10. [3]
7. Find the generating function for the following sequence 0, 1, -2, 3, -4…. [2]
8. Define first order and second order recurrence relations. [3]
9. What is a non-homogeneous recurrence relation? Give an example. [2]
10. Give any three applications of generating fnctions.
11. Give the disjunctive rule for counting problem.
n
12. What is the closed form expression of the sequencen
a 9 .5 , n 0 ? [2]
13. Find the coefficient of x 9 in (1 x 3 x 8 )1 0 [3]
www.ManaResults.co.in
UNIT-V JNTUH-PREVIOUSLY ASKED ESSAY QUESTIONS
Graph: 2
b) Show that the complete bi-partite graph K3, 3 is notplanar graph. [5+5]
Graph: 3
www.ManaResults.co.in
b) Define spanning tree. Apply Prim’s algorithm to find minimum spanning tree
on the following weighted graph 4. [5+5]
Gr
sapuh: l4
6.a) Show that a simple complete digraph with n nodes has the maximum
number of edges n n 1 . Assuming that there are no loops.
b) State and explain graph coloring problem. Give its applications. [5+5]
www.ManaResults.co.in
8 .a) Prove that a simple graph with n vertices and k components can have at most
n k n k 1 edges.
1 and 7 in the following weighted figure 1?
[5+5]
Figure: 1
www.ManaResults.co.in
9. Determine whether the given graphs have Hamilton circuits. If it has for such circuits shown in figure 2. [10]
Figure: 2
10. Use the algorithm BFS to find out whether the following graphs, given by their adjacency
lists are connected, and otherwise determine their connected components. Consider that
the set of vertices is alphabetically ordered. [5+5]
a b c d e f g h i j
d d h a a a b c b b
e g b d d i g g
F i e j
J f
b)
a b c d e f g h i j k l m
B a f b b c b b c a c g
J d i h g e d k b i
E k m
G
H
J
18
11.a) Let G be the non directed graph of order 9 such that each vertex has degree 5 or 6.
Prove that atleast 5 vertices have degree 6 or atleast 6 vertices have degree 5.
b). Determine the number of edges in:
i) Kn ii) Km,n iii) Pn. [5+5]
12.a) Using depth first search method, determine the spanning tree T for the following graph
with e as the root of T.
b). Give an example graph which is Hamiltonian but not Eulerian. [5+5]
18
UNIT –V PREVIOUS ASKED SHORT QUESTIONS
1.
Give a general formula for Chromatic number of Cycle graph Cn. [2]
2. Find the Euler Path in the following graph 1. [3]
Graph: 1
3.
What is chromatic numbers? [2]
4. Define Euler‟s circuit and Give an example. [3]
5. What is minimum spanning tree? Give an example. [2]
6.
Define Bipartite graph and Isomorphic graphs. [3]
7. What do you mean by isomorphism? Give examples of isomorphic graphs. [2]
8.What is a planar graph? Give examples of planar and non-planar graphs. [3]
9. What are the advantages of adjacency matrix representation? [2]
10.Define a spanning tree. [3]
18
18