Discrete Mathematics

125 downloads 0 Views 2MB Size Report
(d) None. Ans : b. 2. Which of the following statements is false. (a) 3 ∈ {1,2,3}. (b) {3}≤{1,2,3} .... Any word is generated by more than left most derivation or right most ...... (b) Design, a FA that accepts strings containing exactly 1 over alphabet.
Discrete Mathematics April 2009 Section - A 10 × 1 = 10 marks Answer ALL questions 1. If A, B and C are sets, then A − (B ∩C) is equal to (a) (A − B) ∩ (A −C) (b) (A − B) ∪ (A −C)

(c) (A − B)(A −C) (d) None

Ans : b

2. Which of the following statements is false (a) 3 ∈ {1, 2, 3} (b) {3} ≤ {1, 2, 3}

(c) {3} ∈ {1, 2, 3} (d) {3} ∈ {(1), (3)}

Ans : b

3. Which of the following statement is proposition? (a) It is raining day. (b) Close the door

(c) What are you going? (d) None Ans : a

4. Which of the following is “false”? (a) If 6 < 2 then -2 > -7 (b) If 3 + 3 = 6 then 6 + 5 = 14

(c) If 6 + 6 = 12 then 6 + (-6) = -17 (d) None Ans : b & c

5. Which of the relation is a function? (a) {(1, 2), (2, 3), (3, 1)} (b) {(1, 2), (2, 3), (1, 1)}

(c) {(1, 2), (1, 3), (1, 1)} (d) None

Ans : a

6. Which of the following relation is not a equivalence relation on the set of the integers 2? (a) xRyi f f |x| = |y| (b) xRyi f f x2 = y2

(c) xRyi f f x ≤= y (d) None

Ans: c

UQ.2

Discrete Mathematics

7. Consider the words u = a2 ba3 and V = ab2 . The value of vu is. (a) a2 ba4 bb2 (b) ab2 a2 ba3

(c) ab3 a3 (d) None

Ans: b

8. Let A = {ab, bc, ca} Find which of the string belong to A. (a) abc (b) abba

(c) ababab (d) bcabbab

Ans: b

9. How many vertices do the graph with 21 edges, vertices of degree 4 and other each of degree 3? (a) 10 (b) 11

(c) 12 (d) 13

Ans: b

10. Suppose a graph has vertices of degree 0,2,2,3 and 9. How many edges does the graph have? (a) 8 (b) 6

(c) 4 (d) 10

Ans: a

Section - B 5 × 5 = 25 marks 11.

Answer all the questions (a) Prove that A ∩ (B −C) = (A ∩ B) − (A ∩C) Solution: To prove this result, let x ∈ A ∩ (B −C) ⇔ x ∈ Aand x ∈ (B −C) ⇔ x ∈ A and (x ∈ B and x ∈ / C) ⇔ (x ∈ A and x ∈ / B) and x ∈ /C ⇔ x ∈ (A ∩ B) and x ∈ / (A ∩C) ⇔ x ∈ (A ∩ B) − (A ∩C) Hence,

(A ∩ B) − (A ∩C) = A ∩ (B −C) [∴ x 6∈ C = x ∈ / (A ∩C)

University Solved Question Papers

UQ.3

(b) f (A∪B) (x) = fA (x) + fB (x) − fA (x) fB (x) Solution: We know that if x ∈ A, then f A (x) = 1. This implies that fA (x) + fB (x) − fA (x) fB (x) = 1 + fB (x) − fB (x) = 1 Similarly, if x ∈ B, then f B (x) = 1. Thus fA (x) + fB (x) − fA (x) fB (x) = 1 However, if x 6∈ A ∩ B, then both f A (x) = 0 and f B (x) = 0 and hence fA (x) + fB (x) − fA (x) fB (x) = 0

12.

This shows that f A (x) + fB (x) − fA (x) fB (x) = 1 when x ∈ A ∩ B and O otherwise and hence equal to f A∪B (x). (a) Prove that the equivalence p ↔ q ⇔ (7p ↔ 7q) 7q). p q p ↔ q 7p 7q 7p ↔ 7q (p ↔ q) ⇔ (7p ↔ 7q) T T T F F T T T F F F T F T F T F T F F T F F T T T T T (b) Prove the following implication: 7(p ↔ q) ⇒ 7q. p q p ↔ q 7 (p ↔ q) 7p 7(p ↔ q) ⇒ 7q T T T F F T T F F T F F F T F T T T F F T F T F

13.

(a) Let A = {a, b}R = {(a, b)(b, a)(b, b)} and S = {(a, a)(b, a)(b, b)} be relation on A. Find SOR. Solution:

A = {a, b} R = {(a, b), (b, a), (b, b)} S = {(a, a), (b, a), (b, b)} SOR = {(a, b)(b, a)(a, a)(b, b)}

UQ.4

Discrete Mathematics A

R

S

a

a

a

b

b

b

(b) If R and S are relation From A to B. Show that (R ∩ S)−1 = R−1 ∩ S−1 Solution: Let (a, b) ∈ (R ∩ S)−1 ⇔ (b, a) ∈ R ∩ S ⇔ (b, a) ∈ R and (b, a) ∈ S ⇔ (a, b) ∈ R−1 and (a, b) ∈ S−1 ⇔ (a, b) ∈ R−1 ∩ S−1 Hence (R ∩ S)−1 = R−1 ∩ S−1 14.

(a) If G = {(S, A), (a, b), S, P} where p consists of the production S → aAs, S → a, A → SbA, A → ba generate. The string aabbaa by using left most derivation. Solution: S ⇒ aAs ⇒ asbAs (∴ A → SbA)[left most A is replaced by SbA] ⇒ aabAs (left most S is replaced by a) ⇒ aabbas (left most A is replaced by b a) ⇒ aabbaa ( S is replaced by a). (b) Examine whether the grammar G = {(S, A), (a, b), S, P} where P is S → aSb, S → aASb, S → ab, A → λ is ambiguous or not by generating the word aabb. Solution: Any word is generated by more than left most derivation or right most derivation is called the ambiguous grammar. Here, S → aAsb S → ab

University Solved Question Papers

15.

UQ.5

aAabb A→λ aabb The above productions are not ambiguous. (a) Define bipartite graph with an example. Solution: A bipartite graph is a graph that has a two colouring. A graph G is bipartite if the vertex set of G can be partitioned into two nonempty subsets so that each edge connects a vertex from each subset i.e., no two vertices belonging to the same subset will be adjacent. The Example It is Bipartite graph with C(G) = 2. (b) Define graph isomorphism and give an example of two isomorphic graphs. Solution: Let G1 (V1 , E1 ) and G2 (V2 , E2 ) be two indirected graphs. A function f : V1 → V2 is called a graph isomorphism if i. f is one - to - one and onto, i.e., there exist a one - to - one correspondence between their vertices as well as edges. and ii. For all u, v ∈ v1 , {u, v} ∈ E1 if and only if { f (u), f (v)} ∈ E2 . If such a function exists, then graphs. The following graphs are example of isomorphic graphs.

(a)

(b)

(c)

(d)

Examples for Isomorphic graph

UQ.6

Discrete Mathematics Section - c 5 × 8 = 40 marks

16.

Answer all the questions (a) Show that A ∪ (B ∩C) = (A ∪ B) ∩ (A ∪C) Solution: Let x be an arbitrary element of A ∪ (B ∩C) Then x ∈ A ∪ (B ∩C) ⇔x ∈ Aorx ∈ (B ∩C) ⇔ x ∈ A or (x ∈ B and x ∈ C) ⇔ (x ∈ A or x ∈ B) and ( x ∈ A or x ∈ C) ⇔ x ∈ (A ∪ B)andx ∈ (A ∪ C) ⇔x ∈ (A ∪ B) ∩ (A ∪ C) Hence, ⇔A ∪ (B ∩C) = (A ∪ B) ∩ (A ∪C)

17.

(b) Out of 250 candidates who failed in an examination, it was revealed that 128 failed in mathematics, 87 in physics and 134 in aggregate 31 failed in mathematics and in physics, 54 failed in the aggregate and in physics. Find how many candidates failed in (i) In all the three subjects. (ii) In mathematics not in physics. (a) Express P ↓ Q in terms of ↑ only Solution: P ↓ Q ≡∼ (pvq) ∼ = (pvq) ↑ (pvq) ∼ = [(p ↑ p) ↑ (q ↑ q)] ↑ [(p ↑ p) ↑ (q ↑ q)] ∼ ∵ pvq = (p ↑ q) ↑ (p ↑ q) (b) Show that RVS logically follows from the premises CV D,CV D → 7H, 7H(A ∧ 7B) and (A ∧ 7B) → (RV S) S). Solution: (i) CVD Rule P (ii) (CVD) → 7H Rule P (iii) 7H Rule T [by(i)& (ii)] P, P → 7Q ⇒ 7P (iv) 7H → (A ∧ 7B) Rule P (v) A ∧ 7B Rule T [by (iii) & (iv)] P, P → Q ⇒ 7R (vi) A ∧ 7B → RVS Rule P (vii) RVS Rule T [by (v) & (vi)] P, P → Q ⇒ P

University Solved Question Papers 18.

UQ.7

(a) Let X = {1, 2, 3.......20} and R = {(x, y) | x − y is divisible by 5} be a relation on X. Show that R is an equivalence relation and find the partition of X induced by R. Solution: Let a ∈ N then a - a = 0 is divisible by 5, and hence (a, a) ∈ R. Thus R is reflexive. Let (a, b) ∈ R. Then (a − b) is divisible by 5 and hence (b − a) is also divisible by 5. Then (b, a) belongs to R. ∴ R is symmetric. Let (a, b) ∈ R and (b, c) ∈ R then (a − b) and (b − c) are each divisible by 5. Hence (b − c) = (a − b) + (b − c) is also divisible by 5. i.e., (a, c) belong to R. R is transitive. Since R is reflexive symmetric and Transitive, R is, by definition, an equivalence relation. (b) Let f : x → y and g : y → z be any two invertible functions then prove that (go f )−1 = f −1 og−1 Solution: Since f and g are one- to - one functions, therefore we have f (x1 ) = f (x2 ) ⇒ x1 = x2 for all x1 , x2 ∈ R g(y1 ) = g(y2 ) ⇒ y1 = y2 for all y1 , y2 ∈ R (go f ) (x1 ) = (go f ) (x2 ) ⇒ g ( f (x1 )) = g ( f (x2 )) ⇒ f (x1 ) = f (x2 ) ⇒ x1 = x2 Also as f and g are both onto functions, so for each Z ∈ C, there exists y ∈ B such that g(y) = Z and f (x) = y for each x ∈ A. Thus Z = g(y) = g( f (x)) = (go f )(x). Hence each element Z ∈ C has preimpage under go f and therefore go f is an onto function. Since it has been proved that go f is one - one onto function, therefore (go f ) exists. This implies that if go f : A → c then (go f )−1 : C → A or g−1 o f −1 : C → A. (go f )−1 (z) = x ↔ (go f ) (x) = z ⇔ g ( f (x)) = z or g (y) = z y = g−1 (z)   ⇔ f −1 (y) = f −1 g−1 (z) = f −1 og−1 (z)  ⇔ x = f −1 og−1 (z)  (go f )−1 = f −1 og−1

UQ.8 19.

