You are on page 1of 12

Master of Computer Application (MCA) – Semester 1

MC0063 - Discrete Mathematics


Book Id B0676 and B0677
Assignment Set – 1
______________________________________________________________________

Q. 1. If A ={ x / x 2 − 5x + 6}, B = {2, 4}, C = {4, 5} find


(i)( A − B )×( B −C )
(ii) ( B − A) ×(C − B)
(iii) A ∪ ( A ∩ B)

Solution:
A={2,3}
B={2,4}
C={4,5}

i. (A-B)={3}
(B-C)={2}
(A-B) × (B-C)={(3,2)}

ii. (B-A)={4}
(C-B)={5}
(B-A) × {(4,5)}

iii. (A ∩ B)={2}
A={2,3}
A ∪( A ∩ B ) ={2,3}

Q. 2. Using mathematical induction prove that


n(n + 1)( 2n + 1)
12 + 2 2 + 3 2 + ..... + n 2 =
6

Solution:
I. If n=1 , left side =12 =1
1(1 +1)( 2.1 +1) 1.2.3
RHS = = 6
=1
6
Hence result is true for n=1
II. Now assume that the result is true for n=k
k (k + 1)( 2k + 1)
Then 12 + 2 2 + 3 2 + ..... + k 2 =
6
(induction hypothesis)
If n = k+1
12 + 2 2 + 3 2 + ..... + k 2 + ( k +1) 2
Form induction hypothesis we get
k ( k +1)( 2k +1)
RHS : + (k +1) 2
6
k (k +1)( 2k +1) + 6(k +1) 2
6
( k +1)( k ( 2k +1) + 6( k +1))
6
(k + 1)( 2k 2 + k + 6k + 6))
6
( k +1)( 2k 7 k + 6))
2

