Download CS173 Homework 8 Solution: Recursive Definitions & Sequences and more Assignments Discrete Structures and Graph Theory in PDF only on Docsity!
CS173 Discrete Mathematical Structures
Spring 2007
Homework #8 Solution
Due Sun 03/12/07, 8AM.
(35 points)
- Give a recursive definition to each of the followings: (13 points, 2+2+3+3+3)
a) an = n 2 + 3 n+ 2 , n = 1, 2,3,L 2 2 a 1 = 6, an (^) + 1 = ( n +1) + 3( n + 1) + 2 = n + 3 n + 2 + 2 n + 4 = an + 2 n+ 4 b) an = log ( !) 2 n , n = 1, 2,3,L a 1 = log 1! 2 = 0, an (^) + 1 = log (( 2 n + 1)!) = an + log ( 2 n+1) c) a n = 2 n^ + −( 2) n, n = 1, 2,3,L
1 1 2 1 1
, is even 0, 8, 4 , is odd
n n n
a n a a a a n
−
−
d) The set of positive integers congruent to 3 modulo 5. 3 ∈ S , and if x ∈ S , then x + 5 ∈S e) S = {( ,a b ) | a ∈ Z +^ , b ∈ Z +, and a +bis odd} (1, 2) ∈ S , (2,1) ∈ S , and if ( ,a b ) ∈ S , then ( a + 1, b + 1) ∈ S , ( a + 2, b) ∈ S , and ( ,a b + 2)∈S
- Suppose sequence{a (^) n }is defined as a 0 = 1, a 1 = 2, a 2 = 3, ak = ak (^) − 1 + ak (^) − 2 + ak− 3 , for k ≥ 3.
a) We want to find a bound for each term of the sequence. (10 points, 6+2+2)
- Prove by strong induction that a n ≤ 2 nfor all integers n ≥ 0. Base case: a 0 = 1 ≤ 20 = 1. Verified. Inductive hypothesis: Assume this bound holds for all ak , where1 ≤ k ≤ n. Inductive step: (Prove a n (^) + 1 ≤ 2 n+^1 is true) According to the definition of the series, an (^) + 1 = an + an (^) − 1 + an− 2. According to IH, an (^) + 1 = an + an (^) − 1 + an (^) − 2 ≤ 2 n^ + 2 n^ −^1 + 2 n−^2 1 2 1 2 2 1 1 2 2 2 1 2 2 2 2 2
n n n n n n a n − − − −
- ≤^ +^ +^ ≤^ +^ +^ +^ L^ +^ +^ + (Notice that this is a geometric series) 1 2 2 1 1 1 1 1 2 2 2 2 2 2 1 2
n n n n n a n − − + +
- ≤^ +^ +^ +^ L^ +^ +^ +^ =^ −^ ≤ Q.E.D.
6 points, 1 for the base case, 2 for the IH, 3 for the inductive step.
- What is the difference between a strong induction and a normal mathematical induction? The difference is in the inductive hypothesis. In mathematical induction, we only need to assume P k( ) is true, and then show the implication P k( ) → P k( + 1)is true for every positive integer k. In strong induction, however, the hypothesis is P (1) ∧ P(2) ∧ L ∧P k( )is true, and then show that P(1) ∧ P (2) ∧ L ∧ P k( ) → P k( +1) is true for every positive integer k. Apparently, the latter has a stronger hypothesis.
- Can we prove it by normal induction? If yes, give your proof. If no, give your explanation No. If we were to prove it by normal induction, the hypothesis would only assume P n( ) is true. That is, for k = n, a k = an≤ 2 nis true. But there is no assumption on any k less than n. Therefore, in the expansion an (^) + 1 = an + an (^) − 1 + an− 2 of the inductive step, we cannot claim 1 1 2
n a n − − ≤^ or^
2 2 2
n an − − ≤^ simply because they are not stated in the hypothesis.
b) We want not only a bound for each term, but also the exact value of each term. (12 points, 4+4+4)
- Devise a recursive algorithm to find the nth term of the sequence{a (^) n }. procedure recFindA (n: non-negative integer) if n = 0 then recFindA (n) := 1 else if n = 1 then recFindA (n) := 2 else if n = 2 then recFindA (n) := 3 else recFindA (n) := recFindA (n-1) + recFindA (n-2) + recFindA (n-3) end procedure
4 points, 0.5 point for each base case, 2 points for the recursive step. 0.5 point for other issues.
- Devise an iterative algorithm to find the nth term of the sequence{ an }. procedure iterFindA (n: non-negative integer) if n = 0 then iterFindA (n) := 1 else if n = 1 then iterFindA (n) := 2 else if n = 2 then iterFindA (n) := 3 else begin x := 1 y := 2 z := 3 sum := x + y + z for i := 3 to n begin x := y y := z z := sum sum := x + y + z end end iterFindA (n) := sum
4 points, 2 points for setting up the base cases appropriately, 2 for the iterative part.