Discrete Mathematics (a) Find a grammar that generates the set of words {a n b2n /n ≥ 0 Solution: Here L = {an b2n /n ≥ 0} when n = 1 we have L = abb

∴ abb ∈ L

Then for any x ∈ L we have axbb ∈ L ∴ The production is S → asbb and S → abb. we have to apply the production S → aSbb as “n” times we get a n b2n . ∴ V = S, Σ = {a, b} and P = {S → abb, S → aSbb. (b) Construct a finite state automation that accepts all strings over {a, b} in which every a is followed by b. Solution: The simplest word as should be acceptable by the FSA. In this FSA requires three states S0 , S1 &S2 . a S0

a S1

b

a

S2 b

So FSA move from S0 to S1 when the input symbol is a. when the input symbol is b at S1 the FSA move to the accepting state which is So. When a O’s input at s1 , the FSA move to non-final trap state S2 . When b is input at so. FSA move to So itself. The input symbols a and b at S2 all FSA from S2 itself. 20.

(a) Represent the expression ((a + b) − ((c ∗ d) − (e/ f ))) ∗ a as a binary tree and write the prefin and postfin forms. Solution: First we have to draw the Binary tree of the above expression.

University Solved Question Papers

UQ.9

+

/

b

c

d

f

e

Prefix form: we have to separate Each root tree +

+

a

Prefix form is *-a *-+-a * - + ab - a * - + ab - */a * - + ab - * cd / a * - + ab - * cd / e f a

b

/

c

d

e

f

Post - order -a* +--a* ab + - - a * ab + * / - - a* ab + cd * / - - a * ab + cd * ef / - - a *

(b) Find the number of paths of length 4 from the vertex B to D in the simple graph G. Identify those paths from the graph.

Solution: Adjacency matrix

A

B

D

C

UQ.10

Discrete Mathematics

A B C D

        

A 0 1 1 1

B 1 0 0 0

Now, find the finding A44 . Now,  0  1 (A4 )2 =   1 1 3  0 =  1 1 

C 1 0 0 1

D 1 0 1 0

        

no.of paths between B and D which are length 4 by

1 0 0 0

1 0 0 1

 0 1 1   0  1 0 1  1 0 1 0 0

0 1 1 1

1 1 2 1

  3 0 1  0 1 1    1   1 1 2 1 1

1 0 0 1

  3 0 1   0   0 1 = 1   1 1 1 1 0

1 1 2 1

 1 A 1  = B 1  C 2 D

1 1 2 1

11  2   6 6 

 1 1   1  2

ABCD

2 3 4 4

6 4 7 6

 6 4   6  7

Now the element in the (2 − 4)t h entry of A 44 is 4. Hence there are 4 paths of length 4 from B to D in the graph G. The 4 paths can be seen as B→A→B→A→D B→A→C →A→D B→A→D→A→D B→A→D→C→D

and

University Solved Question Papers

UQ.11

Discrete Mathematics November 2009 Section - A 10 × 1 = 10 marks Answer ALL questions 1. Let A = {2, 4, 6, 8}B = {1, 3, 5, 7} then the universal set is (a) {1, 2, 3, 4, 5, 6, 7, 8} (b) {1, 2, 3, 4}

(c) {5, 6, 7, 8} (d) None of these

Ans: a

2. Let A = {a, b} and B = {c, d, a} then A ∪ B is (a) {a, b, c} (b) {a, b, c, d}

(c) {a} (d) None

Ans: b

3. A statement that is always true is called as (a) Tautology (b) Contradiction

(c) A logical false (d) A logical true

Ans: a

4. The conjunction of two statements P and Q is (a) P ∧ Q (b) P ∧ (P ∨ Q)

(c) P → Q (d) P ∨ Q

Ans: a

5. If S = {(a, b)(b, Joan)(2µ )(1, x)} then the domain of S is (a) {a, b, 2, 1} (b) {6, Joan, µ , x}

(c) {a, b} (d) None of these

Ans: a

6. Let A = {1, 2, 3} and R = {(1, 1)(1, 3)(2, 3)} then R−1 is (a) {(1, 1, )(3, 1)(3, 2)} (b) {(1, 2)(2, 2)(3, 3)}

(c) {(1, 1)(3, 1)} (d) {(1, 1)}

Ans: a

UQ.12

Discrete Mathematics

7. Type 1 grammar is also called. (a) Context- Sensitive (b) Context - Free

(c) Regular (d) None of these

Ans: a

8. The graph associated with a machine is called (a) block diagram (b) Transition diagram

(c) Hasse diagram (d) None of these

Ans: b

n edges 2 (d) 2n edges

Ans: a

(c) Hamilton path (d) None of these

Ans: b

9. A tree with n vertices has (a) (n-1)edges

(c)

(b) n edges 10. Euler path contains (a) Every vertex (b) Every edge

of G.

Section - B 5 × 5 = 25 marks 11.

(a) Show that A − (A ∩ B) = A − B Solution: Let x ∈ A − (A ∩ B). This implies that x ∈ A and (x 6∈ A ∩ B) = x ∈ A and (x 6∈ Aorx 6∈ B) (x ∈ Aandx 6∈ A) or (x ∈ Aandx 6∈ B) (x ∈ θ ) or [x ∈ A − B] ⇒ x ∈ θ ∩ (A − B) i.e. x ∈ A − B Hence A − (A ∩ B)CA − B

(1)

Again, let X ∈ A − B. This implies that x ∈ A and x 6∈ B or x ∈ A and x 6∈ A ∩ B. or x ∈ A − (A ∩ B) Hence (A − B)CA − (A ∩ B) From (i) and (ii) we have (A − B) = A − (A ∩ B).

(2)

University Solved Question Papers

UQ.13

(b) Show that (A ∩ B)0 = A0 ∪ B0 . Solution: Let x be any element of (A ∩ B). Then x ∈ (A ∩ B)C ⇔ x ∈ / (A ∩ B) ⇔x∈ / A or x ∈ /B ⇔ x ∈ Ac or x ∈ Bc ⇔ x ∈ A c ∪ Bc Hence (A ∩ B)c = Ac ∪ Bc 12.

hence proved. (a) Construct the truth table of (P ∨ Q) ∨ 7P P Q P ∨ Q 7P (P ∨ Q) ∨ 7P T T T F T T F T F T F T T T T F F F T T (b) Show that (7P ∧ (7Q ∧ R)) ∨ (Q ∧ R) ∨ (P ∧ R) ⇔ R P T T T T F F F F

13.

Q T T F F T T F F

R T F T F T F T F

7P F F F F T T T T

7Q F F T T F F T T

7Q ∧ R F F T F F F T F

7P ∧(7Q ∧ R) F F F F F F T F

Q∧R T F F F F F F F

P∧R T F F F F F F F

(a) Show that the fuctions f (x) = x3 and g(x) = x1/3 for x ∈ R are inverse of one another. Solution: For all real numebrs x, we have f og = f (g(x)) f (x1/3 ) = g(x3 ) g( f (x)) = g(x3 ) (x1/3 ) = x

UQ.14

Discrete Mathematics

7P ∧ (7Q ∧ R) ∨ (Q ∧ R) T F F F F F T F

7P ∧ (7Q ∧ R) ∨ (Q ∧ R) ∨ (P ∧ R) T F F F F F T F

7P ∧ (7Q ∧ R) ∨ (Q ∧ R) ∨ (P ∧ R ⇔ R) T T F T F T T T

We say that g is the inverse of f , written g = f −1 . Equivantely f , is the inverse of g, f = g−1 . (b) Let x = {1, 2, 3, 4} and R = {(x, y)/x > yy. Draw the graph of R and also given its matrix. Solution: R = {(2, 1, )(3, 1)(3, 2)(4, 1)(4, 2)(4, 3)} Graph 1

2

3

4

1234  0 0 0 1 2   1 0 0 Matrix = 3  1 1 0 1 1 1 4

14.

 0 0   0  0

(a) Define finite state machine and draw the model of infinite state machine. Finite state machine

A finite state machine is an abstract model of a machine which accept discrete inputs, produces discrete output and has the internal memory

University Solved Question Papers

UQ.15

to keep track of certain information about previous inputs. Thus a finite state machine M consists of six parts: i. ∑, finite set of input alphabet. Symbols ai (i = 1, 2, 3 · · · n) with or without subscripts are input symbols, i.e., ∑ = {a1 , a2 · · · · · · an }. ii. S, a finite set of internal states. Symbols Si (i = 1, 2, · · · · · · n) with or without subscripts are states. The states So is the initial state, i.e. S = {so , S1 , · · · · · · Sn }. iii. O a finite set of output alphabet i.e. O = {x, y, z}. iv. f, a transition (or next state) function or mapping from S × ∑ into S, i-e f : S × ∑ → S. This function describes the effect of input on the states during transition. v. g a output function from S × ∑ intoO, i.e g : S × ∑ → O. Such a machine is written as: M = {∑, S, So , O, f , g}. a a S1

S2 c

b b

a S3

S4 d

(b) Explain the context - sensitive grammar with example. Solution: A grammar G is said to be a context sensitive grammar if the production in G have the specialised from α1 Aα2 → α1 β α2 . Where A denotes non-terminal symbol and α1 , α2 and β are words (strings) in v. The name ‘context - sensitive’ comes from the fact that the non- terminal symbol A can be replaced by β in a word only when A lies between α1 and α2 . However, more often a grammar is said to be context sensitive. if productions merely are of the form α → β , where | α |=| β | or of the form α → λ .

UQ.16

Discrete Mathematics For an example, P = {s → b, s → aA, A → b, A → aA, A → bB, B → a, B → aB}

15.

here length of leftside of each production does not exceed the length of the right side, So G is a context sensitive or Type 1 grammar. (a) Prove that ∑ dG (v) = 2ε v∈v(G)

Solution: Let G be a graph with | E | edges and n vertices v1 , v2 · · · vn when we sum over the degrees of all the vertices. we count each edge (v i , v j ) twice. Once when we count it as (vi , v j ) in the degree of vi and again we count it as (v j , vi ) in the degree of v j . Then the conclusion follows ∑ deg (v) = 2 ∈ v∈v(4)

Example V2

V4

V1

V3

d(v1 ) = 2

V5

∑ degV = 2 + 3 + 3 + 2 + 2

d(v2 ) = 3

E =6

d(v3 ) = 3

2 ∈ = 2(6)

d(v4 ) = 2

= 12

d(v5 ) = 2 (b) Define degree of a vertex and find the degree of each vertex and find the degree of each vertex for the following graph. Solution: The degree of a vertex denoted by d(v) or deg(v) is the number of edges connected with it degree(v1 ) = 1 degree(v2 ) = 3 degree(v3 ) = 3 degree(v4 ) = 2

University Solved Question Papers

UQ.17

v2 v4

v1 v3 Section - C 16.

5 × 8 = 40 marks (a) A = {1}B = {a, b} and c = {2, 3} prove that (A ∪ B) × c 6= A × cA × (B ∨C) Solution: A ∪ B = {1, a, b} (A ∩ B) ×C = {(1, 2), (1, 3)(a, 2), (a, 3)(b, 2)(b, 3)}

(1)

B ∪C = {a, b, 2, 3} A × (B ∪C) = {(1, a)(1, 6)(1, 2)(1, 3)}

(2)

(1) 6= (2) hence proved. (b) Using Venn diagram to prove that A ∪ (B ∩C) = (A ∪ B) ∩ (A ∪C) ∪C). A ∪ (B ∩C) = (A ∪ B) ∩ (A ∪C) 17.

hence proved. (a) State and prove Demorgan’s law. Demorgan’s law for equivalence formula (i) γ (p ∧ q) ≡ (γ p) ∨ (γ q) (ii) γ (p ∨ q) ≡ (γ p) ∧ (γ q) p T T F F

q T F T F

p∧q T F F F

γ (p ∧ q) F T T T

γp F F T T

γq F T F T

(γ p) ∨ (γ q) F T T T

UQ.18

Discrete Mathematics A

B

A

B

A È (B Ç C )

(B Ç C ) C A

B

C A

A

B

B

C

C

C

(A È B )Ç (A È C )

AÈC

AÈ B

γ (p ∧ q) ≡ (γ p) ∨ (γ q) (ii) γ (p ∨ q) ≡ (γ p) ∧ (γ q) p T T F F

q T F T F

p∨q T T T F

γ (p ∨ q) F F F T

γp F F T T

γq F T F T

(γ p) ∧ (γ q) F F F T

γ (p ∨ q) ≡ (γ p) ∧ (γ q) hence proved. (b) Show that (P ∨ Q) ∧ 7(7p ∧ (7Q ∨ 7R)) ∨ (7p ∧ 7Q) ∨ (7p ∧ 7R) is a tautology. Solution:

University Solved Question Papers P T T T T F F F F

Q T T F F T T F F

R T F T F T F T F

P∨Q T T T T T T F F

7P ∧ (7Q ∨ 7R) F F F F F F F F (7P ∧ 7Q) ∨ (7P ∧ 7R) F F F F F T T T 18.

7P F F F F T T T T

7Q F F T T F F T T

7R F T F T F T F T

7(7P ∧(7Q ∨ 7R)) T T T T T T T T (P ∨ Q)∧ 7 (7P ∧ (7Q ∨ 7R)) T T T T T T F F

7Q ∨ 7R F T T T T T T T 7P ∧ 7Q F F F F F F T T

UQ.19

∧(7Q ∨ 7R) T F F F F F F F 7P ∧ 7R F F F F F T F T

(P ∨ Q)∧ 7 (7P ∧(7Q ∨ 7R)) (7P ∧7Q) ∨ (7P ∧ 7R) T T T T T T T T

Above statements are Tautology. (a) Let x = {1, 2, 3, · · · 7} and R = {(x, y)/x − y is divisible by 3 } show that R is an equivalence relation. Draw the graph of R. Solution: Here we have to prove that the given relation R satisfis the following three properties. (i) Reflexive (ii) Symmetric (iii) Transitive Given X = {1, 2, 3, 4, 5, 6, 7}

UQ.20

Discrete Mathematics we have to find out cartesian Product of X. ⇒ {1, 2, 3, 4, 5, 6, 7} × {1, 2, 3, 4, 5, 6, 7} 

    =    

(1, 1) (2, 1) (3, 1) (4, 1) (5, 1) (6, 1) (7, 1)

(1, 2) (2, 2) (3, 2) (4, 2) (5, 2) (6, 2) (7, 2)

(1, 3) (2, 3) (3, 3) (4, 3) (5, 3) (6, 3) (7, 3)

(1, 4) (2, 4) (3, 4) (4, 4) (5, 4) (6, 4) (7, 4)

(1, 5) (2, 5) (3, 5) (4, 5) (5, 5) (6, 5) (7, 5)

(1, 6) (2, 6) (3, 6) (4, 6) (5, 6) (6, 6) (7, 6)

(1, 7) (2, 7) (3, 7) (4, 7) (5, 7) (6, 7) (7, 7)

we know that R ⊆ X × X Herer R is defined as (x - y) is divisible by 3. Hence,     (1, 1)(1, 4)(1, 7)(2, 2)(2, 5)(3, 3)(3, 6)  R = (4, 1)(4, 4)(4, 7)(5, 2)(5, 5)(6, 3)(6, 6)     (7, 1)(7, 4)(7, 7)

Reflexive ∀x, (x, x)ε R (i.e) {(1, 1)(2, 2)(3, 3)(4, 4)(5, 5)(6, 6)(7, 7)}ε R Hence Relation R is a reflexive. Symmetric ∀, x, y(x, y)ε R ⇒ (y, x)ε R Because, (1, 4) ∈ R ⇒ (4, 1) ∈ R (1, 7) ∈ R ⇒ (7, 1) ∈ R (2, 5) ∈ R ⇒ (5, 2) ∈ R (3, 6) ∈ R ⇒ (6, 3) ∈ R (4, 1) ∈ R ⇒ (1, 4) ∈ R (4, 7) ∈ R ⇒ (7, 4) ∈ R Hence Relation R is a symmetric. Transitive ∀, x, y, z

         

University Solved Question Papers

UQ.21

(x, y) ∈ R, (y, z) ∈ R ⇒ (x, z) ∈ R. Because (1, 4) ∈ R and (4, 1) ∈ R ⇒ (1, 1) ∈ R (1, 7) ∈ R and (7, 4) ∈ R ⇒ (1, 4) ∈ R Hence the realtion R is transitive. ∴ Hence the given relation R is equivalence Relation. (b) Show that (go f )−1 = f −1 og−1 if f : x → y and g : y → z. Solution: Since f and g are one - to-one functions, therefore we have f (x1 ) = f (x2 ) ⇒ x1 = x2 for allx1 , x2 ∈ R g(y1 ) = g(y2 ) ⇒ y1 = y2 for ally1 , y2 ∈ R

(go f )(x1 ) = (go f )(x2 ) ⇒ g( f (x1 )) = g( f (x2 )) ⇒ f (x1 ) = f (x2 ) ⇒ x1 = x2 Also as f and g are both on to functions, so for each z ∈ C, there exists y ∈ B such that g(y) = z and f (x) = y for each x ∈ A. Thus z = g(y) = g( f (x)) = (go f )(x). Hence each element z ∈ C has pre - image under go f and therefore go f is an onto function. Since it has been proved that go f is one -one onto function, therefore (go f ) exists. This implies that if go f : A → C then (go f )−1 : C → A or g−1 o f −1 : C → A. (go f )−1 (z) = x ⇔ (go f )(x) = z ⇔ g( f (x)) = zorg(y) = z ⇔ y = g−1 (z) ⇔ f −1 (y) = f −1 (g−1 (z)) = ( f −1 og−1 )(z) ⇔ x = ( f −1 og−1 )(z) (go f )−1 = ( f −1 og−1 )

UQ.22 19.

Discrete Mathematics (a) Define i. ii. iii. iv. v.

Alphabet Sentential form language grammar Production rule

Alphabet An alphabet is non-empty finite set ∑ o f symbols. The word symbol used here is an abstract entity frequently expressed by using English letters or non-negative integers. Sentential form If W ∈ L(G) then the sequene S ⇒ w1 ⇒ w2 · · · ⇒ wn ⇒ w is the derivation of the sentence which does not contain any non -terminal symbol. The strings S,W1 ,W2 · · ·Wn which contain non- terminal symbols as well as terminals are called sentential forms of the derivation. Language For a given alphabet ∑, any subset of ∑∗ is called a language over ∑ and is denoted by L. This includes the subset φ also called empty language A string in a language L is called a sentence of ∑. Grammar A phrase structure grammar or simply a grammar G consist of four parts: V, ∑, S and P. where i. V is a finite set, also called vocabulary, whose elements are called variables. ii. ∑ is a finite subset of V whose elements are called terminals. iii. V ∩ ∑ = φ . iv. S is a special variable in the set V, called the start symbol that begins the generation of any sentence in the language. v. P is a finiteset whose elements are ordered pair (α , β ) usually written as α → β . Production rule P is a finite set whose elements are ordered pair (α , β ) usually written as α → β where α and β are strings (words) on V ∪ ∑ and has at least one non -terminal on its left side. Elements of P are called productions or production rules. These rules specify how sentence in the language can be made up. A grammar is denoted by G = (V, ∑, S, P).

University Solved Question Papers

UQ.23

(b) Prove that G(VN ,V, S, φ ) be a T3 grammar which generates the language L(G), then their exists finite. State acceptor M = hVT , Q, S, δ , Fi such that T (M) = L(G). Solution: The machine M that will be constructed is non deterministic with Q = VN ∪ {X}, where X 6∈ VN . The initial state of the acceptor is S, and its final state is X. For each production of the grammar, construct the mapping S in the following manner. (1) A j ∈ S(Ai , a) if there is a Production Ai → aA j in G. (2) X ∈ S(Ai , a) if there is a Production Ai → a in G. The acceptor M, when processing a sentence x, simulates a derivation of x in the Grammar G. we want to show that T(M) = L(G). Let x = a1 , a2 , · · · , am , m ≥ 1, be in the language L(G). Then there exists some derivation in G such that S ⇒ a1 A1 ⇒ · · · ⇒ a1 , a2 , · · · , am−1 Am−1 ⇒ a1 , a2 · · · am . Present State qo q1 q2

20.

Input Symbol a b {q0 , q1 } {q2 } {qo } {q1 } {q1 } {q0 , q1 }

for a sequence of non terminals A1 , A2 , · · · Am−1 . From the construction of S, it is clear that S(S, a1 ) contains A1 , S(A1 , a2 ) contains A2 , · · · and that S(Am−1 , am ) contains X. Therefore, x ∈ T (M) since S(S, x) contains X and X ∈ F. Conversely, if x ∈ T (M), then we can easily obtain a derivation in G which simulates the acceptance of x in M, thereby concluding that x ∈ L(G). (a) List tha all paths originating in node 1 and ending in node 3 for the following graph.

UQ.24

Discrete Mathematics Paths Paths 1 Paths 2 Paths 3 Paths 4 Paths 5 Paths 6

V1 −V2 −V3 V1 −V4 −V3 V1 −V2 −V4 −V3 V1 −V2 −V4 −V1 −V2 −V3 V1 −V2 −V4 −V1 −V4 −V3 V1 −V1 −V1 · · · −V2 −V3

(b) Define the adjacency matrix of a graph and draw the graphs of the following adjacency matrices. a b c  0 1 0 a  b  0 0 1 A1 = c  1 1 0 1 0 0 d

a b c  0 1 0 a  b  1 0 1 A2 = c  1 0 0 0 0 1 d

d  0 1   1  0

Graph for A1

a

b

c

d

a

b

c

d

Graph for A2

d  1 1   0  0

University Solved Question Papers

UQ.25

Discrete Mathematics April 2010 Section - A 10 × 1 = 10 marks 1. If A and B are three sets then A ∪ B is (a) A ∩ B

(c) A ∪ B

(b) A ∩ B

(d) A ∪ B

Ans: a

2. |A ∪ B| = (a) |A ∩ B|

(c) |A| − |B|

(b) |A| + |B|

(d) |A| + |B| − |A ∩ B|

Ans: d

3. Which one of the following is a logical statement? (a) Take two aspirins

(c) x + y = 8

(b) 3 − x = 5

(d) 2 + 3 = 5

Ans: d

4. Which of the following statement is the negation of the statement “2 is even Or -3 is negative”? (a) 2 is even or -3 is not negative (b) 2 is odd or -3 is not negative (c) 2 is even and -3 is not negative Ans: d

(d) 2 is odd and -3 is not negative

5. Let R be the relation defined in Z + as aRb if and only if a divides b, which of the following ordered pair belong to R. (a) (2,3)

(c) (5,6)

(b) (-6, 24)

(d) (10,11)

Ans: b

UQ.26

Discrete Mathematics

6. Let f : A → B be any function, then IB of = (a) f

(c) IA

(b) IB

(d) none of these

Ans: a

7. Every type O language is (a) Context free language

(c) Regular language

(b) Context sensitive language

(d) none of the above

Ans: d

8. Every finite state machine has a · · · · · · · · · associated with it. (a) group

(c) monoid

(b) semigroup

(d) none of the above

Ans:a

9. Let (T,V0 ) be a rooted tree, then (a) (b) (c) (d)

There are no cycles in T There is one cycle in T There are more than one cycle in T none of the above

Ans: a

10. The path that begins and ends at the same vertex is called

11.

(a) Tree

(c) Bridge

(b) Circuit

(d) none of the above

Ans: b

Section B - (5 × 5 = 25 marks) (a) Prove that A ∩ (B ∪C) = (A ∩ B) ∪ (A ∩C) Solution: Let x be an arbitrary element of A ∩ (B ∪C). Then x ∈ A ∩ (B ∪C) ⇔ x ∈ A and (B ∪C) ⇔ x ∈ A and (x ∈ BOrx ∈ c) ⇔ (x ∈ Aandx ∈ B)Or(x ∈ Aandx ∈ c) ⇔ x ∈ (A ∩ B) Or x ∈ (A ∩C) ⇔ x ∈ (A ∩ B) ∪ (A ∩C) Hence A ∩ (B ∪C) = (A ∩ B) ∪ (A ∩C)

University Solved Question Papers

12.

UQ.27

(b) Prove that A = A and A ∩ A = φ . Let x ∈ (Ac )c ⇒ x 6∈ Ac ⇒x∈A A∩A Let x ∈ A ∩ Ac ⇒ x ∈ A and x ∈ Ac ⇒x∈φ Since there is no element x satisfying both x ∈ A and x ∈ Ac therefore A ∩ Ac = φ (a) Compute the truth table of the statement. (P ⇒ q) ⇔ (∼ q ⇒∼ P) Solution: P

q

P⇒q

∼q

∼p

∼ q ⇒∼ p

T T F F

T F T F

T F T T

F T F T

F F T T

T F T T

(p ⇒ q) ⇔ (∼ p ⇒∼ p) T T T T

(b) Prove that (p ∧ q) ⇒ p is a tautology. p T T F 13.

q T F T

p∧q F F F

(p ∧ q) ⇒ p T T T

It is a tautology. (a) The relation R on A, the collection of real number, is defined as a Rb iff 2a + 3b = 6, Find the Dom(R) and Ran (R). Solution: R = {(3, 0), (0, 3), (0, 2)} Dom(R) = {0, 3} Ran(R) = {0, 2, 3} (b) Let f be a function from A → B where A = B = R and f (a) = find f −1 .

2a − 1 , 3

UQ.28

Discrete Mathematics Solution: 2a − 1 3 2a − 1 y= 3 3y = 2a − 1

f (a) =

2a − 1 = 3y 2a = 3y + 1 3y + 1 a= 2 Now f

14.



3y+1 2

−1 3y + 1 =2 2 3 3y + 1 − 1 3y = =y 3 3







Thus the element 3y+1 in the f image of the element of the given 2 function. (a) Write the regular expression over alphabet {a, b, c} containing atleast one a and which is the first letter. a) since L(r) = L(a)L((b))∗ L((c))∗ Consists of all words in a, b, c with a as first letter, therefore it contains exactly one a which is the first letter. The regular expression. r = ab∗ c∗ (b) Write a CFG, which general palindrome for prinary numbers. Solution: The grammar will generate palindrone for binary numbers, that is 00, 010, 001100, · · · · · · · · · Let G be the CFG G = (Vn ,Vt , P, S) Vn = {S} Vt = {0, 1} Any production rule P is defined as S → 0S0/1S1 S → 0/1/ ∈

University Solved Question Papers 15.

UQ.29

(a) Draw the complete graph on seven vertices. Solution: A complete graph with ‘n’ vertices is denoted by kn and has 12 (n)(n − 1) edges. A complete graph with 7 vertices is denoted by K7 and has 1 42 1 ⇒ 21edges = (7)(7 − 1) = (7)(6) = 2 2 2 The required graph

V2 V1

V5

V7 V3

V4

V6

(b) Draw all possible unordered trees on the set S = {a, b, c}2 k = unordered Tree 23 = 8

16.

Section - C (5 × 8 = 40) (a) Show that if A ⊆ B and B ⊆ C then A ⊆ C Proof Suppose A, B and C are sets and A ⊆ B and B ⊆ C. To show that A ⊆ C. We must show that every element in x ∈ A is in x ∈ B. But given any element in A, that element is in x ∈ x(becauseA ⊆ B) and so that element is also A ⊆ B and B ⊆ C. Hence A ⊆ C

UQ.30

Discrete Mathematics (b) Draw a venn diagram to represent A ∩ B and A ∩ B B

A

U

B

A

AÇ B

B

B

A

U

B

A

A’

17.

U

U

A

B’

B

U

A’ Ç B’

(a) Make a truth table for (∼ P ∧ q) ∨ P. p T T F F

q T F T F

∼p F F T T

(∼ p ∧ q) F F F F

(∼ p ∧ q) ∨ p T T F F

(b) Let n be an integer. Prove that if n2 is odd, then n is odd. Solution: Assume that n is odd. Then n = 2k + 1 for an integer k. Squaring both sides of the equation we get, n2 = (2K + 1)2 = 4k2 + 4k + 1 = 2(2K 2 + 2k) + 1

18.

2k2 + 2k is an integer, let’s Say r. So n2 = 2r + 1 and hence n2 is odd. This prove that if n is odd integer, then n2 is an odd integer is equivalent to if n is not odd then n2 is not odd. (a) Show that if R and S are relations on a set A, then. Prove that (R ∩ S)−1 = R−1 ∩ S−1 . Solution:

University Solved Question Papers

UQ.31

Let (a, b) ∈ (R ∩ S)−1 ⇔ (b, a) ∈ R ∩ S ⇔ (b, a) ∈ R and (b, a) ∈ S ⇔ (a, b) ∈ R−1 and (a, b) ∈ S−1 ⇔ (a, b) ∈ R−1 ∩ S−1 Hence, (R ∩ S)−1 = R−1 ∩ S−1

19.

(b) Let R be a relation on set A. Then prove that R is the transitive closure of R. Solution: We need to prove that R∞ is transitive and also that it is the smallest transitive relation containing R. If a, b ∈ A. Then aR∞ b if and only if there exists a path in R from a to b. If aR∞ b, and bR∞ c, then we can say that aR∞C. This is because aR∞ b means that there exists a path from a to b in R, similarily bR∞C means that there exists a path from b to c in R. Hence there will also exist a path from a to c in R. This proves that R∞ is transitive. Now let us consider a transitive relation S i.e. R ⊆ S. is transitive we can say that Sn ⊆ S∀n . n Now S∞ = ∪∞ n=1 S . Hence, ∞ S ⊆ s. Since R ⊆ s, therefore R∞ ⊆ s∞ , and as S∞ ⊆ S, we can say that R∞ ⊆ S. This means that R∞ is the smallest of all transitive relations on A that contain R. As R∞ satisfies both the properties, we can say that R∞ is the transitive closure of R on set A. This completes our proof. (a) Show that the following grammar ambiguous S → AB/aaB A → a/Aa B→b Solution: Leftmost derivation 1 : S → AB → AaB (since A → Aa) → aaB (since A → a) → aab (since B → b)

UQ.32

Discrete Mathematics Leftmost derivation 2 :

S → aaB → aab (since B → b) S

S

B

A

B

a a

a

A

a

a

a

Fig.: Parse tree W = aab As the string W = aab gets two parse trees as depicted in the below figure, The grammar G is ambiguous. (b) Design, a FA that accepts strings containing exactly 1 over alphabet {0, 1, }. Answer: Strings like 0, 01, 101, etc. 1 q3

1 q1

1

q2

20.

0,1

(a) Prove that a tree with n vertices has n − 1 edges. Solution: We shall prove this theorem by mathematical induction on the number of vertices, n in T. suppose the theorem is true for n = k(≥ 2), where k is some positive integer. To prove that the result is also true for n = k +1, suppose T has K +1 vertices. If we remove an edge with end points U and V from T, then we are left with two sub trees T1 (V1 , E1 )

University Solved Question Papers

UQ.33

and T2 (V2 , E2 ) such that |V | = |V1 | + |V2 |and |E| = |E1 | + |E2 | + 1 Obviously T1 and T2 are connected with no cycles, and having vertices less than n. (i.e.,) |V1 | ≤ n and |V2 | ≤ n. This means that we can apply induction process on T1 and T2 to give |E1 | = |V1 |; |E2 | = |V2 | − 1 |V | = |V1 | + |V2 | = (|E1 | + 1) + (|E2 | + 1) = (|E1 | + |E2 | + 1) + 1 = (|E| + 1) |E| = (|V1 | − 1) + (|V2 | − 1) + 1 = (|V1 | + |V2 |) − 1 = K +1−1 = K This implies that T has K edges, which is the required number, Hence theorem is proved. (b)

i. Draw a complete binary tree with height 3. Solution: V0 V1

V3

V7

V2

V5

V4

V8

V9

V10

V11

V6

V12

V13

V14

Level Vertices 1 2 2 4 3 8 ii. Let T be a complete m-ary tree with n vertices, i.e., |V | = n. If T has i internal vertices and l leaves, then, Prove that n = mi + 1. Solution:

UQ.34

Discrete Mathematics Since T is a complete m-ary, therefore, its each vertex has m children. Thus, the total number of vertices will be mi, expect the root vertex, where i is the internal vertex. This implies that T has n = mi + 1.

Discrete Mathematics November 2010 Section - A 10 × 1 = 10 marks Answer ALL questions 1. ———- means A ⊆ B and A 6= B (a) Subset

(c) Improper subset

(b) Proper subset

(d) Non of these

Ans: B

2. If A = {0, 2, 4, 9} and B = {0, 3, 6, 8, 9} then A − B is——(a) {2, 4}

(c) {0, 9}

(b) {3, 6, 8}

(d) None of these

Ans: B

3. If P : x = 3 then x 6= 3 is ——— (a) Negation of P

(c) Disjunction of P

(b) Conjunction of P

(d) None of these

Ans: A

4. ———- is a compound statement that always true. (a) Contradiction

(c) Negation

(b) Tautology

(d) None of these

Ans: B

5. Symmetric relation means ———(a) aRb ⇒ bRa

(c) aRa

(b) aRb ∧ bRa ⇒ a = b

(d) None of these

Ans: A

6. A function f : A → B and f (x) = y for every x ∈ A, then f is ———— function. (a) Identity

(c) One to one f

(b) Constant

(d) Many to

Ans: C

UQ.36

Discrete Mathematics

7. A ———– grammar contains only productions of the form α → β where |α | ≤ |β |. (a) Context-sensitive

(c) regular

(b) Context-free

(d) None of these

Ans: B

8. A sentence generated by a grammar is ambiguous if there exists ———syntax free. (a) only one

(c) atleast one

(b) more than one

(d) none of these

Ans: B

9. A vertex is pendent if its degree is ———(a) 0

(b) 1

(c) 2

(d) 3

Ans: B

10. ———- means a walk begins and ends at the same vertices. (a) closed walk

(c) path

(b) open walk

(d) none of these Section - B

11.

Ans: A

(5 × 5 = 25) marks

(a) Prove that the intersection of sets is idempotent. Solution: If A is any set, then A ∩ A = A. Let x be an arbitrary element of the set A ∩ A. Then x ∈ A ∩ A ⇔ x ∈ A and x ∈ A ⇔ x∈A Hence, A ∩ A = A. (b) Prove that A − (A − B) = A ∩ B Solution: To prove this result, let x ∈ A − (A − B) ⇔ x ∈ A and x ∈ / (A − B) ⇔ x ∈ A and x ∈ / (A ∩ Bc ) [A ∩ Bc = A − B] ⇔ x ∈ A and (x ∈ / A and x ∈ / Bc )

University Solved Question Papers

UQ.37

⇔ x ∈ A and (x ∈ / A and x ∈ / B) ⇔ x ∈ A and (x ∈ / A and x ∈ B) ⇔ x ∈ φ and x ∈ (A ∩ B) ⇔ x ∈ A∩B

[x ∈ / φ]

Hence, A − (A − B) = A ∩ B. 12.

(a) Construct the truth table prove that ∼ (P ∧ q) =∼ PV ∼ q. Solution: P T T F F

q T F T F

P∧q T F F F

∼ (P ∧ q) F T T T

∼P F F T T

∼q F T F T

∼ PV ∼ q F T T T

∼ (P ∧ q) =∼ PV ∼ q Hence proved. √ (b) Show that 5 + 2 is an irrational number. Solution: √ √ Let 5 + 2 = r be a rational number. Then 2 = r − 5. Since r and 5 are rational numbers, therefore, r − 5 is also a rational number. This √ implies that 2 is a rational number, which is a contradiction √ √ because 2 is an irrational number. Thus, the assumption that 5 + 2 must be false and hence, the given number is irrational. 13.

(a) Draw the Hasse diagram of the Posest (A, ⊆) where A = {a, b}. P(A) = {φ , {a}, {b}, {a, b}} Hasse diagram

(b) Show that the composition of functions obeys associative law. Solution:

UQ.38

Discrete Mathematics Let x be an arbitrary element of set A. Then [(hog)o f ](x) = (hog)[ f (x)] = (hog)(y) = h[g(y)] = h(z) =x∈A Again, let [ho(go f )](x) = h[(go f )(x)] = h[g{ f (x)}] = h[g(y)] = h(z) = x ∈ A Hence (hog)o f = ho(go f ).

14.

(a) The language L(G4 ) = {an ban /n ≥ 1} generated by the grammar G4 = h{s, c}, {a, b}s, φ i where φ is the set of productions s → aCa, C → aCa,C → b. Find the L(G). Solution: S ⇒ aCa aaCaa aaaCaa Apply the production in times we get ⇒ anCan ⇒ an ban

(∴ c → b)

Hence an ban ∈ L(G) for all n ≥ 1 ∴

L(G) : {an ban ; n ≥ 1}

(b) Given Σ = {a, b, c} find L∗ for (a) (c) L = {a, b, c3 } Solution:

L = {b2 } (b)

(a) L∗ = {bn : n is even number including λ } (b) L∗ = {a, b}

L = {a, b}

University Solved Question Papers

UQ.39

(c) L∗ consists of all words from Σ and the length of each maximal subwords are composed of C’s divisible by 3. 15.

(a) Find all simple paths from vertex V1 to V3 and also find the length of the shortest path for the following graph. Solution: Simple path means there is no edge is repeated more than once. Shortest path Path 1: V1 −V4 −V5 −V3 Path 2: V1 −V4 −V2 −V5 −V3 The length of the shortest path is 3 (i.e.,) V1 −V4 −V5 −V3 (b) Explain i. Regular graph ii. Complementary graph (i) A graph in which every vertex has the same degree is called a regular graph. If every vertex has degree r, then graph is called a regular graph of degree r. Examples for regular graph which six vertices

(ii) Let G be a loop-face undirected graph with n vertices. The complement of G denoted as G is the subgraph of kn consisting of the n vertices in G and all edges that are not in G. That is, if G = kn0 then G is a graph consisting of n vertices and no edges.

UQ.40

Discrete Mathematics Section - C

16.

(5 × 8 = 40) marks

(a) Prove that the commutative properties on sets. The properties of commutative sets are i. The union of sets is commutative. ii. The intersection of sets is commutative. 1. The union of sets is commutative If A and B are any two sets, then A ∪ B = B ∪ A. For proving A ∪ B = B ∪ A. We shall prove A ∪ B ⊆ B ∪ A ⊆ A ∪ B. Let x be an arbitrary element of A ∪ B. Then x ∈ A ∪ B ⇒ x ∈ A or x ∈ B ⇒ x ∈ B or x ∈ A ⇒ x∈B ∴ A∪B ⊆ B∪A

(1)

Again, let y ∈ B ∪ A. Then y ∈ B ∪ A ⇒ y ∈ B or y ∈ A ⇒ y ∈ A or y ∈ B ⇒ y ∈ A∪A ∴ B∪A ⊆ A∪B From (1) and (2), we have A ∪ B = B ∪ A. 2. The intersection of sets is commutative If A and B are any two sets, then A ∩ B = B ∩ A. Let x ∈ (A ∩ B) ⇔ x ∈ A and x ∈ B ⇔ x ∈ B and x ∈ A ⇔ x ∈ B∩A

Hence A ∩ B = A ∩ A. (ii) Prove that i. (A ∪ B)c = Ac ∩ Bc ii. (A ∩ B)c = Ac ∪ Bc

(2)

University Solved Question Papers

UQ.41

Solution: Let x be any element of (A ∪ B). Then x ∈ (A ∪ B)c ⇔ x ∈ ∪ and x ∈ / (A ∪ B) ⇔ x ∈ ∪ and (x ∈ / A or x ∈ / B) ⇔ (x ∈ ∪ but x ∈ / B) and (x ∈ ∪ but x ∈ / B) ⇔ x ∈ Ac and x ∈ Bc ⇔ x ∈ A c ∩ Bc Hence, (A ∪ B)c = Ac ∩ Bc . (ii) (A ∩ B)c = Ac ∪ Bc Let x be any element of (A ∪ B)c . Then x ∈ (A ∩ B)c ⇔ x ∈ / (A ∩ B) ⇔ x∈ / A or x ∈ /B ⇔ x ∈ Ac or x ∈ Bc ⇔ x ∈ A c ∪ Bc Hence, (A ∩ B)c = Ac ∪ Bc . 17.

(a) Using the truth table prove that (P ∧ q) ∨ r = (P ∨ r) ∧ (q ∨ r). Solution: P q r P ∧ q (P ∧ q) ∨ r P ∨ r q ∨ r (P ∨ r) ∧ (q ∨ r) T T T T T T T T T T F T T T T T T F T F T T T T T F F F F T F F F T T F T T T T F T F F F F T F F F T F T T T T F F F F F F F F Since (P ∧ q) ∨ r and (P ∨ r) ∧ (q ∨ r) are identical therefore, two statements are logically equivalent. (b) Explain tautology and contradiction with an example. Tautology Tautology is a compound statement if it is true for all truth value assignments for its component statements. Obviously, the truth table of a tautology will contain only T entries in the last column. For an example, consider the following statements. (P ∧ q) ⇒ q

UQ.42

Discrete Mathematics P T T F F

q T F T F

P∧q T F F F

(P ∧ q) ⇒ q T T T T

Since the statement (P ∧ q) ⇒ q has its truth value T for all its entries in the truth table. Hence, it is a tautology. Contradiction If a compound statement is false for all true value assignments for its component statements, then it is called a contradiction, i.e., a compound statement is said to be contradicting its truth value of if its false (F) for all its entries in the truth table. if a statement is a contradiction, then its negation will be a tautology. Let consider the statement, (P ∧ q)∧ ∼ (P ∨ q) P T T F F

q T F T T

P∧q T F F F

P∨q T T T F

∼ (P ∨ q) F F F F

(P ∨ q)∧ ∼ (P ∨ q) F F F F

Since the statement has its false values (F) for all its entries in the last column of the truth table. Therefore, it is a contradiction. 18.

(a) The relation R on the set S of all real numbers is defined as: aRb if and only if 1 + ab > 0. Show that this relation is reflexive and symmetric but not transitive. Solution: (a) Let a be any real number. Then 1 + aa = 1 + a2 > 0, since a2 ≥ 0. Therefore aRa for all a ∈ S. Thus R is reflexive. (b) Let a, b ∈ S. Then aRb ⇒ 1 + ab > 0 ⇒ 1 + ba > 0 ⇒ bRa

[Since ab = ba, for real numbers

Thus, R is symmetric. (c) Consider three real numbers as: 1, −1/2 and −4. Now we have 1 + 1(−1/2) = (1/2) > 0.

University Solved Question Papers

UQ.43

Therefore 1R(−1/2) Further 1 + (−1/2)(−4) = 3 > 0. Therefore (−1/2)R(−4). But 1 + 1(−4) = −3 < 0. Therefore, 1 is not related to −4. Thus, 1R(−1/2), (−1/2)R(−4) is not implying that 1R(−4). Hence, R is not transitive. (b) Let f , g and h be functions from N to N where N is the set of natural numbers. So that f (x) = x + 1, g(x) = 2x and h(x) = 1. Determine (i) f o f (ii) f og (iii) goh (iv) go f . Solution: f (x) = x + 1, g(x) = 2x, h(x) = 1 (i)

fof ⇒

f [ f (x)] f [x + 1] x+1+1 ⇒x + 2

(ii)

fof = x+2

f og ⇒

f [g(x)] f [2x]

f og = 2x + 1

⇒2x + 1 (iii) goh ⇒ g[h(x)] g[1]

goh = 2

=2 (iv) go f ⇒ g[ f (x)] g[x + 1] ⇒ 2(x + 1) ⇒ 2x + 2

go f = 2x + 2

UQ.44 19.

Discrete Mathematics (a) Explain (i) Context free (ii) Regular grammars Context free grammars A grammar G is said to be context free if productions are of the form A → d. That is, the left side is a single non-terminal symbol and the right side is a word in one or more symbols. The name ‘context free’ comes from the fact that the non-terminal symbol A on the left of a production can be replaced in a string β where ever A appears. For an example, consider the language L = {an bm : n 6= m}. Find context free grammar G which generates L. When n = m, the grammar G with productions S → ab, S → aSb will generate L. When n > m, we first generate a string with equal number of a’s and b’s and then add these extra a’s on the left. This gives S → AS1 , S1 → aS1 b.S1 → λ , A → aA, A → a. When n < m, the set of productions with the same reasoning is: S → AS1 , S → S1 B, S1 → aSb, S1 → λ , A → aA, A → a, B → bB, B → b. In all these cases G is context - free language since each left side is a single non-terminal symbol. Regular grammars A grammar G is said to be regular if productions are of the form A → a or A → aB. or S → λ , where A and B are non-terminal symbols and ‘a’ is a terminal symbol. That is, in this type of grammar the left side is a single non-terminal symbol and the right side is either a single terminal symbol or a terminal symbol followed by a nonterminal symbol. For an example, construct regular grammar to generate the following languages. i. {al bm cn : l, m, n ≥ 1} The grammar’s are S → aA, A → aA, A → bB, B → bB, C → cC, C → c. ii. {(ab)n : n ≥ 1} The regular grammars are S → aA, A → bS, S → aB, B → b (b) Prove that a language L be accepted by a nondeterministic finite-state acceptor, then there exists an equivalent deterministic finite state acceptor that accepts L. Proof:

University Solved Question Papers

UQ.45

Let M = {Σ, S, f , S0 , F} be a n f a accepting L. Then we construct a d f a M 0 = {Σ, S0 , f 0 , S0 , S00 , F 0 } such that. i. The states of M 0 are all subsets of the set of states of M, i.e., S0 = 2s . The elements of the state in S0 are denoted by S0 = [S1 , S2 , · · · Si ] where S1 , S2 , · · · Si belong to S. ii. S00 = [S0 ] iii. F 0 is the set of all subsets of S containing an element of F. iv. [S1 , S2 , · · · , Si ] is the single state of d f a corresponding to a set of states of n f a. Observe that a string W ∈ L(M) provided a final state is one of the possible states that reaches on processing the string W . Thus, a final state in n f a is any subset of S containing some final state of n f a. Let us now define f 0 f 0 ([S1 , S2 , · · · Si ], a) = f (S1 , a) ∪ f (S2 , a) · · · ∪ f (Si , a) = {t1 ,t2 , · · · ,t j } i f and only i f . f ({S1 , S2 , · · · Si }, a) = (t1 ,t2 , · · ·t j ) i.e., f 0 applied to an element [S1 , S2 , · · · Si ] of S0 computed by applying f to each state of S represented by [S1 , S2 , · · · Si ]. By applying f to each of S1 , S2 , · · · Si and taking their union, we get a new set of states t1 ,t2 , · · ·t j . The new set so obtained has an element {t1 ,t2 · · ·t j } ∈ S0 . This element represent the value of f 0 ([S1 , S2 , · · · Si ], a). It is easy to prove by induction, the length |w| of the input string w that f 0 (S00 , w) = {S1 , S2 , · · · , Si } if and only f (S0 , w) = {S1 , S2 · · · Si } if |w| = 0, then it implies that f (S0 , λ ) = {S0 } and by definition of f 0 , we get f 0 (S0 , λ ) = S00 = [S0 ]. So, w must be λ . Suppose the result is true for all input strings u of length |u| ≤ m. Let w = ua be a string of length m + 1, where |u| = m and a ∈ Σ. Suppose f (S0 , u) = {t1 ,t2 · · ·t j } and f (S0 , ua) = {r1 , r2 , · · · , rk }. Since |u| ≤ m, therefore by induction hypothesis we have f 0 (S00 , u) = [t1 ,t2 , · · · ,t j ] Also

f (S0 , ua) = f ( f (S0 , u), a) = f ({t1 ,t2 , · · · ,t j }, a) = {r1 , r2 , · · · , rc }

UQ.46

Discrete Mathematics Hence, f 0 (S00 , ua) = f 0 ( f 0 (S00 , u), a) = f 0 ((t1 ,t2 · · ·t j ), a) = {r1 , r2 · · · rk } This proves that f 0 (S00 ua) = {r1 , r2 · · · rk } if and only if f (S0 , ua) = {r1 , r2 · · · rk }. Thus by induction f 0 (S00 , ua) is true for all input strings w. To complete the proof, let x ∈ L(M) provided f (S0 , ω ) ∈ F. But it is true only if f 0 (S0 , w) ∈ F 0 . So, x ∈ L(M) ⇔ x ∈ L(M 0 ) and hence L(M) = L(M 0 ) and d f a accept L.

20.

(a) Prove that the number of vertices of odd degree in a graph is always even. Solution: Let G be a graph with n vertices. Among these some may have odd degree and some may have even degree. n



∑ d(Vi ) = ∑ d(V j )+ ∑ d(Vk ) i



odd n

even

i

even

∑ d(V j ) = ∑ d(Vi ) − ∑ d(Vk )

odd

= 2q-even number using the sum of the degree of all the vertices in a graph G is equal to twice the number of edges. Where q is the number of edges of G. But 2q- an even number is even. ∴ ∑ d(V j ), which is a sum of odd numbers is even. odd

∴ Number of terms in ∑ d(V j ) is even i.e., Number of vertices with odd degree is even.

odd

(b) Explain Adjacency matrix with an example. The adjacency matrix also called sequential representation method is suited to represent a graph G. A graph G with n vertices and m a graph G. A graph G with n vertices and m edges is said to be dense when representation of requires Kn2 . Adjacency matrix representation, stores the graph G consist of n vertices and no parallel edges, in the order v1 , v2 , · · · vn as an n × n matrix A = [ai j] defined as:  if vertex vi is adjacent to vertex v j  1 ai j = i.e., there is an edge between vi and v j   0 Otherwise

University Solved Question Papers V4

V4

V3

V5

V1

(i) Undirected graph

For an example The Adjacency matrix for the above graph   v1 v2 v3 v4 v5  v1   0 1 1 0 0    v2  1 0 1 1 0    A = v3  1 1 0 1 1    v4  0 1 1 0 1    v5  0 0 1 1 0 

UQ.47

UQ.48

Discrete Mathematics

Discrete Mathematics April 2011 Section - A 10 × 1 = 10 marks Answer ALL questions 1. If A = set of all natural numbers B = set of all even natural numbers Then A ∪ B ——– (a) A

(c) φ

(b) B

(d) None of these

Ans : a

2. If A and B are any two sets then (a) A ⊆ A ∪ B

(c) Both a and b

(b) B ⊆ A ∪ B

(d) None of these

Ans : c

3. If P : x = 3 then ∼ P is ——(a) x = 3

(c) x = 4

(b) x 6= 3

(d) None of these

Ans : b

4. p ⇒ q is true if and only if (a) P is true and q is false (b) Both p and q are true (c) Both p and q are false Ans : b and c

(d) None of these

5. Let R and S be two relations. The intersection of R and S x(R ∩ S)y = —— ——– (a) xRy ∧ xSy

(c) xRy

(b) xRy ∨ xSy

(d) None of these

Ans : a

University Solved Question Papers

UQ.49

6. Let A and B be two non-empty sets. If f is one - one onto function from AtoB turn f −1 : B → A is (a) One-one

(c) Both(a) and (b)

(b) onto

(d) None

Ans : c

7. If ` is a regular expression then its closure expression ell is —— (a) a expression

(c) regular expression

(b) empty expression

(d) None

Ans : c

8. A Grammars G is said to be context free if production are of (a) A → α

(c) A → αβ

(b) A → αβ

(d) None of these

Ans : a

9. A vertex is said to be pendent vertex if its degree is —— (a) One

(c) Two

(b) Zero

(d) None of these

Ans : a

10. The number of vertices in a binary tree is always (a) even

(c) n

(b) odd

(d) none of these

Ans :b

Section-B (5 × 5 = 25 marks) 11.

(a) Prove that A − B and A ∩ B are mutually disjoint. Solution: To prove (A − B) ∩ (A ∩ B) = φ , let x ∈ (A − B) ∩ (A ∩ B) ⇔ x ∈ (A − B)andx ∈ (A ∩ B) ⇔ (x ∈ Aandx 6∈ B)and(x ∈ Aandx ∈ B) ⇔ x ∈ Aandx ∈ φ ⇔x∈φ

UQ.50

Discrete Mathematics (b) If A and B are any two sets then prove that A ∪ B = (A − B) ∪ B. To prove the result, let x ∈ A ∪ B ⇔ x ∈ AOrx ∈ B ⇔ x ∈ BOrx ∈ A ⇔ (x ∈ B Or x ∈ A) and (x ∈ B Or x 6∈ B) [Since x ∈ B or x 6∈ B is always a true statement] ⇔ x ∈ R or (x ∈ A and x 6∈ B) ⇔ x ∈ B or x ∈ (A − B) ⇔ x ∈ (A − B) or x ∈ B ⇔ x ∈ (A − B) ∪ B Hence, A ∪ B = (A − B) ∪ B

12.

(a) Construct the truth table for the following statement (p ∨ q) ∨ (∼ q) p T T F F

q T F T F

(p ∨ q) T T T F

∼q F T F T

(p ∨ q) ∨ (∼ q) T T T T

(b) Show that (p ∧ q)∧ ∼ (p ∨ q) is a contradiction. p T T F F 13.

q T F T F

p∧q T F F F

p∨q T T T F

∼ (p ∨ q) F F F T

(p ∧ q)∧ ∼ (p ∨ q) F F F F

It is a contradiction. (a) Let A = {1, 2, 3}B = {a, b, c} and c = {x, y, z} and let R1 = {(1, a)(2, c)(3, a)(3, c)}R2 = {(b, x), (b, z), (c, y)} find R1 oR2 , MR1 , MR2 . R1 = {(1, a)(2, c)(3, a)(3, c)} R2 = {(b, x), (b, z), (c, y)} R1 oR2 , =

University Solved Question Papers

1 MR1 = 2 3

a MR2 = b c



a 1 0 1

b 0 0 0

c 0 1 1





x 0 1 0

y 0 0 1

z 0 1 0



     

     

UQ.51

     

     

(b) Let N be the set of all natural numbers and A be the set of even natural numbers. Consider f : N → A such that f (x) = 2x for all x ∈ N. show that f is one-one and onto. Solution: i. One-one function To show f to be a one-one function. Let x1 , x2 ∈ N to be different elements then x1 6= x2 ⇒ 2x1 6= 2x2 ⇒ f (x1 ) 6= f (x2 ) Let x1 = 1, x2 = 2 f (x1 ) = 2(1)2 f (x2 ) = 4, ∴ f (x1 ) 6= f (x2 ) ∴ f is one-one function. ii. onto function Let y = 2x be any arbitrary element in A. Then we may write y y y = x Now, f = 2( ) = y. 2 2 2 This shows that for every element y ∈ A. There exists pre -image in the domain set N. 14.

(a) Let L1 = {a, b} and L2 = {b, c} be languages over ∑ = {a, b, c} find (L1 ∪ L2 )∗ (L1 ∩ L2 )∗ (L1 ∪ L2 )∗ = set of all strings in ∗

∑ = {a, b, c}∗

L1 ∩ L2 = {b}

So (L1 ∩ L2 )∗ = {bn : n ≥ 0}

UQ.52

Discrete Mathematics (b) Construct regular grammar to generate the following language {a 2n , n ≥ 1} {a2n : n ≥ 1} when n = 1 we get aa. when n = 2 we get aaaa. ∴ The production in the form of S → aA, A → as S → aB, B → a ∴ S ⇒ aA ⇒ aaS ⇒ aaaA ⇒ aaaaS

15.

Apply the production ‘n’ times we get {a2n , n ≥ 1} ∴ ∑ = {a}V = {S, A, B} P = {S → aA, A → aS, S → aB, B →} (a) Draw the connected regular graphs of degrees 0,1,2.

(i) 0 - regular

(ii) 1 - regular

Fig: Connected regular graph - 2

(b) Determine the number of loops and multiple edges in a multi graph G from its adjacency matrix   1 1 2 0  1 2 1 3     2 1 0 1  Draw the graph G and check your answer. 0 3 1 0 Solution: Since adjacency matrix A is a square matrix of order 4. Graph G has 4 vertices, v1 , v2 , v3 , v4 . The diagonal of A is indicating the vertices

University Solved Question Papers

V1

V2

V3

V4

UQ.53

having loops because these entries indicate the no.of edges origination and terminating at the same vertex. The graph is Thus there are 3 loops at one at vertex v1 and two at vertex v2 . Multiple edges: Add the no.of. entries > 1, below the main diagonal and add the no.of. entries > 1, along the main diagonal. main diagonal is also included since multiple loops are also multiple edges. Thus there are 7 multiple edges. 2 edges from v3 to v1 . 2 edges from v4 to v2 . 2 loops at v2 .

16.

Section - C (5 × 8 = 40 marks) (a) If A and B are any two sets. Then show that A ∪ B = A ∩ B if and only if A = B. Solution: Suppose A ∪ B = A ∩ B. Then to show that A = B, let x ∈ A ⇔ x ∈ Aorx ∈ B ⇔ x ∈ A∪B ⇔ x ∈ A∩B

[sinceA ∪ B = A ∩ B]

⇔ x ∈ A and x ∈ B ⇔x∈B Thus A ∪ B = A ∩ B ⇒ A = B (1) Conversely, suppose that A = B. Then to show that A ∪ B = A ∩ B, let x ∈ A ∪ B ⇔ x ∈ A or x ∈ B ⇔ x ∈ A or x ∈ A ⇔x∈A

[sinceA = B]

UQ.54

Discrete Mathematics ⇔ x ∈ A and x ∈ A ⇔ x ∈ A and x ∈ A

[sinceA = B]

⇔ x ∈ A∩B Thus A = B ⇒ A ∪ B = A ∩ B

(2)

Hence, From (1) and (2), we get A∪B = A∩B ⇔ A = B (b) In a survey of 60 people if its found that 25 like to drink milk, 26 coffee and 26 tea. Also 9 like both milk and tea, 11 like milk and coffee, 8 like coffee and tea and 8 like none of three. Find the number of people who like all the three drinks. Give n(u) = 60 n(M) = 25 n(c) = 26 n(7) = 26 n(M ∩ T ) = 9

n(M ∩C) = 11 n(C ∩ T ) = 8 n(M ∪C ∪ T )C = 8 n(M ∩C ∩ T ) =? n(u) = n(M ∪C ∪ T ) + n(M ∪C ∪ T )C 60 = n(M ∪C ∪ T ) + 8 60 − 8 = n(M ∪C ∪ T ) 52 = n(M ∪C ∪ T )

We know that n(M ∪C ∪ T ) = n(M) + n(C) + n(T ) − n(M ∩C) − n(C ∩ T ) − n(M ∩ T ) + n(M ∩C ∩ T ) 52 = 25 + 26 + 26 − 11 − 8 − 9 + n(M ∩C ∩ T ) 52 = 77 − 28 + n(M ∩C ∩ T ) 52 = 49 + n(M ∩C ∩ T ) 52 − 49 = n(M ∩C ∩ T ) 3 = n(M ∩C ∩ T )

University Solved Question Papers 17.

18.

UQ.55

(a) If p and q are two statements, then prove that ∼ p ∨ (p ⇔ q) ≡ p ⇒ q p q ∼ p p ⇔ q ∼ p ∨ (p ⇔ q) p ⇒ q T T F T T T T F F F F F F T T F T T F F T T T T ∼ p ∨ (p ⇔ q) ≡ p ⇒ q hence verified. (b) Symbolize the following expression “for any given positive integer, there is a greater positive integer”. Solution: Given any positive integer, there is a greater positive integer. (∀x) [if Px then there is a positive integer greater than x] ∀x [if Px then (∃y) (Py and Lxy)] Then we finish up by symbolizing the rest of the expression as in the prepositional Calculus. (∀x)[Px → (∃y)(Py and Lxy)] (a) Let X = {1, 2, 3 · · · 7} and R = {(x, y)/x, y, ∈ x and x − y is divisible by 3}. Show that R is an equivalence relation. Solution: Given that A = {1, 2, 3, 4, 5, 6, 7} and R = {(x, y) : x − y is divisible by 3} i. Reflexive: There exists an element x ∈ A such that x − x is divisible by 3. This shown that (x, x) ∈ A for all x ∈ A. Hence, R is reflexive. ii. Symmetric: Let x, y ∈ A and (x, y) ∈ R. This means, x − y is divisible by 3. i.e., x − y = 3m1, where m1 is any integer. This implies that y − x = 3m2, where m2 is also an integer. Since y − x is divisible by 3, R is symmetric. iii. Transitive: Let x, y, z ∈ A. Also Let x − y = 3m1 and y − z = 3m2, where m1 and m2 are integers. Adding these two equations, we have, x − z = 3(m 1 + m2 ) where m1 + m2 is also an integer. So x − z is also divisible by 3 or (x, z) ∈ R. Thus R is transitive. Hence, R is an equivalence relation. (b) xRy ↔ x − y is even, defined on the set Z. Solution: Reflexive : For allx, x − x = 0 which is even.

UQ.56

Discrete Mathematics Symmetric : Suppose xRy This means that x − y is even, say x − y = 2h for some h ∈ z. Then y − x = −2h 2 (- h) which is even, so y R x. Transitive : Suppose xRy and yRz. This means that x − y = 2h for some h ∈ z. and h ∈ Z and y − z = 2k for some k ∈ z. Now x − z = (x − y) + (y − z) = 2h + 2k = 2(h + k)

19.

which is even Hence xRz. (a) Design a finite state machine that performs serial addition. Solution: The serial binary adder accepts pair of digits one by one with least significant digits come first. Thus, the set of input alphabets is ∑ = {00, 01, 10, 11} and the set of output alphabet is O = {0, 1}. Given an input of pair of digits xy, we observe that either x and y are additive with no carry or x and y are additive with a carry bit 0 (Or 1) to the next column. Thus, a finite - state machine will have two states: S = { carry (c), no carry (n)} with n as the starting state. The functions f and g are shown in the Table and state diagram. State n C

00,0 01,0 10,0

00 n n

f (Input) 01 10 11 n n c c c c 11,0

n

C

00 0 1

g(Output) 01 10 11 1 1 0 0 0 1

01,0 10,0 11,1

00,1 State diagram

In the figure we observe that if input is 00 to n, then the output is 0 and remains in state n; if input is 11 to n, then there is a carry 1 and output is O and therefore there is a change in the state from n to c.

University Solved Question Papers

UQ.57

From the above table we observe that, for example, f (n, o1) = n and g(n, 01) = 0 because n indicates a carry of 1 from. The addition of the previous bits. The input 01 indicates that we are adding O and 1 (and carrying 1). Thus the sum is 10 and g(n, 01) = 0 for the O in 10. The carry is remembered in n = f (n, 01). (b) Consider the context free grammar with production. S → bAs, S → b, A → as. Find the derivation tree of the word w = babbabb. S

b S

S A

b A

b

a a

S S b b

20.

(a) Find the adjacency matrix and incidence matrix of the multigraph given below. v1

v2 e3

e1 e4

e2 v3

e5 e6 e7 v4

v5 e8

Graph v5 v1

v2

v4

v3

UQ.58

Discrete Mathematics Adjacency matrix V V 1 2 0 0  0 1   1 0   0 1 1 1

V1 V2 V3 V4 V5

V3 1 0 0 1 0

V4 0 1 1 0 1

1 1 0 1 0

V5      

Incidence matrix

V1 V2 V3 V4 V5

          

e1 1 0 1 0 0

e2 1 0 0 0 1

e3 0 1 0 0 0

e4 0 1 0 0 1

e5 0 1 0 1 0

e6 0 0 1 1 0

e7 0 0 0 1 1

e8 0 0 0 1 1

          

(b) Suppose the pre-order and in order search of a binary tree T yields the following sequence of vertices (nodes) In order

D

Pre order A

B

B

P

H Q S E A C R K

D

root node E H P Q S C F K R L

F

L

root node

Draw the binary tree. Find depth of T and descendants of vertex B. Solution: Since the root of the binary tree T is the first vertex in pre-order search, therefore, we choose vertex A as the root vertex of T . To find left child of root vertex A first mark in inorder search all nodes that are to the left of A. These vertices constitute a sub-tree TL of A. The left sub-tree TL consists of the vertices D, B, P, H, Q, S and E which are to the left of root vertex A. Then left child of A is then obtained by choosing the next vertex (root) in the pre-order, i.e., vertex B. This vertex is to the left of A in order search. Thus B is the leftchild of A.

University Solved Question Papers

UQ.59

Similarly, the right sub-tree TR of root vertex A consist of the vertices C,R,K, F and L and C is the root of TR i.e. C is the right child of T. To draw the tree as shown in the below figure repeat the above process for each new vertex until all the nodes of preorder search are considered.

B C E

D

F H K L Q

R

P S

The depth (height ) of T is 5 and descendants of B are D, E, H, p, Q, S.

UQ.60

Discrete Mathematics

Discrete Mathematics November 2011 Section - A 10 × 1 = 10 marks Answer ALL questions 1. If A = {2, 5, 6, 7}B = {1, 2, 3, 4} then A − B is —— (a) B − A

(c) {5, 6, 7}

(b) φ

(d) {1, 3, 4}

Ans : c

2. The dual of A ∪ (A ∩ B) = A is —(a) A ∩ (A ∪ B) = A

(c) A ∪ (A ∪ B) = A

(b) A ∩ (A ∩ B) = A

(d) A ∪ (A ∩ B) = A

Ans : a

3. Which of the following is not a statement? (a) (b) (c) (d)

Is 2 a positive number? x2 + x + 1 = 0 There will be show in June If stock prices fall, then I will lose money

Ans : a

4. If p and q are statements, the conjunction of p and q is ——(a) p ∧ q

(c) 7p ∧ q

(b) p ∨ q

(d) p ∧ 7q

Ans : a

5. A relation in a set A is said to be void relation provided R = ——— (a) A × A

(c) φ

(b) A × B

(d) None of these

Ans : c

6. Let A = {1, 2, 3} Define f : A → A such that f = {(1, 2), (2, 1), (3, 3)} then f −1 (a) {(1, 2)(2, 1)}

(c) {(1, 2)(2, 1)(3, 3)}

(b) {(3, 3)}

(d) None of these

Ans : c

University Solved Question Papers

UQ.61

7. If ∑ = {0, 1, 2}, w = 01212 then |w| = ——— (a) 4

(c) 2

(b) 5

(d) None of these

Ans : b

8. If a and b are strings of length m and n respectively, then the concatenation of a with b = ——— (a) m + n

(c) n

(b) m

(d) None of these

Ans : a

9. The adjacency matrix of a null graph is ——– (a) identity matrix

(c) Square matrix

(b) a null matrix

(d) None of these

Ans : b

10. A tree is a connected graph without ——

11.

(a) Self loops

(c) Cycles circuit

(b) Parallel edges

(d) None of these

Ans : c

Section - B (5 × 5 = 25 marks) (a) Draw a venn diagram to illustrate A ∪ (B − A) = A. Solution: LHS : A ∪ (B − A) A È (B - A )

B-A B

A

(1)

B

A

(2)

A È (B - A ) ¹ A A

RHS

(b) ∪ = {a, b, c, d, e, f , g, h} A = {a, c, f , g} B = {a, e}

B

(3)

UQ.62

Discrete Mathematics Compute A ∪ B and A ∩ B A ∪ B = {a, c, e, f , g} A ∪ B = {b, d, h} A ∩ B = {a} A ∩ B = {b, c, d, e, f , g, h}

12.

(a) Write down the truth table for the following: (p → q) ↔ (7p ∨ q) p T T F F

q T F T F

(p → q) T F T T

(7p) F F T T

(7p ∨ q) T F T T

(p → q) ↔ (7p ∨ q) T T T T

(b) Verify whether (P ∨ q) ∨ 7(p ∧ q) is a contradiction or tautology. p T T F F 13.

q T F T F

p∨q T T T F

p∧q T F F F

7(p ∧ q) F T T T

(p ∨ q) ∨ 7(p ∧ q) T T T T

It is a tautology. (a) Find the domain, range, matrix of the relation R, A = {1, 2, 3, 4, 5}, aRb if and only if a ≤ b. Solution: R = {(1, 1)(2, 2)(3, 3)(4, 4)(5, 5)(1, 2) (1, 3)(1, 4)(1, 5)(2, 3)(2, 4)(2, 5) (3, 4)(3, 5)(4, 5)} domain = {1, 2, 3, 4, 5} Matrix 1 2 M= 3 4 5

1 1  0   0   0 0 

2 1 1 0 0 0

3 1 1 1 0 0

4 1 1 1 1 0

5  1 1   1   1  1

University Solved Question Papers

UQ.63

(b) Consider the functions f : R → R and g : R → R defined by f (x) = x 2x + 1g(x) = , R is set of real numbers. Verify (go f )−1 = f −1 og−1 . 3 Solution: x f (x) = 2x + 1 g(x) = 3 go f ⇒ g[ f (x)] = g[2x + 1] 2x + 1 = 3 3x −1 (go f )−1 (x) = 2 x−1 −1 g−1 (x) = 3z f (x) = 2 ( f −1 og−1 )(x) ⇒ 3x − 1 f −1 (3z) = 2 −1 −1 −1 (go f ) = f og hence proved 14.

(a) Let L1 = {a, b} and L2 = {b, c} be languages over ∑ = {a, b, c}. Find (L1 ∪ L2 ) and (L1 ∩ L2 )∗ Solution: (L1 ∪ L2 )∗ = Set of all strings in ∗

∑ = {a, b, c}∗

L1 ∩ L2 = {b}

So(L1 ∩ L2 )∗ = {bn : n ≥ 0} (b) Consider the grammar G with v = {S, A, B}, ∑ = {a, b} and P = {S → AB, S → bA, A → a, B → ba}. Find L(G). Solution: S ⇒ AB ⇒ aB ⇒ aba Also S ⇒ bA ⇒ ba

UQ.64

Discrete Mathematics Thus L(G) = {abc, ba}

15.

(a) Give three different elementary paths from v1 to v3 for the digraph given below. Is there any cycle in the graph? V4

V1

V2

V3

The below elementary paths represented vertex v1 to v3 . v1 − v 4 − v 3 v1 − v 2 − v 4 − v 3 v1 − v 2 − v 3 No, there are any cycle in the graph. (b) Prove that an indirected simple graph is a tree if and only if there is a unique path between any pair of its vertices. Proof If we have a graph T which is a tree, then it must be connected with no cycles. Since T is connected there must be at least one simple path between each pair of vertices. If there is more than one path between two vertices, then parts of those paths could be joined to form a cycle. Thus, there must be exactly one path. Now suppose we have a graph G where there exactly one simple path between vertices. This graph is clearly connected. If G contains a simple circuit, then there are two paths between any vertices on that circuit. Thus contradicts the assumption, So there can be no circuits, and G is a tree. Section - C (5 × 8 = 40 marks) 16.

(a) Show that A − (B ∪C) = (A − B) ∩ (A −C) Solution: Let x be any arbitrary element of A − (B ∪C). Then

University Solved Question Papers

UQ.65

x ∈ A − (B ∪C) ⇔ x ∈ A and x 6∈ (B ∪ c) ⇔ x ∈ A and (x 6∈ B or x 6∈ C) ⇔ (x ∈ A but x 6∈ B) and (x ∈ A but x 6∈ C) ⇔ x ∈ (A − B) and x ∈ (A −C) ⇔ x ∈ (A − B) ∩ (A −C) Hence A − (B ∪C) = (A − B) ∩ (A −C) (b) In a survey of 260 computer science students, the following data were obtained: 94 like to work in USA, 64 like to work in UK, 58 like to work in India, 28 like UK and India, 26 USA and UK, 22 USA and India, and 14 like all the three places. How many students like only India? Solution: n(US) = 94 n(UK) = 64 n(In) = 58

n(UK ∩ In)= 28 n(US ∩ UK) = 26 n(US ∩ In)=22

n (US ∩ UK ∩ In) = 14 UK

US

94

U = 260

64

26 14 28

22 58

India

From the above venn diagram No.of. students like only India = n(In) − (22 + 14 + 28)122 − 64 = 58

UQ.66 17.

Discrete Mathematics (a) Establish the validity of the argument. P⇒r r⇒s r∨ ∼ s ∼ t ∨u ∼u −−−− ∴ ∼p Solution: 1. p ⇒ r, r ⇒ S 2. p⇒s 3. t∨ ∼ s 4. ∼ s∨t 5. s⇒t 6. ⇒t 7. ∼ t ∨u 8. t ⇒u 9. p⇒u 10. ∼ u 11. ∴ p

Premises. From (1), law of syllogism. Premises From (3) From (4) because ∼ s ∨ t ⇔ S ⇒ t From (2) and (5), law of syllogism. Premise From (7) because ∼ t ∨ u ⇔ t ⇒ u From (6) and (8), law of syllogism Premise From (9) and (10), modus Tollens.

(b) Given the following open statements. p(x) :> 0, q(x) : x is odd, r(x) : x is a perfect square, t(x) : x is divisible by 2. write the following statements in symbolic form. i. ii. iii. iv.

At least one integer is odd. There exists a positive integer that is odd. If x is odd then x is not divisible by 2. No odd integer is divisible by 2.

Solution: i. ii. iii. iv. 18.

∃xq(x) ∃x[P(x) ∧ q(x)] ∀x[q(x) ⇒∼ t(x)] ∀x[q(x) ⇒ t(x)]

(a) Let N be the set of all natural numbers. The relation R on the set N ×N of ordered pairs of natural numbers is defined as (a, b)R(c, d) if and only if ad = bc. Prove that R is an equivalence relation.

University Solved Question Papers

UQ.67

Solution: a) R is reflexive,since for each (a, b) ∈ N × N, we have ab = ba. i.e. (a, b)R(b, a) b) Let (a, b)R(c, d). The ad = bc ⇒ cb = da. Thus (c, d)R(a, b), and R is symmetric. c) Let (a, b)R(c, d) and (c, d)R(e, f ). Then ad = bc and c f = de. thus (ad)(c f ) = (bc)(de) dividing on both sides by dc, we get.a f = be, i.e. (a, b)R(e, f ) Therefore, R is transitive. Since R is reflexive, symmetric and transitive, therefore R is an equivalence relation. (b) Let f , g and h be functions from I to I, where I is the set of integers, so that f (x) = x + 5, g(x) = x − 2 and h(x) = x3 . Define. (i) f og (ii) f oh Solution: f og ⇒ f [g(x)] f [x − 2] x−2+5 f og = x + 3 f oh ⇒ f [h(x)] f [x3 ] f oh = x3 + 5 19.

(a) Construct a finite state automation that accepts all string over {a, b} in which every a is followed by b. Solution: The simplest word as should be acceptable by the FSA. In this FSA requires three states So, S1 and S2 . a a S0

S1 b

a

S2 b

So FSA move from So to S1 when the input symbol is a when the input symbol is b at S1 the FSA move to the accepting state which is

UQ.68

Discrete Mathematics So . When a O’s input at S1 , the FSA move to non-final trap state S2 . When b is input at So. FSA move to So it self. The input symbols a and b at S2 all FSA from S2 itself. (b) Draw a transition of the non- deterministic finite state automation whose transition function table is given below. f State 0 S0 {S0 , S1 } S1 φ S2 {S1 , S2 } Solution:

1 {S2 } {S1 } φ

The transition diagram of n f a is shown in the below figure 0

S0

20.

1

0

0

S1

S2

(a) Find the adjacency matrix and incidence matrix of the given graph. e5 V1

V4

e2

e6 e3 e1

e7

V5 e7

V2

e4

V3

Adjacency matrix

v1 v2 A = v3 v4 v5

v 1 0  1   0   1 1

v2 1 0 1 0 0

v3 1 1 0 1 1

v4 1 0 1 0 1

v5  1 0   1   1  0

University Solved Question Papers

UQ.69

Incidence Matrix v1 v2 M = v3 v4 v5

     

e1 1 1 0 0 0

e2 1 0 0 0 1

e3 1 0 1 0 0

e4 0 1 1 0 0

e5 1 0 0 1 0

e6 0 0 0 1 1

e7 0 0 1 0 1

e8 0 0 1 1 0

     

(b) Consider the binary Tree T given below. Search Tusing Pre-order, inorder and post order algorithms. A

B

E

C

D

F

G H I

Preorder ABD ABC D ABC E D ABC E DF G ABC E DF GH I The Preorder of the above binary Tree is A B C E D F G H I Postorder BDA CBDA ECBDA ECBF GDA ECBF HIGDA The Postorder of the given binary Tree is E C B F H I G D A

UQ.70

Discrete Mathematics Inorder BAD BC AD BECAD BECAF DG BECAF GHGI The Inorder of the given binary tree is represented as follows B E C A F G H G I.

University Solved Question Papers

UQ.71

Discrete Mathematics April 2012 Section - A 10 × 1 = 10 marks Answer ALL questions 1. If A = {0, 2, 4, 9} and B = {0, 3, 6, 8, 9} then (a) A − B = B − A

(c) A − B 6= B − A

(b) A − B = A

(d) None of these

Ans: (b)

2. If A = {1, 2} then P(A) is ——— (a) 2

(c) 3

(b) 4

(d) none of these

Ans: (b)

3. If P : x = 3 then ∼ P is ——— (a) x 6= 3

(c) x > 3

(b) x < 3

(d) none of these

Ans: (a)

4. If p and q are two statement then NORing of p and q is denoted by (a) p ↓ q

(c) p ⊕ q

(b) p ↑ q

(d) none of these

Ans: (a)

5. If aRb and bRc then aRc is ——— (a) reflexive

(c) transitive

(b) symmetric

(d) none of these

Ans: (c)

6. Injective function is ——— function (a) One-to-one (b) onto (c) both one-to-one and onto (d) none of these

Ans: (a)

UQ.72

Discrete Mathematics

7. Context-free grammar is also called ——— grammar. (a) Type 0

(c) Type 2

(b) Type 1

(d) none of these

Ans: (c)

8. Finite state machines can recognize strings of ——— languages only. (a) Context - sensitive

(c) regular

(b) Context free

(d) none of these

Ans: (c)

9. A vertex is said to be ——— vertex if its degree is one. (a) Pendant

(c) even

(b) isolated

(d) none of these

Ans: (a)

10. A tree with n vertices has ——— edges (a) n − 2

(c) n

(b) n − 1

(d) none of these

Ans: (b)

Section - B 5 × 5 = 25 marks 11.

(a) Prove that A − (B ∪C) = (A − B) ∩ (A −C). Solution: Let x be any arbitrary element of A − (B ∪C). Then x ∈ A − (B ∪C) ⇔ x ∈ A and x ∈ / (B ∪C) ⇔ x ∈ A and (x ∈ / B or x ∈ / C) ⇔ (x ∈ A but x ∈ / B) and (x ∈ A but x ∈ / C) ⇔ x ∈ (A − B) and x ∈ (A −C) ⇔ x ∈ A(A − B) ∩ (A −C) Hence A − (B ∪U) = (A − B) ∩ (A −C). (b) Using venn diagram to prove that A ∪ B = (A − B) ∪ B.

University Solved Question Papers 12.

UQ.73

(a) Define conjunction and disjunction with an example. Conjunction When two or more statements are joined by the connective, denoted by the symbol, ∧, the compound statement so formed is called a conjunction. Example: p ∧ q p T T F F

q T F T F

p∧q T F F F

Disjunction When two or more statements are joined by the connective or denoted by the symbol, v, the compounds statement, so formed is called disjunction of two statements p and q and is written as p or q or p ∨ q. Example: p ∨ q p T T F F

q T F T F

p∨q T T T F

(b) Over the universe of animals let A(x) : x is a whole; B(x) : x is a fish; C(x) : x lives in water. Translate. i. ∃x(∼ C(x)) ii. (∃x)(B(x)∧ ∼ A(x)) iii. (∀x)(A(x) ∧C(x)) ⇒ B(x) Solution: i. There exists an animal which does not live in water. ii. There exists a fish that is not a whole. iii. Every whole that lives in the water is a fish.

UQ.74 13.

Discrete Mathematics (a) Show that the relation subset defined on the power set P(A) of the set A is a partial order relation. Solution: To prove the relation, Ra partial order relation we prove that the following three properties hold. i. Reflexive: For any element A1 ∈ P(A). We have A1 ⊆ A1 , which is true because of the definition of subset. Hence, R is reflexive. ii. Anti-symmetric: Let A1 , A2 ∈ P(A) be any two different subsets of set A, such that A1 ⊆ A2 . But A2 ⊆ A2 . But A2 ⊆ A1 is not possible unless A1 = A2 . Hence R is anti-symmetric. iii. Transitive: Let A1 , A2 , A3 ∈ P(A) be any three different subsets of the set A such that A1 ⊆ A2 and A2 ⊆ A3 . It obviously follows that A1 ≤ A3 . Hence R is transitive. Since all three properties of partial order relation are satisfied, therefore the given relation is partial order relation. (b) Show that the composition of functions obeys associative law. Solution: Let x be an arbitrary element of set A. Then [(hog)o f ](x) = (hog)[ f (x)] = (hog)(y), because y = f (x), for x ∈ A, y ∈ B = h[g(y)] = h(z) =x∈A

[since z = g(y), for all y ∈ B, z ∈ C]

Again let [ho(go f )](x) = [(go f )(x)] = h[g{ f (x)}] = h[g(y)] = h(z) =x∈A Hence (hog)o f = ho()go f 14.

(a) The language L(G) = {an bam /n, m ≥ 1} is generated by the grammar G = ({S, A, B,C}, {a, b}, S, φ ) where the set of productions is S → aS, S → aB, B → bC,C → aC,C → a derive the sentence a2 ba3 .

University Solved Question Papers

UQ.75

Solution: The sentence a2 ba3 has the following derivation S ⇒ aS ⇒ aaB ⇒ aabC ⇒ aabaC ⇒ aabaaC ⇒ aabaaa (b) Explain the finite state machine. Finite state machine A finite - state machine is an abstract model of a machine which accept discrete inputs, produces discrete output and has the internal memory to keep track of certain information about previous inputs. At any instant of time the machine can be is any of the finite number of states. The next state of the machine at any point on time is determined by the present state and subsequent input and produces an output. Thus a finite - state machine M consist of Six Parts: i. ∑, finite set of input alphabets. Symbols ai (i = 1, 2, 3 · · · n) with or without subscripts are input symbols, ie, ∑ = {a1 , a2 · · · an }. ii. S, a finite set of internal states. Symbols Si (i = 1, 2, · · · n) with or without subscripts are states. The states so is the initial state, ie, S = {S0 , S1 · · · Sn }. iii. O a finite set of output alphabet, ie, O = {x, y, z}. iv. f , a transition (or next - state) function or mapping from S × ∑ into S, ie, f : S × ∑ → S. This function describes the effect of input on the states during transition. v. g a output function from S × ∑ into O, i.e., g : S × ∑ → o.Such a machine is written as : M = {∑, s, s0 , o, f , g} 15.

(a) Prove that the number of vertices of odd degree in a graph is always even. Solution: Let G be a graph with n vertices. Among these some may have odd degree and some may have even degree.

UQ.76

Discrete Mathematics

n

∴ ∑ d(vi ) = ∑ d(v j ) + ∑ d(vk ) i

odd n

even

∴ ∑ d(v j ) = ∑ d(vi ) − ∑ d(vk ) odd

i

even

= 2q − even number The sum of the degrees of all the using vertices in a graph G is equal to twice the number of edges. Where q is the number edges of G, But 2q - an even number is even. ∴ ∑ d(v j ), which is a sum of odd numbers, is even. odd

∴ Number of terms in ∑ d(v j ) is even odd

i.e., Number of vertices with odd degree (odd vertices) is even. (b) Find all simple paths from vertex V1 to V3 and also find the length of the shortest path. v1

v2

v3

v6 v4

v5

Solution: Simple path means there is no edge is repeated more than once. Shortest Path Path 1 : V1 −V4 −V5 −V3 Path 2 : V1 −V4 −V2 −V5 −V3 The length of the shortest path is 3. (ie), V1 −V4 −V5 −V3 . Section C = (5 × 8 = 40 marks) 16.

(a) Prove that: i. Union is distributive over intersection. ii. Intersection is distributive over union.

University Solved Question Papers

UQ.77

Solution: i. If A, B and C are any three sets, then A ∪ (B ∩C) = (A ∪ B) ∩ (A ∪C) Let x be an arbitrary element of A ∪ (B ∩C). Then x ∈ A ∪ (B ∩C) ⇔ x ∈ A or x ∈ (B ∩C) ⇔ x ∈ A or (x ∈ B and x ∈ C) ⇔ (x ∈ A or x ∈ B) and (x ∈ A or x ∈ C) ⇔ x ∈ (A ∪ B) ∩ (A ∪C) Hence A ∪ (B ∩C) = (A ∪ B) ∩ (A ∪C) ii. If A, B and C are any three sets, then A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩C). Let x be an arbitrary element of A ∩ (B ∪C). Then x ∈ A ∩ (B ∪C) ⇔ x ∈ A and x ∈ (B ∪C) ⇔ x ∈ A and (x ∈ B or x ∈ C) ⇔ (x ∈ A and x ∈ B) or (x ∈ A and x ∈ C) ⇔ x ∈ (A ∩ B) or x ∈ (A ∩C) ⇔ x ∈ (A ∩ B) ∪ (A ∩C) Hence A ∩ (B ∪C) = (A ∩ B) ∪ (A ∩C) (b) If A = {1, 3, 5}B = {2, 4, 6, 8}C = {2, 5, 10} and U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} Verity i. (A ∩ B)C = AC ∪ BC ii. (A ∪ B)C = AC ∪ BC Solution: L.H.S A ∩ B = {φ } (A ∩ B)C = U − φ = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

(1)

UQ.78

Discrete Mathematics R.H.S AC = ∪ − A = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} − {1, 3, 5} AC = {2, 4, 6, 7, 8, 9, 10} BC = ∪ − B = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} − {2, 4, 6, 8} C

B = {1, 3, 5, 7, 9, 10} C

A ∪ BC = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

(2)

(1) = (2) hence proved (ii) (A ∪ B)C = ∪ − A ∪ B (A ∪ B) = {1, 2, 3, 4, 5, 6, 8} (A ∪ B)C = {7, 9, 10}

(1)

AC = {2, 4, 6, 7, 8, 9, 10} BC = {1, 3, 5, 7, 9, 10} AC ∩ BC = {7, 9, 10} (1) = (2) hence proved. 17.

(a) Make truth table for (p ↓ q) ∧ (p ↓ r) Solution: p q r p ↓ q p ↓ r (p ↓ q) ∧ (p ↓ r) T T T F F F T T F F F F T F T F F F T F F F F F F T T F F F F T F F T F F F T T F F F F F T T T (b) State and prove equivalence formula for Demorgan’s laws Demorgan’s law for equivalence formula. i. ∼ (p ∧ q) ≡ (∼ p) ∨ (∼ q) ii. ∼ (p ∨ q) ≡ (∼ p) ∧ (∼ q)

(2)

University Solved Question Papers p T T F F

q T F T F

p∧q T F F F

∼ (p ∧ q) F T T T

∼p F F T T

∼q F T F T

UQ.79

(∼ p) ∧ (∼ q) F T T T

∼ (p ∧ q) ≡ (∼ p) ∧ (∼ q) (ii) ∼ (p ∨ q) ≡ (∼ p) ∧ (∼ q) p q p ∨ q ∼ (p ∨ q) ∼ p T T T F F T F T F F F T T F T F F F T T

∼q F T F T

(∼ p) ∧ (∼ q) F T F T

∼ (p ∨ q) ≡ (∼ p) ∧ (∼ q) 18.

(a) If R is the set of real numbers then show that the function, f : R → R defined by f (x) = 5x3 − 1 is one - one function and onto function. Solution: To show f to be a one-one function, let x1 , x2 ∈ R (domain set) be two different elements. Then x1 3 5x1 − 1

6= x2 6= 5x23 − 1

⇒ f (x1 ) 6= f (x2 ) This shows that different elements in R have different f - images in R. hence f is one-one. To show that f is an onto function, let y = 5x3 − 1 be any arbitrary element in R. 1  (y + 1) 3 , which is a real number for all Then we may write x = 5 values of y ∈ R. " " 1 #  1 #3 (y + 1) 3 (y + 1) 3 f =5 −1 5 5   (y + 1) −1 =5 5 = (y + 1) − 1 =5

UQ.80

Discrete Mathematics This shows that for every element y ∈ R (range set) there exists per image in the domain set R of f . Thus f is an onto function, and hence f is one-one onto function. (b) A relation R on the set of integers, I is defined as aRb if and only if (a − b) is divisible by m. Show that R is an equivalence relation. Solution: R is reflexive for each a ∈ I. Also (a − b) is divisible by m and henceb − a = −(a − b) is also divisible by m. Thus, aRb ⇒ bRa Therefore, R is symmetric. For a, b, c ∈ I, we have aRb and bRc ⇒ a − b and b − c are both divisible by m. This implies that (a − b) + (b − c) is divisible by m or (a − c) is divisible by m or aRc. Therefore, R is transitive. Since R is reflexive, symmetric and transitive, therefore R is an equivalence relation.

19.

(a) Explain the different types of grammars. Grammars are classified according to the types of productions that are allowed to define them. The following classifications is due to Noam Chomsky. i. A grammar G is said to be of Type 1 if every production is of the form α → β where |α | ≤ |β | or of the form α → λ . Here λ is the null string and α , β are arbitrary strings on V . ii. A grammar G is said to be of Type 2 if every production is of the form A → β , ie, where the left hand side strong is always a single non-terminal symbol. iii. A grammar G is said to be of Type 3 if every production is of the form A → α or A → aB, ie, where the left hand side string is a single non-terminal symbol and the right hand side string is either terminal symbol or a terminal symbol followed by a non-terminal symbol or of the form S → λ . iv. A grammar G with no restriction on its productions is called a Type 0 grammar. (b) Define deterministic finite automata and non-deterministic automata. Solution: A finite - state automation is a special type of finite-state machine, in which there is no output, and some of its states are distinguished as accepting states. There are two types of automation.

University Solved Question Papers

UQ.81

i. Deterministic finite - state automata. ii. Non-deterministic finite - state automata. DFA A deterministic finite - state automata or simply an automata M consist of five parts. i. A finite non-empty set ∑ of inputs, called alphabet. ii. A finite non-empty set S of (internal)state. iii. A next - state function (also called transition function) from S × ∑ into S, ie, f (s, a) is a state for each state s and input symbol a. This function or mapping describes the change of states during the transition. It is usually represented by a state transition table or a state transition diagram. iv. A subset F of set S of accepting (final) states. v. An initial state S0 ∈ S. Such a finite automata is denoted by M = (∑, S, F, S0 , f ). Non- deterministic Finite - State Automata. A non-deterministic finite-state automata(nfa) allows zero, one or more transitions from a state on the same input symbol. The definition of nfa is as follows: A non-deterministic finite - state automata M consist of five parts: i. A finite non-empty set ∑ of input symbols. ii. A finite non-empty setS of states. iii. A next-state function f from S × ∑ into P(s), which is the power set of S, ie, the set of all subsets of S which are equal to 2s . iv. A subset F of set the S of accepting (final) states. v. An initial state S0 ∈ S. 20.

(a) Explain the adjacency matrix and incidence matrix of undirected graph with an example. Adjacency Matrix: The Adjacency matrix also called sequential representation method is suited to represent a graph G. A graph G with n vertices and m edges is said to be dense when representation of requires Kn2 . Adjacency matrix representation, stores the graph G consist of n vertices and no parallel edges, is the order V1 ,V2 , · · ·Vn are an n × n matrix A = [ai j ] defined as:

UQ.82

Discrete Mathematics   1 if vertex Vi is adjacent to vertexV j ai j = ie, there is an edge between vi and V j   0 other wise For an example

v2

v4

v3

v5

v1

(i) Un directed graph. The Adjacency Matrix for the above graph.

V1 V2 A = V3 V4 V5

          

V1 0 1 1 0 0

V2 V3 1 1 0 0 1 1 1 0 1 1 1 0 0 1 1

V4 0 0 1 1 0

          

Incident Matrix: An incidence matrix stores the graph G consists of n vertices and m edges as an n × m matrix M = [ai j ] defined as: ( 1 if vertexVi is incident on edge e j Mi j = 0 other wise The matrix has a row for every vertex and a column for every edge. The non - zero elements in the matrix is equal to the sum of degrees of all vertices of the graph. The below diagram specifies 5 × 8 matrix representation for the graph consists of 5 vertices and 8 edges. Shown in Fig

University Solved Question Papers

UQ.83

Incidence Matrix:

V1 V2 M = V3 V4 V5

          

e1 1 1 0 0 0

e2 1 0 0 0 1

e3 1 0 1 0 0

e4 0 1 1 0 0

e5 1 0 0 1 0

e6 0 0 0 1 1

e7 0 0 1 0 1

e8 0 0 1 1 0

          

e5 v1

e2

v4 e6

e3 e1

e7

v5 e8

e4

v2

v3

Incidence graph (b) Suppose the pre order and in order search of a binary tree T yield the following sequence of vertices. In order

D

B

P

H Q S E A C R K

F

L

root node Pre order A

B

D

E H P Q S C F K

R

root node

i. Draw the binary tree T . ii. Find depth of T and the descendants of vertex B.

L

UQ.84

Discrete Mathematics

B C E

D

F H K L Q

R

P S

(ii) The depth (height) of T is 5 and descendents of B are D, E, H, P, Q, S.

University Solved Question Papers

UQ.85

Discrete Mathematics November 2012 Section - A 10 × 1 = 10 marks Answer ALL questions 1. If A = {1, 2, 3, 4, 5} and B = {3, 5, 7, 9, } then A B is T

(a) {3, 5}

(c) {3, 5, 7}

(b) {2, 4, 1}

(d) None of these

Ans: a

2. The number of proper subsets of {a, b, c} is (a) 6

(c) 8

(b) 7

(d) None of these

Ans: c

3. Tautology is a compound statement that is always (a) True

(c) Either true or False

(b) False

(d) None of these

Ans: a

4. If P = Jack went up the hill Q = Jill went up the hill then the symbolic form of Jack and Jill went up the hill is (a) P ∨ Q

(c) P ⊕ Q

(b) P ∧ Q

(d) None of these

Ans: b

5. The function f : A → B is Said to be an onto function if (a) R f = B

(c) R f ⊆ B

(b) R f 6= B

(d) None of these

Ans: a

6. Let X = {1, 2, 3} and f (x) = x2 then the range is (a) {1, 4, 9}

(c) {1, 4, 3}

(b) {1, 2, 3}

(d) None of these

Ans: a

UQ.86

Discrete Mathematics

7. Type 3 grammar is also called —— grammar (a) Context-Sensitive

(c) Regular

(b) Context free

(d) None of these

Ans: c

8. Finite state machines can Recognize strings of ——– language only (a) Context free

(c) Context Sensitive

(b) Regular

(d) None of these

Ans: b

9. A graph is which every vertex has the same degree is called a ——(a) Regular graph

(c) Complete graph

(b) Null graph

(d) None of these

Ans: a

10. A forest is an ——- graph

11.

(a) Cyclic

(c) Connected path

(b) Acyclic

(d) None of these

Ans: d

Section -B (5 × 5 = 25 marks) T (a) Prove that A − (A − B) = A B Solution: To prove this result, let x ∈ A − (A − B) ⇔ x ∈ A and x 6 ∈(A − B) ⇔ x ∈ A and x 6 ∈(A ∩ Bc ) ⇔ x ∈ A and (x 6 ∈A and x 6 ∈Bc ) ⇔ x ∈ A and (x 6 ∈A and X ∈ B) ⇔ x ∈ A and x 6 ∈A)and (x ∈ A and x ∈ B) ⇔ x ∈ φ and x ∈ (A ∩ B) ⇔ x ∈ A∩B Hence A − (A − B) = A ∩ B (b) If A = {3, 4, 2} B = {3, 4, 5, 6} and C = {2, 4, 6, 8} verify LHS B −C = {3, 8} A ∩ (B −C) = {3}

(1)

University Solved Question Papers

UQ.87

RHS A ∩ B = {3, 4} A ∩C = {2, 4} (A ∩ B) − (A ∩C) = {3}

(2)

(1) = (2)hence proved. 12.

(a) Make truth table for p ⊕ q ⊕ r. p T T T T F F F F

p⊕q p⊕q⊕r F T F F T F T T T T T T F T F F √ (b) Show that 5 + 2 is an irrational number. Solution: √ Let 5 + 2 = r be a rational number. √ Then 2 = r − 5. Since r and 5 are rational √ numbers, therefore r − 5 is also a rational number. This implies that 2 is an irrational number, √ which is a contradiction √ because 2 is an irrational number. Thus, the assumption that 5 + 2 must be false and hence, the given number is irrational. 13.

q T T F F T T F F

r T F T F T T T F

(a) Let A and B be two non-empty sets. If f is one-one onto function from A to B, then prove that inverse function f −1 : B → A is unique. Solution: Let g : B → A and h : B → A be two inverse functions of f . Then we need to prove that g = h. Let y be any arbitrary element in B, and g(y) = x1 and h(y) = x2 Since g is the inverse functions of f , therefore g(y) = x1 ⇒ f (x1 ) = y. Also h is the inverse function of f , therefore h(y) = x2 ⇒ f (x2 ) = y Since f is one-one function, therefore f (x1 ) = y and f (x2 ) = y ⇒ x1 = x2 ⇒ g(y) = h(y) Hence, g = h

UQ.88

Discrete Mathematics (b) Let A = {1, 2, 3}} and B = {a, b, c}}C = {1, 2, 3}} and R1 = {(1, a)(2, c)(3, a)(3, c)} and R1 = {(1, a)(2, c)(3, a)(3, c)} Find R1 oR2 Solution:

1

a

x

2

b

y

3

c

z

In this diagram, elements 2 and 3 of A are ‘connected’ to element y of C by the path 2 → c → y and 3 → c → y. Thus (2, y), (3, y) ∈ R1 oR2 . 14.

(a) Find the derivation of the sentence “a monkey ate the banana”. Solution: Production are S → SP ∨ P we have replaced the class S by its only possible composition. We then taken the string. SP ∨ P and look for a production whose left -hand side is SP and then replace it with righthand side of that production the application of the only production possible produces the string. We next look for a production whose left part is A and two such productions are found. By selecting the production A → a and upon substituting its right-hand side is the string AN ∨ P, obtain the string. a N VP This process is continued until we arrive at the correct sentence. At this point, the sentence contains only primitive or terminal elements of the language. A complete derivation of the above sentence is as follows. S ⇒ SP ∨ P ⇒ A N ∨P ⇒ a N ∨P ⇒ A N ∨P ⇒ a monkey ∨P ⇒ a monkey ∨O ⇒ a monkey ate O

University Solved Question Papers

UQ.89

⇒ a monkey ate NP ⇒ a monkey ate A N ⇒ a monkey ate the N ⇒ a monkey ate the banana Here the symbol ⇒ denotes that the string on the right - hand side of the symbol can be obtained by applying one rewriting rule to the previous string. (b) The language L(G) = {an ban /n ≥ 1 } is generated by the Grammar G = {{s, c} {a, b} , s, φ } where the set of productions S → aCa C → aCa,C → b, derive the sentence a2 ba2 Solution: S ⇒ aCa ⇒ aba

15.

since c → b

Again S ⇒ aCa ⇒ a aCaa = a2Ca2 since C → aCa Now Applying C → aCa, (n − 1) times, we get S ⇒ anCan ⇒ an ban , since C → b. Hence an ban ∈ L(G) for all n ≥ 1. So {an ban n ≥ 1} ⊆ L(G) (a) Draw the complete graphs K5 and K6

(a) K5

(b) K6

(b) Define walk, closed walk, open walk with an example. Walk A finite alternating Sequence of vertices and edges of a graph G beginning and ending with vertices, such that each Edge is incident with vertices preceding and following it is called a walk of the graph G. Walk is also called edge train or chain

UQ.90

Discrete Mathematics Closed walk and open Walk A walk is said to be the closed walk if it is possible that a walk begins and end at the same vertices, i.e., Vi = V j (and n > 1).Otherwise the walk is called open, i.e., terminal vertices are different. However, a vertex may appear more than once. The below figure illustrate two walks in this graph: 1 − 2 − 3 − 4 and 1 − 2 − 4 − 5 − 2 − 3 2

2

1

3

4

4

5 1

3 (a)

16.

(b)

Fig: Examples of Walk Section C = (5 × 8 = 0) Marks (a) If A and B are any two sets then prove that A∪B = A∩B ⇔ A = B Solution: Suppose A ∪ B = A ∩ B. then to show that A = B, let x∈A ⇔x∈A or x ∈ B ⇔ x ∈ A∪B ⇔ x ∈ A∩B ⇔x∈A and x ∈ B ⇔x∈B Thus A∪B = A∩B ⇒ A = B

(1)

Conversely, suppose that A = B. Then to show that A ∪ B = A ∩ B, let x ∈ A ∪ B ⇔ x ∈ A or x ∈ B ⇔ x ∈ A or x ∈ A ⇔ x∈A ⇔ x ∈ A and x ∈ A ⇔ x ∈ A and x ∈ B ⇔ x ∈ A∩B Thus A = B ⇒ A∪B = A∩B (2)

University Solved Question Papers

UQ.91

Hence from (i) and (ii), we get A∪B = A∩B ⇔ A = B (b) Prove that : i. (A ∩ B)c = Ac ∪ Bc ii. (A ∪ B)c = Ac ∩ Bc Solution: i. (A ∩ B)c = Ac ∪ Bc Let x be any element of (A ∩ B)c then x ∈ (A ∩ B)c ⇔ x 6∈ (A ∩ B) ⇔ x 6∈ A or x ∈ Bc ⇔ x ∈ Ac or x ∈ Bc ⇔ x ∈ A c ∪ Bc Hence, (A ∩ B)C = Ac ∪ Bc ii. (A ∪ B)c = AC ∩ Bc Let x be any element of (A ∪ B). Then x ∈ (A ∪ B)c ⇔ x ∈ ∪ and x 6∈ (A ∪ B) ⇔ x ∈ ∪ and (x 6∈ A or x 6∈ B) ⇔ (x ∈ ∪ but (x 6∈ A) and (x ∈ ∪ but x 6∈ B) ⇔ x ∈ Ac and x ∈ Bc ⇔ x ∈ A c ∩ Bc

17.

Hence, (A ∪ B)c = Ac ∩ Bc (a) If p and q are two statements then show that the statement (p ↑ q) ⊕ (p ↑ q) is equivalent to (pvq) ∧ (p ↓ q). Solution: The equivalence of two compound statements is shown in the truth table. p q p ↑ q (p ↑ q) ⊕ (p ⇑ q) p ∨ q p ↓ q (p ∨ q) ∧ p ↓ q 1 2 3 4 5 6 7 T T F F T F F T F T F T F F F T T F T F F F F T F F T F

UQ.92

Discrete Mathematics Since values in columns (4) and (7) are same, therefore two statements are equivalent. (b) If p and q are two statements then prove that i. ∼ pv(p ⇔ q)Ξp ⇒ q ii. p ⇔ (∼ p∨ ∼ q) Truth table for ∼ p ∨ (p ⇔ q) p T T F F

q T F T F

∼p F F T T

p⇒q T F T T

p⇔q T F T T

∼ p ∨ (p ⇔ q) T F T T

∼ P ∨ (p ⇔ q)Ξp ⇒ q hence verified. Truth table for p ⇔ (∼ p∨ ∼ q) p T T F F

q T F T F

∼p F F T T

∼p F T F T

∼ p∨ ∼ q F T T T

p ⇔ (∼ p∨ ∼ q) T T F F

p ⇔ (∼ p∨ ∼ q) hence proved. 18.

(a) If R and S are equivalence relations in a set A, prove that R ∩ S is an equivalence relation in A . Since R and S are two equivalence relations on a set A, therefore R ⊆ A × A and S ⊆ A × A. Thus, R ∩ S ⊆ A × A implies that R ∩ S is also a relation in A. i. Since R and S are reflexive, therefore (a, a) ∈ R and (a, a) ∈ S for all x ∈ A. Thus for all a ∈ A,(a,a)∈ R∩S. Hence, R∩S is reflexive. ii. Let (a, b) ∈ R ∩ S. But (a, b) ∈ R ∩ S ⇒ (a, b) ∈ R and (a, b) ∈ S. Therefore R ∩ S is symmetric.

University Solved Question Papers

UQ.93

iii. Let (a, b) ∈ R ∩ S and (b, c) ∈ R ∩ S (a, b) ∈ R ∩ S and ⇒ [(a, b) ∈ R and b(a, b) ∈ S] and (b, c) ∈ R ∩ S[(b, c) ∈ R and (b, c) ∈ S] ⇒ [(a, b) ∈ R and (b, c) ∈ R] and [(a, b) ∈ S and (b, c) ∈ S] ⇒ (a, c) ∈ R and (a, c) ∈ S [since Rand Sare transitive] ⇒(a, c) ∈ R ∩ S Therefore R ∩ S is transitive. Since R ∩ S is reflexive, symmetric and transitive, therefore R ∩ S is an equivalence relation. (b) Explain different types of function. Equal Functions

Two functions f : A → B and g : A → B are said to be equal if and only if f (x) = G(x) for every x ∈ A and are written as f = g Constant Functions

A function f : A → B is called a constant function, if some Element y ∈ B, is assigned to every element of A, i.e., f (x) = y for every x ∈ A. In other words, f : A → B is a constant function if the range of f consists of only one element. Onto and Into Functions

The function f : A → B is said to be an a) Onto (or surjective) function: if every element of B is f − image of at least one element in A. In this case, the range of f is equal to B, that is, For all y ∈ B, y = f (x) for some x ∈ A or f (a) = B. b) Into Function: If there is atleast one element in B which is not the f -image of any element in A. But every element of A has f − image in B in this case the range of f is proper subset of B, that is, f (a) ⊆ B and f (A) 6= B. Many -One and One -to-One functions

The function f : A → B is said to be a

UQ.94

Discrete Mathematics i. Many - One function:If two or more different elements in A have same f -image in B i.e., f (x1 ) = f (x2 ) even if x1 6= x2 for all x1 , x2 ∈ A. ii. One-to-One Functions:If different elements in A have different f − image in B, i.e., x1 6= x2 implies f (x1 ) 6= f (x2 ) for all x1 , x2 ∈ A or equivalently, f (x1 ) = f (x2 ) ⇒ x1 = x2 for All x1 , x2 ∈ A. If f is one-to-one with A and B finite, then we must have |A| ≤ |B|. With A and B finite, then we must have |A| ≤ |B|. One-One On to (bijective) function

The function f : A ⇒ B is said to be one-one onto function if to each element of A there corresponds one and only one element of B and every element of B have one and only image in A. One -One and onto function are also called bijective mapping as shown in the figure 1. A

B

a

x

b

y

c

z

Fig 1: One -One onto function One -One into function The function f : A → B is said to be one-one into function if to each element of A there corresponds one elements of B, but there are some element of B which do not correspond to any of the elements of A shown in the figure 2. A

B

a

x

b

y

c

z w

Fig 2: One -One into function

University Solved Question Papers

UQ.95

Many-One into function

The function, f : A ⇒ B is said to be many -one into function if two or more elements of a set A corresponds to the Same element of B and there are some elements in B which do not correspond to any of the elements of A as shown in the figure 3. A

B

a

x

b

y

c

z w

Fig 3: Many -One into function Many-One onto function

The function, f : A → B is said to be many-one onto function if each element in B is joined to At least one element in A, and two or more elements in A are joined to the Same element in B as Shown in the figure 4. A

B

a

x

b

y

c

z

d

19.

Fig 4: Many -One onto function (a) Define the different types of grammars. Grammars are classified according to the types of productions that are allowed to define them. The following classifications is due to Noam chomsky. i. A grammar G is Said to be of Type 1 if Every production is of the form α → β where |α | ≤ |β | or of the form α → λ . Here λ is the null string and α , β are arbitrary strings on V . ii. A grammar G is Said to be of Type 2 if every production is of the form A → β , i.e., where the left hand side string is always a single non-terminal symbol.

UQ.96

Discrete Mathematics iii. A grammar G is said to be of Type 3 if every production is of the form A → α or A → a, B i.e., where the left hand side string is a single non-terminal symbol and the right hand side string is either terminal symbol or a terminal symbol followed by a non-terminal symbol or of the form S → λ . iv. A grammar G with no restriction on its productions is called a Type 0 grammar. (b) Define deterministic Finite automata and non-deterministic automata. Solution A finite state automation is a special type of finite - state machine, in which there is no output and Some of its states are distinguished as accepting states. There are two types of automation. i. Deterministic finite state automata. ii. Non - Deterministic finite state automata DFA A deterministic finite - state automata or simply an automate M consist of five parts. i. A finite non-empty set ∑ of inputs, called alphabet. ii. A finite non-empty set S of (internal) states. iii. A next - state function (also called transition function) from S × ∑ into S, i.e., f (S, a) is a state for each state S and input symbol a. This function or mapping described the change of states during the transition. It is usually represented by a state transition table or a state transition diagram. iv. A subset F of set S of accepting (final) states. v. An initial state S0 ∈ S. Such a finite automata is denoted by M = (∑, S, F, So , f ) Non - deterministic Finite State Automata A non-deterministic finite state automata (n f a) allows zero, one or more transitions from a state on the Same input symbol. The definition of nFa is as follows: A non- deterministic finite state automata M consists of five parts: i. A finite non-empty set ∑ of input symbols ii. finite non -empty set S of states. iii. A next - state function f from S × ∑ into P(s), Which is the power set of S, i.e, the set of all subsets of S which are equal to 2s

University Solved Question Papers

UQ.97

iv. A subset F of set the S of accepting (final States). v. An initial state S0 ∈ S 20.

(a) Define i. Null graph ii. Regular graph iii. Complementary graph iv. Complete graph v. Weighted graph Null graph Any graph with Edge set empty is Called a null graph.

Fig 1: Null graph Regular graph A graph in which every vertex has the Same degree is called a Regular graph. The fig 2. described the regular graph.

Fig 2: Regular graph Complementary Graph A graph G is Said to be complementary graph to G if V (G) = V (G) and V1 is adjacent to V2 in G ⇒ V1 is not adjacent to V2 in G and V1 is not adjacent to V2 in G ⇒ V1 is adjacent to V2 is G. The complement of Simple graph G = (V, E)is the graph G = (V, E where E = V ×V − E.

UQ.98

Discrete Mathematics v1

v2

v1

v2

v4

v3

v4

v3

Fig 3:1 graph

Fig 3:2 Complement graph

Complete Graph A simple graph G with n vertices is Said to be a Complete graph if the Degree of every vertex is n − 1.

Fig 2: Complete graph Weighted graph A graph is which weights (capacities, distances, probabilities etc) are assigned to each edge is called a weighted graph. (b) Explain the adjacency matrix and incidence matrix of undirected graph with an example. Adjacency matrix The adjacency matrix also called sequential representation method is situated to represent a graph G. A graph G with n vertices and m a graph G. A graph G with n vertices and m edges is Said to be dense When representation of requires Kn2 . Adjacency matrix representation, stores the graph G v1 , v2 . . . vn as an n × n matrix A = [ai j] defined as:

ai j =

 1

if vertex vi is adjacent to vertex vi i.e., there is an edge between vi andv j  0 otherwise

University Solved Question Papers

UQ.99

For an example v2

v4

v3

v5

v1

(i) undirected graph The Adjacency matrix for the above graph

v1 v2 A = v3 v4 v5

     

v1 0 1 1 0 0

v2 1 0 1 1 0

v3 1 1 0 1 1

v4 0 1 1 0 1

v5 0 0 1 1 0

     

Incidence matrix An incidence matrix stores the graph G consists of n vertices and m edges as an n × m matrix. M = [mi j ] defined as: mi j =



1 if vertex vi is incident on edge e j 0 otherwise

The matrix has row for every vertex and a column for every edge. The non-zero elements in the matrix is equal to the sum of degrees of all vertices of the graph. The below diagram specifies 5 × 8 matrix representation, for the graph consists of 5 vertices and 8 edges, shown in Fig. Incidence matrix e1  V1 1 V2  1 M = V3  0 V4 0 V5 0

e2 e3 e4 e5 e6 e7 e8 1 0 0 0 1

1 0 1 0 0

0 1 1 0 0

1 0 0 1 0

0 0 0 1 1

0 0 1 0 1

 0 0  1  1 0

UQ.100

Discrete Mathematics

Incidence graph e5 v1

e2

v4 e6

e3 e1

e7

v5 e8

v2

e4

v3

University Solved Question Papers

101

Discrete Mathematics April 2013 Section- A (10 ×1 = 10 marks) Choose the correct answers 1. If the elements of a set can be put into a one-to-one correspondence with the elements of another set, then the sets are called ——– (a) Equal sets (b) Equivalent sets

(c) Dual Sets (d) Proper sets

Ans: b

(c) A (d) B

Ans: a

2. If B is superset of A, then A ∪ B =——(a) φ (b) ∪

3. The conjunction of two statement p and q is denoted by ——– (a) p × q (b) p ∨ q

(c) p → q (d) p ↔ q

Ans: a

(c) ∼ p∨ ∼ q (d) ∼ p ∨ q

Ans: c

4. ∼ (p∧)q =—— (a) ∼ p∧ ∼ q (b) ∼ (p ∨ q)

5. If R and S are two relations from A to B, then (R ∪ S)−1 —— (a) R ∩ S (b) (R ∩ S)−1

(c) R−1 ∩ S−1 (d) R−1 ∪ S−1

Ans: c

6. If R is a set of real numbers, then f : R → R defined by f (x) = 5x 3 − 1 is —— (a) 1-1 onto function (b) 1-1 into function

(c) Many -one onto function (d) Many - one into function Ans: a

7. The length of a string u is denoted by (a) u∗ (b) u+

(c) |u| (d) ∑4

Ans: c

102

Distric Mathematics

8. If L1 and L2 are two languages, then L1 ⊆ L2 (a) L2∗ ⊆ L1∗

(c) (L1 ⊆ L2 )∗

(b) L1∗ ⊆ L2∗

(d) (L2 ⊆ L1 )∗

Ans: b

9. A graph in which loops and multiple edges are allowed is called a—— (a) Pseudo graph

(c) Complete graph

(b) Diagraph

(d) Connected graph

Ans: a

10. In a tree, every pair of vertices is connected by

11.

(a) Infinite number of paths

(c) No Path

(b) Finite number of Paths

(d) Unique Path

Ans: d

Section -B (5 × 5 = 25 marks) (a) if A = {3, 4, 2} B = {3, 4, 5, 6} and C = {2, 4, 6, 8} Prove that A ∩ (B −C) = (A ∩ B) − (A ∩C) Solution Given that A = {3, 4, 2} B = {3, 4, 5, 6} and C = {2, 4, 6, 8} Therefore B −C = {3, 4, 5, 6} − {2, 4, 6, 8} = {3, 5} A ∩ (B −C) = {3, 4, 2} ∩ {3, 5, } = {3}

(1)

A ∩ B = {3, 4, 2} ∩ {3, 4, 5, 6} = {3, 4} A ∩C = {3, 4, 2} ∩ {2, 4, 6, 8} (A ∩ B) − (A ∩C) = {3, 4} − {4, 2} = {3}

(2)

From (1) and (2) we get, A ∩ (B −C) = (A ∩ B) − (A ∩C) (b) Out of 450 students in a school, 193 students read science and 200 students read commerce and 80 students read neither. Find how many students read both. Solution:

University Solved Question Papers

103

Suppose A and B denote the set of students who read science and commerce, respectively. It is given that n(A) = 193, n(B) = 200, n(∪) = 450 and n(Ac ∪Bc ) = 80. Now we should find the number of these students who read science as well as commerce i.e., n(A ∪ B) Since Ac ∩ Bc = (A ∪ B)c therefore n(A ∪ B)c = 80. But n(A ∪ B)c = n(∪) − n(A ∪ B) 80 = 450 − n(A ∪ B) n(A ∪ B) = 450 − 80 = 370 Further, we know that n(A ∪ B) = n(A) + n(B) − n(A ∩ B) 370 = 193 + 200 − ∩(A ∪ B) −n(A ∩ B) = 370 − 193 − 200 −n(A ∩ B) = 370 − 393 −n(A ∩ B) = −23 n(A ∩ B) = 23 Thus, 23 students read both science and commerce. 12.

(a) Prove that p ⇒ (q ∧ r) ≡ (p ⇒ q) ∧ (p ⇒ r) by a truth table. p T T T T F F F F

q T T F F T T F F

r T F T F T F T F

q∧r T F F F T F F F

p ⇒ (q ∧ r) T F F F T T T T

(p ⇒ q) T T F F T T T T

p⇒r T F T F T T T T

From the above table, we conclude that, p ⇒ (q ∧ r) ≡ (p ⇒ q) ∧ (p ⇒ r) hence proved.

(p ⇒ q) ∧ (p ⇒ r) T F F F T T T T

104

13.

Distric Mathematics (b) Show that p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∧ r) by a truth table. p q r q ∧ r p ∨ (q ∧ r) p ∨ q p ∧ r (p ∨ q) ∧ (p ∧ r) T T T T T T T T T T F F T T F F T F T F T T T T T F F F T T F F F T T T T T F F F T F F F T F F F F T F F F F F F F F F F F F F From the above table, we conclude that p ∨ (q ∧ r) 6= (p ∨ q) ∧ (p ∧ r) a truth table. (a) If R and S are equivalence relation on a set A, Prove that R ∩ S is an equivalence relation in A. Solution Since R and S are two equivalence relation on set A, therefore R ⊆ A × A and S ⊆ A × A. Thus, R ∩ S ⊆ A × A that R ∩ S is also a relation in A. i. Since R and S are reflexive, there fore (a, a) ∈ R and (a, a) ∈ S for all a ∈ A. Thus for all a ∈ A(a, a) ∈ R ∩ S. Hence R ∩ S is reflexive. ii. Let (a, b) ∈ R ∩ S. But (a, b) ∈ R ∩ S ⇒ (a, b) ∈ R and (a, b) ∈ S. Therefore R ∩ S is symmetric. iii. Let (a, b) ∈ R ∩ S and (b, c) ∈ R ∩ S. (a, b) ∈ R ∩ S and (b, c) ∈ R ∩ S ⇒ [(a, b) ∈ R and (a, b) ∈ S and [(b, c) ∈ R and (b, c) ∈ S] ⇒ [(a, b) ∈ R and (b, c) ∈ R] and [(a, b) ∈ S and (b, c) ∈ S] ⇒ (a, c) ∈ R and (a, c) ∈ S. ⇒ (a, c) ∈ R ∩ S. Therefore R ∩ S is transitive. Since R ∩ S is reflexive, symmetric and transitive therefore R ∩ S is an equivalence relation. (b) Prove that the composition of functions obeys associative law. Solution Let X be an arbitrary element of set A. Then [(hog)o f ](x) = (hog)[ f (x)] = (hog)(y), because y = f (x), forx ∈ A, y ∈ B = h[g(y)] = h(z) =x∈A

University Solved Question Papers

105

Again, let h o(go f )(x) = h[(go f )(x)] = h[g { f (x)}] = h[g(y)] = h(z) =x∈A hence 14.

(hog)o f = ho(go f )

  (a) Let L1 = a, ab, a2 and L2 = b2 , aba be two languages over the alphabet ∑ {a, b}. Then find out L1 , L2 , L22 Solution Concatenate words in L1 with words in L2 to obtain   L1 L2 = a, ab, a2 b2 , aba  = ab2 , ab3 , a2 b2 , a2 ba, a2 b2 a, a3 ba   L22 = L2 L2 = b2 , aba b2 , aba  = b4 , b2 aba, abab2 , aba2 ba (b) L1 = {s, c} ∑ {a, b}, p = {s → aCa,C → aCa, C → b} Find L(G) Solution Here

S ⇒ aCa ⇒ aba since C → b

Again

S ⇒ aCa ⇒ aaCaa = a2Ca2

since C → aCa

Now Applying C → aCa, (n − 1) times, we get S ⇒ anCan ⇒ an ban , since C → b. Hence, an ban ∈ L(G) for all n ≥ 1, So {an ban : n ≥ 1} ⊆ L(G). Let w be any string in L(G). Since S → aCa is the only productions having S on the left side, S → aCa is applied to derive string in L(G) . Applying C → b. We get S ⇒ aba. Thus aba ∈ L(G). But when S → aCa is applied repeatedly, We get S = an ban . Hence, any string we L(G) is of the form S ⇒ an ban with n ≥ 1. So L(G) = {an ban : n ≥ 1}

106 15.

Distric Mathematics (a) Define i. ii. iii. iv. v.

Connected graph Complete graph Regular graph Multi graph Null graph

• Connected graph A graph G is said to be connected if there is at least one path between every pair of vertices in G. Otherwise G is said to be disconnected. • Complete graph A complete graph every vertex is connected to every other vertex i.e., every pair of different vertices are adjacent. • Regular graph A graph in which every vertex has the same degree is called a regular graph. • Multi graph Any graph which contains some parallel edges is called a multi graph. • null graph A graph is called a null graph if there are no edges or every vertex is an isolated vertex. (b) Prove that every tree with n vertices has n − 1 edges. Proof is by induction If n = 1, The no. of vertices = 1, edges = 0 Hence the theorem is true for n = 1 if n = 2, the number of vertices =23, edges = 1 = 2 - 1. The theorem is true for n = 2 Let the theorem be true for n ≤ k also. Consider a tree with k + 1 vertices. Let e p an edge of the tree G, connecting Vi and V j . Since G is a tree, e p is the only path connecting Vi and V j . Hence deleting e p will disconnect G into exactly two components, Each such component has, fewer than K +1 vertices and hence each component is a tree. Let the two components have k1 and k2 , vertices. Then the total number of edges will be k1 − 1 + k 2 − 1 = k 1 + k 2 − 1 = k+1−1 =k

since k1 , k2 , ≤ k

The theorem is tree for n = k + 1 if it is true n ≤ k.

University Solved Question Papers

107

Hence by mathematical induction the proof follows i.e., If G is a tree with n vertices, it has n − 1 edges. Section C (5 × 8 = 40 marks ) 16.

(a) If A and B are two sets, then prove that i. A ∩ (B − A) = φ ii. (A ∪ B)c = Ac ∩ Bc i. To prove A ∩ (B − A) = φ let x ∈ A ∩ (B − A) ⇔ x ∈ A and x ∈ (B − A) ⇔ x ∈ A and (x ∈ B and x 6∈ A) ⇔ (x ∈ A and x 6∈ A) and x ∈ B. ⇔ x ∈ φ and x ∈ B ⇔x∈φ Hence,

A ∩ (B − A) = φ

ii. Let x be any element of (A ∪ B). Then x ∈ (A ∪ B)c ⇔ x ∈ ∪ and x 6∈ (A ∪ B) ⇔ x ∈ ∪ and(x 6∈ A or x 6∈ B) ⇔ (x ∈ ∪ but x 6∈ A) and (x ∈ ∪ but x 6∈ B) ⇔ x ∈ Ac and x ∈ Bc ⇔ x ∈ A c ∩ Bc Hence,

(A ∪ B)c = Ac ∩ Bc

(b) A TV survey shows that 60 percent people see programme A, 50 percent see programme B, 50 percent see programme C, 30 percent see programme A and B, 20 percent see programme B and C, 30 percent see programme A and C and 10 percent do not sec any programme. i. What percent see programme A, B, and C ? ii. What percent see exactly two programmers? Solution Suppose X,Y, and Z denote the set of people who see programme A, B and C respectively, then it is given that n(X) = 60, n(Y ) = 50, n(Z) = 50, n(X ∩ Y ) = 30, n(Y ∩ Z) = 20, n(X ∩ Z) = 30, n[(X ∪Y ∪ Z)c ] = 10

108

Distric Mathematics i. Let (X ∪Y ∪ z) + n[(X ∪Y ∪ Z)c ] = 100 then n(X ∪Y ∪ Z) = 100 − n[(X ∪Y ∪ Z)c ]100 − 10 = 90 n(X ∪Y ∪ Z) = n(X) + n(Y ) + n(Z) − n(X ∩Y ) − n(Y ∩ Z) − n(X ∩ Z) + n(X ∩Y ∩ Z) 90 = 60 + 50 + 50 − 30 − 20 − 30 + n(X ∩Y ∩ Z) n(x ∩ y ∩ z) = 90 − 80 = 10 Thus, 10 percent people see programme A, B and C. ii. Since the set of people who see programme A and B but not C, i.e., x ∩ y ∩ zc and the set of people who see all the programmes A, B and C, (i.e.,) x ∩ y ∩ z are disjoint sets, therefore. n(X ∩Y ∩ Z c ) + n(X ∩Y ∩ Z) = n(X ∩Y ) or n(X ∩Y ∩ Z c ) = n(X ∩Y ) − n(X ∩Y ∩ Z)30 − 10 = 20 Similarly (X ∩Y c Z) + n(X ∩Y ∩ Z) = n(X ∩ Z) n(X ∩Y c ∩ Z) = ∩(X ∩ Z) − n(X ∩Y ∩ Z)30 − 10 = 20 and n(X c ∩Y ∩ Z) + n(X ∩Y ∩ Z) − n(Y ∩ Z) n(X c ∩Y ∩ Z) = n(Y ∩ Z) − n(X ∩Y ∩ Z) = 20 − 10 = 10 Thus, the percentage of people who see Exactly two programmers = 20+20+10=50

17.

(a)

i. Define quantifiers ii. What are the types of quantifiers iii. State the properties of quantifiers. Solution i. Certain statements involve, works that indicate quantity such as ‘some’, ‘none’ or ‘one’. They answers the questions “How many?” since such words indicate quantity they are called quantifiers. ii. Types of Quantifiers A. Universal quantifier B. Existential quantifier iii. Properties of Quantifiers A. ∃x(P(x)) ⇒ q(x) ∼ ∀xp(x) ⇒ ∃xq(x)

University Solved Question Papers

109

B. ∃xp(x) ⇒ ∀xq(x) ≡ ∀x(p(x)) ⇒ q(x)) C. ∃x(p(x) ∨ q(x)) ≡ ∃xp(x) ∨ ∃xq(x) ∀x [p(x) ∧ q(x)] ≡ [∀xp(x) ∧ ∀xq(x)] [∀xp(x) ∨ ∀xq(x)] ⇒ ∀x[p(x) ∨ q(x)] D. ∼ (∃x ∼ p(x)) ≡ ∀xp(x)) (b)

i. Show that the statement (p ∧ q) ⇒ (pvq) is a tautology. ii. Show that (p ∧ q)∧ ∼ (p ∨ q) is a fallacy. Solution (i) p q p ∧ q p ∨ q (p ∧ q ⇒ ∨q) T T T T T T F F T T F T F T T F F F F T It is tautology (ii) p q p∧q T T T T F F F T F F F F

p∨q T T T F

∼ (p ∨ q) F F F T

(p ∧ q)∧ ∼ (p ∨ q) F F F F

Since the statement has its false values (F) for all its entries in the last column of the truth table, therefore, it is a fallacy. 18.

(a)

i. A = {1, 2, 3} and B = {2, 3} Prove that A × B 6= B × A. Also find n(A × B) ii. If A, B and C are sets and A ⊆ B, then prove that (A ×C) ⊆ (B ×C) Solution: i. A = {1, 2, 3} B = {2, 3} The Product, A × B = {(1, 2)(1, 3)(2, 2)(2, 3)(3, 2)(3, 3)} B × A = {(2, 1)(2, 2)(2, 3)(3, 1)(3, 2)(3, 3)} Since elements of A × B and B × A are not same, therefore A × B 6= B×A

110

Distric Mathematics Now n(A × B) = n(A) × n(B)3 × 2 n(A × B) = 6 ii. Proof: Let (a, c) be an arbitrary element of A ×C Then, (a, c) ∈ A ×C ⇒ a ∈ A and c ∈ C ⇒ a ∈ B and c ∈ C (since A ⊆ B) ⇒ (a, c) ∈ B ×C Thus, A ×C ⊆ B ×C (b) If R is the set of all real numbers, then show that the function f : R → R defined by f (x) = 5x3 − 1 is one-one onto function. Solution: To show f to be a one-one function, let x1 , x − 2 ∈ R two different elements. Thus, x1 6= x2 ⇒ 5x13 − 1 6= 5x23 − 1 ⇒ f (x1 ) 6= f (x2 ) This shows that different elements in R have different f-images in R. Hence f images in R. Hence f is one-one. To show that f is an onto function, let y = 5x3 −1 be any arbitrary element in R. Then we may write x = {(y + 1)/5}1/3 , which is a real number for all values of y ∈ R now. f [{(y + 1)/5}1/3 ] = 5[{(y + 1)/5}1/3 ]3 − 1 = 5{(y + 1)/5} − 1 (y + 1) − 1 = y

19.

This shows that for every element y ∈ R. There exists Pre-image is the domain set R of f . Thus f is an onto function, and hence f is one-one onto function. (a) State the properties of concatenation Solution i If ∑ is an alphabet and n is a non-negative integer, then the power of ∑ is defined recursively as A. ∑1 = ∑ and

University Solved Question Papers

111

B. ∑n+1 = {ab : a ∈ A and b ∈ ∑n } where ab is the position of letters. ii If ∑ is an alphabet, then A. ∑+ = ∑1 B. ∑∗ = ∑0

∞ S 2S 3S S ··· =





n=1

∑n =

∞ S S 1S 2 ∑ ∑ ··· = ∑n

S

n∈1

∑n

n=0

iii The concatenation operation on an alphabet ∑ is associative, since for every u, v, w ∈ ∑∗ , we have u(vw) = (uv)w. iv The concatenation operation is not commutative on an alphabet ∑, since uv 6= vu for every u, v ∈ ∑∗ v The empty string λ is an identity element for concatenation operation on an alphabet ∑. That is ∗

λ u = uλ = u for every u ∈ ∑ vi If u, v ∈ ∑+ then we may write u = u1 , u2 . . . um and v = v1 , v2 . . . vn , for m, n ∈ I+ and u1 , u2 , . . . um ; v1 , v2 . . . vn ∈ ∑. Two strings u and v are said to be equal. i.e., u = v if m = n and ui = vi for all 1 ≤ i ≤ m vii For every u, v, w ∈ ∑∗ we have uv = wv ⇒ u = v (left cancellation) uw = vw ⇒ u = v (right cancellation) viii For u, v, ∈ ∑∗ , we have |uv| = |u| + |v| ix for each u ∈ ∑∗ , the power of u is defined as u0 = λ , u1 = u, u2 = uu, u3 = uuu . . . un+1 = uun , for n ∈ N. (b) Explain the types of grammar. Grammars are classified according to the types of productions that are allowed to define them. The following classifications is due to Noam chomsky. i. A grammar G is said to be of Type 1if every production is of the form α → β where |α | ≤ |β | or of the form α → λ . Here λ is the null string and α , β are arbitrary strings on V . ii. A grammar G is said 10 be of Type 2 if every production is of the form A → β , i.e., where the left hand Side string is always a single non-terminal symbol.

112

Distric Mathematics iii. A grammar G is said to be Type 3 if every production is of the form A → α or A → aB i.e., where the left hand side string is a single non-terminal symbol and the right hand side string is either terminal symbol or a terminal symbol followed by a non-terminal symbol or of the form S → λ iv. A grammar G with no restriction on its productions is called a Type 0 grammar.

20.

1 (a) If a simple graph G with n vertices has more than (n − 1)(n − 2) edges. 2 The G is connected Proof 1 Let G be a simple graph with n vertices and more than (n − 1)(n − 2) 2 edges. If G has k components, then by using following theorem (i.e.,) A graph G is disconnected if and only if its vertex set V can be partitioned into two non-empty, disjoint subsets V1 and V2 such that there exists no edge is G whose one end vertex is in subset V1 and the other in subset V2 . 1 So G have at most (n − k)(n − k + 2) edges. 2 1 But G has more than (n − 1)(n − 2) edges, 2 Therefore we have 1 1 (n − k)(n − k + 2) > (n − 1)(n − 2) 2 2 which is possible only when k = 1 Hence, G is connected. (b) What are the recursive methods for traversing a positional binary tree T with root V ? Explain Solution The following are three standard recursive methods for searching a positional binary tree T with root v. i. Pre order Search ii. In order Search iii. Post order Search Pre Order Search The steps of pre order search algorithm are as follows: i. First visit the root V of the tree ii. If VL exists, then search the left sub-tree TL of T in pre order. iii. If VR exists, then search the right sub -tree TR of T in pre order. In Order Search The steps of in order search algorithm are as follows:

University Solved Question Papers

113

i. Search the left sub-tree TL in order. ii. Visit the root of the tree iii. Search the Right sub-tree TR in order. Post Order Search The steps of post order search algorithm are as follows: i. Search left subtree TL in post order. ii. Search right subtree TR in post order iii. Visit the root of the tree. For an example, the following binary tree to perform the Inorder, Pre order, and Post order. A

C B

E D

F

G

Binary tree The result of pre orders, in order and post order tree search algorithms is as follows. Pre order : A B D C E F G In order : BDACGFE Post order : D B G F E C A

114

Distric Mathematics

Discrete Mathematics November 2013 Section - A 10 × 1 = 10 marks Answer ALL questions Section- A (10 ×1 = 10 marks) 1. If A and B are disjoint sets, then A ∩ B——(a) φ

(c) B

(b) A

(d) ∪

Ans: a

2. If A is a subset of B and C is a superset of B, then—(a) A is a superset of C

(c) A is a subset of C

(b) A and C are subsets of B

(d) B is a superset of C

Ans: c

3. ∼ (∼ p∨ ∼ q) = ——(a) p ∨ q

(c) ∼ (p ∨ q)

(b) p ∧ q

(d) ∼ (p ∧ q)

Ans: b

4. q ⇒≡ (a) p ⇒∼ q

(c) p ⇒ q

(b) ∼ p ⇒ q

(d) ∼ p ⇒∼ q

Ans: d

5. When R = A × A, the relation in the set A is said to be —– (a) Identity relation

(c) Universal relation

(b) Void relation

(d) Reflexive relation

Ans: c

6. f −1 (A ∪ B) = ——(a) f −1 (A) ∩ f −1 (B)

(c) f (A ∪ B)−1

(b) f −1 (A) ∪ f −1 (B)

(d) f (A ∩ B)−1

Ans: a

University Solved Question Papers

115

7. If ∑ is an alphabet, then ∑ = ——(a) (b)

∞ S

n=1 ∞ S

n=0

∑n

(c)

∑n

(d)

S

n=1+ ∞ T n=1

∑n

∑n

Ans: b

8. Ona set ∑, the finite sequence of its elements is known as —– (a) Language (b) Grammar

(c) Automata (d) String

Ans: d

9. In a connected graph G, e is called a bridge if (a) G − e is connected (b) G − e is complete

(c) G − e is dis connected (d) G − e is a tree

Ans: c

(c) n edges (d) 2n edges

Ans: a

10. A tree with n vertices has —– (a) n − 1 edges (b) n + 1 edges

11.

Section - B (5 ×5 = 25 marks) (a) If A = {1, 3, 5} B = {2, 4, 6, 8} C = {2, 5, 10} and ∪ = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} verity that (A ∩ B)C = AC ∪ BC Solution: A∩B = { } (A ∩ B)C = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

(1)

C

A = {2, 4, 6, 7, 8, 9, 10} BC = {1, 3, 5, 7, 9, 10} AC ∪ BC = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} (1) = (2) (b) Prove that A ⊕ B = (A ∪ B) − (A ∩ B) Solution: To prove this result, let x ∈ (A − B) ∪ (B − A) ⇔ x ∈ (A − B) or x ∈ (B − A) ⇔ (x ∈ A and x ∈ / B) or (x ∈ B and x ∈ / A) ⇔ [(x ∈ A and x ∈ / B) or x ∈ B] and [(x ∈ A and x ∈ / B) or x ∈ / A]

(2)

116

Distric Mathematics ⇔ [x ∈ B or (x ∈ A and x ∈ / B)] and [x ∈ / Aor(x ∈ A and x ∈ / B)] ⇔ [(x ∈ B or x ∈ A) and (x ∈ B or x ∈ / B)] and [(x ∈ / A or x ∈ A) and (x ∈ / A or x ∈ / B)] ⇔ x ∈ (A ∪ B) and x ∈ / (A ∩ B) ⇔ x ∈ (A ∪ B) − (A ∩ B) Hence,

12.

(A − B) ∪ (B − A) = (A ∪ B) − (A ∩ B)

(a) If p, q and r are 3 statements, then show that [(p ⇒ q) ∧ (q ⇒ r)] ⇒ (p ⇒ r) and also write its truth set. Solution: p

q

r

p⇒r

q⇒r

T T T T F F F F

T T F F T T F F

T F T F T F T F

T T F F T T T T

T F T T T F T T

(p ⇒ q) ∧ (q ⇒ r) T F F F T F T T

(p ⇒ r)

T F T F T T T T

(p ⇒ q) ∧ (q ⇒ r) ⇒ (p ⇒ r) T T T T T T T T

(b) Prove that ∼ [p → (q∧ ∼ r)] = p ∧ [∼ (q∧ ∼ r)] by a truth table. Solution: p T T T T F F F F

q T T F F T T F F

r T F T F T F T F

∼r F T F T F T F T

(q∧ ∼ r) F T F F F T F F

p → (q∧ ∼ r) F T F F T T T T

University Solved Question Papers ∼ [p → (p∧ ∼ r)] T F T T F F F F 13.

q∧ ∼ r F T F F F T F F

∼ (q∧ ∼ r) T F T T T F T T

117

p ∧ [∼ (q∧ ∼ r)] T F T T F F F F

7 = 10 hence proved (a) Let N be the set of all natural numbers. The relation R on the set N × N of ordered pairs of natural numbers is defined as (a, b)R(c, d) if and only if ad = bc. Prove that R is an equivalence relation. Solution: i) R is reflexive, since for each (a, b) ∈ N × N, we have ab = ba, i.e, (a, b)R(b, a). ii) Let (a, b)R(c, d). The ad = bc ⇒ cb = da. Thus (c, d)R(a, b), and R is symmetric. iii) Let (a, b)R(c, d) and (c, d)R(e, f ). Then ad = bc and c f = de. Thus (ad)(c f ) = (bc)(de). Dividing on both sides by dc, we get. a f = be, ie, (a, b)R(e, f ). Therefore, R is transitive. Since R is reflexive, symmetric and transitive, therefore R is an equivalence relation. (b) If S and T are two non-empty sets, then prove that there exists a one-toone correspondence between S × T and T × S. Solution: Consider the function defined as f : (S × T ) → (T × S) such that f (a, b) = (b, a), for all (a, b) ∈ (S × T ). i. To prove f is one-one, let (a, b) ∈ (S × T ) and (c, d) ∈ (S × T ). Then f (a, b) = f (c, d) ⇒ (b, a) = (d, c) ⇒ (b = d) and (a = c) ⇒ (a, b) = (c, d) Since f (a, b) = f (c, d) ⇒ (a, b) = (c, d), Therefore f is one-one. ii. To prove f is onto, let (b, a) ∈ (T × S). Obviously b ∈ T and a ∈ S. Thus for (b, a) ∈ (T × S), there exists a number (a, b) ∈ (S × T ) such that f (b, a) = (a, b). Hence, f is onto.

118 14.

Distric Mathematics (a) If ∑ = {a, b, c} and L = {b2 }L2 = {b4 }, L3 = {b6 } · · · then find out L∗ and L+ Solution: L∗ = L0 ∪ L1 ∪ L2 ∪ L3 = {λ } ∪ {b2 } ∪ {b4 } ∪ {b6 } · · · = {λ , b 2 , b 4 , b 6 , · · · } L+ = L1 ∪ L2 ∪ L3 ∪ · · · = {b2 } ∪ {b4 } ∪ {b6 } ∪ · · · = {b2 , b4 , b6 , · · · } (b) Determine the type of the grammar G which consist of productions. i. ii. iii. iv. v.

P = {S → α A, A → α AB, B → b, A → a} with starting symbol S. P = {S → b, S → aA, A → b, A → aA, b → bB, B → a, B → aB} P = {S → aAB, AB → a, A → b, B → AB} P = {S → b, S → aA, A → b, A → aA, A → bB, B → a, B → aB} P = {S → bA, A → aA, B → aB, B → b, A → a}

Solution: i. G is a context free or Type 2 grammar.Since each production is of the form A → a, ie, a single non-terminal symbol on the left and right side is a word in one or more symbols. ii. G is a regular or Type 3 grammar since each production is of the form A → a or A → aB ie, a single non-terminal symbol on the left and right side is either a single terminal symbol or a terminal symbol followed by a non-terminal symbol. iii. G is a grammar of Type 0, since one of the production is AB → a. iv. Length of left side of each production does not exceed the length of the right side, so G is a context sensitive on Type 1 grammar. v. Type 2 grammar since each production is of the form A → a. 15.

(a) Prove that a simple graph G with n vertices and k components cannot 1 have more than (n − k)(n − k + 1) edges. 2 Solution: If ni represents the number of vertices in a component i, for 1 ≤ i ≤ k of a graph G, then the sum of all vertices in each ofk components must equal the number of vertices in G, i.e, i=1

∑ ni = n k

University Solved Question Papers

119

Any component with ni vertices will have maximum possible number of edges = 12 ni (ni − 1) when it is complete. Hence, the maximum number of edges in G are 1 k 1 k 1 k ni (ni − 1) = ∑ ni2 − ∑ ni ∑ 2 i=1 2 i=1 2 k=1 1 1 ≤ [n2 − (k − 1)(2n − k)] n 2 2 1 1 = [n2 − 2nk + k2 + n − k] = (n − k)(n − k + 1) 2 2 (b) Prove that there is a unique path between each pair of vertices is a tree T (V, E) Solution: Since tree T (V, E) is connected, there exist at least one path between each pair of distinct vertices in T . Suppose, there exist two distinct paths between a pair of vertices u and v in T , then some of the edges for me. These paths will form a cycle. Since a tree has no cycle, therefore, T cannot be a tree.

16.

Section -C (5 × 8 = 40 marks) (a) (i) Prove that (A − B) ∩ (A ∩ B) = φ (ii) Prove that (A − B) ∪ A = A Solution: i. To prove (A − B) ∩ (A ∩ B) = φ , let x ∈ (A − B) ∩ (A ∩ B) ⇔ x ∈ (A − B) and x ∈ (A ∩ B) ⇔ (x ∈ A and x ∈ / B) and (x ∈ A and x ∈ B) ⇔ x ∈ A and x ∈ φ , [Since there is no element satisfying both x ∈ B and x ∈ / B] ⇔x∈φ ii. To prove (A − B) ∪ A = A, let x ∈ (A − B) ∪ A ⇔ x ∈ (A − B) or x ∈ A ⇔ (x ∈ A and x ∈ / B) or x ∈ A ⇔ x ∈ A and x ∈ /B ⇔x∈A Hence, (A − B) ∪ A = A

120

Distric Mathematics (b) If A = [0, i] where i ∈ I, the set of integers, then find (i) A1 ∪ A2 (ii) A3 ∩ A4 (iii) (a)

10 S

i=1

Ai

A1 ∪ A2 = set of all real numbers in the interval[0, 1]and[0, 2] = [0, 2] = A2

(b)

A3 ∩ A4 = set of all real numbers lies in both intervals [0, 3]and[0, 4] = [0, 3] = A3

(c)

10 [

Ai = A1 ∪ A2 ∪ · · · ∪ A10

i=1

= [0, 1] ∪ [0, 2] ∪ · · · ∪ [0, 10] = [0, 10] = A10 17.

(a) (i) Make a truth table for (p ↓ q) ∧ (p ↓ r) (ii) Make a truth table for p ⊕ q ⊕ r Solution: (i) (p ↑ q) ∧ (p ↓ r) p T T T T F F F F (ii)

q T T F F T T F F

r T F T F T F T F

(p ↓ q) F F F F F F T T

(p ↓ r) F F F F F T F T

p T T T T F F F F

q T T F F T T F F

p⊕q F F T T T T F F

(p ↓ q) ∧ (p ↓ r) F F F F F F F T

p⊕q⊕r r T F T F T F T F

p⊕q⊕r T F F T F T T F

University Solved Question Papers (b)

121

i. If p and q are two statements, then show that the statements (p ⊕ q) ∨ (p ↓ r) ≡ (p ↑ q) ii. If p and q are two statements, then show that the statement (p ↑ q) ⊕ (q ↑ q) ≡ (p ∨ q) ∧ (p ↓ q Solution: (i) (p ⊕ q) ∨ (p ↓ r) ≡ (p ↑ q) p T T F F

q T F T F

p⊕q F T T F

(p ↓ q) F F F T

(p ⊕ q) ∨ (p ↓ q) F T T T

p↑q F T T T

(p ⊕ q) ∨ (p ↓ q) ≡ (p ↑ q) hence proved. (ii)

18.

(p ↑ q) ⊕ (p ↑ q) ≡ (p ∨ q) ∧ (p ↓ q) p

q

p↑q

T T F F

T F T F

F T T T

(p ↑ q) ⊕ (p ↑ q) F F F F

(p ∨ q)

p↓q

T T T F

F F F T

(p ∨ q) ∧ (p ↓ q) F F F F

(p ↑ q) ⊕ (p ↑ q) ≡ (p ∨ q) ∧ (p ↓ q) hence proved. (a) If R and S are relations from A to B, prove that (i) R−1 ⊆ S−1 when R ⊆ S (ii) (R ∩ S)−1 = R−1 ∩ S−1 Solution: i. Since R ⊆ S, then for an element (a, b) ∈ R−1 implies that (b, a) ∈ R and (b, a) ∈ S. Also (b, a) ∈ S−1 implies (a, b) ∈ S. Thus R−1 ⊆ S−1 . ii. Let (a, b) ∈ (R ∩ S)−1 ⇔ (b, a) ∈ R ∩ S ⇔ (b, a) ∈ R and (b, a) ∈ S ⇔ (a, b) ∈ R−1 and (a, b) ∈ S−1 ⇔ (a, b) ∈ R−1 ∩ S−1 Hence (R ∩ S)−1 = R−1 ∩ S−1 (b) If f : A → B is one-to-one and onto function then prove that. (i) f −1 o f = IA (ii) f o f −1 = IB Solution:

122

Distric Mathematics i. For every x ∈ A, IA (x) = x = f −1 [ f (x)] = ( f −1 o f )(x) Thus, f −1 o f is the function from set A to itself. ii. Similarly, for every y ∈ B, IB (y) = y = f [ f −1 (y)] = ( f o f −1 )(y) Thus, f o f −1 is the function from set B to itself.

19.

(a) What are the main features of a finite state machine? A finite -state machine is an abstract model of a machine which accept discrete inputs, produces discrete output and has the internal memory to keep track of certain information about previous inputs. The major features of a finite - state machine are as follows. i. At any given time, the machine can be in only one of finite number of states. These states are called the internal states of the machine, and at a given time the total memory available to the machine is the knowledge of internal state it is in at that moment. ii. The machine accepts as input only a finite number of symbols. The finite set of all possible inputs constitute the input alphabet for the machine. iii. An output and a next state are determined by each combination of inputs and internal states. The finite set of all possible outputs constitute the output alphabet for the machine. iv. We assume that the machine has an internal clock, and the sequential processing are synchronised by separate and distinct clock pulses. The machine is initiated by placing it is a fixed initial state before the clock is started and that the machine operates in a deterministic manner, where the output is completely determined by the total input provided and the starting state of the machine. (b) (i) Define finite state automata. (ii) What are the types of automaton? (iii) What are the properties of Transition function. i) A finite - state automation is a special type of finite - state machine, in which there is no output, and some of its states are distinguished as accepting states.

University Solved Question Papers

123

ii) Types of automation (i) Deterministic finite - state automaton. (ii) Non - deterministic finite - state automaton. iii) Properties of Transition function Let f (Si , ω ) = S j be a unique state such that there is a path in the transition diagram from Si to S j , thus we define. A. f (S, λ ) = S, where λ denotes no input. That is, without reading an input symbol, the finite automaton cannot change state. B. For all strings ω and input symbols a, f (S, ω a) = f ( f (S, ω ), a) that is, to find the state after reading a non-empty input string ω a, find the state f (S, ω ) after reading ω 20.

(a) If the intersection of two paths in a graph G is disconnected, then prove that their union has atleast one circuit. Solution: Let P1 and P2 be two in G such that P1 ∩ P2 is disconnected. Since P1 ∩ P2 is disconnected, there is at least one pair of vertices u, v in P1 ∩ P2 where both do not exists between then. However, u, v, ∈ P1 ∩ P2 implies that u, v belong to both paths P1 and P2 and therefore, there exists a path in P1 and P2 which connect vertices u and v. As there is no path in P1 ∩ P2 connecting vertices u and v, it may be assumed that paths in P1 and P2 connecting u and v are edge - disjoint. Thus, union of these two paths connecting u and v forms a circuit in P1 ∪ P2 as shown in Figure 1 P1

P2

(b) Let T be a complete m -ary tree of height h and l leaves, prove that l ≤ m h and h ≥ logm l Proof: We shall prove this theorem by mathematical induction on h. For h = 1, the tree T consists of one root and m children, each of which is a leaf. Thus, l = m = mh in m-ary tree of height one. Suppose the result is true for all m-ary trees of height less then h. Consider a m -ary tree T of height h having l leaves (at least m of the leaves at level h). The l leaves of T are also the leaves of m. Sub-trees

124

Distric Mathematics Ti , 1 ≤ i ≤ m obtained by deleting the edges from the root of each of the vertices at level 1. Since m ≥ 1, therefore each of these sub-trees is a height less than or equal to h − 1. Thus, by the induction hypothesis, Li ≤ mh(Ti ) ≤ mh−1 where h(Ti ) is the height of sub tree Ti for 1 ≤ i ≤ m. Since there are almost m such trees, each with a maximum of m h−1 leaves, m

` = ∑ `i ≤ m(mh−1 ) = mh . This proves the theorem. i=1

Since ` ≤ mh , taking log on both sides, we have log`m = logm (mh ) = h. This implies that h ≥ log`m for h ∈ I+ .

University Solved Question Papers

125

Additional Important Questions for Unit - I 1. Let A, B,C are sets and U be the universal set. Then prove that A − B = A ∩ B0 Solution: x ∈ A − B ⇔ x ∈ A but x ∈ /B ⇔ x ∈ A and x ∈ B0 ⇔ x ∈ A ∩ B0 So A − B = A ∩ B0 2. If A ∪ B = A ∪C and A ∩ B = A ∩C, prove that B = C. Solution: As it is given that A ∪ B = A ∪C, we have B ∩ (A ∪ B) = B ∩ (A ∪C)

(1)

L.H.S B ∩ (A ∪ B) = B as B ⊆ A ∪ B

(2)

R.H.S = B ∩ (A ∪C) = (B ∩ A) ∪ (B ∩C)

[Distribute law]

= (A ∩ B) ∪ (B ∩C)

[Commutative law]

= (A ∩C) ∪ (B ∩C)

(Since A ∩ B = A ∩C)

= (A ∪ B) ∩C

[Distribute law]

= (A ∪C) ∩C

(as A ∪ B = A ∪C)

=C

(as C is a subsetA ∪C)

Thus R.H.S = C from (2) and (3), B = C 3. If A and B are finite sets, then n(A ∪ B) = n(A) + n(B) − n(A ∩ B) Solution: Let n(A/B) = x n(B/A) = y n(A ∩ B) = z Then n(A) = x + z n(B) = y + z and n(A ∪ B) = x + y + z n(A) + n(B) − n(A ∩ B) = x + z + y + z − z = x+y+z = n(A ∪ B)

126

Distric Mathematics

4. IfA and B are sets, prove that A ⊆ B if and only if B0 ⊆ A0 Solution: A ⊆ B ⇔ if x ∈ A, then x ∈ B ⇔ if x ∈ / A0 , then x ∈ / B0 ⇔ if x ∈ B0 , then x ∈ A0 ⇔ B0 ⊆ A0 5. For any two sets A and B, prove that (a) A ⊆ B ⇔ A ∩ B = A (b) A ∩ B ⊆ A ∪ B Solution: (a) Suppose A ⊆ B, if x ∈ A, since A ⊆ B if follows that x ∈ B. ∴ x ∈ A ⇒ x ∈ A∩B ∴ A ⊆ A∪B Given A ∩ B = A if x ∈ A = A ∩ B then x ∈ Aand x ∈ B ∴ x ∈ A ⇒ x ∈ B ie, A ⊆ B (b) x ∈ A ∩ B ⇒ x ∈ A and x ∈ B ⇒ x ∈ A∪B ∴ A∩B ⊆ A∪B 6. A computer company must hire 25 programmers to handle system programming tasks and 40 programmers for applications programming of these hired, 10 will be expected to perform tasks of each type. How many programmers must be hired. Solution: Let A be the set of system programmers hired, and let B be the set at application programmers hired. We must have |A| = 25, |B| = 40 and |A ∩ B| = 10 Thus the number that must be hired is |A ∪ B| = |A| + |B| − |A ∩ B| = 25 + 40 − 10 = 55

University Solved Question Papers 7. Show that for any two sets A and B (i) A − B = A∩ ∼ B (ii) A ⊆ B ⇔∼ B ⊆∼ A Solution: (i) For any x, x ∈ A − B ⇔ x ∈ {x/x ∈ A ∩ x ∈ / B} ⇔ x ∈ (A∩ ∼ B) (ii)

A ⊆ B ⇔ (x)(x ∈ A → x ∈ B) ⇔ (x)(7(x ∈ B) → 7x ∈ A) ⇔ (x)(x ∈ / B) → x ∈ /A ⇔∼ B ⊆∼ A

8. Prove that A − (A − B) ⊂ B Solution: x ∈ A − (A − B) ⇒ x ∈ A, x ∈ / A−B ⇒ x ∈ A, x ∈ B ⇒x∈B ∴ A−(A − B) ⊂ B 9. Draw a venn diagram (i) A ⊆ B

(ii) A ∩ B = φ U

U

B A

B

A

() i AÍ B

(ii) A Ç B = f

10. Explain the properties of union operation. Solution: Let A, B,C be subsets of U. Then

127

128

Distric Mathematics (i) (ii) (iii) (iv) (v)

A∪A = A A∪φ = A A ∪U = U A ∪ A0 = U A ⊆ A ∪ B and B ⊆ A ∪ B

(vi) A ∪ B = B ∪ A (vii) (A ∪ B) ∪C = A ∪ (B ∪C)

11. Explain the properties of intersection. Solution: For any three set A, B,C we have (a) A ∩ A = A (b) A ∩ B = A whenever A ⊆ B (c) A ∩ B = B whenever B ⊆ A

(d) A ∩ B ⊆ A and A ∩ B ⊆ B (e) A ∩ B = B ∩ A (f) (A ∩ B) ∩C = A ∩ (B ∩C)

12. Among 50 students in a class, 26 passed in first semester and 21 passed in second semester examination. If 17 did not pass in either semester, how many passed in both semesters? Solution: Let A, B represent respectively the sets of students passing the first semester and passing the second semester. n(A) = 26, n(B) = 21 It is given that 17 have not passed in either semester. ∴ 50 − 17 = 33 ie, n(A ∪ B) = 33 n(A ∪ B) = n(A) + n(B) − n(A ∩ B) 33 = 26 + 21 − n(A ∩ B) 33 = 47 − n(A ∩ B) n(A ∩ B) = 47 − 33 n(A ∩ B) = 14 i.e, 14 students passed in both semester. 13. In a class of 25 students,12 have taken economics, 8 have taken economics but not political science. Find the number of students who have taken economics and political science and those who taken politics but not economics. Solution: Suppose A and B denote the set of students who take economics and political science, respectively. it is given that n(A) = 12, n(A ∪ B) = 25 and n(A ∪ BC ) = 8

University Solved Question Papers n(A) = n(A ∩ Bc ) + n(A ∩ B) 12 = 8 + n(A ∩ B) n(A ∩ B) = 4 Also n(A ∪ B) = n(A) + n(B) − n(A ∩ B) 25 = 12 + n(B) − 4 n(B) = 17 Therefore n(B) = n(A ∩ B) + n(B ∩ Ac ) 17 = 4 + n(B ∩ Ac ) n(B ∩ Ac ) = 17 − 4 n(B ∩ Ac ) = 13 14. Express (A − B)c in terms of U and C Solution: A − B = {x : x ∈ A and x ∈ / B} = A∩B c

Thus (A − B) = (A ∩ Bc )c = Ac ∪ (Bc )c = Ac ∪ B 15. Explain the properties of Symmetric Difference (i) A ⊕ B = B ⊕ A (ii) (A ⊕ B) ⊕C = A ⊕ (B ⊕C) (iii) A ⊕ A = φ (iv) A ⊕ (A ∩ B) = φ (v) A ⊕ (A ∩ B) = A ∪ B (vi) (A ⊕ B) ∪ (A ∩ B) = A ∪ B (vii) A ⊕ B = (A − B) ∪ (B − A) (viii) A ⊕ B = φ ⇔ A = B

129

130

Distric Mathematics

16. Let An = {x : x is divisible by n} when x ∈ N. Find A3 ∩ A5 and A3 ∪ A5 Solution:

A3 ∩ A5 = {x : x is divisible by both 3 and 5} = {x : x is divisible by 15} = {0, 15, 30, 45, · · · } A3 ∪ A5 = {x : x is divisible by 3 or 5} = {0, 3, 5, 6, 9, 10, 12, 15, · · ·} 17. Given that A ⊕ B = A ⊕C, is it necessary that B = C? Justify your answer. Solution: Let B = C. Then A ⊕ B = (A ∪ B) − (A ∩ B) is the set that contains elements which are either in A or B but not in both. But, if A ⊕ B = A ⊕C, then (A ∪ B) − (A ∩ B) = (A ∪C) − (A ∩C) ⇒ A ∪ B = A ∪C and A ∩ B = A ∩C ⇒ B=C 18. If A = [0, i] where i ∈ I, the set of integers. Then find (a) A1 ∪ A2 (b) A3 ∩ A4 (c)

20 S

i=5

Ai

Solution: a) A1 ∪ A2 = Set of all real numbers in the interval [0, 1] and [0, 2] = [0, 2] = A2 b) A3 ∩ A4 = Set of all real numbers lie in both interval [0, 3] and [0, 4] = [0, 3] = A3

University Solved Question Papers c)

10 [

131

= A1 ∪ A2 ∪ · · · ∪ A10

i=1

= [0, 1] ∪ [0, 2] ∪ · · · ∪ [0, 10] = [0, 10] A10 19. There are two sets S1 = {a, b, c, 2} and S2 = {1, 2, 3}. Perform the operations of union and intersection on these sets. Also find S1 − S2 and S2 − S1 . Solution: (a) S1 ∪ S2 = {a, b, c, 2, 1, 2, 3} = {a, b, c, 1, 2, 3} (b) S1 ∩ S2 = {2} (c) S1 − S2 = {a, b, c} (d) S2 − S1 = {1, 3} 20. In a survey concerning the smoking habits of consumers, it was found that 55 percent smoke cigarette A, 50 percent smoke B, 42 percent smoke C, 28 percent smoke A and B, 20 percent smoke A and C, 12 percent smokeB and C and 10 percent smoke all the three cigarettes. Find what percentage do not smoke? Solution: n(A ∪ B ∪C) = n(A) + n(B) + n(C) − n(A ∩ B) − n(B ∩C) − n(A ∩C) + n(A ∩ B ∩C) = 55 + 50 + 42 − 28 − 12 − 20 + 10 = 97 c

n(A ∪ B ∪C) = U − n(A ∪ B ∪C) = 100 − 97 c

n(A ∪ B ∪C) = 3 21. 63% of persons like oranges while 76% like apples, what can be said about the percentage of persons who like both oranges and apples? Solution: n(S) = total number of persons = 100

132

Distric Mathematics n(A) = 63

n(B) = 76 n(A ∪ B) = n(A) + n(B) − n(A ∩ B) n(A ∩ B) = n(A) + n(B) − n(A ∪ B) = 63 + 76 − 100 = 39 ∴ n(A ∩ B) = 39

Hence, 39% people like both oranges and apples. 22. Prove that power set (A ∩ B) is equal to the powerset (A) ∩ powerset (B) Solution: Let C be a non-empty set and C ∈ powerset (A ∩ B) Then C ⊆ A ∩ B ie,C ⊆ A and C ⊆ B

(1)

x ∈ powerset A and x ∈ powerset B x ∈ powerset A and A∩ powerset B

(2)

From (1) and (2) Powerset (A ∩ B) ⊆ powerset (A)∩ powerset (B)

(3)

Similarly, it can also be proved that Powerset (A)∩ powerset (B) ⊆ powerset (A ∩ B) from (3) and (4), it is concluded that Powerset (A ∩ B) = powerset (A)∩ powerset (B) 23. Write the dual of each set equation (i) A ∪ B = (BC ∩ AC )C (ii) A = A ∪ (A ∪ B) (iii) A = (BC ∩ A) ∪ (A ∩ B) (iv) (A ∪ B ∪C)C = (A ∪C)C ∩ (A ∪ B)C Solution: (i) A ∩ B = (BC ∪ AC )C (ii) A = A ∪ (A ∪ B) (iii) A = (BC ∪ A) ∩ (A ∪ B) (iv) (A ∩ B ∩C)C = (A ∩C)C ∪ (A ∩ B)C

(4)

University Solved Question Papers

133

24. Let U = {x : x ∈ N, 1 ≤ x ≤ 12} be the universal set and A = {1, 9, 10} B = {3, 4, 6, 11, 12} and C = {2, 5, 6}. Find the (i) (A ∪ B) ∩ (A ∪C) (ii) A ∪ (B ∩C) (i) U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} A ∪ B = {1, 3, 4, 6, 9, 10, 11, 12} A ∪C = {1, 2, 5, 6, 9, 10} (A ∪ B) ∩ (A ∪C) = {1, 6, 9, 10} (ii) B ∩C = {6} A ∪ (B ∩C) = {1, 6, 9, 10} 25. Show that A ∪ (B −C) 6= (A ∪ B) − (A ∪C) Solution: To prove this result, let x ∈ A ∪ (B −C) ⇔ x ∈ A or x ∈ (B −C) ⇔ x ∈ A or (x ∈ B and x ∈ / C) ⇔ (x ∈ A or x ∈ B) and (x ∈ A or x ∈ / C) ⇔ (x ∈ A or x ∈ B) and (x ∈ A or x ∈ CC ) ⇔ x ∈ (A ∪ B) ∩ (A ∪CC ) Hence, A ∪ (B −C) 6= (A ∪ B) − (A ∪C) 26. If X = Y ∪ Z, show that X −Y = Z ∩Y C Solution: X −Y = X ∩Y C = (Y ∪ Z) ∩Y C = (Y ∩Y C ) ∪ (Z ∩Y C ) = φ ∪ (Z ∩Y C ) = Z ∩Y C

