2019-2020 Fall MATH163 Final Answer Keys
2019-2020 Fall MATH163 Final Answer Keys
DEPARTMENT OF MATHEMATICS
MATH163 DISCRETE MATHEMATICS
2019-2020 FALL SEMESTER
FINAL EXAMINATION
ANSWER KEYS
𝑛𝑛
Question 1: Let 𝑓𝑓: ℕ × ℕ → ℕ defined by 𝑓𝑓 (𝑛𝑛, 𝑚𝑚) = � � + 1, where ℕ = {1,2,3, … } is
𝑚𝑚
the set of natural numbers.
a) Is 𝑓𝑓 one-to-one? Justify your answer.
E
b) Is 𝑓𝑓 onto? Justify your answer.
Answer
PL
a) Here is a counter example proving that 𝑓𝑓 is not one-to-one function. By substituting
𝑛𝑛
(𝑛𝑛, 𝑚𝑚) by (4,2) and then by (2,1) in 𝑓𝑓 (𝑛𝑛, 𝑚𝑚) = � � + 1 we can easily see that
𝑚𝑚
4 2
𝑓𝑓 (4,2) = � � + 1 = 3 and 𝑓𝑓 (2,1) = � � + 1 = 3, meaning that 𝑓𝑓(4,2) = 𝑓𝑓(2,1). This
2 1
counter example proves the fact that 𝑓𝑓 is not one-to-one function. (3.5 points)
M
b) To prove that it is onto we need to find for each natural number 𝑛𝑛 arguments of 𝑓𝑓
1
where 𝑛𝑛 is taken. Particularly: 𝑓𝑓 (1,2) = � � + 1 = 0 + 1 = 1. Further 𝑓𝑓 (𝑘𝑘, 1) =
𝑘𝑘
2
� � + 1 = 𝑘𝑘 + 1 for 𝑘𝑘 ∈ ℕ where 𝑘𝑘 + 1 takes each natural number 𝑛𝑛 ≥ 2. These two
SA
1
parts together prove that 𝑓𝑓 is onto, i.e. each natural number is taken by 𝑓𝑓. (3.5 points)
Question 2: Prove or disprove that the following two logic diagrams are equivalent.
EE
Answer
FR
Grading: up to 1.5 point will be given for correct writing of formulae 𝑓𝑓 = 𝑥𝑥𝑥𝑥 ���������
+ 𝑧𝑧 and
𝑔𝑔 = (𝑥𝑥̅ + 𝑦𝑦�)𝑧𝑧̅, up to 1.5+1.5 points for the truth tables and 1 point for reading the final
result correctly.
E
and Python, and just 1 in all three languages. How many are not proficient in any of these
three programming languages?
PL
Answer
Let 𝑈𝑈, 𝐽𝐽, 𝐶𝐶 and 𝑃𝑃 be the sets of all computer programmers, those who are proficient in
Java, proficient in C# and proficient in Python, respectively. Expressed mathematically,
M
|𝑈𝑈| = 100, |𝐽𝐽| = 45, |𝐶𝐶 | = 30, |𝑃𝑃| = 20.
Then, |𝐶𝐶 ∩ 𝐽𝐽| = 6, |𝐽𝐽 ∩ 𝑃𝑃| = 1, |𝐶𝐶 ∩ 𝑃𝑃| = 5, |𝐶𝐶 ∩ 𝐽𝐽 ∩ 𝑃𝑃| = 1. According to the principle
of inclusion-exclusion
SA
|(𝐶𝐶 ∪ 𝐽𝐽 ∪ 𝑃𝑃)𝑐𝑐 |
= |𝑈𝑈| − (|𝐶𝐶 | + |𝐽𝐽| + |𝑃𝑃|) + (|𝐶𝐶 ∩ 𝐽𝐽| + |𝐶𝐶 ∩ 𝑃𝑃| + |𝐶𝐶 ∩ 𝑃𝑃|) − |𝐶𝐶 ∩ 𝐽𝐽 ∩ 𝑃𝑃|
= 100 − (45 + 30 + 20) + (6 + 1 + 5) − 1 = 100 − 95 + 12 − 1 = 16.
EE
Thus, 16 out of 100 computer programmers employed by the company are not proficient
in any of these 3 programming languages.
Grading: up to 2 points for correct writing of the givens of the problem; up to 3 points for
the correct writing of the formula and up to 2 points for calculation of the correct
FR
answer. To get a full mark not only the answer must be correct but also set operators and
notations should be correctly used.
Question 4: There are 10 houses on a street. An absent minded postman arrives with one
letter to each house. In how many ways he can deliver the letters, one to each house, so
that 3 letters arrive to the correct houses while remaining 7 to incorrect houses.
Answer
10
There are � � ways to deliver 3 letter to 3 correct houses and for each of these choices
3
there are 𝐷𝐷7 more choices to deliver remaining 7 letters to 7 incorrect houses. We use
multiplication rule and find that
10 10! 1 1 1 1 1 1 1
� � × 𝐷𝐷7 = × 7! �1 − + + + + + + � = 120 × 1854 = 222480.
3 3!7! 1! 2! 3! 4! 5! 6! 7!
10 10!
E
Grading: 2 points will be given for � �, 2 points for 𝐷𝐷7 , 1.5 points for and 1.5
3 3!7!
1 1 1 1 1 1 1
more points for 7! �1 − + + + + + + �.
PL
1! 2! 3! 4! 5! 6! 7!
3
Question 5: Find ∑100
𝑘𝑘=0 𝑘𝑘 . 2
Answer
∑100
𝑘𝑘=0
3
𝑟𝑟 = ÷ 3 =
3
2𝑘𝑘
= 3 + + ⋯+
1
3
2 2100
3
M (1 point)
(1 point)
SA
2 2
𝑎𝑎 = 3 (1 point)
𝑛𝑛 = 101 (1 point)
1−𝑟𝑟 𝑛𝑛
𝑆𝑆 = 𝑎𝑎 ∙
EE
(1 point)
1−𝑟𝑟
1 101
1−� �
2
𝑆𝑆 = 3 ∙ 1 (1 point)
1−
2
FR
1 101
𝑆𝑆 = 6 ∙ �1 − � � � (1 point)
2
E
c) Is this an Eulerian graph? Justify your answer.
PL
Answer
Question 7: Given the following graph, use Prim’s algorithm to find a minimum
spanning tree. Trace the algorithm starting with vertex A and also provide the trace table.
Find the sum of the weights of the edges in a minimum spanning tree.
FR
11
J G
D
7 H
20
C F
14
I
A
B
Answer
We trace the Prim’s algorithm starting with vertex A as follows: (5.5 point)
Step 1 2 3 4 5 6 7 8 9
Edge AC CJ CD DB BH HI HG EJ EF
Weight 3 5 7 2 4 1 6 9 11
E
Sum of the weights of the edges of the minimum spanning tree is 48. (0.5 point)
PL
M
SA
EE
FR