0% found this document useful (0 votes)
174 views5 pages

CSC 236 A1 2018 Winter

This document contains sample solutions to four problems from the CSC236H Fall 2017 Assignment 1. The problems cover topics like proofs by induction, properties of functions, and structural induction. The solutions provide detailed step-by-step working to prove the statements in each problem.

Uploaded by

Steven Succar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
174 views5 pages

CSC 236 A1 2018 Winter

This document contains sample solutions to four problems from the CSC236H Fall 2017 Assignment 1. The problems cover topics like proofs by induction, properties of functions, and structural induction. The solutions provide detailed step-by-step working to prove the statements in each problem.

Uploaded by

Steven Succar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

CSC236H, Fall 2017

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.

Base Case: Assume n = 0.


Then we have 20+2 + 32∗0+1 = 22 + 3 = 7, which is indeed divisible by 7.

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.

2(k+1)+2 + 32(k+1)+1 = 2k+3 + 32k+3


= 2k+2 ∗ 2 + 32k+1 ∗ 32
= 2 ∗ (2k+2 + 32k+1 ) + 7 ∗ 32k+1
= 2 ∗ 7m + 7 ∗ 32k+1 # by IH
2k+1
= 7(2m + 3 )
0
= 7m # where m0 = 2m + 32k+1 and so m0 ∈ N

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

Then f (k) = 5 ∗ 3, and so P (k) is true.



Case B: Let b kc = 3. That is, k ∈ {9, 10, 11, ..., 15}.


f (k) = f (3)2 + 2f (3) # Since b kc = 3
= 32 + 2 ∗ 3 # Since f (2) = 3
= 15

Then f (k) = 5 ∗ 3, and so P (k) is true.

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

By our assumption C is not empty. By definition, C is a subset of N.


By PWO there exists a smallest element a in C.

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

Expanding the right hand side of the formula we get that


a−1
X (a − 1)a(2a − 1)(3(a2 − 2a + 1) + 3a − 2)
k4 =
30
k=1
a(a − 1)(2a − 1)(3a2 − 6a + 3 + 3a − 2)
=
30
a(2a2 − 3a − 1)(3a2 − 3a + 1)
=
30
a(6a4 − 15a3 + 10a2 − 1)
=
30
Adding a4 to both sides we get
a−1
X a(6a4 − 15a3 + 10a2 − 1)
k 4 + a4 = + a4
30
k=1
a(6a4 + 15a3 + 10a2 − 1)
=
30
which in turn can be rewritten as
a
X a(6a4 + 15a3 + 10a2 − 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

4. Let L : Z2 → N be a function defined by the equation

L(x, y) = x2 + y 2 .

Let C ⊆ Z2 be the smallest set such that:

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.

Solution: Proof by structural induction on the structure of C.

P (x, y) : There is some k ∈ N such that L(x, y) = 2k .

Base Case: There are 2 cases (A) (x, y) = (1, 1) and (B) (x, y) = (1, −1).

Case A: Suppose (x, y) = (1, 1).


Then L(x, y) = 12 + 12 = 2 = 21 .
So L(x, y) is a power of 2.

Case B: Suppose (x, y) = (−1, 1).


Then L(x, y) = (−1)2 + 12 = 2 = 21 .
So L(x, y) is a power of 2.

Induction Step: Suppose (r, s), (t, u) ∈ C.


Assume that P(r,s) and P(t,u) hold. That is:
There are some i, j ∈ N such that r2 + s2 = 2i and t2 + u2 = 2j . [IH]
WTP: P (x, y) holds for (A) (x, y) = (r, −s) and (B) (x, y) = (rt − su, ru + st).

Case A: Suppose (x, y) = (r, −s). Then

L(x, y) = r2 + (−s)2 # definition of L


2 2
=r +s # since (−s)2 = s2
= 2i . # by IH

So L(x, y) is a power of 2, and P (x, y) holds.

Case B: Suppose (x, y) = (rt − su, ru + st). Then

L(x, y) = (rt − su)2 + (ru + st)2 # definition of L


= (rtrt − 2rtsu + susu) + (ruru + 2rust + stst) # expand terms
= rtrt + susu + ruru + stst # -2rtsu cancels +2rust
2 2 2 2
= (r + s ) ∗ (t + u ) # factor into product of sums
i j
=2 ∗2 # by IH
i+j
=2 .

So L(x, y) is a power of 2, and P (x, y) holds.

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.

Base Case: Let w = .


Then applying the base case of the recursive definition twice, (wR )R = (R )R = ()R =  = w.

Induction Step: Let w = ua where u is a string composed of characters in Σ and a ∈ Σ.


Assume P (u). [IH]

WTP: P (w) holds.

Case 1: Assume u is the empty string, that is, u = .


Then

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.

Case 2: Assume u is not the empty string.


Then,

(wR )R = ((ua)R )R = (a · uR )R # by the recursive rule


R R R
= (u ) · a # by the fact
R
= ua # by the induction hypothesis
= ua # as proved in Case 1
= w.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy