MA 161: DISCRETE MATHEMATICS I
Faculty of Science, Technology & Environment
School of Computing, Information & Mathematical Sciences
Final Examination
Semester II, 2018
Mode: Face-to-Face and Online
Duration of Exam: 3 hours + 10 minutes
Reading Time: 10 minutes
Writing Time: 3 hours
Total Marks: 100
INSTRUCTIONS:
1. There are six (6) questions and ALL are compulsory.
2. There are seven (7) pages (including this cover page) in this exam paper.
3. Write your answers in the answer booklet provided. Start each question on a new page.
4. For questions 2-6, show all necessary working. Partial marks will be awarded for partially
correct answers.
5. Only non-programmable calculators are allowed.
6. Some useful tables are given on Pages 6 - 7.
7. This exam is worth 50% of your overall mark. The minimum passing mark is 40/100.
Question 1. Start on a new page. Total marks: 10.
Determine if each of the following statements is True or False. Do not provide any reason for
your answer.
(a) The sum of two primes is always even.
(b) ∃ x(x2 = 1), where the domain is the set of all real numbers.
(c) ∀ x(x2 = 1), where the domain is the set of all real numbers.
(d) gcd(a, b) = gcd(b, a) for all integers a, b not both zero.
(e) The empty string has length 1.
(f) (1010)2 + (1001)2 = (10011)2
(g) There is exactly one one-to-one function from the set {1, 2} to the set {a, b}.
(h) For all integers n, the number n/5 is also an integer.
(i) There exists an integer n such that n/3 is also an integer.
(j) −4 ≡ 7 (mod 11).
Question 2. Start on a new page. Total marks: (3 + 2) + (3 + 3) + 5 = 16.
(a) (i) Use the Euclidean Algorithm to find gcd(901, 1007).
(ii) Hence, determine if 901 and 1007 are coprime.
(b) (i) Find a decimal expansion of (101010)2 .
(ii) Find a hexadecimal expansion of (245)10 .
(c) Let a and n be integers with n positive. Show that
a + n2 ≡ a (mod n).
Page 2 of 7
Question 3. Start on a new page. Total marks: 4+(3+5) + 4 = 16.
(a) Determine whether or not p → ¬q and q → ¬p are logically equivalent and explain your
reasoning.
(b) Consider the following three statements:
(I) If I have money then I would hire a car.
(II) If I would hire a car then I would give you a ride.
(III) I have no money or I would give you a ride.
Let p be the proposition “I have money”, q be the proposition “I would hire a car”, and r be
the proposition “I would give you a ride”.
(i) Formalise each of the statements (I) - (III) above by writing it in logical notation using
logical connectives and p, q, and r.
(ii) Using the formal statements you obtained in (i) above and an appropriate truth table,
show that from the premises (I) & (II), one can conclude (III).
(c) Consider the following “argument” that purports to show that from the premises
p ∧ t, p → ¬q, t ∨ r
one can conclude ¬r:
Step Reason
1. p∧t Premise
2. p Simplification, using (1)
3. p → ¬q Premise
4. ¬q Modus ponens, using (2) & (3)
5. ¬q ∨ r Addition, using (4)
6. q→r Logically equivalent to (5)
7. ¬q → ¬r Inverse form of (6)
8. p → ¬r Hypothetical syllogism, using (3) & (7)
9. ¬r → ¬q Contrapositive form of (6)
10. ¬q → ¬r Converse form of (9)
11. ¬r Modus ponens, using (4) & (10)
Only two steps are invalid in the argument above. Identify the invalid steps, and explain why
each chosen step is invalid.
Page 3 of 7
Question 4. Start on a new page. Total marks: 6 + 5 + 4 + (1+1+1+1+5) = 24.
(a) Use a direct proof to show that, if n is an even integer, then
jnk lnm
+ = n.
2 2
(b) Use a proof by cases to show that, if n is any integer, then n(n − 1) is always an even integer.
(c) Use an appropriate membership table to establish the set identity A ∪ (B − A) = A ∪ B.
(d) Let P (n) be the statement that
1 · 1! + 2 · 2! + 3 · 3! + · · · + n · n! = (n + 1)! − 1
for the positive integer n. A proof by mathematical induction is to be used to establish this
summation formula.
(i) What is the statement P (1)?
(ii) Show that P (1) is true, completing the basis step of the proof.
(iii) What is the inductive hypothesis?
(iv) What do you need to prove in the inductive step?
(v) Complete the inductive step, identifying where you use the inductive hypothesis.
Question 5. Start on a new page. Total marks: 5+3+6 = 14.
(a) Consider the following algorithm segment:
x := 7, y := 5
while (x > 3 and y < 7)
if (y < x)
y := y + 1
x := y
else x := x − 2
end
end
Find the values of x and y after the execution of the segment.
(b) Give a recursive definition of the sequence {2, −4, 8, −16, 32, −64, . . .}.
(c) Consider the following procedure:
Procedure Just4fun(n:nonnegative integer)
if n = 0 then Just4fun(n) := 0
else if n i s even then Just4fun(n) := n + Just4fun( n
2)
else Just4fun(n) := n + Just4fun(n − 1)
Use this procedure to find Just4fun(6).
Page 4 of 7
Question 6. Start on a new page. Total marks: 6 + 5 + 6 + 3 = 20.
(a) How many bit strings of length 5 either begin with two 0s or end with three 1s.
(b) Expand (1 + 2x)4 using the binomial theorem.
(c) Solve the recurrence relation an = 5an−1 − 6an−2 with the initial conditions a0 = 4, a1 = 11.
(d) Construct a circuit using NOT gates, AND gates and OR gates to produce the outpur x(x + y).
The End
Page 5 of 7
TABLE 1 Important Logical Equivalences.
Equivalence Name
p∧T≡p Identity laws
p∨F≡p
p∨T≡T Domination laws
p∧F≡F
p∨p≡p Idempotent laws
p∧p≡p
¬(¬p) ≡ p Double negation law
p∨q ≡q∨p Commutative laws
p∧q ≡q∧p
(p ∨ q) ∨ r ≡ p ∨ (q ∨ r) Associative laws
(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)
p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r) Distributive laws
p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)
¬(p ∧ q) ≡ ¬p ∨ ¬q De Morgan’s laws
¬(p ∨ q) ≡ ¬p ∧ ¬q
p ∨ (p ∧ q) ≡ p Absorption laws
p ∧ (p ∨ q) ≡ p
p ∨ ¬p ≡ T Negation laws
p ∧ ¬p = F
[Here, T (respectively F) denotes a proposition that is always True (respectively False).]
TABLE 2 Rules of Inference.
Rule of Inference Tautology Name
p
p→q (p ∧ (p → q)) → q Modus ponens
∴q
¬q
p→q (¬q ∧ (p → q)) → ¬p Modus tollens
∴ ¬p
p→q
q→r ((p → q) ∧ (q → r)) → (p → r) Hypothetical syllogism
∴p→r
p∧q
(p ∧ q) → p Simplification
∴p
p∨q
¬p (p ∨ q) ∧ ¬p) → q Disjunctive syllogism
∴q
p
q ((p) ∧ (q)) → (p ∧ q) Conjunction
∴p∧q
p
p → (p ∨ q) Addition
∴p∨q
p∨q
¬p ∨ r ((p ∨ q) ∧ (¬p ∨ r)) → (q ∨ r) Resolution
∴q∨r
¬p → F
(¬p → F) → p Contradiction
∴p
Page 6 of 7
TABLE 3 Extra Logical Equivalences.
p → q ≡ ¬p ∨ q
p → q ≡ ¬q → ¬p
p ∨ q ≡ ¬p → q
p ∧ q ≡ ¬(p → ¬q)
¬(p → q) ≡ p ∧ ¬q
(p → q) ∧ (p → r) ≡ p → (q ∧ r)
(p → r) ∧ (q → r) ≡ (p ∨ q) → r
(p → q) ∨ (p → r) → p → (q ∨ r)
(p → r) ∨ (q → r) ≡ (p ∧ q) → r
p ↔ q ≡ (p → q) ∧ (q → p)
p ↔ q ≡ ¬p ↔ ¬q
p ↔ q ≡ (p ∧ q) ∨ (¬p ∧ ¬q)
¬(p ↔ q) ≡ p ↔ ¬q
Page 7 of 7