Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Student Id: Name:

CS 204: Discrete Mathematics


Final Examination

June 30 (Tuesday), 2020

1:00 pm ~ 3:00 pm

Part / 32
I

Part / 28
II

Part / 15
III

Part / 35
IV

Part / 30
V

Total / 140

(Total number of pages including cover: 13)

1
Student Id: Name:

Part I. (Logic)
1. (4 pts) Let P be a predicate over elements of type T. Assume you can test elements for
equality. Write predicates to capture the following English sentences.

There is exactly one element of T that satisfies P.

There are at least two elements of T that satisfy P.

2. (6 pts) Give English translations for each of the following assertions and explain how
the two are related, assuming P is some predicate.

(a) (xy)P(x,y)

(b) (y)(x)P(x,y)

2
Student Id: Name:

3. (7 pts) Prove the following theorems using natural deduction:

(P  Q)  (Q  R)
SQ
S  (P  R)

Use only the inference rules of Gentzen's Natural Deduction.

3
Student Id: Name:

4. (15 pts) Consider the following argument:

Only students are members.


Only members are welcome.
Therefore all students are welcome.

(1) (6 pts) Translate the above argument into predicate logic statements. Use the following
predicates:
S(x): x is a student.
M(x): x is a member.
W(x): x is welcome.

(2) (2 pts) Is the above argument valid?

(3) (7 pts) If your answer to (2) is yes, formally prove using the Natural Deduction inference
rules in the previous page. If your answer to (2) is no, provide an interpretation (i.e.
construct a model) that will refute the validity of the argument.

4
Student Id: Name:

Part II. (Sets and Relations)

1. (8 pts)

Define a relation on Z by a R b if a2 = b2.

(a) Prove that R is an equivalence relation

(b) Describe the equivalence classes (with respect to the relation R above).

5
Student Id: Name:

2. (10 pts)

A tree T is a graph with the root node r such that from any non-root node v there is a unique
path from r to v. Prove that if T is a tree with n vertices then T has n - 1 edges.

3. (10 pts) Let A = {a, b, c}. Use Hasse diagrams to describe all partial orderings on A for
which a is a minimal element.

6
Student Id: Name:

Part III. (Induction and Recursion)

1. (15 pts)

Let S be the subset of the set of ordered pairs of integers defned recursively by

Basis Step) (0,0) S

Recursive Step) If (a,b) S , then (a,b+1) S, (a+1, b+1) S, and (a+2, b+1) S.

(a) List the elements of S produced by the first four applications of the recursive definition.

(b) Use strong induction on the number of applications of the recursive step of the definition
to show that a  2b whenever (a, b)S.

7
Student Id: Name:

Part IV. (Counting and Probability)

1. (8 pts) A bag contains 4 red balls and 6 green balls. Three balls are chosen randomly from
the bag, without replacement.
(a) What is the probability that all three balls are red?

(b) Suppose that you win $10 for each red ball drawn and you lose $5 for each green ball
drawn. Compute the expected value of your winnings.

2. (7 pts) It is known that all items produced by a certain machine will be defective with
probability 0.1, independently of each other. What is the probability that in a sample of
three items, at most one will be defective?

8
Student Id: Name:

3. (10 pts) Consider two bags. The first contains two white and seven black balls, and the
second contains five white and six black balls. We flip a fair coin and then draw a ball
from the first bag or the second bag depending upon whether the outcome was heads or
tails. What is the conditional probability that the outcome to the toss was heads given that
a white ball was selected?

9
Student Id: Name:

4. (10 pts) Suppose that a town has the population of 100 and 10 of them are infected with
coronavirus. Assume that currently I am not infected and that if I meet with a group of one or
more people that includes a infected person then I will get infected.

(a) What is the probability that I will get infected when I meet with one person?

(b) What is the probability that I will get infected when I meet with two persons?

(c) What is the probability that I will get infected when I meet with three persons?

10
Student Id: Name:

Part V. (Trees, Graphs and Algorithms)

1. (7 pts)

The following graph has 45 vertices.

(a) Does this graph have an Euler circuit? Why or why not?

(b) Does this graph have an Euler path? Why or why not?

(c) The graph below is a copy of the above graph, but with some additional edges added so
that all of the vertices in the resulting graph have degree four.

How many edges does this new graph have?

11
Student Id: Name:

2. (8 pts)

Draw a binary search tree constructed by inserting the words:

math, physics, geography , zoology, meteorology, psychology and chemistry

in that order.

12
Student Id: Name:

3. (15 pts) Describe an algorithm that takes as input a list of n integers in non-decreasing
order (that is, for any two successive elements x and y of the list, x  y is true) and
produces the list of all values that occur more than once in the input list.

13

You might also like