You are on page 1of 5

AMTH140 Trimester 2 2012

Question 1 [8 marks]
Let A × B = {(1, 1), (2, 2), (3, 1), (3, 2), (1, 2), (1, 4), (2, 1), (2, 4), (3, 4)}. Find the power set of
B, P(B).
Answer
The set B = {1, 2, 4}. Then P(B) = {∅, {1}, {2}, {4}, {1, 2}, {1, 4}, {2, 4}, {1, 2, 4}}
Question 2 [8 marks]
Let f (x) = x2 + 3x + 2. Evaluate f (2) and f (−2) by Horner’s method.
Answer
f (x) = x2 + 3x + 2 = x(x + 3) + 2. Then
f (2) = 2 · (2 + 3) + 2 = 2 · 5 + 2 = 12
f (−2) = (−2) · (−2 + 3) + 2 = (−2) · 1 + 2 = −2 + 2 = 0
Question 3 [10 marks]
Use mathematical induction to show that

n! ≥ 2n−1 for n = 1, 2, . . .

Answer
Basic step.
Let S n be the proposition n! ≥ 2n−1 , then we must show that S 1 is true. This is easily
accomplished since 1! = 1 ≥ 1 = 21−1 .
Inductive step.
We must show that if S 1 , S 2 , . . . , S n are true (i! ≥ 2i−1 for i = 1, 2, . . . , n) then S n+1 , that is
(n + 1)! ≥ 2n is true. Assume that S 1 , S 2 , . . . , S n are true, that is i! ≥ 2i−1 for i = 1, 2, . . . , n are
true. Then, in particular, for i = n we have n! ≥ 2n−1 . Now,

(n + 1)! = (n + 1)n! ≥ (n + 1)2n−1 ≥ 2 · 2n−1 = 2n since n + 1 ≥ 2

Therefore S n+1 is true and hence P.M.I. tells us that n! ≥ 2n−1 is true for every postive integer n.
Question 4 [10 marks]
If f, g : N → R, f1 (n) = O(g1 (n)) and f2 (n) = O(g2 (n)) then f1 (n)+ f2 (n) = O(max(g1 (n), g2 (n)))
Answer
By definition of ”big O”, there are two integers, say M1 and M2 and two constants C1 and C2
such that

| f1 (n)| ≤ C1 |g1 (n)| for n ≥ M1 and | f2 (n)| ≤ C2 |g2 (n)| for n ≥ M2

Let M0 = max(M1 , M2 ) and let C0 = 2 max(C1 , C2 ) and consider the sum f1 (n)+ f2 (n) for n ≥ M0 :

| f1 (n)+ f2 (n)| ≤ | f1 (n)|+| f2 (n)| ≤ C1 |g1 (n)|+C2 |g2 (n)| ≤ C0 (g1 (n)+g2 (n))/2 ≤ C0 max(g1 (n), g2 (n))

Therefore f1 (n) + f2 (n) = O(max(g1 (n), g2 (n))).


Question 5 [8 marks]

2
AMTH140 Trimester 2 2012

In MERGE SORT algorithm, if we are given two sorted lists, LIST1 with n elements and
LIST2 with m elements, what is the maximum number of comparisons required to merge these
two lists into a single sorted list?
Answer
Each time we compare two elements, one is removed and put in the combined list. If we
have only one element left, no further comparisons are possible. So the number of comparisons
is certainly no bigger than one less than the total number of elements, that is ≤ m + n − 1.
Question 6 [6 marks]
Use a truth table to prove that Modus Ponens is a valid argument.
Answer
Use a truth table to prove that p → q, p, ∴ q.
p q p→q p q
T T T T T
T F F T F
F T T F T
F F T F F
Question 7 [8 marks]
Let us suppose that G is a graph with seven vertices, such that two vertices have the degree
one, three vertices have the degree two and two vertices have the degree three. Can this graph be
a tree?
If your answer is yes, draw a tree with these properties. If your answer is no, prove that it
couldn’t be a tree.
Answer
For any graph G, we denote by N the sum of the degrees of all vertices of G, denote by E
the number of edges in G, and denote by V the total number of vertices of G. Then obviously
N = 2E (*) because each edge will contribute exactly 2 degrees (by its 2 ends) to the total degrees
N. Moreover a connected graph G is a tree if and only if V = E + 1 (**)
N = 14 so E = 7 (edges). From (**), a connected graph with 7 vertices is a tree iff it has 6
edges. So this graph could not be a tree.
Question 8 [6 marks]
Convert 0.1100012 to bases four, octal and hexadecimal.
Answer
Since the number is of base 2 and that 4 = 22 , we need to convert 2-digit blocks into the
corresponding base 4 representation:
0.1100012 = 0. |{z}
11 |{z} 01 = 0.3014
00 |{z}
3 0 1
Since the number is of base 2 and that 8 = 23 , we need to convert 3-digit blocks into the
corresponding base 8 representation:
0.1100012 = 0. |{z} 001 = 0.618
110 |{z}
6 1
Since the number is of base 2 and that 16 = 24 , we need to convert 4-digit blocks into the
corresponding base 16 representation:

3
AMTH140 Trimester 2 2012

0.1100012 = 0. |{z} 0100 = 0.C416


1100 |{z}
C 4

Question 9 [4 marks]
Given the adjacency matrix
 
 0 1 1 
A =  1 0 1
 

 1 1 1 

draw its corresponding graph.


Answer
v1

v2 v3

Question 10 [6 marks]
Use a binary tree to sort the following list of numbers

65, 75, 6, 57, 99, 27, 0, 96

Answer
The binary tree constructed during the course of sorting reads

65

6 75

0 57 99

27 96

Figure 1: Binary tree

Question 11 [8 marks]
Let A be the set of all integers greater than or equal to 2, and relation R be defined by

∀m, n ∈ A : (m, n) ∈ R iff m | n

Show that

4
AMTH140 Trimester 2 2012

(a) 7 is a minimal element of A.

(b) 6 is not a minimal element of A.

(c) A does not have any maximal elements.

(d) 2 is not a least element of A.

Answer

(a) Because 7 is prime, no numbers in A can divide 7, i.e., x R 7 does not hold far any x ∈ A
(no x precedes 7), we conclude 7 is a minimal element of A.

(b) Since 2 | 6, we see immediately that 6 is not a minimal element of A.

(c) For any x ∈ A, since 2x ∈ A and x | 2x, we have x R 2x, i.e., x precedes 2x under relation R.
Hence x cannot be a maximal element. Since x is an arbitrary element in A, we conclude
that A does not have any maximal elements.

(d) The fact that 2, 3 ∈ A and 2 is not comparable with 3 means 2 is not a least element of A.

Question 12 [8 marks]
Given S = {0, 1}, the table below specifies a Boolean function f : S × S × S −→ S

x y z f (x, y, z)
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1

(a) Using a Karnaugh map, simplify the Boolean expression corresponding to this function.

(b) Draw a gate implementation for the simplified Boolean expression.

Answer
The Boolean expression corresponding to this function is

x0 y0 z0 + x0 y0 z + x0 yz0 + xyz .

We may simplify the expression with the Karnaugh map below

5
AMTH140 Trimester 2 2012

xy xy’ x’y’ x’y

z 1 1
z’ 1 1

The minimal expression is thus xyz + x0 y0 + x0 z0 .


Question 13 [5 marks]
Given that
X n!
(a1 + a2 + · · · + ak )n = an1 · an22 · · · ank k
n1 ,n2 ,...,nk ≥0
n1 ! · n2 ! · · · nk ! 1
n1 +n2 +···+nk =n

write down (a1 + a2 + a3 )3 =?


Answer

(a1 + a2 + a3 )3 =
a31 + 3a21 a2 + 3a21 a3 +
a32 + 3a22 a1 + 3a22 a3 +
a33 + 3a23 a1 + 3a23 a2 +
6a1 a2 a3

Question 14 [5 marks]
Let a sequence (xi )i∈N be determined by the recurrence relation
1 + xn+1
xn+2 =
xn
and the initial conditions x0 = a and x1 = b with a, b , 0x. Find x10 .
Answer
1 + x1
x2 =
x0
1 + x2 1 + x0
1+x1
1 + x0 + x1
x3 = = =
x1 x1 x0 x1
1 + x3 1 + x0
x4 = = ... =
x2 x1
1 + x4
x5 = = . . . = x0
x3
1 + x5 1 + x0
x6 = = 1+x0 = x1
x4 x 1

The recurrence relation has period 5. Hence x10 = x5 = x0 .

You might also like