First, see students have any questions and answer them, if there are any. Then finish whatever is left from the previous week. - Problem 1: Let f: N ---> N be the function defined by / 1, if n = 0 | f(n) = < 2, if n = 1 | \ 4*f(n - 2) + 2^n if n > 1 Prove that for every integer n >= 3, f(n) <= 3*n*2^{n - 2} Solution: Define S(n) to be the predicate "f(n) <= 3*n*2^{n - 2}". We will prove by complete induction that S(n) is true for all n >= 3. Using the definition of f, we can calculate f(2), f(3), and f(4) easily. We need to compute these values in our base case, as they will be needed when doing the induction step. Base: f(2) = 4f(0) + 2^2 = 4*1 + 4 = 8 f(3) = 4f(1) + 2^3 = 4*2 + 8 = 16 <= 3*3*2^1 f(4) = 4f(2) + 2^4 = 4*8 + 16 = 48 <= 3*4*2^2 So S(3) and S(4) are true. Ind. Hyp.: Let i >= 5 be an arbitrary integer. Assume that S(j) is true for all integers 3 <= j < i. That is, assume that for all integers j such that 3 <= j < i, f(j) <= 3*j*2^{j - 2}. Ind. Step: We will prove that S(i) is true. Since i >= 5, therefore, i - 2 >= 3 and so by Ind. Hyp. S(i - 2) is true, that is, f(i - 2) <= 3*(i - 2)*2^{i - 4}. By definition of f we have: f(i) = 4*f(i - 2) + 2^i since i >= 5 and so i >= 2 <= 4*(3*(i - 2)*2^{i - 4}) + 2^i by Ind. Hyp. = 3*i*2^{i - 2} - (3/2)*2^i + 2^i = 3*i*2^{i - 2} - (1/2)*2^i <= 3*i*2^{i - 2} So S(i) is true, as wanted. Note: In the above proof, if we do not consider n = 4 in our base case, then our induction step starts from i = 4. To compute f(4), we need f(2), and if we are going to use Ind. Hyp. to prove S(4) we need to have S(2) which we have not proved it (and in fact it is not true for n = 2). So we have to consider S(4) as a special case in Ind. Step, or move it to the base case (as we did above). - Problem 2: Let B be the smallest set of binary strings such that: . 10 \in B, and . if b \in B, then b00 \in B. Let f: B ---> N be the function that maps each binary string b to the number that has b as a binary representation. Prove by induction that for all b \in B: log_2 (f(b)) is odd. Solution: Define S(b) to be this predicate: "log_2 (f(b)) is odd". We prove by induction that S(b) holds, for all b \in B. Base: if b is the smalles element in B then b = 10. In this case f(b) = 2 and log_2 (f(b)) = log_2 (2) = 1 which is odd. Ind. Hyp.: Let b be an arbitrary element of B and assume that S(b) holds. Ind. Step: We prove that for any element b' \in B that can be constructed from b, S(b') holds, too. The only way to construct b' is by adding 00 at the end of b. That is, b' = b00. Therefore, f(b') = f(b) * 4 and log_2 (f(b')) = log_2 (f(b)*4) = log_2 (f(b)) + 2 By Ind. Hyp. S(b) holds, which means that log_2 (f(b)) is odd, and therefore, log_2 (f(b)) + 2 is odd as well, which implies that log_2 (f(b')) is odd. Thus S(b') is true.