Chapter 4
Chapter 4
2.
a. P(18) is true: 18 cents = 4 + 2.7.
P(19) is true: 19 cents = 3.4 + 7.
P(20) is true: 20 cents = 5.4.
P(21) is true: 21 cents = 3.7.
b. P(j): “j cents can be formed using just 4-cent stamps and 7-cent
stamps” is true for 18 ≤ j ≤ k, k ≥ 21.
c. P(k + 1): “k + 1 cents can be formed using just 4-cent stamps and 7-
cent stamps” is true for k ≥ 21.
d. We can form k + 1 cents by adding 4-cent stamps to k – 3 cents.
Using inductive hypothesis, we have P(k – 3) is true because 18 ≤ k –
3 < k.
→ P(k + 1) is true. → Proved.
4.3 Recursive Definitions and Structural Induction
1.
a. f(n + 1) = f(n) + 2
f(1) = f(0) + 2 = 1 + 2 = 3.
f(2) = f(1) + 2 = 3 + 2 = 5.
f(3) = f(2) + 2 = 5 + 2 = 7.
f(4) = f(3) + 2 = 7 + 2 = 9.
b. f(n + 1) = 3f(n)
f(1) = 3f(0) = 3.1 = 3
f(2) = 3f(1) = 3.3 = 9
f(3) = 3f(2) = 3.9 = 27
f(4) = 3f(3) = 3.27 = 81
c. f(n + 1) = 2f(n)
f(1) = 2f(0) = 2.1 = 2
f(2) = 2f(1) = 2.2 = 4
f(3) = 2f(2) = 2.4 = 8
f(4) = 2f(3) = 2.8 = 16
d. f(n + 1) = f(n)2 + f(n) + 1
f(1) = f(0)2 + f(0) + 1 = 12 + 1 + 1 = 3
f(2) = f(1)2 + f(1) + 1 = 32 + 3 + 1 = 13
f(3) = f(2)2 + f(2) + 1 = 132 + 13 + 1 =183
f(4) = f(3)2 + f(3) + 1 = 1832 + 183 + 1 = 33673
2.
a. f(n + 1) = f(n) + 3f(n − 1)
f(2) = f(1) + 3f(0) = 2 + 3(–1) = –1
f(3) = f(2) + 3f(1) = –1 + 3.2 = 5
f(4) = f(3) + 3f(2) = 5 + 3(–1) = 2
f(5) = f(4) + 3f(3) = 2 + 3.5 = 17
b. f(n + 1) = f(n)2 * f (n − 1)
f(2) = f(1)2 * f(0) = 22.( –1) = –4
f(3) = f(2)2 * f(1) = (–4)2.2 = 32
f(4) = f(3)2 * f(2) = 322.( –4) = –4096
f(5) = f(4)2 * f(3) = (–4096)2.32 = 536870912
c. f (n + 1) = 3f (n)2 − 4f (n − 1)2
f(2) = 3f(1)2 – 4f(0)2 = 3.22 – 4.( –1)2 = 8
f(3) = 3f(2)2 – 4f(1)2 = 3.82 – 4.22 = 176
f(4) = 3f(3)2 – 4f(2)2 = 3.1762 – 4.82 = 92672
f(5) = 3f(4)2 – 4f(3)2 = 3.926722 – 4.1762 = 25764174848
d. f(n + 1) = f(n − 1)/f (n)
f(2) = f(0)/f(1) = (–1)/2 = –1/2
f(3) = f(1)/f(2) = 2/(–1/2) = –4
f(4) = f(2)/f(3) = (–1/2)/( –4) = 1/8
f(5) = f(3)/f(4) = (–4)/(1/8) = –32
3.
a. f(n + 1) = f(n) − f(n − 1)
f(2) = f(1) – f(0) = 1 – 1 = 0
f(3) = f(2) – f(1) = 0 – 1 = –1
f(4) = f(3) – f(2) = –1 – 0 = –1
f(5) = f(4) – f(3) = –1 – (–1) = 0
b. f(n + 1) = f(n) * f (n − 1)
f(2) = f(1).f(0) = 1.1 = 1
f(3) = f(2).f(1) = 1.1 = 1
f(4) = f(3).f(2) = 1.1 = 1
f(5) = f(4).f(3) = 1.1 = 1
c. f(n + 1) = f(n)2 + f(n − 1)3
f(2) = f(1)2 + f(0)3 = 1 + 1 = 2
f(3) = f(2)2 + f(1)3 = 22 + 12 = 5
f(4) = f(3)2 + f(2)3 = 52 + 22 = 29
f(5) = f(4)2 + f(3)3 = 292 + 52 = 866
d. f(n + 1) = f(n)/f(n − 1)
f(2) = f(1)/f(0) = 1/1 = 1
f(3) = f(2)/f(1) = 1/1 = 1
f(4) = f(3)/f(2) = 1/1 = 1
f(5) = f(4)/f(3) = 1/1 = 1
4.
5.
a. an = 6n
a1 = 6
an+1 = an + 6
b. an = 2n + 1
a1 = 3
an+1 = an + 2
c. an = 10n
a1 = 10
an+1 = an + 10
d. an = 5
a1 = 5
an+1 = an
e. an = 4n – 2
a1 = 2
an+1 = an + 4
f. an = 1 + (−1)n
a1 = 0
an+1 = 2 – an
g. an = n(n + 1)
a1 = 2
an+1 = an + 2(n + 1)
h. an = n2
a1 = 1
an+1 = an + 2n + 1
6.
F(1) = 1
F(n+1) = F(n) + n + 1
7.
a. A = {2, 5, 8, 11, 14, …}
Basic step: 2 ∈ A.
Recursive step: If x ∈ A, then x + 3 ∈ A.
b. B = {…, -5, -1, 3, 7, 10, …}
Basic step: –5 ∈ B.
Recursive step: If x ∈ B, then x ± 4 ∈ B.
c. C = {3, 12, 48, 192, 768, …}
Basic step: 3 ∈ C.
Recursive step: If x ∈ C, then 4x ∈ C.
d. D = {1, 2, 4, 7, 11, 16, …}
Basic step: 1 ∈ D.
Recursive step: If x ∈ D, then (x + 1/2 + √ 2 x −7/4 ) ∈ D.
8.
a. 0101 1010
b. 1 1011 1 1011
c. 1000 1001 0111 1110 1001 0001
9.
When that string has the form “00...0011...11” with n number 0 and n
number 1, n is a positive integer.
3. Give a recursive algorithm for finding the sum of the first n odd positive
integers.
procedure sumOdd(n: positive integer)
if n = 1 then return 1
else return 2n – 1 + sumOdd(n – 1)