134

Distric Mathematics Solved Extra Problems for Unit - II

1. Determine the truth table of the formula P → (Q → R) Solution: P T T T T F F F F

Q T T F F T T F F

R T F T F T F T F

Q→R T F T T T F T T

P → (Q → R) T F T T T T T T

2. Construct the truth table for 7(7p ∧ 7Q) Solution: P T T F F

Q T F T F

7P F F T T

7Q F T F T

7P ∧ 7Q F F F T

7(7P ∧ 7Q) T T T F

3. Construct the truth table of the formula (7P ∨ Q) ∧ (7Q ∨ P) Solution: P T T F F

Q T F T F

7P F F T T

7Q F T F T

7P ∨ Q T F T T

7Q ∨ P T T F T

(7P ∨ Q) ∧ (7Q ∨ P) T F F T

4. Verify whether (P ∨ Q) → P is a tautology. Solution: P T T F F

Q T F T F

P∨Q T T T F

(P ∨ Q) → P T T F T

University Solved Question Papers

135

Since the truth table of (P ∨ Q) → P is not tautology because the entries in the last column of the truth table contains false. 5. Verify whether (p ∧ (p ←→ q)) → q. Solution: p T T F F

q T F T F

p ←→ q T F F T

p ∧ (p ←→ q) T F F F

(p ∧ (p ←→ q)) → q T T T T

It is tautology because the entries in the last column of the truth table contains true. 6. Verify whether (p ∨ q) ∨ 7(p ∧ q) is a contradiction or tautology. Solution: p T T F F

q T F T F

p∨q T T T F

p∧q T F F F

7(p ∧ q) F T T T

(p ∨ q) ∧ 7(p ∧ q) T T T T

It is a tautology. 7. Show that Q ⇒ P → Q Solution: P T T F F

Q T F T F

P→Q T F T T

Q→P→Q T T T T

So Q ⇒ P → Q 8. Demonstrate that S is valid inference from the premises. P → 7Q, Q ∨ R, 7S → P and 7R

136

Distric Mathematics 1

Q∨R

Premise (or hypothesis)

2

7R

Premise (or hypothesis)

3

Q

(1), (2) and tautology

4

P → 7Q

Premises (or hypothesis)

5

7P

(3),(4) and tautology

6

7S → P

Premise (or hypothesis)

7

S

(5), (6) and tautology

9. Show that 7Q, P → Q ⇒ 7P Solution: 1 P→Q 2 7Q → 7P 3 7Q 4 7P

Premisses T ,(1) and E18 P T, (2)(3) and I11

10. Write each of the following in symbolic form. (a) All men are giants (b) No men are giants (c) Some men are giants (d) Some men are not giants Solution: M(x) :xis a man, and G(x) :xis a giant. Statement (a) means ‘for all x, if x is a man, then x is a giant. So (∀x)[M(x) → G(x)] Statement (b) means, ‘for all x, if x is a man, then x is not a giant’ and it is represented by (∀x)[M(x) → 7G(x)] Statement (c) means, ‘then is an x, such that x is a man and x is a giant’ (∃x)[M(x) ∧ G(x)] Statement (d) means, ‘there is an x, such that x is a man and x is not a giant’ so it is (∃x)[M(x) ∧ 7G(x)]

