Professional Documents
Culture Documents
Classes - Soe.ucsc - Edu Cmps102 Fall01 Solutions2
Classes - Soe.ucsc - Edu Cmps102 Fall01 Solutions2
Classes - Soe.ucsc - Edu Cmps102 Fall01 Solutions2
Problem 1.
n 2 i=1 i
n(n+1)(2n+1) 6
for n 1.
Solution. The proof will be by induction on n. The base case is n = 1. The 1 2 left-hand side of the equation becomes i=1 i = 1 and the right-hand side is 1(1+1)(2+1) 23 = 6 = 1. Thus the base case holds. 6 Now assume that the above equation hold for n = k 1 where k N is some constant such that k 1 1. Thus in,
k k1
i2 =
i=1 i=1
i2
+ k2
i2 =
i=1
k[(k 1)(2k 1) + 6k] k(2k 2 3k + 1 + 6k) = 6 6 k(k + 1)(2k + 1) k(2k 2 + 3k + 1) = = . 6 6 Thus the equation holds for some k given that it holds k 1. By induction it follows that the equation holds for all n N. Problem 2.
n i=0
xi =
xn+1 1 x1
for x = 1 and n 0.
xi = x0 = 1 =
i=0
x1 1 . x1
Now, assume that the equation is true for some k N and n = k 1 0. Consider,
k k1
xi =
i=0 i=0
xi
+ xk =
xk 1 + xk x1
Where the second equality comes from applying the induction hypothesis. Continuing,
k
xi =
i=0
Which is the desired result for n = k. By induction, the equation is true for all n N.
1
ASSIGNMENT 2
SOLUTIONS 2
Problem 3. Consider the following statement: the sum of cubes of the rst n positive integers is equal to the square of the sum of these integers. Restate this as a formal mathematical theorem using -notation. Prove your theorem. Solution. Theorem 1. For n N and n 1,
n n 2
i3 =
i=1 i=1
i =1=
i=1 i=1
Now assume that the theorem holds for n = k 1 for some k N, k 1 1. Thus we get that,
k k1 k1 2
i =
i=1 i=1
+k =
i=1
+ k3
Where the last equation comes from applying the induction hypothesis. Now we k1 use the fact that i=1 i = k(k 1)/2 to show that,
k
i3 =
i=1
k(k 1) 2
+ k3 =
k 2 (k 2 2k + 1) 4k 3 + 4 4
2
k 2 (k 2 + 2k + 1) k 2 (k + 1)2 k(k + 1) = = 4 4 2
Problem 4. n5 n is divisible by 5 for every positive integer n. Solution. The proof will follow by induction on the n. We prove the base case, n = 1, follows because n5 n = 15 1 = 0 is divisible by 5. Now we assume that k 5 k is divisible by 5 for some positive integer k. Consider, (k + 1)5 (k + 1) = k 5 + 5k 4 + 10k 3 + 10k 2 + 5k + 1 k 1 = (k 5 k) + 5(k 4 + 2k 3 + 2k 2 + k) The rst term is divisible by 5 because of the induction hypothesis and the second term is divisible by 5 because is contains a factor of 5. Thus the sum is divisible by 5. This proves the induction hypothesis and completes the proof. Problem 5. Find (and prove) an exact closed form solution to f (n) mapping the natural numbers to the reals dened by f (n) = n if n = 0 or n = 1, 5f (n 1) + 6f (n 2) otherwise.
ASSIGNMENT 2
SOLUTIONS 3
Solution. Claim: f (n) = 1 6n 1 (1)n . 7 7 The proof is by induction on n. Base: (note that there are two base cases since the recurrence uses two previous values f (n 1) and f (n 2)). n=0 : f (0) = 6 7 denition of f . 1 n=1 : f (1) = 6 7 denition of f .
0
(1)0 7 (1)1 7
= =
1 7 6 7
1 7 1 7
= 0, and we have f (0) = 0 by the recursive = 1, and we have f (1) = 1 by the recursive
1 Inductive Step: Assume n > 1. Assume f (j) = 7 6j 1 (1)j , for all j such 7
that 0 j < n. Let IH(j) be the statement f (j) = 6 (1) , so we are assuming 7 7 IH(j) for 0 j < n. We need to show that f (n) = 6n /7 (1)n /7. Since n > 1, we can use the recursive denition of f to get that f (n) = 5f (n 1) + 6f (n 2). We can use IH(n 1) and IH(n 2) to rewrite f (n 1) and f (n 2). So from the inductive hypothesis we get: f (n) = = = = = = 5 (1)n1 6n2 (1)n2 6n1 +6 7 7 7 7 6 6n2 5 (1)n1 6 (1)n2 5 6n1 + 7 7 7 7 6n2 (1)n2 [5(6) + 6] [5(1) + 6] 7 7 n2 n2 6 (1) (36) (1) 7 7 (1)n2 6n2 2 (6 ) (1)2 7 7 1 1 6n (1)n 7 7
which is what we needed to show. Problem 6. Dene the following recurrence if n = 0 1 6 if n = 1 F (n) = 6F (n 1) + 9F (n 2) for all n 2
Solution. Proof by induction on n. Note that there will need to be two base cases for this induction proof. One (n = 0) is not sucient because then our inductive step would have to cover 1, . . . , n. This presents a problem because our recurrence is not dened for n = 1. In general when there are two recursive references to a function like F , namely F (n 1 and F (n 2), two base cases are required for a proof by induction. Base Step: n = 0: By denition F (0) = 1 (0)30 = 0. n = 1: again we have F (1) = 6 (1)31 = 3.
ASSIGNMENT 2
SOLUTIONS 4
Inductive Step: Let n 2. Assume F (j) j3j for all 2 j < n. This is the inductive hypothesis. Our goal is to show that this assumption implies that F (n) n3n . Consider the recursive denition of F : F (n) = 6F (n 1) + 9F (n 2) 6(n 1)3n1 + 9(n 2)3n2 by the inductive hypothesis. Note the inequality, and that here we have applied the inductive hypothesis twice once for F (n 1) and once for F (n 2). Continuing on... F (n) 3n2 (6(n 1)3 + 9(n 2)) = 3n2 (18n 18 + 9n 18) = 3n2 (27n 36) = 3n2 (3 32 n 4 32 ) = n3n (3n 4) Recall that we are deaing with n 2. In this case we have that 3n 4 n. Of course, this can also be proved by induction. n3n as desired. By the principle of mathematical induction we are done.