Informatics College, Pokhara: MA4001NP Logic and Problem Solving
Informatics College, Pokhara: MA4001NP Logic and Problem Solving
MA4001NP
Logic and Problem Solving
Solution of Test-I
Submitted By:
Submitted To:
Name of the London Met ID
student Mr. Aananda Bhattarai
Module Leader, Logic and
Problem Solving
Date:
Attempt all the questions.
If you are a flower lover, then you work in the garden. If you don’t like roses, then
you don’t work in the garden. Therefore, if you are flower lover, then you like
roses.
If you don’t like roses, then you don’t work in the garden = ¬r→ ¬q
If you are flower lover, then you like roses = p→r
In order to show that the above argument is valid , we need to show that X = [(p→q) ∧(¬r→¬q)]
→ (p→r) is a tautology.
Truth table:
p Q r p→q ¬r ¬q ¬r→¬q (p→q) (p→r) X
∧(¬r→¬q)
T T T T F F T T T T
T F F T T F F F F T
T T T F F T T F T T
T F F F T T T F F T
F T T T F F T T T T
F F F T T F F F T T
F T T T F T T T T T
F F F T T T T T T T
Here from the truth table its proved that X = [(p→q) ∧(¬r→¬q)] → (p→r) is a tautology.
ii) ¬(p∧q) ≡ ¬p v ¬q
i) ¬(pvq) ≡ ¬p∧ ¬q
Truth Table:
T T T F F F F
T F T F F T F
F T T F T F F
F F F T T T T
The value of column 4 i.e. ¬(pvq) and column 7 i.e. ¬p∧ ¬q are same. Therefore ¬(pvq) ≡ ¬p∧ ¬q to each
other.
ii) ¬(p∧q) ≡ ¬p v ¬q
Truth table
P q ¬p ¬q p∧q ¬(p∧q) ¬p v ¬q
T T F F T F F
T F F T F T T
F T T F F T T
F F T T F T T
In the truth table, column 6 i.e. ¬(p∧q) and column 7 i.e. ¬p v ¬q have the same value. Therefore ¬(p∧q)
≡ ¬p v ¬q to each other.
3.
Solution:
To show the given propositions tautology, every entry in the last column should be True value (T).
Truth table:
p q ¬p p→q ¬p ⋁ q (p → q) ↔ (¬p
⋁ q)
T T F T T T
T F F F F T
F T T T T T
F F T T T T
Here, every entry in the last column is T. This means the proposition evaluates to true for all possible
combination of Truth values of its component propositions.
b) Show that ¬ (p ∨ (¬p ∧ q)) and (¬p ∧¬q) are logically equivalent by using laws.
Solution:
By using laws, it is proved that ¬ (p ∨ (¬p ∧ q)) and (¬p ∧¬q) are logically equivalent.
4. Provided the output function:
X = A. B. C + A. B. C̅+ A. B̅ . C + A̅ . B. C
Solution:
Given
X = A. B. C + A. B. C̅+ A. B̅ . C + A̅ . B. C
X = A. B. C + A. B. C̅+ A. B̅ . C + A̅ . B. C
=( A̅ . B. C + A. B. C) + (A. B̅ . C + A. B. C) + (A. B. C̅ + A. B. C)
Step 2: The circuit for the simplified function X requires three gates:
A.B
OR
Step 3: Truth table for the simplified expression i.e. X = AB + BC + AC
5. Build a digital circuit that produces the output (A + B̅ ) [A̅ + (B + C̅)] when given input bits A, B, and C.
Also, construct the truth table.
Solution:
Suppose given output function ‘X’ i.e. X = (A + B̅ ) [A̅ + (B + C̅)]. The circuit for the output function X
requires 3 gates.
A+ B̅
B B̅
C C̅
Ooo
o B+ C̅
A̅ A̅ +(B+ C̅).
6. Draw the logic circuit for the following output functions.
i) F = XZ + Y̅Z + X̅YZ̅
X X̅
Y X̅ YZ̅
Z Z̅
XZ
Y̅
Y̅Z
̅̅̅̅ )
ii) Q = (A̅ BC)(̅A̅ +D̅
A A̅
B A̅ BC
D
̅
A+D (̅A̅ +̅̅D̅̅ )
7. A system uses 3 switches W, X and Y ; a combination of switches determines whether an alarm, Z,
sounds. If switch W or switch Y are in the ON position and switch X is in the OFF position then a signal to
sound an alarm, Z, is produced. Design the logic of the circuit using the appropriate logic gates and
construct the truth table to show all possible output.
Solution:
So we get
If (W=1 OR Y = 1): The first part is two inputs(W and Y )joined by an OR gate.
AND: The output from the first part and the third part are joined by an AND gate
(X= NOT 1) then Z= 1 : The third part is one input (X) which is put through a NOT gate.
W+Y
X X̅
This gives the following truth table:
b) Find A ∩ C
c) Find B ꓴ C
d) Find (A ꓴ C) - B
Solution:
Given,
A= {x: x ∈ U, x ≥ 8} = {8,9,10,11,12,13,14,15}
A B
12,13,14,15 1,2,3,4
8,9,10
9,6,7
b. A = {8,9,10,11,12,13,14,15}
C = {5,6,7,8,9,10,11}
= {8,9,10,11}
c. B = {1,2,3,4}
C = {5,6,7,8,9,10,11}
={1,2,3,4,5,6,7,8,9,10,11}
d. A{8,9,10,11,12,13,14,15}
B{1,2,3,4}
C{5,6,7,8,9,10,11}
AUC = {8,9,10,11,12,13,14,15} U {5,6,7,8,9,10,11}
= {5,6,7,8,9,10,11,12,13,14,15}
= {5,6,7,8,9,10,11,12,13,14,15}
e) (AUB) – (AnB)
A = {8,9,10,11,12,13,14,15}
B = {1,2,3,4}
= {1,2,3,4,8,9,10,11,12,13,14,15}
={}
= {1,2,3,4,8,9,10,11,12,13,14,15}
9. Draw the Venn diagrams for each of these combinations of the sets A,B and C.
a) (A ∩ B) ∪ (A ∩ C)
AnB AnC
(AnB) U (AnC)
b) (A ∩ B’) ∪ (A ∩ C’)
B’ An B’
C’ An C’
(A ∩ B’) ∪ (A ∩ C’)
10.In a group of students 18 read Books, 19 read Magazines and 16 read Novels.
6 read Books only, 9 read Magazines only, 5 read Books and Magazines only
Let, n(B) be the number of students who reads books, n(M) be the number of students who reads
magazines, n(N) be the number of students who reads novels. no(B) be the number of students who
reads books only, no(M) be the number of students who reads magazines only, no(N) be the number of
students who read novel only.
Here,
n(B) =18
n(M) = 19
n(N) = 16
no(B) = 6
no(M) = 9
no(BnM) = 5
no(MnN) = 2
a) Venn- Diagram
6 5 9
4 2
c) According to the Venn-Diagram, there are 4 students who reads books and novels only.
d) According to the Venn-Diagram, there are 7 students who reads novels only.
e) According to the Venn-Diagram, there are altogether 36 students.