University Solved Question Papers 11. Show that P → Q, Q →∼ R, R, P ∨ (J ∧ S) Solution: (i) P→Q (ii) Q →∼ R (iii) P →∼ R (iv) R →∼ P (v) R (vi) ∼P (vii) P ∨ (J ∧ S) (viii) J ∧ S

rule P rule P ∴ (P → Q, Q → R ⇒ P → R) Steps (i), (ii) P → Q ⇐⇒∼ Q →∼ P ∼ Q →∼ P ∴ (P, P → Q ⇒ Q, iv, v) rule P ∴∼ P, P ∨ Q ⇒ Q (vi, vii)

12. Show that ∼ (P ∧ Q) follows from ∼ P∧ ∼ Q Solution: (i) ∼∼ (P ∧ Q) (ii) P ∧ Q (iii) P (iv) ∼ P∧ ∼ Q (v) ∼ P (vi) P∧ ∼ P

assumed P∧Q ⇒ P (rule P) from (iv) a contradiction

13. Show that ∼ P ∨ Q, ∼ Q ∨ R, R → S ⇒ P → S Solution: 1 P∨Q 2 ∼P→Q 3 P 4 Q 5 ∼ Q∨R 6 Q→R 7 R→S 8 Q→S 9 S

rule P from (1) from CP from (2,3) rule P from 5 rule P from (4,8)

