You are on page 1of 13

2068 Bhadra

Submitted by: Sanjay Rijal


BEX/073/342

1. Using rules of interferences, show that the hypothesis “If you send me an
email message, then I will finish writing the program,” “If you don’t send
me an email message then I will go to sleep early,” and if I go to sleep
early then I will wake up feeling refreshed” lead to the conclusion “If I do
not finish writing the program, then I will wake up feeling refreshed.” You
are required to show each step and give reasons for those steps before
you come to desired conclusion from the hypothesis.

Ans.:
Let p be the proposition “you send me email message”, q be the
proposition “I will finish writing the program”, the proposition “I will go to
sleep early”, and the proposition “I will wake up feeling refreshed.”
Then, the hypothesis is p q, ┐ p r, and r s.
The desired conclusion is ┐ q s.
We need to give a valid argument with hypothesis p q.
┐ p r, and r s and conclusion ┐ q s.
This argument from shows that the hypothesis p leads to the desired
conclusion.

Step Reason
I. p q Hypothesis
II. ┐q ┐p Contrapositive of (1)
III. ┐p r Hypothesis
IV. ┐q r Hypothetical syllogism using (ii) and (iii)
V. r s Hypothesis
VI. ┐q s Hypothetical syllogism using (iv) and (v)
2. Use mathematical induction
Prove that
3 + 3.5 + 3.52 +………+ 3.5n =
3(5n+1- 1)/4
Whenever n is a nonnegative
number.

Ans.:
Let p(n) be the proposition that
3 + 3.5 + 3.52 +………+ 3.5n = 3(5n+1- 1)/4 for the integer n.

Basis step: p (0) is true because 3.50=3=3(51 – 1)/4. This complete the basis
step.

Inductive step: for the inductive hypothesis, we assume that p(k) is true. That
is, we assume that 3 + 3.5 + 3.52 +………+ 3.5k = 3(5k+1- 1)/4

To carry out the inductive step using this assumption, we must show that
when we assume that p(k) is true, then p(k+1) is also true. That is, we must
show that

3 + 3.5 + 3.52 +………+ 3.5k+3(5(k+1) +1 -1)/4 = 3(5k+2- 1)/4


Assuming the inductive hypothesis(k). Under the assumption of p(k), we see
that
3 + 3.5 + 3.52 +………+ 3.5k+ 3.5k+1 = 3(1+5+52+……+5k) +3.5k+1
= 3(5k+1- 1)/4 + 3.5k+1
= 3(5.5k+1- 1)/4
= 3(5.5k+1)/4
= 3(5k+2 – 1)/4
Note that we used the inductive hypothesis in the second equation in this
string of equalities to replace 3 + 3.5 + 3.52 +………+ 3.5k+3(5(k+1) +1 -1)/4 =
3(5k+2- 1)/4. We have completed the inductive step.
Because we have completed the basic step and the inductive step, by
mathematical induction we know that p(n) is true for all nonnegative
integers n. that is,
3 + 3.5 + 3.52 +………+ 3.5k = 3(5k+1- 1)/4 for all nonnegative integers n.
3. Prove that √2 is an irrational by giving a proof by contradiction. Draw the
tableau for the formula (T v S)  ┐Q where denotes the negation of a
variable.
Ans.:
A real number is a rational if a = p/q for some integers p and q such that
q≠0.
Real number which is not rational is irrational.
Proof: let √2 is rational number then,
√2 = p/q for p, q є Z, q≠0 and ‘p’ and ‘q’ has no common factor.
Now,
(√2)2 = (p/q)2
Or, 2 = p2/q2
Or, p2 = 2q2
This shows that p2 is even so, p should be even
Thus, p = 2k k є Z then,
(2k)2 = (2q)2→ 4k2 = 2q2 → 2k2 = q2
This shows that q2 is even so, q must also be even. But if both p and q are
even they have common factor. Thus, by method of contradiction it is proved
that √2 is irrational number.

T S Q TvQ ┐Q (TvQ) ┐Q
F F F F T T
F F T T F F
F T F T T T
F T T T F F
T F F T T T
T F T T F F
T T F T T T
T T T T F F

Table 3.1

4. Differentiate between Deterministic Finite State Automata and Non-


Deterministic Finite State Automata. Design a Finite State Automata that
accepts precisely those strings over {a, b} that contain an even number a’s.
You design should include the proper definition of the finite – state
automaton, transition table and the transition diagram.
Ans.:

Deterministic finite state automata Non-deterministic finite state


automata
1. One input transition to only 1. One input transition to
one state multiple state
2. For each pair of state and 2. Such type of finite state
input value is a unique next automata in which there may be
state given by the transition several possible next states for
function. each pair of input value and
state.
3. Example: 3. Example:
0 0
q0 1
q1 q0 q1

