Chapter 7. Induction and Recursion
Total Page:16
File Type:pdf, Size:1020Kb
Chapter 7. Induction and Recursion Part 1. Mathematical Induction The principle of mathematical induction is this: to establish an infinite sequence of propositions P1,P2,P3,...,Pn,... (or, simply put, Pn (n 1)), it is enough to verify the following two things ≥ (1) P1, and (2) Pk Pk ; (that is, assuming Pk vaild, we can rpove the validity of Pk ). ⇒ + 1 + 1 These two things will give a “domino effect” for the validity of all Pn (n 1). Indeed, ≥ step (1) tells us that P1 is true. Applying (2) to the case n = 1, we know that P2 is true. Knowing that P2 is true and applying (2) to the case n = 2 we know that P3 is true. Continue in this manner, we see that P4 is true, P5 is true, etc. This argument can go on and on. Now you should be convinced that Pn is true, no matter how big is n. We give some examples to show how this induction principle works. Example 1. Use mathematical induction to show 1 + 3 + 5 + + (2n 1) = n2. ··· − (Remember: in mathematics, “show” means “prove”.) Answer: For n = 1, the identity becomes 1 = 12, which is obviously true. Now assume the validity of the identity for n = k: 1 + 3 + 5 + + (2k 1) = k2. ··· − For n = k + 1, the left hand side of the identity is 1 + 3 + 5 + + (2k 1) + (2(k + 1) 1) = k2 + (2k + 1) = (k + 1)2 ··· − − which is the right hand side for n = k + 1. The proof is complete. 1 Example 2. Use mathematical induction to show the following formula for a geometric series: 1 xn+ 1 1 + x + x2 + + xn = − . (x = 0) (7.1) ··· 1 x − 1−x Answer: For n = 1, the formula becomes 1 = 1−x , which holds trivially. Now we assume the validity of the identity for n = k: 1 + x + x2 + + xk = (1 xk+ 1)/(1 x). ··· − − For n = k + 1, the left hand side of the formula is 1 xk+ 1 1 + x + x2 + + xk + xk+ 1 = − + xk+ 1 ··· 1 x − 1 xk+ 1 xk+ 1(1 x) 1 xk+ 1 xk+ 1 xk+ 2 1 xk+ 2 = − + − = − + − = − 1 x 1 x 1 x 1 x 1 x − − − − − which is the right hand side for n = k + 1. So the formula is valid for general n. Exercise 1. Prove the following identity by induction: n(n + 1) 1 + 2 + 3 + + n = (7.2) ··· 2 Exercise 2. Prove the following identity by induction: n(n + 1)(2n + 1) 12 + 22 + 32 + + n2 = . (7.3) ··· 6 Exercise 3. Prove the following identity by induction: 13 + 23 + 33 + + n3 = (1 + 2 + 3 + + n)2 ··· ··· 2 (According to Exercise 1, you only need to prove 13 + 23 + 33 + + n3 = n(n+ 1) .) ··· 2 Not every identity depending on n can be handled by induction, as indicated in the following exercise. Exercise 4. Try to prove the following identity by induction: an+ 1 bn+ 1 = (a b)(an + an−1b + an−2b2 + + abn−1 + bn). (7.4) − − ··· After failing to do so, try to prove this by multiplying out the right hand side. 2 Sometimes we can use induction to statements depending on a parameter n of natural numbers, other than identities, as shown in the following example: Example 3. The celebrated Cauchy-Schwarz inequality says 2 2 2 2 2 2 2 (a b + a b + + anbn) (a + a + + a )(b + b + + b ) (7.5) 1 1 2 2 ··· ≤ 1 2 ··· n 1 2 ··· n Check this for n = 1, 2. Then use induction to prove this inequality for general n. Answer. When n = 1, the inequality reads (a b )2 a2b2. This is clear: in fact, 1 1 ≤ 1 2 2 2 2 (a1b1) = a1b2. Next we verify this inequality for n = 2. Here we rewrite this inequality in different symbols because we need it in the inductive step: (A B + A B )2 (A2 + A2)(B2 + B2), ( ) 1 1 2 2 ≤ 1 2 1 2 ∗ that is, A2B2 + 2A B A B + A2B2 A2B2 + A2B2 + A2B2 + A2B2. So it is enough to 1 1 1 1 2 2 2 2 ≤ 1 1 1 2 2 1 2 2 check 2A B A B A2B2 + A2B2, 1 1 2 2 ≤ 1 2 2 1 which can be recast as A2B2 2A B A B + A2B2 0. But 1 2 − 1 1 2 2 2 1 ≥ A2B2 2A B A B + A2B2 = (A B A B )2 1 2 − 1 1 2 2 2 1 1 2 − 2 1 which is clearly 0. Thus ( ) is valid. Now we assume the validity of ≥ ∗ 2 2 2 2 2 2 2 (a b + a b + + anbn) (a + a + + a )(b + b + + b )( ) 1 1 2 2 ··· ≤ 1 2 ··· n 1 2 ··· n ∗∗ for n = k. Notice that the left hand side of ( ) increases or remains the same if all ∗∗ numbers in it are replaced by their absolute values, while the right hand side remains the same. Hence we may (and we do) assume that aj 0 and bj 0 for all j = 1, . , n. ≥ ≥ 2 2 2 2 2 By the induction hypothesis, (a b + + akbk) (a + + a )(b + + b ), or 1 1 ··· ≤ 1 ··· k 1 ··· k a b + a b + + akbk A B , 1 1 2 2 ··· ≤ 1 1 where A = a2 + a2 + + a2 , and B = b2 + b2 + + b2 . 1 1 2 ··· k 1 1 2 ··· k Now let A = ak and B = bk and use ( ) to obtain 2 + 1 2 + 1 ∗ 2 2 (a b + + akbk + ak bk ) (A B + ak bk ) 1 1 ··· + 1 + 1 ≤ 1 1 + 1 + 1 (A B + A B )2 (A2 + A2)(B2 + B2) ≡ 1 1 2 2 ≤ 1 2 1 2 = (a2 + a2 + + a2 + a2 )(b2 + b2 + + b2 + b2 ), 1 2 ··· k k+ 1 1 2 ··· k k+ 1 3 and hence ( ) is also valid for n = k + 1. ∗∗ Question 5. What is wrong with the following “proof” of “n = n + 1”? “Assume that n = n + 1 holds for n = k, that is, k = k + 1. Add both sides by 1, we get k + 1 = k + 1 + 1, which shows that the identity n = n +1 also holds for n = k + 1. By the principle of induction, n = n + 1 is valid for all n.” Question 6. What is wrong with the following “proof” of the statement “every man is bald” by induction? “All we need to do is to establish the statement ‘a man with n hairs or less is bald’ for all n. When n = 0, 1 or 2, the statement is clearly valid. Now assume that the statement is true for n = k, that is, assume that “a man with k hairs or less is bald” is valid. Then the statement n = k + 1 is also valid because an additional hair cannot change the fact of being bald. So by the principle of induction, the statement ‘a man with n hairs is bald’ is valid for all n. This proves all men are bald.” An important role played by induction is to give proper definitions for many mathe- matical expressions involving natural numbers. The usual pattern (or its variant) of this definition by induction or by recursion is such: to define a sequence f(n) n≥ , we { } 1 take the following two steps: (I) Specify what f(1) is, (II) Specify how f(n + 1) can be decided from a subset of f(1), f(2), . , f(n). Example 4. You know the meanings of the expressions an, and n!. Strictly speaking, they should be defined by induction. We write down the two steps (I), (II) described above for defining each of them: a1 = a; an+ 1 = ana. (With f(n) = an, f(1) = a and f(n + 1) = f(n)f(1).) 1! = 1; (n+1)! = n!(n+1). (With f(n) = n!, f(1) = 1 and f(n+1) = f(n)(n+1).) Certainly, na is also defined by induction: 1a = a and (n + 1)a = na + a. 4 Example 5. This is an example of great importance about an expression involving the summation symbol that can be defined recursively, given as follows n ak. k = 1 We read the expression as “the sum of all terms ak, where k runs from 1 to n. (Earlier we write such an expression simply as a + a + + an.) Many identities and exercises 1 2 ··· above can be recast nicely in the format using the summation symbol, for example, n n n 2 (2k 1) = n2, k3 = k , k= 1 − k= 1 k= 1 n etc.; (see Example 1 and Exercise 3 above). The recursive definition of k= 1 ak is 1 n+ 1 n ak = a1; ak = ak + an+ 1 k= 1 k= 1 k= 1 n (with f(n) = k= 1 ak, f(1) = a1 and f(n + 1) = f(n) + an+ 1.) Example 6. The famous Fibonacci numbers Fn (n = 0, 1, 2, 3,... ) are defined by induction (or recursion): Fn = Fn− + Fn− , n 2, (7.6) 1 2 ≥ which says, starting from the third term, every term in the sequence of Fibonacci numbers is the sum of the previous two terms. In order to determine this sequence, we have to specify the first two terms. Here they are: F0 = 1 and F1 = 1. It is easy to produce a few terms at the beginning of the sequence 1, 1, 2, 3, 5, 8, 13, 21, 34,... (This sequence was originally described by the inventor as how rabbits multiply: Fn is the number of pairs of rabbits on the nth day.