CS70 Discrete Mathematics and Probability Theory, Spring 2009
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.
2
points are deducted for a wrong answer in Q. 1
1. [Logic]
2pts
(a)
Valid:
We can see this by rewriting the implication and applying De Morgan’s laws.
∀
n
(
¬
Q
(
n
)
⇒
P
(
n
))
≡ ∀
n
(
Q
(
n
)
∨
P
(
n
))
≡ ∀
n
¬
(
¬
P
(
n
)
∧ ¬
Q
(
n
)
≡ ¬
[
∃
n
(
¬
P
(
n
)
∧ ¬
Q
(
n
))]
2pts
(b)
Invalid:
We can see this by looking at the right hand side of the equivalence. Note that the logical
expression
(
P
∨ ¬
P
)
is always going to be true. Therefore, we see that the expression
∀
n
[(
P
(
n
)
∨ ¬
P
(
n
))
∧
(
Q
(
n
)
∨ ¬
Q
(
n
))]
is always true. However, it is not true that the left hand side expression
∀
n
(
P
(
n
)
⇔
Q
(
n
))
is always
true, and so the equivalence is invalid.
2pts
(c)
Valid:
We can see this by rewriting the implication and applying De Morgan’s laws.
∀
m
∀
n
[
R
(
m,n
)
⇒ ¬
(
∀
l
[
R
(
m
+
l,n
)
∨
R
(
n,m
+
l
)])]
≡ ∀
m
∀
n
[
¬
R
(
m,n
)
∨ ¬
(
∀
l
[
R
(
m
+
l,n
)
∨
R
(
n,m
+
l
)])]
≡ ∀
m
∀
n
[
¬
R
(
m,n
)
∨ ∃
l
¬
(
R
(
m
+
l,n
)
∨
R
(
n,m
+
l
))]
≡ ∀
m
∀
n
[
¬
R
(
m,n
)
∨ ∃
l
(
¬
R
(
m
+
l,n
)
∧ ¬
R
(
n,m
+
l
))]
2pts
(d)
Invalid:
We can see this just by coming up with a simple counterexample. In order for the equivalence
to be valid, it needs to be valid for all possible
R
(
m,n
)
. If we can ﬁnd an proposition
R
(
m,n
)
such that
the equivalence does not hold, then it must be invalid. Consider the proposition
R
(
m,n
) = (
m
=
n
2
)
.
We are looking at the equivalence
∀
n
∃
m R
(
m,n
)
≡ ∃
m
∀
n R
(
n,m
)
Now, it is true that
∀
n,
∃
m
(
m
=
n
2
)
 we can just pick
m
=
n
2
which is a natural number, and so the
left hand side of the equivalence is true with this particular choice of
R
(
m,n
)
. However, it is not true
that
∃
m
∀
n
(
n
=
m
2
)
. This should be obvious to see that all of the natural numbers
n
are not all the
square of the same natural number
m
.
Note:
This is obviously not the only possible counterexample that we can use. For example another
counterexample,
R
(
m,n
) = (
m > n
)
would be valid as well.
2. [Induction]
Prove by induction that the sum of the interior angles of a convex polygon with
n
vertices is exactly
(
n

2)
π
.
Proof
:
(a)
Base case:
For
n
= 3
we have a triangle. From elementary geometry we know that the sum of the
3pts
interior angles of a triangle is
(3

2)
π
=
π
.