14. prove by indicated method 7P, P → Q, P ∨ T = T Solution: 1 P∨T 2 7T 3 P 4 P→Q 5 Q 6 7Q 7 Q ∧ 7Q

Rule P Rule P (additional premise) Rule T , 1, 2 Rule P T , 3,4 Rule P Rule T , 5,4 contradiction.

137

138

Distric Mathematics

15. Symbolise the expression “x is the father of the mother of y” Solution: P(x) : x is a person F(x, y) : x is the father of Y M(x, y) : x is the mother of y We name a person called z as the mother of y ⇒ x is the father of z and z is the mother of y. We symbolise this as (∃z)(P(z) ∧ F(x, z) ∧ M(z, y)) 16. Show that (∃x)M(x) follows logically from the premises (x)((H(x) → M(x))) and (∃x)H(x) Solution: 1 (∃x)H(x) 2 H(y) 3 (x)((H(x) → M(x))) 4 H(y) → M(y) 5 M(y) 6 (∃x)M(x)

rule P ES P US T EG

17. Give direct and indirect proofs of p → q, q → r, ∼ (p ∩ r), p ∪ r ⇒ r Solution: Direct Proof: 1 p→q 2 q→r 3 p→r 4 p∪r 5 ∼ p∪r 6 (p ∪ r) ∩ (∼ p ∪ r) 7 (p∩ ∼ p) ∪ r 8 p∪r 9 r Indirect Proof: 1 ∼r negated conclusion 2 p∪r premise 3 p (1), (2) 4 p → q premise 5 q from (3), (4) 6 q → r premise 7 r from (5), (6) 8 0 from (1),(7)

University Solved Question Papers

139

18. Give direct proof a → b, c → b, d → (a ∨ c), d ⇒ b. Solution: Direct Proof: 1 d → (a ∪ c) 2 d 3 a∪c 4 a→b 5 ∼ a∪b 6 c→b 7 ∼ c∪b 8 (∼ a ∪ b) ∩ (∼ c ∪ b) 9 (∼ a∩ ∼ c) ∪ b 10 (a ∨ c) → b 11 b 19. Show that the formula Q ∪ (P∩ ∼ Q) ∪ (∼ P∩ ∼ Q) is a tautology. Solution: Let A be the given formula. If PdnF of A consists of all minterms then it is a tautology. For this we obtain the pdnf as follows: A ⇔ Q ∪ (P∩ ∼ Q) ∪ (∼ P∩ ∼ Q) ⇔ Q ∩ (P∪ ∼ P) ∪ (P∩ ∼ Q) ∪ (∼ P∩ ∼ Q) ⇔ (Q ∩ P) ∪ (Q∩ ∼ P) ∪ (P∩ ∼ Q) ∪ (∼ P∩ ∼ Q) Which is a tautology since all minterms are present in pdnf. 20. Show that (P → C) ∩ (Q → C) ⇔ (P ∪ Q) → C Solution: P T T T T F F F F

Q T T F F T T F F

C T F T F T F T F

P∪Q T T T T T T F F

P→C T F T F T T T T

Q→C T F T T T F T T

(P → C) ∩ (Q → C) T F F F T F T T

(P ∪ Q) → C T F T F T F T T

(P → C) ∩ (Q → C) ⇔ (P ∪ Q) → C 21. Obtain the principal disjunctive and conjunctive. Normal forms of P → ((P → Q)∩ ∼ (∼ Q∪ ∼ P))

140

Distric Mathematics Solution: P → ((P → Q)∩ ∼ (∼ Q∪ ∼ P)) ⇔∼ P ∪ (∼ P ∪ Q) ∩ (Q ∩ P) ⇔∼ P ∪ (∼ P ∩ (Q ∩ P)) ∪ (Q ∩ (Q ∩ P)) ⇔∼ P ∪ (Q ∩ P) ⇔ (∼ P ∩ (Q∪ ∼ Q)) ∪ (Q ∩ P) ⇔ (∼ P ∩ Q) ∪ (∼ P∩ ∼ Q) ∪ (P ∩ Q) which is pdnf. pdnf: If A is the above therm then 7A is 7(∼ Q ∩ P) ∴ 77 A gives Q∪ ∼ P which is pcnf.

22. Show that S ∪ R is tautologically implied by (P ∪ Q) ∩ (P → R) ∩ (Q → S) Solution: 1 P∪Q 2 7P → Q 3 Q→S 4 7P → S 5 7S → P 6 P→R 7 7S → R 8 S∪R

rule P rule T , P → Q ⇐⇒ 7P ∪ Q, 77P ⇐⇒ P, (i) rule P rule T from 2 and 3, P → Q, Q → R ⇒ P → R rule T, 4, P → Q ⇐⇒ 7Q → 7P rule P from 5,6, rule T from 7, ruleT

23. Symbolize the expression “All the world loves a lover”. Solution: The Quotation means everybody loves a lover. Now let P(x) L(x) R(x, y)

: : :

x is a person x is a lover x loves y

The required expression is (x)(P(x) → (y)(p(y) ∩ L(y) → R(x, y))) 24. Verify the validity of the following arguments. All men are mortal Socrates is a man Therefore Socrates is a mortal Solution:

University Solved Question Papers

141

We denote H(x) : x is a man M(x) : x is a mortal S : Socrates (∀x)(H(x) → M(x)) ∧ H(s) ⇒ M(s) Argument: 1 2 3 4

(∀x)(H(x) → M(x)) H(s) → M(s) H(s) M(s)

P Us, (1) P T , (2), (3)

25. Write the following statement in the symbolic form: ‘every one who likes fun will enjoy each of these plays’ Solution: We rite L(x) P(x) E(x, y)

: : :

x likes fun x is a play x will enjoy y

Then (∀x) [L(x) → (∀y)P(y) → E(x, y)] represents the given statement. The statement can also be represented as “for each x, if x likes fun and for each y, if y is a play, then x enjoys y”. So it could be symbolized as (∀x)(∀y) [L(x) ∧ P(y) → E(x, y)] 26. Write in the symbolic form: Every one who is healthy can do all kinds of work. Solution: H(x) : W (y) : D(x, y) :

x is a healthy person y is a kind of work x can do y

The statement is ‘for all x, if x is healthy, and for all y, if y is a kind of work, then x can do y’. So a symbolic form is (∀x)(∀y) [H(x) ∧ H(y) → D(x, y)] 27. List out the rules for Inferenie theory. (i) Universal Specification: (x)A(x) ⇒ A(y) (ii) Universal Generalization: A(y) ⇒ (x)A(x)

142

Distric Mathematics (iii) Existential Specification: (∃x)A(x) ⇒ A(y) (iv) Existential Generalization: A(y) ⇒ (∃x)A(x)

28. Write in the symbolic form Every one should help his neighbors, or his neighbors will not help him. Solution: N(x, y) H(x, y) P(x, y)

: : :

x and y are neighbors x should help y x will help y

The given statement is ‘ for every person x and every person y, if x and y are neighbors, then either x should helpy or y will not help x’. So the symbolic form is (∀x)(∀y)(N(x, y) → (H(x, y) ∨ 7P(y, x))) 29. Show that the statements are contingency. p ⇒ (p ⇒ q) p T T F F

q T F T F

p⇒q T F T T

p ⇒ (p ⇒ q) T F T T

Since entries in the last column of the truth table depend on statements p, q and p ⇒ q, therefore, given statement is a contingency. 30. Examine the validity of following arguments p⇒q q⇒ p ∴ p∨q Solution: p T T F F

q T F T F

Premises p→q q⇒ p T T F T T F T T

Conclusion p∨q T T T F

Since critical now 4 does not contain true conclusion, the argument is invalid.

University Solved Question Papers 31. Explain the elementary rules of conclusion. (i) Modus Ponens  p⇒q Premises p ∴q Conclusion (ii) Modus tollens ∼p p⇒q ∴∼ p (iii) Hypothetical Syllogism p ⇒ q and q ⇒ r ∴ p⇒r (iv) Constructive dilemma  (p ⇒ q) ∧ (r ⇒ s) p∧r ∴ q∨s (v) Disjunctive Syllogisms  p∧q ∼p ∴p (vi) Absorption p⇒q ∴ p ⇒ (p ∧ q) 32. Over the universe of animals, let A(x) B(x) C(x)

: : :

x is a whale x is a fish x lives in water translate the following in your own words:

(i) ∃x(∼ C(x)) (ii) (∃x)(B(x)∧ ∼ A(x)) (iii) (∀x)(A(x) ∧C(x)) ⇒ B(x) Solution: (i) There exists an animal which does not live in water. (ii) There exists a fish that is not a whale. (iii) Every whale that lives in the water is a fish.

143

144

Distric Mathematics

33. Use quantifiers to say that

√ 3 is not a rational number.

Solution: Let p(x) be a prime number and q(x) :

√ x, where x is prime number.

Then r(x) : is rational for all x, and q(x) ⇒∼ r(x). ie, square root of every prime number is not rational. 34. Test the validity of the following statement: ‘If a boy gets high marks in examination, he is either deligent or intelligent. The boy has got high marks in examination. he is either deligent or intelligent’. Solution: Let p = boy has got high marks in examination. The conclusion to be tested is : He is deligent or intelligent. Hence, the argument is: (p ⇒ q) ∧ p ⇒ q p T T F F

q T F T F

p⇒q T F T T

p ⇒ q∧ p T F F F

(p ⇒ q) ∧ p ⇒ q T T T T

Since (p ⇒ q) ∧ p ⇒ q is tautology, therefore, the statements are valid. 35. Negate the proposition and show it by quantifiers ‘All integers are grater than θ ’. Solution: Let p(x) denote ‘x is integer’ and q(x) denote ‘x is grater than q’. Then the given proposition can be written as (∃x ε p(x))(∼ q(x)) 36. Which is the logical opposite of the following words? (i) good

(iii) equal

(ii) less

(iv) braves

Solution: (i) not good

(iii) not less

(ii) unequal

(iv) not brave

University Solved Question Papers

145

37. Over the universe of four - wheelers, let A(x) B(x) C(x)

: : :

x is a four wheeler, x is a car and x is a manufactured by Maruti Udyog ltd.

Express the following statements using quantifiers. (a) Every car is a four-wheeler manufactured by MUL. (b) There are cars that are not manufactured by MUL. (c) Every four - wheeler is a car. Solution: (a) (∀x)(A(x)∧ ∼ B(x)) ⇒ C(x) (b) (∃x)(A(x) ∧C(x)) (c) (∀x)(A(x) ⇒ B(x)) 38. In the universe of all integers, let Q(x, y) : x + y = 10 which of the following statements are true in this universe (a) (∃x)(∀y)Q(x, y) (b) (∃x)(∃y)Q(x, y) Solution: a) (∃x)(∀y)Q(x, y) means ‘these exists an x such that x + y = 10, for all integer y’. It is not true as there is no common x satisfy this relation for all y. If there is an integer x1 such that x1 + y1 = 10 for some y1 , then x1 + 2y1 = 10 is not true. c) The statement is true. For (∃x)(∃y)Q(x, y) means ‘there is an integer x and there is an integer y such that x + y = 10. It is true. When x = 3 and y = 7, we have 3 + 7 = 10. (There are many pairs (x, y) such that x + y = 10). 39. Write in symbolic form P Q

: :

Marl is rich Mark is happy.

(a) Mark is poor but happy. (b) Mark is rich or unhappy (c) mark is neither rich nor happy. (d) Mark is poor or he is both rich and unhappy.

146

Distric Mathematics Solution: (i) 7P ∧ Q (ii) P ∨ 7Q (iii) 7P ∨ 7Q (iv) 7P ∨ (P ∨ 7Q)

40. Show that (P → Q) ∧ (R → Q) ⇔ (P ∨ R) → Q Solution: (P → Q) ∧ (R → Q) ⇔ (7P ∨ Q) ∧ (7R ∨ Q) ⇔ (7P ∧ 7R) ∨ Q ⇔ 7(P ∨ R) ∨ Q ⇔ (P ∨ R) → Q

University Solved Question Papers

147

Solved Extra Problems for Unit - III 1. Let A = {−2, −1, 0, 1, 2}B = {0, 1, 4} and f : A → B is defined as f (x) = x 2 is a function. Find whether it is one - one or bijection? Solution: f (x) = x2 f (−2) = 4, f (−1) = 1 f (0) = 0, f (1) = 1, f (2) = 4 f : A → B is a function, and f : A → B is onto (subce f (A) = B)). f (−1) = f (1) = 1 hence f : A → B is not one-one, since f : A → B is not a bijection. 2. If A = {p, q, r}B = {2, 1, 0} and f : A → B, find whether it is one-one, onto or bijection? (a) f = {(p, 2)(q, 0)(r, 2)} (b) f = {(p, 1)(q, 0)(r, 2)} (a) f = {(p, 2)(q, 0)(r, 2)} ⇒ p and r have the same image ∴ f : A → B is not one- one. f(A) = {0, 2, } 6= B. Therefore not onto. ∴ f : A → B is not a bijection. (b) f = {(p, 1)(q, 0)(r, 2)} Different elements in A have different f - images in B and hence f is one - one. f (A) = {1, 0, 2} = B, ∴ f : A → Bis onto ∴ f : A → Bis a bijection 3. Find whether function f : 0, ∞ → R defined as f (x) = x2 is one-one, onto or bijection. Solution: f (x) = x2 F : [0, ∞) → Ris a function.

148

Distric Mathematics let a1 , a2 ∈ [0, ∞) and f (α1 ) = f (α2 ) Now

f (a1 ) = f (a2 ) ⇒ a21 = a22 ⇒ a1 = a2

∴ [0, ∞) → R is one - one. There is no pre-image in [0, ∞] to (-1) ∴ f is not onto ∴ f : [0, ∞) → R is not a bijection. 4. Find inverse functions of the following of f (x) = 4x + 7 Solution:

y = f (x) = 4x + 7 y−7 x= 4 y−7 , 4 x−7 and inverse function f −1 (x) = 4 ∴ inverse function f −1 (y) =

5. Find inverse function of f (x) =

2x + 1 3

Solution: Let 2x + 1 3 3y − 1 −1 ∴ f (y) = x = 2 3x − 1 and f −1 (x) 2 y = f (x) =

6. Find whether each of the following functions is one- one or onto or one-one and onto. f (x) = 2x − 3 Solution: If f : R → R, then

University Solved Question Papers

149

f (x) = 2x − 3 ∈ R a1, a2, ∈ R

f (a1 ) = f (a2 ) 2a1 − 3 = 2a2 = 3 ⇒

a1 = a2

Hence f is one-one. y+3 if y ∈ R, then x = 2 f (x) = 2x − 3   y+3 2 −3 = y 2 Thus f is onto. Hence f is a bijection. 7. Let f : R → R and g : R → R defined by f (x) = 4x − 1, g(x) = cosx find go f and f og. Solution:

go f (x) = g( f (x)) = g(4x − 1) = cos(4x − 1) f og(x) = f (g(x)) = f (cosx) = 4cosx − 1 8. Find f og, go f when f : R → R and g : R → R defined by f (x) = 2x − 1, g(x) = x2 − 2 Solution:

f og(x) = f [g(x)] = f [x2 − 2] = 2(x2 − 2) − 1 = 2x2 − 4 − 1 = 2x2 − 5

150

Distric Mathematics go f (x) = g[ f (x)] = [g2x + 1] = (2x + 1)2 − 2 = 4x2 + 4x + 1 − 2 = 4x2 + 4x − 1

9. Show that the function f : R → R given by f (x) = sinx is neither 1 - 1 nor onto. Solution: π  1 π = sin = √ f 4 4 2   1 3π 3π =√ = sin f 4 4 2 Hence π4 , 34π have same image and therefore f is not 1 − 1. For any x ∈ R, −1 ≤ sinx ≤ 1 (i.e.)

−1 < f (x) < 1

∴ Range of f = [−1, 1] 6= R = codomain of f . (i.e.) f is not onto. 10. Let A = {1, 2, 3, 4}B = {a, b, c, d} f : A → B and g : B → c defined by

and c = {x, y, z}. Consider the function

f = {(1, a)(2, c)(3, b)(4, a)} g = {(a, x)(b, x)(c, y)(d, y)}find The composition function go f . Solution: The composition function (go f ) is computed (go f )(1) = g( f (1)) = g(a) = x; (go f )(2) = g( f (2)) = g(c) = y; (go f )(3) = g( f (3)) = g(b) = x; (go f )(4) = g( f (4)) = g(a) = x

Thus, the composition function (go f ) from the set A to C is given by go f = {(1, x), (2, y), (3, x), (4, x)}

University Solved Question Papers

151

11. If A = {2, 3, 5}B = {6, 8, 10}, c = {2, 3} and D = {8, 10} are four non-empty sets. Suppose the relation R from A to B is defined as: R = {(2, 6), (2, 8), (3, 10)} and the relation S from C to D is defined as : S = {(2, 8), (3, 10)}. Find R ∪ S, R ∩ S, R − S and R1 . Solution: R ∪ S = {(2, 6), (2, 8), (3, 10)} R ∩ S = {(2, 8), (3, 10)} R − S = {(2, 6)} R0 = Set of all ordered pairs in A × B that are not in R. = {(2, 10), (3, 6), (3, 8), (5, 6), (5, 8), (5, 10)} 12. Let R be a binary relation defined as: R = {(a, b) ∈ R : a − b ≤ 3} determine whether R is reflexive, Symmetric, anti - symmetric and transitive. Solution: (a) The relation R = {(a, b) ∈ R : a − b ≤ 3} reflexive as there exist a ∈ R, a − a = 0 ≤ 3. It is not symmetric as a, b ∈ R ⇒ a − b ≤ 3 then b − a ≤ 3. (b) The relation is anti - symmertric as (a, b) ∈ R ⇒ a − b ≤ 3 and b − a ≥ 3 but a − b ≤ 3 and b − a ≤ 3 is possible only if a = b. Thus R is anti symmetric. (c) The relation is not transitive because if (a, b) ∈ R and (b − c) ∈ R other a − b ≤ 3 and b − c ≤ 3. Adding these inequalities, we get a − c ≤ 6. Thus R is not transitive. 13. Let N be the set of all natural numbers. The realtion R on the set N × N of ordered pairs of natural numbers is defined as : (a,b) R (c,d) if and only if ad = bc. Prove that R is an equivalence relation. Solution: (a) R is reflexive, since for each (a, b) ∈ N × N, we have ab = ba, i.e., (a, b)R(b, a). (b) For a, b, c ∈ I, we have aRb and bRc ⇒ a − b and b − c are both divisible by m. This implies that (a − b) + (b − c) is divisible by m or (a − c) is divisible by m or a R c. Therefore, R is transitive. Since R is reflexive, symmetric and transitive, therefore R is an equivalence relation.

152

Distric Mathematics

14. Let R be an equivalence relation on a non-empty set A. Let a and b be arbitrary elements in A. Then prove that b ∈ [a] ⇔ [b] = [a]. Solution: Let b ∈ [a] ⇒ bRa. To prove [b] = [a], let x be an arbitrary element of [b]. Then x ∈ [b] ⇔ xRbandbRa ⇔ xRa ⇔ x ∈ [a] Since x ∈ [b] and x ∈ [a], therefore [b] ⊆ [a]. Again, let x be an arbitrary element of [a]. Then x ∈ [a] ⇔ xRa ⇔ xRaandaRb ⇔ xRb ⇔ x ∈ [b] Since x ∈ [a] and x ∈ [b], therefore [a] ⊆ [b]. Hence, from the proof given above, we get [a] = [b]. 15. Let R be a relation on the set A = {1, 2, 3, 4} defined by R = {(1, 1)(1, 2)(1, 3) (1, 4)(2, 2)(2, 4)(3, 3)(3, 4)(4, 4)} construct the matrix and digraph of R. Solution: 1 2 3 4

1 1 0 0 0

2 1 1 0 0

3 1 0 1 0

4 1 1 1 1

4

3

2

Fig.1. Matrix of Relation R. 1

Fig.2. Diagraph of Relation R.

University Solved Question Papers

153

16. Let A = {a, b, c} be an non-empty set, and R be the relation on A that has the matrix.  1 0 1 MR =  0 1 0  0 1 1 

Construct the diagraph of R, and list indegrees and out degrees of all vertices. a

b

c

Indegree

1

2

2

Outdegree

1

2

1

b

a c

17. Let A = {1, 2, 3, 6}. Show that the relation ‘divides’ is a partial ordering on A. Draw the Hasse Diagram. Solution: 6

2

3

1

18. Given A = {1, 2, 3, 4} and B = {x, y, z} Let R be the relation from A to B defined as: R = {(1, x)(2, z)(3, x)(3, y), (3, z)} (a) Determine the matrix of the relation. (b) Find the inverse relation R−1 of R. (c) Determine the domain and range of R.   x y z  1   1 0 0    2  0 0 1  (a) B =   3  1 1 1    4  0 0 0 

154

Distric Mathematics (b) Reverse the ordered pairs of R to obtain R−1 = {(x, 1), (z, 2), (x, 3), (y, 3), (z, 3)}. (c) Domain R = {1, 2, 3} Range (R) = {x, y, z}

19. Given A = {x, y, z, w}. Let R be the relation on A and is defined as R = {(x, x), (y, y), (y, z), (z, y), (w, y), (w, w)} (a) Draw its diagraph (b) Is R equivalence relation? (c) Is R anti - symmetric? Solution: a) x

y

Z

w

b) R is reflexive and symmetric but not transitive. Hence, R is not an equivalence relation. c) R is not antisymmetric because yRz and zRy but y 6= z. 20. If R is a set of real numbers, then show that the function, f : R → R defined by f (x) = −sinx, is neither one-one nor onto. Solution: Let

π 6

and

5π 6

be two different elements in domain set R of functino f. Now π   π  −1 f = − sin =  6 6  2 5π 5π −1 f = − sin = 6 6 2

This implies that f (x1 ) = f (x2 ) even if x1 6= x2 , then f is not one - one function. Since value of f (x) = −sinx Oscillates between -1 and 1, i.e., −1 ≤ −sinx ≤ 1, therefore, range set of f is {-1,1}, which is the subset of the set R. Hence, f is not onto.

University Solved Question Papers

155

21. Let R and S be the relations on A then if R and S are symmetric then R ∪ S and R ∩ S symmetric. Proof Let us assume that, R and S to be symmetric if (a, b) ∈ R ∩ S ⇒ (a, b) ∈ R and (a, b) ∈ S since R is symmetric. ∴ (a, b) ∈ R ⇒ (b, a) ∈ R also since S is symmetric ∴ (a, b) ∈ S ⇒ (b, a) ∈ S then (a, b) ∈ R ∩ S ⇒ (b, a) ∈ R ∩ S ∴ (R ∩ S) is also symmetric. Similarly R∪ is also symmetric. 22. Let ‘r0 be a relation on A = {1, 2, 3, 6} by aRb if a Divides b. Find ISR an equivalence relation of A? Proof Let A = {1, 2, 3, 36} We have ‘a0 ⇒ aRa,

∀a ∈ A

∀a ∈ A

∴ R is reflexive. Let a, b, ∈ A ∴ aRb(i.e.)(a, b) ∈ R ⇒ ⇒ ⇒

a a R

divides b does not divide b is not symmetric

Let a, b, c ∈ A ∴ aRb and bRc (i.e.) (a, b)] ∈ R and (b, c) ∈ R. ⇒ ⇒ ⇒

a a aRC

divides b divides c (i.e.)

b divides c (a, c) ∈ R

∴ R is transitive. Hence R is not an equivalence relation. ∴ R = {(1, 2)(1, 3)(1, 6)(1, 1)(2, 2)(2, 6)(3, 3)(3, 6)(6, 6)} 23. Let R be a relation on NXN satisfying (a, b)r(x, y) if that r is an equivalence relation.

a x = i.e., ay = Bx. Show b y

156

Distric Mathematics Proof We know that

a a = 6 b

⇒ (a, b)r(a, b) ∴ r is reflexive Let (a, b), (x, y) ∈ N × N ∴ (a, b)4(x, y) a x ⇒ = b y x a ⇒ = y b ⇒(x, y)r(a, b) ∴ r is symmetric Let (a, b), (x, y), (u, v) ∈ N × N such that (a, b)r(x, y) and (x, y)r(u, v) a x x u ⇒ = ; = b y y v a u ⇒ = b v ⇒(a, b)r(u, v) ∴ r is transitive. Hence X is an equivalence relation. 24. Let X = {1, 2, 3, 4, 5},Y = {1, 2, 3} what is the graph r = {(x, y)/x ∈ X, y ∈ Y, x > y} from X into Y . What is domain and range of r. Solution Given (x, y) ∈ r ⇒ x > y ∴ 2r1,

3r1,

5r2,

5r3 . . .

∴ r = {(2, 1)(3, 1)(3, 3)(4, 1)(4, 2)(4, 3)(5, 1)(5, 2)(5, 3)} Domain = {1, 2, 3, 4} Range = {1, 2, 3}

