Test #2: Solutions

21:640:237
Discrete Structures
Test #2: Solutions
Wednesday, June 22 2016
NAME:
Please write clearly and properly.
Problem
Grade
1
/3
2
/2
3
/3
4
/3
5
/3
6
/3
Total
/17
Summer 2016
21:640:237
Discrete Structures
Summer 2016
Problem 1. Prove that: ∀n ∈ Z n is odd if and only if n2 is odd.
Proof. Let us first show the implication: if n is odd, then n2 is odd. For this we are going
to write a direct proof: let us assume that n is odd, our goal is now to show that n2 is odd.
Since n is odd, it can be written as n = 2k + 1, where k is some integer. It follows that
n2 = (2k + 1) 2 = 4k 2 + 4k + 1, which we can write n2 = 2K + 1, where K is the integer
K = 2k 2 + 2k. This shows that n2 is odd, which is what we wanted.
Let us now show the converse implication: if n2 is odd, then n is odd. For this we are
going to write a proof by contrapositive: we are going to prove that if n is not odd, then n2
is not odd. Thus let us now assume that n is an even integer, our goal is now to show that
n2 is even. Since n is even, it can be written as n = 2k, where k is some integer. It follows
that n2 = (2k) 2 = 4k 2 , which we can write n2 = 2K, where K is the integer K = 2k 2 .
This shows that n2 is even, which is what we wanted.
21:640:237
Discrete Structures
Summer 2016
Problem 2. Prove that for any two sets A and B, P ( A ∩ B) = P ( A) ∩ P (B).
Proof. Let us first show the inclusion P ( A∩B) ⊆ P ( A)∩P (B). For this, let S ∈ P ( A∩B),
our goal is now to show that S ∈ P ( A) ∩ P (B). The fact that S ∈ P ( A ∩ B) means that
S ⊆ A ∩ B (by definition of the power set). It follows that S ⊆ A and S ⊆ B, in other
words S ∈ P ( A) and S ∈ P (B), and from this we conclude that S ∈ P ( A) ∩ P (B).
Let us now show the other inclusion: P ( A) ∩ P (B) ⊆ P ( A ∩ B). For this, let S ∈
P ( A) ∩ P (B), our goal is now to show that S ∈ P ( A ∩ B). The fact that S ∈ P ( A) ∩ P (B)
says that S ∈ P ( A) and S ∈ P (B). By definition of the power set, this means that S ⊆ A
and S ⊆ B. It follows that S ⊆ A ∩ B. In other words, S ∈ P ( A ∩ B), which is what we
wanted.
21:640:237
Discrete Structures
Summer 2016
Problem 3. Consider the “theorem”:
Theorem. For any real numbers x 1 , x 2 , . . . , x N , if the sum x 1 + x 2 + · · · + x N is negative,
then at least one of the numbers x 1 , x 2 , . . . , x N is negative.
(1) Rewrite this theorem using only mathematical symbols.
∀(x 1, . . . , x N ) ∈ R N
x 1 + x 2 + · · · + x N < 0 ⇒ ∃i ∈ {1, . . . , n}
xi < 0
Remarks:
• ∀(x 1, . . . , x N ) ∈ R N can also be written ∀x 1 ∈ R . . . ∀x N ∈ R
N
X
• x 1 + x 2 + · · · + x N can also be written
xi
• Instead of writing ∃i ∈ {1, . . . , N }
{x 1, . . . , x N } x < 0.
i=1
xi
< 0, we could have written ∃x ∈
(2) Write a proof of this theorem.
Proof. Let us write a proof by contrapositive. Assume that all of the numbers x 1 ,
x 2 , . . . , x N are nonnegative. Then their sum must be nonnegative.
Remark: A proof by contradiction here is also fine (very similar, maybe a line or
two longer).
21:640:237
Discrete Structures
Summer 2016
Problem 4. Let x 0 be a real number and let r be a positive real number. Prove that:
∀x ∈ R
|x − x 0 | > r ⇔ (x 6 x 0 − r or x > x 0 + r) .
Proof. Let us first show the implication: |x − x 0 | > r ⇒ (x 6 x 0 − r or x > x 0 + r)
(by direct proof). So, let x ∈ R such that |x − x 0 | > r, our goal is now to show that
x 6 x 0 − r or x > x 0 + r. Let us consider two different cases:
• Case 1: x − x 0 > 0. In this case, |x − x 0 | = x − x 0 , so the fact that |x − x 0 | > r is
saying that x − x 0 > r, i.e. x > x 0 + r.
• Case 2: x − x 0 6 0. In this case, |x − x 0 | = x 0 − x, so the fact that |x − x 0 | > r is
saying that x 0 − x > r, i.e. x 6 x 0 − r.
In both cases, we have indeed showed that x 6 x 0 − r or x > x 0 + r.
Let us now show the converse implication: that (x 6 x 0 − r or x > x 0 + r) ⇒ |x − x 0 | >
r (by direct proof). So, let x ∈ R such that x 6 x 0 − r or x > x 0 + r. Let us consider two
different cases:
• Case 1: x 6 x 0 − r. In this case, x − x 0 6 −r < 0, so |x − x 0 | > r.
• Case 2: x > x 0 + r. In this case, x − x 0 > r > 0, so |x − x 0 | > r.
In both cases, we have indeed showed that |x − x 0 | > r.
21:640:237
Discrete Structures
Summer 2016
Problem 5. Use induction to prove the following theorem:
Theorem. Let n ∈ N. Consider (n + 1) distinct points A0, A1, . . . , An in the plane. The
n(n + 1)
.
total number of line segments joining any two of these points is
2
Proof. We are going to write a proof by induction of the theorem: ∀n ∈ N P(n). Here
n(n + 1)
P(n) is the following open proposition: “There is a total of
line segments joining
2
any two points amongst n + 1 points in the plane.”
Basis. We have to check that P(1) is true. P(1) is the proposition that “There is a total
of 1 line segment joining any two points amongst 2 points in the plane.” That is clearly true.
n(n + 1)
line segments
Induction. Let us assume that P(n) is true: “There is a total of
2
joining any two points amongst n + 1 points in the plane.” Our goal is now to show
(n + 1)(n + 2)
line segments joining any two
that P(n + 1) is true: “There is a total of
2
points amongst n + 2 points in the plane.” So, let us consider n + 1 points in the plane
A0, A1, . . . , An+1 and let us try to count how many line segments there are joining any
two of them. We can consider that there are two kinds of line segments: those joining
any two points amongst the points A0, A1, . . . , An , and those joining An+1 to some other
point in the list A0, A1, . . . , An . On the one hand, since we are assuming that P(n) is true,
n(n + 1)
line segments of the first kind. On the other hand, it is
we know that there are
2
clear that there are n + 1 line segments of the second kind. This therefore adds up to a
n(n + 1)
total of
+ n + 1 line segments. Finally, it is a quick calculation to check that
2
n(n + 1)
(n + 1)(n + 2)
+n+1=
, which is what we wanted.
2
2
21:640:237
Discrete Structures
Summer 2016
Problem 6. Consider the following function:
f:Z→Z
n 7→ n2 .
(1) What is the domain of f ? What is its codomain? What is its range?
• The domain of f is Z.
• The codomain of f is Z.
• The range of f is {n2, n ∈ Z}.
(2) Is f one-to-one (injective)? Explain why or why not.
f is not injective because different elements of the domain do not always have
different images: for instance, f (−1) = f (1).
(3) If f onto (surjective)? Explain why or why not.
f is not surjective because not all elements of the codomain have at least one
preimage: for instance, 2 does not have any preimage.