0 0
1 0

q2 q2
1 1

Finite state Automata:


Analytically, a finite state automaton M = (I, O, S, f, g,σ)
Where,
I = finite set of input symbols
O = finite set of output symbols
S = finite set of states
f: S x I S = next state function
g: S x I  O = output function
σ = initial state
Let M = [{q0, q1, q2}, {a, b}, {q0, q1, q2}] be the required finite state automata
where the transition functions can be defined as follows:
Transition table:

S/I A B

>q0 q1 q0

q1 q1 q1

q2 q0 q2

Table 4.1

Transition diagram:
bb bb bb
a a
q0 q1 q2
oo oo oo

Fig.4.1

5. Consider the regular grammar defined by T = {a,b} , N ={σ,C} with


productions
σ’  bσ, σ  aC, C  bC, C  b and starting symbol σ.
Construct a Non-Deterministic Finite State Automata equivalent to the
above given regular grammar and convert this into equivalent
Deterministic Finite State Automata.

Ans.: b b
σ a c b f
Fig.5.1
Now, converting the above Non-Deterministic Finite State Automata to
Deterministic Finite State Automata.
Σ/t a B
Σ c σ
c ɸ {c, f}
{c, f} ɸ {c, f}
Hence the required state diagram is:
b b
σ a c a {c, f}

a a
ɸ
Fig.5.2

6. Find all the possible solutions of the recurrence relation


an = 7an-1 -16an-2 + 12an-3 + n4n
with initial condition a0 =-2, a1 =0 and a2 = 5.

Ans.:
Here, the given relation is a linear non-homogeneous recurrence relation.
So, it's solution exists in two parts i.e. homogeneous solution and particular
solution.
an = H.S + P.S = anh + anp
For homogeneous solution:
The homogeneous part: an = 7an-1 -16an-2 + 12an-3
Thus, the characteristic equation for the homogeneous part is:
r3 = 7r2 -16r + 12
or, r3 -7r2 -16r + 12 = 0
or, r3 - 3r2 -4r2 + 12r +4r – 12 = 0
or, r2(r-3) – 4r(r-3) +4(r-3) = 0
or, (r-3)(r2 -4r+4) = 0
or, (r-3)(r-2)(r-2) = 0
. .. r = 2,2,3
Now, the solution of homogeneous part of given recurrence relation is
anh = α13n + (α2 + nα3)2n ……………………………………………… (1)
to find the values of constants α1, α2 and α3, we use the initial conditions;
a0 = -2 = α1 + α2
or, α1 = -( α2 + 2) …………………………………………………………… (2)
a1 = 0 = 3 α1 + 2(α2 + 1* α3)20
or, 3 α1 + 2(α2 + α3) = 0 ……………………………………………………. (3)
solving eqns (2) and (3) we get,
α2 = 2(α3 - 3) …………………………………………………………………… (4)
we have, a2 = 5 = 32α1 + (α2 + 2 α3)22 ………………………………. (5)
solving (2) and (5) we get,
-5 α2 + 8 α3 = 23 ………………………………………………………. (6)
Solving (4) and (6) we get,
α3 = 7/2
now, from (4) we have,
α1 = -( α2 + 8) = -(1+2) = -3
thus, homogeneous solution is
anh = -3*3n + (1+ 7n/2)2n ………………………………………………… (7)
again, for particular solution:
let the trial reasonable solution be
anp = (Cn +D)4n
we have from recurrence relation,
(Cn + D) 4n = 7{C(n-1) + D}4n-1 -16{C(n-2) +D}4n-2+ 12{C(n-3) + D}4n-3 +n4n
(Cn + D) = 7/4*(Cn-C + D) -16/42*(Cn -2C + D) + 12/43*(Cn-3C + D} + n
16(Cn + D) = 28(Cn-C + D) -16(Cn -2C + D) + 3(Cn-3C + D} +16n
Cn + 5C + D – 16n = 0
n(C-16) + (D +5C) = 0
comparing coefficient on both sides, we get,
C = 16
So, D = -5C = -15 * 16 = -80
Thus, particular solution is,
anp = (Cn + D)4n = (16n - 80) 4n
Hence, the required solution of given recurrence relation is,
an = -3n+1 + (1 + 7n/2)2n + (16n - 80) 4n
7. Use Dijkstra’s algorithm to find the length of the shortest path between the
vertices a and z in the weighted graph displayed below.

b 3 d 4
4

4 z
a
1

5 2
3
c e

Fig.7.1
Ans.:

b 4 (a, b) d 7 (a, b, d)
3
4 4

a 4 z 10 (a, b, d, e, z)
1

5 2
3
c e 8 (a, b, d, e)

Fig.7.2