University Solved Question Papers

157

2

1 3

5

4

25. Which of the following maps are 1 − 1, onto or bijective map on R, f (x) = x2 − 1 Solution Let x, y ∈ R and Let f (x) = F(y) x2 − 1 = y2 − 1 ⇒ x 2 = y2 ⇒x=y ∴ f is 1 − 1 let y ∈ R suppose ∃x ∈ R such that f (x) = y = x2 − 1

but f is not onto

⇒ x2 = y + 1 p x = ± y+1

∴ f is not a bijective map on R. 26. If f : x → x and g : x → x are both bijection. Then show that (g o f ) −1 = f −1 o g −1 Proof We know that f : x → x is 1-1 and onto ⇒ f −1 exists and f o f −1 = IX Similarly g o g−1 = g−1 o g = IX Now (go f )( f −1 og−1 = g o[ fo f −1 ]o g−1 = g o ix o g−1 = g o g−1

158

Distric Mathematics = IX

(1)

( f −1 o g−1 )(g o f ) = f −1 o (g−1 o g) o f = f −1 o IX o f = f −1 o f = IX

(2)

from (1) and (2) we have (g o f )−1 = f −1 o g−1 27. Let R be a relation on a set A then (a) If R is reflexive, then R−1 is also reflexive (b) If R is transitive, then R−1 also transitive. Proof R reflexive ⇒ ∆ ⊆ R ⇒−1 ⊆ R−1 ⇒ ∆ ⊆ R−1 as ∆−1 = ∆ ⇒ R−1 is reflexive R is transitive ⇒ RoR ⊆ R ⇒ (RoR)−1 ⊆ R−1 ⇒ R−1 o R−1 ⊆ R−1 as (Ros)−1 = S−1 o R−1 ⇒ R−1 isatransitive 28. What is equivalence class? List out the properties of Equivalence class Equivalence Class Let R be an equivalence relation defined on a non -empty set X. Then to a ∈ X, define a subset R(a) of X by R(a) = {x ∈ X/(a, x) ∈ R} The subset R(a) is called the equivalence class of R determined by the element a. The equivalence class R(a) is also denoted by [a]R . Properties of Equivalence Class (i) R(a) 6= φ , for all a ∈ X (ii) b ∈ R(a) ⇒ a ∈ R(b) (iii) b ∈ R(a) ⇒ R(b) = R(a)

University Solved Question Papers

159

(iv) If a, b ∈ X, Then Either R(a) ∩ R(b) = φ or R(a) = R(b) 29. State whether or not each of the diagrams given below defines a function of A = {a, b, c, } into B = {x, y, z, }

a

x

a

x

a

x

b

y

b

y

b

y

c

z

c

z

c

z

(i)

(ii)

(iii)

Solution (i) It is not a Function since nothing is assigned to b (ii) is function (iii) It is not a function since the element a in the domain is assigned to two Elements x and Y is the co-domain. But in a function, each element in the domain can be assigned to only one element is the co-domain. 30. State which of the Following are injections, Surjections or bijections for R into R where R is the set of all real numbers, (a) f (x) = −2x (b) g(x) = x2 − 1 Solution (a) Let x, y ∈ R If f (x) = F(y) i.e., −2x = −2y then x = y So f is one-to-one (injection)  −y  Also Given y ∈ R, y = (−2) −y 2 = f 2 . Hence f is a surjection. As f is one-to-one and onto, it is a bijection. (b) g(1) = G(−1) = 0. Hence g is not one-to-one. g is not onto since -2 has no pre - image in R. For suppose g(x) = −2. Then x 2 − 1 = −2 and so x2 = −1. But there is no real number x such that x2 = −1. Thus g is neither an injection nor a surjection (and so not a bijection).

160

Distric Mathematics Solved Extra Problems for Unit - IV

1. Let M is a finite machine whose transition table is given by S0 S1 S2

0 S0 S2 S1

1 S1 S2 S0

List the values of the transition function f w for w = 111000 Solution: fw (S0 ) = S0 fw (S1 ) = S2 fw (S2 ) = S1 2. Prove that the grammar S → AB, B → ab, A → aa, A → a, B → b is ambiguous. Solution: Consider the string aab. This string can be produced in two different ways: S → AB → aaB → aab S → AB →→ aB → aab and hence G is ambiguous. 3. Draw a parse tree for the following Grammar. G = ({S, A}, {a}, S, {S → AA, A → aSa, A → a}) Solution: S

A A

a a

a

S A

A

a

a

University Solved Question Papers

161

4. Explain the four quantities of a Grammar. Quantities of a Grammar (i) (ii) (iii) (iv)

Terminals Non-terminals Start symbol Production

: : : :

It means tokens, begins, else it means statements set of strings. It means one non-terminal It means rules of the form.

5. Let M = (S, I, f , Si , S0 ) be a finite state machine whose state diagram is given by 1 0 0,1

S0

S2 1

S1 1

List the values of the transition function f ω for ω = 0.01011. fw (S0 ) = S1 fw (S1 ) = S2 fw (S2 ) = S0 6. Construct a grammar G for the language L(G) = {an b am : n, m ≥ 1} Solution: Define G = ({S, A}, {a, b}, P, S) whereP consists of S → aS, S → abA, A → aA, A → a. We first show that S ⇒ an bam , n, m ≥ 1 S ⇒ abA ⇒ aba

Hence S ⇒ aba

S → aS ⇒a

n−1

(by applying S → aS S

once)

(by applying S → aS(n − 2) times)

n

⇒ a bA

(by S → abA)

⇒ an bam−1 A

(by applying A → aA(m − 1) times)

n

m−1

n

m

⇒ a ba Hence S ⇒ a ba

a

(By applying

for m, n ≥ 1.

A → a finally)

162

Distric Mathematics

7. Construct a finite - state machine that accepts exactly those input strings of 0’s and 1’s that end in 11. Solution: 1/0 0/0

0 q0

q1

0/0

0/0

1/1

q2 1/1

8. Give a deterministic finite automaton accepting the set of all strings over {0, 1} with three constructive 0’s. Solution: 0,1

1

q0

0

q1

0

q2

0

q3

1

9. Construct a finite automaton M accepting {ab, ba} Solution: First of all we construct states q0 , q1 , q2 , q3 and direct edges in such a way that ab and ba are accepted. Then we construct another state q 4 and directed edges from q4 and into q4 so that other strings are not accepted (ie, M does not reach a final state on processing other strings). Such a state is called a ‘trap state’ or ‘dead state’. q1

b

a a

q0

a,b

q4

a,b

b a

b q2

q3

University Solved Question Papers

163

10. Describes in words the strings in each of the following regular sets. (i) 1(0)∗ (ii) 10 0(0)∗ (iii) (0∗ 1) Solution: (a) Any number of 1’s followed by any number of 0’s including no zero. (b) Any number of 1’s followed by one or more 0’s. (c) Any string not ending with 0. 11. If L = {ab, c} over Σ{a, b, c} find L0 , L3 , L−3 Solution: (i) L0 = {λ } (ii) L3 = {ababab, ababc, abcab, abc2 cabab, cabc, c2 ab, c3 } (iii) The negative power of a language is not defined. 12. If L = {a2 , ba}, find L0 , L2 andL3 Solution: (i) L0 = {λ } by definition (ii) All two - word sequences from L L2 = {a2 , ba}{a2 , ba} = {a4 , a2 ba, ba3 , baba} (iii) L3 = all three - word sequence from L = {a6 , a4 ba, a2 ba3 a2 baba, ba5 , ba2 ba, bab3 , bababa} 13. Express each of the following sets using a regular expression. (a) The set of strings of one or more 0’s follows by 1. (b) The set of all strings of 0’s and 1’s end with 00. Solution: (a) Since the set of one or more 0’s is represented by 0{0} ∗ , therefore the set of one or more 0’s followed by 1 is obtained by concentration of 0(0) ∗ and 1 and hence is represented by 0(0)∗ 1. (b) The set {0, 1} is represented by 0 ∪ 1. The set of strings of 0’s and 1’s represented by (0 ∪ 1)∗ . Hence, the set of all strings of 0’s and 1’s ending in 00 is obtained by concatenation of (0 ∪ 1)∗ and 00. So it is represented as : (0 ∪ 1)∗ 00.

164

Distric Mathematics

14. For the alphabet Σ = {0, 1} the languages L1 , L2 , L3 are defined as: L1 = {0, 1, 00, 11, 000, 111, 0000, 1111} L2 = {x : 2 ≤ x|, x ∈ Σx } L3 = {x : 2 ≥ |x|, x ∈ Σ∗ } Determine the following languages (subsets) of Σ∗ (a) L1 ∩ L2 ,

(c) L2 ∪ L3 ,

(b) L1 ∩ L3 ,

(d) L1 − L2

Solution: (a) (b) (c) (d)

L1 ∩ L2 = {00, 11, 000, 111, 0000, 1111} L1 ∩ L3 = {0, 1, 00, 11} L 2 ∪ L3 = Σ ∗ L1 − L2 = {0, 1}

15. Prove the following equation (1 + 00∗ 1) + (1 + 00∗ 1)(0 + 10∗ 1)∗ (0 + 10∗ 1) = 0∗ 1(0 + 10∗ 1)∗ Solution: L.H.S = (1 + 00∗ 1) + (1 + 00∗ 1)(0 + 10∗ 1)∗ (0 + 10∗ 1) = (1 + 00∗ 1) [λ + (0 + 10∗ 1∗ )(0 + 10∗ 1)] , Since (r1 + r2 )r = r1 r + r2 r and r(r1 + r2 ) = rr1 + rr2 = (1 + 100∗ 1)(0 + 10∗ 1)∗ , Since λ + rr∗ = r∗ = λ + r∗ r = (λ + 00∗ 1)(0 + 10∗ 1)∗ = 0∗ 1(0 + 10∗ 1)∗ = R.H.S Hence Proved 16. List out the identities of Regular expressions. Solution: Two regular expressions r1 and r2 are equivalent if these represent the same set of strings. (1) φ + r = r

University Solved Question Papers

165

(2) φ r = rφ = φ (3) λ r = rλ = r (4) λ ∗ = λ and φ ∗ = λ (5) r + r = r (6) r∗ r∗ = r∗ (7) rr∗ = r∗ r (8) (r∗ )∗ = r∗ (9) λ + rr∗ = r∗ = λ r∗ r (10) (r1 r2 )∗ r1 = r1 (r2 r1 )∗ (11) (r1 + r2 )∗ = r1∗ + r2∗ (12) (r1 + r2 )r3 = r1 r3 + r2 r3 and r3 (r1 + r2 ) = r3 r1 + r3 r2 17.

(a) Construct the finite state automata for Binary odd numbers Solution: 1

0

0

1

q0

q1

(b) Construct the finite state automata for sequence of digits that begin at least with two 0 and finish with at least two 1, ie, the language 00(1/0) ∗ 11

q0

0

q1

q2

1

q3

1

q1

166

Distric Mathematics Extra Solved Problems for Unit - V

1. Calculate the degree for the following graph. v5

v6 v1 v2

v3 v4

Solution:

d(V1 ) = 5 d(V2 ) = 2 d(V3 ) = 5 d(V4 ) = 3 d(V5 ) = 1 d(V6 ) = 0 2. Explain Sub Graph. Solution: A graph H is said to be Subgraph of G if all the vertices and all the edges of H are in G and if the adjacency is proved in H exactly as in G. Obviously (i) (ii) (iii) (iv)

Every graph is its own subgraph. A single vertex in a graph G is a subgraph of G. A single edge in G, together with its end vertices is also a subgraph if G. A subgraph of a subgraph of G is a subgraph of G.

For an example, the following diagram represents the subgraph. v4

v6

v5 v3

University Solved Question Papers

167

3. If a graph G has exactly two vertices of odd degree there must be a path joining these two Vertices - Prove. Solution: Let V1 ,V2 ∈ G be the two distinct vertices of odd degree. Let there be no path between V1 and V2 , if possible. Then V1 will be in a component and it will be the only odd vertex in that component. Also V2 will be in another component and it will be the only odd vertex in that component. This is impossible because the number of odd vertices in any graph is even. 4. Find the complaint of the following graphs. v1 v1

v2

v4

v3

v6

v4

v3

v2 v5 (ii)

(i)

Solution: v1 v5

v1

v2 v6 v3

v4

v3

(i)

(ii)

5. Determine the path originating from node v1 to the node v4 of the following graph.

v3

v2

v4

v1

168

Distric Mathematics Solution: P1 : v1 v4 P2 : v1 v2 v4 P3 : v1 v2 v3 v4 P4 : v1 v2 v4 v3 v4 P5 : v1 v2 v3 v4 v3 v4

6. Prove that in a simple diagraph, the length of any elementary path is less than or equal to n − 1, where n is the number of nodes in the graph and the length of any elementary cycle does not exceed n. Solution: elementary path

⇒ ⇒ ⇒

elementary cycle

⇒ ⇒ ⇒

nodes in the elementary path are distinct. number od distinct nodes in any elementary path of length P is P + 1 length of any elementary path having, all the n nodes of the graph G, cannot be greater than n − 1 nodes in the cycle are distinct Number of distinct nodes in the cycle of length P is P. length of an elementary cycle having all the n nodes cannot exceed n.

7. Find the adjacency matrix of the following graph G Find A2 and A3 e3

v4

v3

e5

e2

e4

v1

v2

e1

Solution:

V1 V2 V3 V4

        

V1 0 1 0 1

V2 1 0 1 1

V3 0 1 0 1

V4 1 1 1 0

        

University Solved Question Papers 0  1 A=  0 1  0  1 A2 =   0 1 

A3 = A2 .A  2 1  1 3   2 1 1 2

1 0 1 1

0 1 0 1

1 0 1 1

0 1 0 1

2 1 2 1

 1 1   1  0  1  1   1  0

0 1 0 1

 1 0 1  1 0 2   1  0 1 3 1 1

1 0 1 1

0 1 0 1

0 1 0 1

  1 2  1 1  = 1   2 0 1

  1 2  5 1  = 1   2 0 5

5 4 5 5

1 3 1 2 2 5 2 5

2 1 2 1

169

 1 2   1  3

 5 5   5  4

8. Find Y = A + A2 + A3 + A4 where A is the adjacency matrix of the following graph. v2

v4

v3

v1

Solution:

V1 V A= 2 V3 V4 0  1 A2 =   0 0  1  0 A3 = A2 .A =   0 0 

        

V1 0 1 0 0

1 0 0 0

0 0 0 1

0 1 0 0

0 0 1 0

V2 1 0 0 0

V3 0 0 0 1

V4 0 0 1 0

        

 0 0 1  1 0 0   1  0 0 0 0 0  0 0 1   0  1 0 0  0 0 1 0 0

0 0 0 1 0 0 0 1

  0 1  0 0  = 1   0 0 0   0 0   0   1 = 1   0 0 0

0 1 0 0

0 0 1 0

1 0 0 0

0 0 0 1

 0 0   0  1  0 0   1  0

170

Distric Mathematics 0  1 A4 = A3 .A =   0 0  

1 0 0 0

0 0 0 1

0 1  1 0 Y = A + A 2 + A3 = A4 =   0 0 0 0  0  1 +  0 0  2  2 =  0 0

   1 0 1 0 0 0  1 0 0 0   0 0  =  1  0 0 0 1   0 0 0 0 1 0 0    0 0 1 0 0 0  0 1 0 0  0 0  +  0 1   0 0 1 0  1 0 0 0 0 1    1 0 0 1 0 0 0   0 0 0  + 0 1 0 0    0 0 1 0 0 1 0  0 1 0 0 0 0 1  2 0 0 2 0 0   0 2 2  0 2 2

9. Construct the incident matrix B for the following graph G. e3

v3

v4

e5

e2 v2

e4 v1

e1

Solution:

V1 V B= 2 V3 V4

        

e1 e2 1 0 1 1 0 1 0 0

e3 0 0 1 1

e4 1 0 0 1

e5 1 0 1 0

10. Construct the circuit matrix of the following graph G. Solution: The different circuits of G are {e1 , e5 , e4 }, {e5 , e2 , e3 }{e1 , e2 , e3 , e4 }

        

0 1 0 0

0 0 1 0

 0 0   0  1

University Solved Question Papers v5

e6 e3

v3

e2

171

v4 e5 e4

v2

v1

e1

Let C1 = {e1 , e5 , e4 } C2 = {e5 , e2 , e3 } C3 = {e1 , e2 , e3 , e4 }  e1 e2 e3  C1  1 0 0  = C2  0 1 1  C3  1 1 1

e4 1 0 1

e5 1 1 0

e6 0 0 0

      

11. Construct the path matrix P(V2 ,V4 ) for the following graph G. v3

e2

v2

e3

v4

e4

e6

v5

e5

v1

e1

Solution: There are 3 different paths from V2 to V4 . These paths from V2 to V4 are {e4 }{e1 , e5 }{e2 , e3 } say P1 , P2 , P3 respectively.

P1 P(V2 ,V4 ) = P2 P3

      

e1 e2 0 0 1 0 0 1

e3 0 0 1

e4 1 0 0

e5 e6 0 0 1 0 0 0

      

172

Distric Mathematics

12. Construct the adjacency matrix for the following graph G. v4

v3

v1

v2

Solution:

V1 V A= 2 V3 V4

        

V1 1 0 0 0

V2 1 0 1 0

V3 0 0 0 1

V4 1 0 1 0

        

13. Construct the incidence matrix B for the following graph G. v5

e3 e5

v4

e4 e2

v2

e6

e1

v3 e7

v1

Solution:

V1 V2 B = V3 V4 V5

          

e1 e2 1 0 −1 1 0 0 0 −1 0 0

e3 e4 e5 e6 e7 0 0 0 0 1 0 0 0 1 0 0 0 −1 −1 −1 1 −1 1 0 0 −1 1 0 0 0

          

University Solved Question Papers 14. Construct the path matrix of the following diagraph G v4

v3

v2

v1

Solution:

V1 V P= 2 V3 V4

        

V1 1 1 1 1

V2 1 1 1 1

V3 1 1 1 1

V4 0 0 0 0

        

15. Find the path matrix for the graph G. v3

v4

v2

v1

Solution:

V1 V P= 2 V3 V4

        

V1 1 1 1 1

V2 1 1 1 1

V3 1 1 1 1

V4 1 1 1 1

        

16. Obtain the adjacency matrix A of the diagraph (a) Find the elementary paths of lengths 1 and 2 from V1 to V4 . (b) Show that there is also a simple path of length 4 from V1 to V4 (c) Verify the result by calculating A2 , A3 and A4 .

173

174

Distric Mathematics v1

v2

v4

v3

Solution: (a) Elementary paths from V1 to V4 of length 1 is V1V4 2 is V1V2V4 . (b) V1 ,V2 ,V3 ,V2 ,V4 is a simple path of length 4.   V1 V2 V3 V4 (c)  V1   0 1 0 1    V  0 0 1 1  A= 2   V3  0 1 0 1    V4  0 1 0 0  0  0 A2 =   0 0  0  0 A3 =   0 0  0  0 A4 = A3 .A ⇒   0 0  0  0 A4 =   0 0 

1 0 1 1

0 1 0 0

1 2 1 0

1 0 1 1

2 1 2 2

1 2 1 0

3 4 3 1

2 1 2 2

 0 1 1   1  0 0 1  0 1 0 1 0  1 0 1  0 0 1   1  0 1 1 0 1  2 0 1  0 0 2   2  0 1 1 0 1  3 3   3  2

0 1 0 0

0 1 0 0 0 1 0 0

  0 1   1   0 = 1   0 0 0   1 0  0 1  = 1   0 0 0  1 1   1  0

17. Find the Adjacency matrix for the following diagraph G. Solution: The Adjacency matrix A of this diagraph is given by

1 2 1 0

1 0 1 1

2 1 2 2

1 2 1 0

 1 1   1  1  2 2   2  1

University Solved Question Papers

V1 V A= 2 V3 V4

        

V1 0 0 1 1

V2 1 0 0 0

V3 0 1 0 1

V4 0 0 1 0

        

18. Find the adjacency matrix A of the graph G given below: v4 v1

v3

v2

and deduce from the matrix Y = A + A2 + A3 that G is disconnected. Solution:

V1 V A= 2 V3 V4 0  0 A2 =   0 0  0  0 A3 =   0 0 

        

V1 0 0 0 0

0 0 1 1

0 1 0 1

0 2 1 1

0 1 2 1

V2 0 0 1 1

V3 0 1 0 1

V4 0 1 1 0

        

 0 0 0  0 0 1   1  0 1 0 0 1  0 0 0   1  0 0 1  0 1 2 0 1

0 1 0 1 0 1 0 1

  0 0  0 1  = 1   0 0 0   0 0   1   0 = 1   0 0 0

0 2 1 1

0 1 2 1

0 2 3 3

0 3 2 3

 0 1   1  2  0 3   3  2

175

176

Distric Mathematics 0  0 Y = A + A 2 + A3 =   0 0 

0 4 5 5

0 5 4 5

 0 5   5  4

Since there is zero entry as a non diagonal element in A + A2 + A3 the graph is disconnected. 19. Draw all distinct full binary takes having seven vertices. Solution:

20. Give a directed tree representation of the following formula: (p ∪ (7P ←→ Q)) ←→ ((7P ∪ Q) ←→ 7R) Solution:

Ù

Ù

V 7

V

P

Ù 7

7

Q P

P

Q

R

University Solved Question Papers

177

21. Show that in a complete binary tree the total number of edges is given by 2(ni − 1) where ni is the number of terminal nodes. Solution: Number of terminal vertices = ni Number of internal vertices = ni − 1 Total number of vertices = 2(ni − 1) + 1 = 2ni − 1 ∴ Number of edges = 2ni − 1 − 1 = 2(ni − 1) 22. Obtain the binary tree corresponding to the tree given below. v1 v2 v7 v5

v4

v3

v9

v8

v6

v10

v11

Solution: v1 v2

v7 v5

v3

v8

v9

v4 v10

v11

v6

23. Obtain the binary tree corresponding to the tree given below. v0 v6 v1 v7 v10

v9

v5

v3 v8 v5

v4

178

Distric Mathematics Solution: v0 v6 v10 v1 v3 v9 v2 v5

v7

v4 v8

24. Represent the following expressions as binary trees and write the prefix and postfix forms of the expression /

((A −C) × D)/(A + (B − D)) Solution: Prefix form: / × −ACD + A − BD Postfix form: AC − D × ABD − +/ D

A

A

C

B

D

25. List the orders in which the vertices are processed using pre order, in order and post order traversal. A

B

H

C

D

E

J

J

F k

k

k

G

University Solved Question Papers Solution: Pre Order In Order Post Order

: : :

179

ABHIKLMJCDEFG ILKMHJBADFEGC LMKIJHBFGEDCA

26. Draw the expression trees for the following expressions z2 − 4xy Solution:

x

x

4

z

z

x

y

27. Find all the in degrees and out degrees of the nodes of the graph given in the figure. u3

u2

u5

u1

Solution: Vertex Indegree u1 1

u4

Outdegree 2

u2 u3

1 2

2 2

u4

2

0

u5

1

2

28. Show that the sum of the in degrees of all the nodes of a simple diagraph G is equal to the sum of the out degrees of all its nodes and that this sum is equal to the number of edges of the graph. Proof: To each in degree of a vertex V ∈ G. There corresponds one out degree of the vertex V 0 (VV 0 being an edge). Hence the sum of the in degrees of all the

180

Distric Mathematics vertices of a graph is equal to the sum of all the out degrees of the vertices of the graph. Since each edge contributes one to this sum of the in degrees and one to the sum of the out degrees the number of edges is obviously half of the sum of all the in degrees and out degrees. ∴ Sum of the in degrees = Sum of the out degrees = Number of edges of any diagraph G.

29. Find pre order, post order and in order traversal for the below binary tree.

Solution: Pre Order Post Order In Order

: : :

ABCDEFGHIJ CEDBIJHGFA ILKMHJBADFEGC

30. Find the incidence matrix for the following graphs v1

e7

v4

e6

e1

e8 e5 v3 v5

v2

e2

e3

Solution:

V1 V2 B = V3 V4 V5

          

e1 e2 1 0 1 1 0 1 0 0 0 0

e3 0 0 1 0 1

e4 0 0 1 0 1

e5 0 0 1 1 0

e6 e7 1 1 0 0 0 1 1 0 0 0

          

University Solved Question Papers

181

31. Obtain the adjacency matrix A of the diagraph given below. Find the elementary paths of lengths 1 and 2 from V1 to V4 v1

v2

v4

v3

Solution: V1 V A= 2 V3 V4

        

V1 0 0 0 0

V2 1 0 1 1

V3 0 1 0 0

V4 1 1 1 0

        

Elementary path of length 1 from V1 to V4 : V1V4 Elementary path of length 2 from V1 to V4 : V1V2V4 32. For the digraph given below write down the incidence matrix (A) and the adjacency matrix (X) of

A

B

C

D

Solution: A B Adjacency matrix(X) = C D

        

A 0 1 0 0

B 1 0 0 1

C 1 0 0 0

D 0 0 1 0

        

182

Distric Mathematics

A B Incidence Matrix(A) = C D

        

e1 −1 1 0 0

e2 e3 e4 e5 1 0 0 1 −1 −1 0 0 0 0 1 −1 0 1 −1 0

        

33. Draw the expression tree for a(b + c). hence workout the pre order, in order and post order traversals of the tree. Solution: Given expression is a × (b + c) x

a

b

Pre order traversal In order traversal Post order traversal

: : :

c

×a + ac a×b+c abc + ×

34. Find out pre order, in order, post order traversal of the following binary tree. A

C

B

D

E

F

G

Solution: Pre order list In order list Post order list

: : :

ABDECFG DBEAFCG DEBFGCA

35. Prove that A simple graph with n vertices and k components can have almost (n − k)(n − k + 1) edges. 2

University Solved Question Papers

183

Proof: Let n1 , n2 , · · · nk be the number of vertices in each of the k components of G. Thus n1 + n2 + · · · + nk = n k

Consider ∑ n2i ≤ n2 − (k − 1)(2n − k)

1

i=1

1 Now,the maximum number of edges in the ith component of G is ni (ni − 1) 2 ∴ The maximum number of edges in G is =

1 k ∑ ni (ni − 1) 2 i=1

1 k 2 n ∑ ni − 2 2 i=1 1 n ≤ [n2 − (k − 1)(2n − k)] − 2 2 1 = (n − k)(n − k + 1) 2 =

(by 1)

and hence proved. 36. Show that the maximum number of edges in a simple graph with n vertices is n(n − 1) 2 Proof: We can prove this theorem, by mathematical induction. For n = 1, E = 0 n(n − 1) 1(1 − 1) = =0 2 2 For n = 2, E = 1

now,

There is almost one edge between the two vertices. n(n − 1) 2(2 − 1) 2 × 1 = = =1 2 2 2 ∴ The theorem is tree for n = 2 ie,

Suppose, assume that the theorem is true for n = k. (ie,) G has almost edges k(k − 1) edges by adding one vertex in G, then G, has k + 1 vertices 2

184

Distric Mathematics Now k(k − 1) + k k(k − 1) + 2k = 2 2 2 k − k + 2k = 2 (k + 1)(k + 1 − 1) = 2 Hence proved.

37. Prove that In a tree, any two vertices are connected by unique path. Proof: Let T be a tree. P1 u

V P2

By definition, T is a connected acyclic graph. Let u and v be two vertices in T . ⇒ u and v are connected vertices ⇒ There is a (u, v) path in T We prove that the path is unique. Suppose that there one two disjoint paths P1 and P2 connecting u and v ⇒ P1 P2 contains a cycle. But this is a contradiction. ∴ There is only one path. Hence proved. 38. Prove that every tree has at least two and vertices. Proof: deg 1 V1

Let G be a non trivial tree than d(v) ≥ 1∀v ∈ V

V2

University Solved Question Papers

185

By Euler’s theorem,

∑ d(v) = 2 ∈

(1)

v∈V

By theorem, ∈= λ − 1 (1) ⇒

∑ d(v) = 2(λ − 1)

(2)

v∈V

= 2λ − 2 ∴ d(v) = 1 for at least two vertices V . Hence proved. 39. If E is a link of G, then T (G) = T (G.E) + T (G − E). Proof: Let T (G) be the number of spanning tree of G ⇒ T (G) = T1 + T2

1

Where T1 is number spanning tree of G that contain E. T2 is number of spanning tree of G that does not contain E. Clearly V (G) = V (G − E). Any spanning tree of G − E is also a spanning tree of G. But such a spanning tree does not contain E. Any spanning tree of G not containing e is also a spanning tree of G − E. ⇒ T2 = T (G − E) Let T be a spanning tree of G that contains E ⇒ T.E is a spanning tree of G − E.

T1 = T (G − E) ∴ (1) ⇒ T (G) = T1 + T2 = T (G.E) + T (G − E) 40. Prove that if G is a tree then ∈= λ − 1 Proof: We prove this by induction on λ Step 1 For λ = 1

186

Distric Mathematics The number of edges = 0 ⇒ ∈= 0 Next the number of vertices =1

⇒λ =1 ⇒ λ −1 = 0 ∴ ∈ = λ −1