8 Colored Solutions
8 Colored Solutions
Name:
NetID: Lecture: A B
Discussion: Thursday Friday 9 10 11 12 1 2 3 4 5 6
2
Use (strong) induction to prove that g(n) = 2 −
3n
Solution: Proof by induction on n.
2 2
Base case(s): n = 0: 2 − 3n
=2− 1
= 0 = g(0) So the claim holds.
2 2 4
n = 1: 2 − 3n
=2− 3
= 3
= g(1) So the claim holds.
Inductive Step:
2
We need to show that g(k) = 2 −
3k
4 1
g(k) = g(k − 1) − g(k − 2) [by the def, k ≥ 2]
3 3
4 2 1 2
= 2 − k−1 − 2 − k−2 [Inductive Hypothesis]
3 3 3 3
8 8 2 2
= − k − + k−1
3 3 3 3
6 8 6
= − k+ k
3 3 3
2
= 2 − k.
3
CS 173, Spring 19 Examlet 8, colored 2
Name:
NetID: Lecture: A B
Discussion: Thursday Friday 9 10 11 12 1 2 3 4 5 6
f (0) = 2
f (1) = 7
Use (strong) induction to prove that f (n) = 3 · 2n + (−1)n+1 for any natural number n.
Solution: Proof by induction on n.
Base case(s): For n = 0, we have 3 · 20 + (−1)1 = 3 − 1 = 2 which is equal to f (0). So the claim
holds.
For n = 1, we have 3 · 21 + (−1)2 = 6 + 1 = 7 which is equal to f (1). So the claim holds.
Inductive hypothesis [Be specific, don’t just refer to “the claim”]: Suppose that f (n) = 3 · 2n +
(−1)n+1 , for n = 0, 1, . . . , k − 1 where k ≥ 2.
f (k) = f (k − 1) + 2f (k − 2) by definition of f
= (3 · 2k−1 + (−1)k ) + 2(3 · 2k−2 + (−1)k−1 ) by inductive hypothesis
= (3 · 2k−1 + (−1)k ) + 3 · 2k−1 + 2(−1)k−1
= 6 · 2k−1 + (−1)k − 2(−1)k
= 3 · 2k − (−1)k
= 3 · 2k (−1)k+1
Name:
NetID: Lecture: A B
Discussion: Thursday Friday 9 10 11 12 1 2 3 4 5 6
(20 points) Use (strong) induction to prove that the following claim holds:
Claim : For any integer n ≥ 2, if p1 , . . . , pn is a sequence of integers and p1 < pn , then there
is an index j (1 ≤ j < n) such that pj < pj+1 .
Solution:
Base case(s): Proof by induction on n. At n = 2: It’s given that p1 < pn . But pn = p2 . So p1 < p2
and so j = 1 is the required index.
Inductive Hypothesis [Be specific, don’t just refer to “the claim”]: Suppose that any sequence of
integers p1 , . . . , pn with p1 < pn has an index j (1 ≤ j < n) such that pj < pj+1, for n = 2, . . . , k.
Rest of the inductive step: Let p1 , . . . , pk+1 be a sequence of k + 1 integers, with p1 < pk+1 .
Consider pk and pk+1 . There are two cases:
Case (1): pk < pk+1 . Then the index j = k works.
Case (2): pk ≥ pk+1 . Then we have p1 < pk+1 and pk+1 ≤ pk . So p1 < pk . So we can apply the
inductive hypothesis to the shorter subsequence p1 , . . . , pk . That is, by the inductive hypothesis, there is
an index j into the subsequence (i.e. 1 ≤ j < k) such that pj < pj+1. This (obviously) also works as an
index into the longer sequence of k + 1 integers.
In both cases, we have found an index j such that pj < pj+1, which is what we needed to find.
[Notes: it also works to remove the first element p1 from the sequence, with small changes to the
inductive step. Your inductive step doesn’t need to be quite this detailed.]
CS 173, Spring 19 Examlet 8, colored 4
Name:
NetID: Lecture: A B
Discussion: Thursday Friday 9 10 11 12 1 2 3 4 5 6
f (1) = 5 f (2) = −5
Name:
NetID: Lecture: A B
Discussion: Thursday Friday 9 10 11 12 1 2 3 4 5 6
(20 points) Suppose that θ is a constant (but unknown) real number. For any real number p, the
angle addition formulas imply the following two equations (which you can assume without proof):
Use (strong) induction to prove that f (n) = cos(nθ) for any natural number n.
Rest of the inductive step: In particular, by the inductive hypothesis, f (k) = cos(kθ) and
f (k − 1) = cos((k − 1)θ).
If we set p = k in equations (1) and (2), and then add them together, we get
f (k + 1) = 2 cos(θ)f (k) − f (k − 1)
= 2 cos(θ) cos(kθ) − cos((k − 1)θ) (by the IH)
= cos((k + 1)θ) + cos((k − 1)θ) + cos((k − 1)θ)
= cos((k + 1)θ)
Name:
NetID: Lecture: A B
Discussion: Thursday Friday 9 10 11 12 1 2 3 4 5 6
(20 points) A Zellig graph consists of 2n (n ≥ 1) nodes connected so as to form a circle. Half of the
nodes have label 1 and the other half have label -1. As you move clockwise around the circle, you keep
a running total of node labels. E.g. if you start at a 1 node and then pass through two -1 nodes, your
running total is -1. Use (strong) induction to prove that there is a choice of starting node for which the
running total stays ≥ 0.
Hint: remove an adjacent pair of nodes.
Base case(s): At n = 1, there are only two nodes. If you start at the node with label 1, the running
total stays ≥ 0.
Inductive Hypothesis [Be specific, don’t just refer to “the claim”]: Suppose that there is a choice of
starting node for which the running total stays ≥ 0, for Zellig graphs with 2n nodes, where n = 1, . . . , k−1.
Rest of the inductive step: Let G be a Zellig graph with 2k nodes. Find a 1 node that immediately
precedes a -1 (going clockewise). Remove those two nodes m and s from G to create a smaller graph H.
By the inductive hypothesis, we can find a starting node p on H such that the running total stays
≥ 0. I claim that p also works as a starting node for G. Between p and m, we see the same sequence of
nodes as in H, so the total stays ≥ 0. The total increases by 1 at m and the immediately decreases by 1
at s. So it can’t dip below zero in that section of the circle. Between s and returning to p, we have the
same running totals as in H.
So G has a starting point for which all the running totals stay ≥ 0, which is what we needed to prove.
CS 173, Spring 19 Examlet 8, colored 7
Name:
NetID: Lecture: A B
Discussion: Thursday Friday 9 10 11 12 1 2 3 4 5 6
Rest of the inductive step: By the definition of f and the inductive hypothesis, we get
f (k) = 6f (k − 1) − 11f (k − 2) + 6f (k − 3)
= 6(1 − 2k−1 + 2 · 3k−1) − 11(1 − 2k−2 + 2 · 3k−2 ) + 6(1 − 2k−3 + 2 · 3k−3 )
= (6 − 11 + 6) − (6 · 2k−1 − 11 · 2k−2 + 6 · 2k−3) + 2(6 · 3k−1 − 11 · 3k−2 + 6 · 3k−3 )
= 1 − (12 · 2k−2 − 11 · 2k−2 + 3 · 2k−2 ) + 2(18 · 3k−2 − 11 · 3k−2 + 2 · 3k−2)
= 1 − 4 · 2k−2 + 2 · 9 · 3k−2 = 1 − 2k + 2 · 2k
Name:
NetID: Lecture: A B
Discussion: Thursday Friday 9 10 11 12 1 2 3 4 5 6
(20 points) Use (strong) induction to prove that, for any integer n ≥ 8, there are non-negative integers
p and q such that n = 3p + 5q.
Inductive Hypothesis [Be specific, don’t just refer to “the claim”]: Suppose that there are non-
negative integers p and q such that n = 3p + 5q, for n = 8, 9, . . . , k − 1, where k ≥ 11.