100 likes | 202 Views
Quiz 7. The way I expected it. How to do it!. 1. Let P(n) be the statement that 1 2 + 2 2 + ... + n 2 = n(n + 1)(2n + 1)/6 for the positive integer n . Be sure to use the formal proof that includes the Basis Step. State what you are trying to prove!.
E N D
Quiz 7 The way I expected it.
How to do it! 1. Let P(n) be the statement that 12 + 22 + ... + n2= n(n + 1)(2n + 1)/6 for the positive integer n. Be sure to use the formal proof that includes the Basis Step
State what you are trying to prove! Prove 12 + 22 + ... + n2= n(n + 1)(2n + 1)/6 for the positive integer n. Positive integer n means 1, 2, 3, …
Basis Step Let P(n) be the statement that 12 + 22 + ... + n2= n(n + 1)(2n + 1)/6 for the positive integer n. (a) Basis Step: plugging in n = 1 we have that P(1) is the statement: (1)2= (1)((1) + 1)(2(1) + 1)/6 Expanding both sides we have: 1 = 1 * 2 * 3/6 = 1 Both sides of P(1) shown in part (a) equal 1. Here we are just plugging in the smallest positive integer and showing that both sides are equivalent.
Inductive Hypotheses (b) Inductive Hypotheses: The inductive hypothesis is the statement that 12 + 22 + ... + k2= k(k + 1)(2k + 1)/6 Here we substitute k for n and restate what we are trying to prove.
Inductive step (c) For the inductive step, we want to show for each k ≥ 1 that P(k) implies P(k + 1). In other words, we want to show that by assuming the inductive hypothesis we can prove (12 + 22 + ... + k2) + (k + 1)2 = (k + 1) ((k + 1) + 1)(2(k + 1) + 1)/6 We take the last k term on the left side , (k)2, add another similar term with the k value replaced by k + 1, and replace all k terms on the right-hand side by k + 1 terms.
Substitution Proof (d) Replacing the quantity in brackets on the left-hand side of part(c) by what it equals by virtue of the inductive hypothesis k(k + 1)(2k + 1)/6+ (k + 1)2= (k + 1) ((k + 1) + 1)(2(k + 1) + 1)/6, we have k(k + 1)(2k + 1)/6+ (k + 1)2= (k + 1) ((k + 1) + 1)(2(k + 1) + 1)/6 k(k + 1)(2k + 1)/6+6 (k + 1)2/6 = (k + 1) ((k + 1) + 1)(2(k + 1) + 1)/6 (k(2k + 1)+ 6 (k + 1))/6 = (k + 2)(2k + 3)/6 {divide both sides by (k + 1)} (k(2k + 1)+ 6 (k + 1))= (k + 2)(2k + 3){multiply both sides by 6} 2k2 + k+ 6k + 6= (k + 2)(2k + 3){expand both sides} 2k2 + 7k + 6= 2k2 + 7k + 6{divide both sides by 2k2 + 7k + 6} 1 = 1{both sides equal} we have shown that both sides are equal as we desired.
N Factorial 2. Convert the following recursive function into a recursive algorithm (using the pseudo format specified in appendix A3): f(0) = 1 f(n + 1) = (n + 1) * f(n) procedure factorial(n:nonnegative integer) if n = 0 then return 1 else return n ∙ factorial(n − 1) {output is n!}
A Recursive Algorithm for Computing nk=0 ak 3. Bonus: a. Give a recursive algorithm (in the pseudo format specified in appendix A3) for computing: nk=0 ak = a0 + a1 + a2 + … + an procedure series (a: list of nonzero real numbers, n:nonnegative integer) if n = 0 then return a0 else return an+ series(a, n − 1) {output is a0 + a1 + a2 + … + an}
Bonus b. Using 3. above, show the value of ak generated at each step given a0= 1 and n= 4. (missing information a1 = 2, a2 = 3, a3 = 4, a4 = 5) Green is the values that missing info would have provided! Red is what you could have provided without missing info!