Here, we can use the Dijkstra’s algorithm to calculate the shortest path from
a to z.
Step 1: Calculating the possible adjacent nodes from ‘a’ i.e:
a b = 4 i.e. 4(a, b) (selected)
a c = 5 i.e. 5(a, c)
Step 2: Possible nodes from ‘b’ are:
bd =3 i.e. abd =7 (selected)
b e = 4 i.e. abe = 8
Step 3: Possible nodes from ‘d’ are:
dz =4 i.e. abdz = 11
dz =1 i.e. abde =8 (selected)
Step 4: Possible nodes from ‘e’ are:
ez =2 i.e. abdez =10 (selected)
Hence, the shortest path using the Dijktra’s algorithm is:
abdez with minimum weight 10 as shown in figure above.

8. Draw the figure for the complete bipartite graph K4,5 and the cycle graph with
6 vertices (this is usually denoted by C6). What is the chromatic number of the
drawn complete bipartite graph K4,5 and the cycle graph C6.

Ans.:

The figure for the complete bipartite graph K4,5 is

a b

f c

e d

Fig.8.1

The chromatic number of C6:

Let us consider node as a, b, c, d, e and f. Let us consider node a, c and e as


‘Red’ and node b, d and f as ‘Blue’. Since, nodes aren’t adjacent to each other
thus, the chromatic number of C6 is 2.
Fig.8.2

The chromatic number of K4,5:


Let us consider upper 4 nodes as ‘Red’ and the lower 5 nodes as ‘Blue’. Upper
nodes aren’t connected to each other. Similarly, the lower nodes are not
connected to each other. Thus, the chromatic number of K4,5 is 2.

9. Define a tree and discuss its various properties as well as application of trees.
Ans.:

Tree:
A tree is a connected undirected graph with no simple circuits. Because a
tree cannot have a simple circuit. A tree cannot contain multiple edges or
loops. Therefore, any tree must be a simple graph.
Properties of tree:
1. A tree with n vertices has n-1 edges.
2. A full m - ary tree with I interval vertices contains n=mi + 1 vertices
3. A full m – ary tree with
a. N vertices has I = (n – 1)/m internal
vertices and l = [(m – 1) n + 1]/mi + 1 leaves.
b. l internal vertices have n = mi + 1 vertices
And l = (m – 1) i + 1 leaves,
c. lleaves has n = (ml – 1)/ (m – 1) vertices
and I = (l – 1)/ (m – 1) internal vertices.
4. There are at most mn leaves in any m – ary of height h.
Application of trees:

1. Binary search trees:


It is a binary tree on which each child of a vertex is designed as a right or left
child, no vertex has more than one right child or left child, and each vertex is
labeled with a key, which is one of the items. Furthermore, vertices are
assigned keys so that the key of a vertex is both larger than the keys of all
vertices in its left subtree and smaller than the keys of all vertices in its right
subtree.

2. Decision Tree:
Rooted trees can be used to model problems in which series of decisions
leads to a solution. For instance, a binary search tree can be used to locate
items based on a series of comparisons, where each comparison tells us
whether we should go right or left in a subtree. A rooted tree in which each
internal vertex corresponds to a decision, with a subtree at these vertices for
each possible outcome of the decision, is called a decision tree.

3. Game Tree:
Trees can be used to analyze certain types of games such as tic-tac-toe, nim,
cheekers, and chess. In each case of these games, two players take turns
making moves. Each player knows the moves made by the other player and
no element of chance enters into the game. We model such game using
game trees; the vertices of these trees represent the position that a game
can be in as it progresses: the edges represent legal moves between these
positions. Because game trees are usually large, we simplify game trees by
representing all symmetric positions of a game by the same vertex.

10. Write short notes on:


Ans.:

i. Eulerian graph

An Eulerian graph is an undirected graph is a walk that uses each edge


exactly once. An undirected graph has an Eulerian cycle iff every vertex
has even degree and all of its vertices with non-zero degree belong to a
single connected component. It is used in bioinformatics to reconstruct
the DNA sequence from its fragments. It is also used in CMOS circuit deign
to find the optimal logic gate ordering.

ii. Max flow, min cut theorem:

“For any network, the maximum of all flow values (i.e., the value of the
maximum flow), is equal to the minimum of all cut capacities (i.e. capacity
of the minimum cut).

iii. Planer and regular graphs:

a. Planer graphs:
A graph is called planar if it can be drawn in the plane without any
edges crossing (where a crossing of edges is the intersection of the
lines or arcs representing them at a point other than their common
end point). Sech a drawing is called a planar representation of the
graph.
Example:

Fig.10.1
b. Regular Graph:

A simple graph is called regular graph if every vertex of this graph has
the same degree. A regular graph is called n – regular if every vertex
in this graph has degree n.
Example:

Degree = 4

Fig.10.2

Degree = 2

Fig.10.3

Degree = 3

Fig.10.4

You might also like