CS70 Discrete Mathematics for Computer Science, Fall 2007
Midterm 1 Solutions
Note: These solutions are not necessarily model answers. Rather, they are designed to be tutorial in nature,
and sometimes contain more explanation (occasionally much more) than an ideal solution. Also, bear in
mind that there may be more than one correct solution. The maximum total number of points available is 60.
1. Quick Questions
(a) The truth tables are as follows:
6pts
P
Q
P
⇒
Q
Q
⇒
P
P
⇔
Q
true
true
true
true
true
true
false
false
true
false
false
true
true
false
false
false
false
true
true
true
Almost all people got this question right. The most common mistake was in the table for
P
⇔
Q
.
(b) (i) and (iii) are valid strategies. (ii) and (iv) are invalid strategies. Although they were not required,
8pts
here are explanations for these answers:
The original statement is
(
∃
x P
(
x
))
⇒
(
∀
y Q
(
y
))
.
(i): The
contrapositive
is
(
∃
y
¬
Q
(
y
))
⇒
(
∀
x
¬
P
(
x
))
. The contrapositive is logically equivalent
to the original statement. Thus, we can approach this problem by assuming the lefthand side is true
and showing that this implies the righthand side.
(ii): This would prove the statement
(
∀
y Q
(
y
))
⇒
(
∃
x P
(
x
))
. This is the
converse
of the origi
nal statement which is not logically equivalent to the original statement.
(iii): This is a proof by
contradiction
. It approaches the proof by assuming that the negation of the
statement is true. The negation of the statement is
¬
[(
∃
x P
(
x
))
⇒
(
∀
y Q
(
y
))]
≡ ¬
[
¬
(
∃
x P
(
x
))
∨
(
∀
y Q
(
y
))]
≡ ¬
[(
∀
x
¬
P
(
x
))
∨
(
∀
y Q
(
y
))]
≡ ¬
(
∀
x
¬
P
(
x
))
∧ ¬
(
∀
y Q
(
y
))
≡
(
∃
x P
(
x
))
∧
(
∃
y
¬
Q
(
y
))
(iv): This would prove the statement
¬
[(
∀
x P
(
x
))
∧
(
∀
y
¬
Q
(
y
))]
≡ ¬
(
∀
x P
(
x
))
∨ ¬
(
∀
y
¬
Q
(
y
))
≡ ¬
(
∀
x P
(
x
))
∨
(
∃
y Q
(
y
))
≡
(
∀
x P
(
x
))
⇒
(
∃
y Q
(
y
))
which is not logically equivalent to the original statement.
A number of people had some trouble with one or more parts of this problem. Some people reduced
incorrectly. It was not necessary to show your work for this part.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document(c) The stable marriage produced by the algorithm is (1,B), (2,C), (3,A), (4,D).
4pts
Almost all people got this question right.
(d) We use the extendedgcd algorithm:
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 PAPADIMITROU
 Computer Science, Logic, Mathematical Induction, Inductive Reasoning, Tn, Mathematical logic, induction hypothesis

Click to edit the document details