6
( k + 1)( 2k 2 + 4k + 3k + 6))
6
( k + 1)( 2k ( k + 2) + 3( k + 2))
6
( k +1)( 2k + 3)( k + 2))
6
(k +1)(( k +1 +1)( 2(k +1) +1)
LHS 6
( k +1)(( k + 2)( 2k + 3)
6
RHS = LHS
Hence Proved

Q. 3. Prove that the number of partitions of n in which no integer occurs more


than twice as a part is equal to the number of partitions of n into parts not
divisible by 3.
Solution:
The generating function corresponding to “no integer occurs more than twice” is
(1 + x + x 2 )(1 + x 2 + x 4 )(1 + x 3 + x 6 )... --------------(1)

The generating function corresponding to “no part is divisible by 3” is


(1 − x ) −1 (1 − x 2 ) −1 (1 − x 4 ) −1 .... ------------------(2)
1 − x 3 = (1 − x ) (1 + x + x 2 )

Therefore (1) becomes


(1 − x 3 )(1 − x ) −1 (1 − x 6 ) (1 − x 2 ) −1 (1 − x 9 )(1 − x 3 ) −1 (1 − x 12 ) (1 − x 4 ) −1 .......... ...
= (1 − x) −1 (1 − x 2 ) −1 (1 − x 4 ) −4 (1 − x 5 ) −1 (1 − x 7 ) −1

Which is equation (2)

For instance take n = 6. The partitions in which no integer occurs more than twice
are 6,5,1,4 2,4 1 1 ,3 3,3 2 1,2 2 1,1(these are 8 in number).
The partitions in which no part is divisible by 3 are 5 1,4 2 ,4 1 1 , 2 2 2 ,2211, 2
14,1 6 .

Q.4. Prove that if S contains more than two elements, then there exist f,

g∈ A(S), such that


f g ≠g f

Solution:
Since S contains more than two elements, take the distinct elements a,b,c ∈S.

Define f:S→S by f(a)=f(b)=c,f(c)=a and f(x)=x for all x∈S\{a,b,c}.Define g: S→S

by g(a)=b,g(b)=a, and g(x)=x for all x ∈S\{a,b}. Then f,g are bijections and hence

f.g∈A(S).Now (gof)(a)=g(f(a))=g(b)=a and (fog)(a)=f(g(a))=f(b)=c . Therefore


(gof)(a)=a ≠ c =(fog)(a). This shows that gof ≠ fog.
Q.5. Prove that a ≡ b(mod m ) and a ≡ b(mod n ) if and only if a ≡ b(mod lcm( m,n ))

Solution:
Suppose a ≡ b(mod m ) and a ≡ b(mod n ) . This means m|a-b and n|a-b. That is,(a-b)
is a common multiple of m and n.
But l=lcm(m,n) is the least common multiple of m and n.
a ≡ b(mod lcm( m,n ))
Therefore (a-b) is a multiple of l.That is l|a-b. This means

Q. 6. Construct a grammar for the language


L = {x / x ∈{a, b}∗ , the number of a ' s in x is a multiple of 3}

Solution:
Let t = {a,b} and N={S,A,B}
S is a stating symbol.

The set of productions : Φ


S → bS
S→b
S → aA
A →bA
A → aB
B → bB
B → aS
B→a
For instance ,
bbababbab can be generated as follows.
S => bS
=>bbS=>bbaA=>bbabA=>bbabaB=>bbababbB=>bbababbaS=>bbababbab
Therefore the grammer G=(VT={a,b},VN={S,A,B},Φ,S)
Master of Computer Application (MCA) – Semester 1
MC0063 - Discrete Mathematics
Book Id B0676 and B0677
Assignment Set – 2
______________________________________________________________________

Q. 1. Determine the number of integers between 1 to 250 that are divisible by


any of the integers 2, 3, 5 and 7.
Solution
Write Similarly A2, A3, A4 are set of integers ≤ that are divisible by 3,5 and 7
respectively.
250
|A1|= 2
=125
250
|A2|= 3
=83
250
|A3|= 5
=50
250
|A4|= 7
=35
250
| A1 ∩ A2 |= =41
2 ×3
250
| A1 ∩ A3 |= =25
2 ×5
250
| A1 ∩ A4 |= =17
2 ×7
250
| A2 ∩ A3 |= =16
5 ×3
250
| A2 ∩ A4 |= =11
7 ×3
250
| A3 ∩ A4 |= =417
5 ×7
250
| A1 ∩ A2 ∩ A3|= =8
2 ×3 ×5
| A1 ∩ A2 ∩ A4 | =5

| A1 ∩ A3 ∩ A4 | =3

| A2 ∩A3 ∩ A4 | =2
| A1 ∩ A2 ∩ A3 ∩ A4 | =1

Therefore | A1 ∪ A2 ∪ A3 ∪ A4 |=125+83+50+35-41-25-17-16-11-7+8+5+3+2-1=193

Q.2. Solve the recurrence relation a n = 2a n −1 − an −2 , n ≥ 2 , given a0 = 3, a1 = – 2


using the generating function.

2 n
Solution: Let f(x)=a0+a1x+a2x +…+anx +….
2 n
2xf(x)= 2a0x+2a1x +…+2an-1x +….
2 2 n
x f(x)= a0x +…+an-2x +….

2 2 n
Therefore f(x)-2xf(x)+ x f(x)= a0+(a1 -2a0 )x+(a2 -2a1 +a0 )x +…+(an -2an-1 +an-2)x
+…=3-8x(since a0=3 , a1 =-2 and an -2an-1 +an-2 =0 for n≥2)
1
On simplification ,we get f(x)= (1− x)
2
(3 – 8x)

= (1 + 2 x + 3 x
2
+ ...... + ( n +1) x n + ......) (3 - 8x)
= 3 − 2 x − 7 x 2 −12 x 3 ...... + (−5n + 3) x n + ......
Therefore the coefficient of xn ,that is ;an=3-5n is the solution.

Q.3. Prove that “If L is a distributive lattice, then it is a modular lattice”


Solution: Assume that L is a distributive lattice. Let x ,y, z ∈ L and x ≤ z.
We have that ( x ∧ y ) ∨ ( y ∧ z ) ∨ ( z ∧ x) = ( x ∨ y ) ∧ ( y ∨ z ) ∧ ( z ∨ x)

Since x ≤z, we have that ( x ∧ z) = x and z ∨ x = z,and so


( x ∧ y) ∨ ( y ∧ z) ∨ x = ( x ∨ y) ∧ ( y ∨ z) ∧ z

This implies x ∨ ( y ∧ z ) = ( x ∨ y ) ∧ z (by absorption laws)


This shows that L is modular lattice.
Q.4. Prove that for any a and b in a Boolean algebra,
(i) a ∨ b = a ∧ b (ii) a ∧ b = a ∨ b
Proof :
(i) We show that a ∧b is the complement of a ∨ b
(a ∨ b) ∨ ( a ∧ b ) =[( a ∨ b) ∨ a ] ∧[( a ∨ b) ∨ b ]
=[( a ∨ a ) ∨ b] ∧[ a ∨ (b ∨ b )]
= (1 ∨ b) ∧ (a ∨1)
=1 ∧1
=1

Also
(a ∨ b) ∧ ( a ∧ b ) =[( a ∧ b) ∧ a ] ∨ [( a ∧ b) ∧ b ]
=[( a ∧ a ) ∧ b] ∨ [ a ∧ (b ∧ b )]
= ( 0 ∧ b ) ∨ ( a ∧ 0)
=0 ∧0
=0

(ii) We show that a ∨b is the complement of a ∧ b


(a ∧ b) ∨ ( a ∨ b ) = [( a ∨ (b ∨ a )] ∧ [b ∨ (a ∨ b ]
= [( a ∨ a ) ∨ b] ∧ [a ∨ (b ∨ b )]
= (1 ∨ b) ∧ (a ∨1)
=1 ∧1
=1

Also
(a ∧ b) ∧ ( a ∨ b ) =[( a ∧ b) ∧ a ] ∨ [( a ∧ b) ∧ b ]
=[( a ∧ a ) ∧ b] ∨ [ a ∧ (b ∧ b )]
= ( 0 ∧ b ) ∨ ( a ∧ 0)
=0 ∧0
=0
Q.5. Explain the concept turing machine with example.

Definition : Conceptually a Turing machine, like finite automata, consists of a


finite control and a tape. At any time it is in one of the finite number of states. The
tape has the left end but it extends infinitely to the right. It is also divided into
squares and a symbol can be written in each square. However, unlike finite
automata, its head is a read-write head and it can move left, right or stay at the
same square after a read or write.

Given a string of symbols on the tape, a Turing machine starts at the initial state.
At any state it reads the symbol under the head, either erases it or replaces it with a
symbol(possibly the same symbol). It then moves the head to left or right or does
not move it and goes to the next state which may be the same as the current state.
One of its states is the halt state and when the Turing machine goes into the halt
state, it stops its operation.
Formally a Turing machine is a 5-tuple T = < Q,∑, Γ ,q0,δ> , where
Q is a finite set of states, which is assumed not to contain the symbol h. The
symbol h is used to denote the halt state.
∑ is a finite set of symbols and it is the input alphabet
Γ is a finite set of symbols containing as its subset and it is the set of tape symbols.
q0 is the initial state.
δ is the transition function but its value may not be defined for certain points.
It is a mapping from Q (Γ U{Δ} ) to ( Q U{ h } ) (Γ U { Δ } )
{ R , L ,S } .
Here Δ denotes the blank and R, L and S denote move the head right, left and do
not move it, respectively. A transition diagram can also be drawn for a Turing
machine. The states are represented by vertices and for a transition δ ( q, X ) = ( r,
Y, D ) , where D represents R, L or S , an arc from q to r is drawn with label
( X/Y , D ) indicating that the state is changed from q to r, the symbol X currently
being read is changed to Y and the tape head is moved as directed by D.
Example : The following Turing machine < Q,∑, Γ ,q0,δ> accepts the language
aba* , where
Q1= { q0, q1, q2, q3} , = { a , b } , = { a , b } and is as given by the table below

State(q) Input(X) Move(δ(q,X))


q0 Δ (q1, Δ , R )
q1 a (q2,a,R)
q2 b (q3,b,R)
q3 a (q3,a,R)
q3 Δ (h, Δ , s )

A transition diagram of this Turing machine is given below. It is assumed that the
tape has at the left end and the head is initially at the left end of the tape

Q.6. The generator matrix for an encoding function E : Z 23 → Z 26 is given by


1 0 0 1 1 0
 
G = 0 1 0 0 1 1
0 0 1 1 0 1
 

(i) Find the code words assigned to 110 and 010


(ii)Obtain the associated parity –check matrix
(iii) Hence decode the received words:110110,111101

Solution:

 1 0 0  1  1 0
   
G=[I | A],where I = 0 1and
3   0 A=  0  1 1
3

 0 0 1 1 0 1
   
1 0 0 1 1 0
 
(i) E(110)=[110] 0 1 0 0 1 1  =[110101] and
0 0 1 1 0 1
 
1 0 0 1 1 0
 
E(010)=[010] 0 1 0 0 1 1  =[010011]
0 0 1 1 0 1
 

Therefore the required code words are : 110101,010011

1 0 1 1 0 0
 
The parity-check matrix associated with G is H=[A | I ]= 1 1 0 0 1 0
(ii)
 T
3

0 1 1 0 0 1

(iii) For r=110110 the syndrome of r is
1 0 1 1 0 0  0
   
H[110110] = 1 1 0[110110]
010
T
 T =
1 .
0 1 1 0 0 1 1
  
We can observe that this matrix is identical with the second column of H.
Therefore we change the second component in r (from 1 to 0) to get the
code word c=100110. The first three components of this code word gives
the original message w=100.

For r=111101 the syndrome of r is

1 0 1 1 0 0 1
   
H[111101] = 1 1 0[111101]
010
T
 T =
 0 .
0 1 1 0 0 1 1
  
We can observe that this matrix is identical with the third column of H.
Therefore we change the third component in r (from 1 to 0) to get the
code word c=110101. The first three components of this code word gives
the original message w=110