CSC 236 A1 2018 Winter
CSC 236 A1 2018 Winter
CSC 236 A1 2018 Winter
Assignment 1
Sample Solutions
1. Prove by induction that 2n+2 + 32n+1 is divisible by 7 for all positive integers.
Solution:
P (n) : exists m ∈ N such that 2n+2 + 32n+1 = 7m.
We will prove that that P (n) hold for all natural numbers n.
Induction Step: Let k be an arbitrary natural number. Assume that P (k) holds, i.e., exists m ∈ N
such that 2k+2 + 32k+1 = 7m. [IH]
We will show that P (k + 1) also holds.
Thus P (k + 1) holds.
In conclusion, by the Principle of Simple Induction, P (n) hold for all natural numbers.
2. Consider the function:
1,
n=0
f (n) = 1, n=1
√ 2 √
f (b nc) + 2f (b nc), n≥2
Use induction to prove that for all natural numbers n ≥ 4, f (n) is divisible by 5.
Solution: P (n) : There is some natural number i such that f (n) = 5i.
The goal is to prove that for all n ∈ N, n ≥ 4, P (n) holds.
√ √
Base Case: There are two base cases: (A) b kc = 2, and (B) b kc = 3.
1
√
Case A: Let b kc = 2. That is, k ∈ {4, 5, 6, 7, 8}.
√
f (k) = f (2)2 + 2f (2) # Since b kc = 2
= 32 + 2 ∗ 3 # Since f (2) = 3
= 15
√
f (k) = f (3)2 + 2f (3) # Since b kc = 3
= 32 + 2 ∗ 3 # Since f (2) = 3
= 15
Induction Step: Let k ∈ N and k ≥ 15. Suppose for all 4 ≤ j ≤ k, P (j) is true, i.e., f (j) = 5i for
some i ∈ N. [IH]
WTP: P(k+1) holds, i.e., f (k + 1) = 5i0 for some i0 ∈ N.
√ √
Notice that since k ≥ 15, we have√k + 1 ≥ 16, and so k + 1 ≥ 4. Thus we have b k + 1c ≥ 4.
Also, since k + 1 ≥ 16, we know k + 1 < k + 1.
By
√ the definition of the floor function
√ we have bxc ≤ x, for any real number x. So we √
can say that
b k + 1c < k + 1. Since both b k + 1c and k + 1 are natural numbers we can say that b k + 1c ≤ k.
√ 2 √
f (k + 1) = f (b k + 1c) + 2f (b k + 1c) # Since k + 1 ≥ 16 > 1
2
√ √
= (5m) + 2(5m) # Since 4 ≤ b k + 1c ≤ k, by IH we know that f (b k + 1c)
√
is divisible by 5, that is, for some m ∈ N, f (b k + 1c) = 5m
= 5(5m2 + 2m) # Factoring out 5
0
= 5m # where m0 ∈ N since N is closed under summation and multiplication
Thus, P (k + 1) is true.
Pn n(n+1)(2n+1)(3n2 +3n−1)
3. Prove using the Well Ordering Principle that k=1 k4 = 30 .
Solution: Pn 2
Let P (n) denote k=1 k 4 = n(n+1)(2n+1)(3n
30
+3n−1)
.
We want to prove that for all n ∈ N, n ≥ 1, P (n) holds.
For a contradiction, assume that there is some m ∈ N, m ≥ 1, such that P (m) does not hold.
Let C be the set of all natural numbers greater that 0 for which the predicate does not hold, i.e.,
n
X n(n + 1)(2n + 1)(3n2 + 3n − 1)
C = {n ∈ N|n ≥ 1 and k 4 6= }.
30
k=1
2
1 is not in C, as the formula is verified for 1.
Then a > 1, and so a − 1 ≥ 1. That is a − 1 ∈ N.
Since a − 1 < a and a is the minimum element of C, a − 1 6∈ C, i.e.,
a−1
X (a − 1)a(2(a − 1) + 1)(3(a − 1)2 + 3(a − 1) − 1)
k4 = .
30
k=1
On the other hand, if we expand (a+1)(2a+1)(3a2 +3a−1) we can see that (a+1)(2a+1)(3a2 +3a−1)
is equal to a(6a4 + 15a3 + 10a2 − 1). That is
a
X a(6a4 + 15a3 + 10a2 − 1)
k4 =
30
k=1
(a + 1)(2a + 1)(3a2 + 3a − 1)
=
30
which implies that P (a) holds and so a 6∈ C.
This contradicts our assumption that a is the minimal element of C.
Thus we conclude that our assumption is false. That is, for all n ∈ N
n
X n(n + 1)(2n + 1)(3n2 + 3n − 1)
k4 = .
30
k=1
L(x, y) = x2 + y 2 .
3
• (1, 1), (−1, 1) ∈ C.
• If (r, s), (t, u) ∈ C then (r, −s), (rt − su, ru + st) ∈ C.
Use induction to prove that for any (x, y) ∈ C, L(x, y) is a power of 2.
Base Case: There are 2 cases (A) (x, y) = (1, 1) and (B) (x, y) = (1, −1).
5. Let denote the empty string, and Σ be a set of characters. The reversal of a string w, denoted wR ,
can be defined recursively as follows:
• R = ;
4
• If w = ua for some string u composed of characters in Σ and some character a ∈ Σ, then
wR = auR .
Use structural induction to prove that for all strings w composed of characters in Σ, (wR )R = w.
You may use the following fact, which is proved in the CSC236/240 Course Notes:
For all strings u, w, (wu)R = uR wR .
Solution: P (w) : (wR )R = w.
wR = ( · a)R
= a · R # by the recursive rule
=a· # by the base rule
=a # by properties of .
=w
Hence (wR )R = wR = w.
Notice also that w = · a = a, and so we just showed for an arbitrary character a ∈ Σ, aR = a.