Advanced Analysis of Algorithms By Dr. Muhammad Safyan
Lecture No 4. Mathematical Induction Lecture No 4 Mathematical Induction (Proving, Validation and Verification etc.)
Today Covered In this lecture, we will cover the following What is Mathematical Induction? Why is Mathematical Induction Valid ? Proving problems using Induction Proving hard problems using Induction Strong Mathematical Induction Proving Problems using Strong Induction Conclusion
What is Mathematical Induction? Mathematical induction is a powerful, yet straight-forward method of proving statements whose domain is a subset of the set of integers. Usually, a statement that is proven by induction is based on the set of natural numbers. This statement can often be thought of as a function of a number n, where n = 1, 2, 3,. . . Proof by induction involves three main steps Proving the base of induction Forming the induction hypothesis Proving that the induction hypothesis holds true for all numbers in the domain.
What is Mathematical Induction? Let P(n) be the predicate defined for any positive integers n, and let n0 be a fixed integer. Suppose the following two statements are true P(n0) is true. For any positive integers k, k n0, if P(k) is true then P(k+1)is true. If both of the above statements are true then the statement: n N, such that n n0, P(n) is also true
Steps in Proving by Induction Claim: P(n) is true for all n Z+, for n n0 Basis Show formula is true when n = n0 Inductive hypothesis Assume formula is true for an arbitrary n = k where, k Z+ and k n0 To Prove Claim Show that formula is then true for k+1 Note: In fact we have to prove P(n0) and P(k) P(k+1)
Mathematical Way of Expressing Induction Basis step. Show that proposition P(1) is true. Inductive step. Show that for every positive integer n, the implication P(n) P(n+1) is true. P(n) for a fixed n is called inductive hypothesis. [P(1) n, (P(n) P(n+1))] n, P(n)
Well Ordering and Modus Ponens Principal Definition (Well-Ordering Principle) The Well-ordering Principle is the following statement “every nonempty set of positive integers contains a least element” In a mathematical way we can define this Principle as: there is a in S such that a b for all b in S i.e. a S, such that a b, b S And we say that set S is well-ordered with respect to . Modus Ponens Principal p q p Hence, q
Why Mathematical Induction is Valid? Let us suppose that P(1) is true, and that n (P(n) P(n+1)) is also true. Claim: n P(n) is true Assume proposition n, P(n) is false, i. e, there are some positive integers for which P(n) is false. Let S be the set of those n’s. By well-ordering property, S has a least element, suppose, k. As 1S, so 1< k, so k-1 is a positive Since k-1 < k, hence k-1 S. So P(k-1) is true. By modus ponens, P((k-1) + 1) = P(k) is true. Contradiction, hence n, P(n)
Another Reason for Validity? Basis Step First suppose that we have a proof of P(0). Inductive Hypothesis k > 0, P(k) P(k + 1) How it is proved n > 0? P(0) P(1) P(1) P(2) P(2) P(3) . . . Iterating gives a proof of n, P(n). This is another way of proving validity of mathematical Induction.
Proof by Induction Example 1 Prove that n2 n + 100 n 11 Solution Let P(n) n2 n + 100 n 11 P(11) 112 11 + 100 121 111, true Suppose predicate is true for n = k, i.e. P(k) k2 k + 100, true k 11 Now it can be proved that P(k+1) (k+1)2 (k+1) + 100, k2 + 2k +1 k +1 + 100 k2 + k 100 (by 1 and 2) Hence P(k) P(K+1)
Validity of Proof Example 1 Prove that n2 n + 100 n 11 Solution Initially, base case Solution set = {11} By, P(k) P(K+1) P(11) P(12), taking k = 11 Solution set = {11, 12} Similarly, P(12) P(13), taking k = 12 Solution set = {11, 12, 13} And, P(13) P(14), taking k = 13 Solution set = {11, 12, 13, 14} And so on
Another Easy Example Reasoning of Proof Example 2 Use Mathematical Induction to prove that sum of the first n odd positive integers is n2. Proof Let P(n) denote the proposition that Basis step : P(1) is true , since 1 = 12 Inductive step : Let P(k) is true for a positive integer k, i.e., 1+3+5+…+(2k-1) = k2 Note that: 1+3+5+…+(2k-1)+(2k+1) = k2+2k+1= (k+1)2 ∴ P(k+1) true, by induction, P(n) is true for all n Z+ Another Proof
Proving Inequalities Reasoning of Proof Example 3 Use mathematical Induction to prove that the inequality n < 2n for all n Z+ Proof Let P(n) be the proposition that n < 2n Basis step : P(1) is true since 1 < 21 . Inductive step : Assume that P(n) is true for a positive integer n = k, i.e., k < 2k. Now consider for P(k+1) : Since, k + 1 < 2k + 1 2k + 2k = 2.2k = 2k + 1 ∴ P(k+1) is true. It proves that P(n) is true for all n Z+.
Example 4: Harmonic Numbers The harmonic numbers Hk, k = 1, 2, 3, …, are defined by Use mathematical induction to show that whenever n is a nonnegative integer. Proof Let P(n) be the proposition that Basis step : P(0) is true, since, Inductive step Assume that P(k) is true for some k,
Example 4: Harmonic Numbers Now consider ∴P(k+1) is true. Hence the statement is true for all n Z+.
Strong Mathematical Induction Induction Examples (4/4) 3.3 Mathematical Induction Strong Mathematical Induction
Strong Mathematical Induction Induction Examples (4/4) 3.3 Mathematical Induction Let P(n) be a predicate defined for integers n, and a and b are fixed integers with a ≤ b. Suppose the following statements are true: 1. P(a), P(a + 1), … , P(b) are all true (basis step) 2. For any integer k > b, if P(i) is true for all integers i with a ≤ i < k, then P(k) is true. (inductive step) Then P(n) is true for all integers n ≥ a.
Example 1: Divisibility by a Prime Induction Examples (4/4) 3.3 Mathematical Induction Theorem: For any integer n ≥ 2, n is divisible by a prime. Proof (by strong mathematical induction): Basis step: The statement is true for n = 2. This is because 2 | 2 and 2 is a prime number. Inductive step: Assume the statement is true for all i with 2 ≤ i <k (inductive hypothesis) ; To show that it is true for k .
Example 1: Divisibility by a Prime Induction Examples (4/4) 3.3 Mathematical Induction We know that i Z, with 2 ≤ i < k, P(i), i.e. i is divisible by a prime number. (1) Now we show P(k), i.e., k is divisible by a prime. Take two cases: Case 1: k is prime. Then k is divisible by itself. And nothing to prove Case 2: k is composite. Then k = a·b, where 2 ≤ a <k and 2 ≤ b <k Based on (1), p|a for some prime p. (2) Based on Case 2, a|k (3) By transitivity, p|a and a|k p|k Thus, P(n) is true by strong induction.
Any Amount Limited Coins: More Steps in Basis Statement Show that any amount in cents ≥ 8 cents can be obtained using 3 cents and 5 cents coins only. Proof We have to prove that, amount = 3.m + 5.n, m 0, n 0 Basis Step This time check for a five particular values: 8 = 1.3 + 1.5 9 = 3.3 10 = 2.5 11 = 2.3 + 1.5 12 = 4.3 Now we generalize it?
Any Amount Limited Coins : More Steps in Basis Let P(n) be the statement that: “n cents can be obtained using 3 and 5 cents”. Inductive Hypothesis We want to show that P(k) is true P(k+1), k ≥ 8 There are two cases now Case 1 P(k) is true and k cents contain at least one 5 coin. Case 2 P(k) true, k cents do not contain any coin of 5 cent.
Any Amount Limited Coins : More Steps in Basis Case 1 P(k) is true and k cents contain at least one 5 coin. Since P(k) is true k 8 Hence k can be expressed as k = 3.m + 5.n m 0 and n 1 k + 1= 3.m + 5.n + 1 k + 1= 3.m + 5.(n - 1) + 1 + 5 k + 1= 3.(m + 2) + 5.(n - 1), m 2 and n 0 Hence the statement is true for n = k + 1
Any Amount Limited Coins : More Steps in Basis Case 2 P(k) is true and k cents do not contain any coin of 5 cent. for k 8 Hence k can be expressed as k = 3.m m 3 k + 1= 3.(m – 3) + 9 + 1 k + 1= 3.(m – 3) + 2.5 k + 1= 3.m’ + 5.n m’ 0 and n = 2 Hence the statement is true for n = k + 1 Hence P(k + 1) is true
Postage Ticket: Again More Steps in Basis Prove that postage ticket of amount 12 cents can be formed using only 4 cent and 5 cent stamps. Proof Let P(n) n cents can be formed using only 4 and 5 cent P(n) n = 4s + 5t s 0, and t 0 n 12 Basis : P(12) is true, since 12 = 4 3; P(13) is true, since 13 = 4 2 + 5 1; P(14) is true, since 14 = 4 1 + 5 2; P(15) is true, since 15 = 5 3; Inductive : Assume P(12), P(13), …, P(k) are true. Now prove for P(k + 1) Suppose k-3 = 4 s + 5 t. Then k +1 = 4 (s + 1) + 5 t. true for n = k + 1. By Strong Induction, P(n) is true if n Z and n 12. (k-3 12)
Proving a Property of a Sequence Induction Examples (4/4) 3.3 Mathematical Induction Proposition: Suppose a0, a1, a2, … is defined as follows: a0 = 1, a1 = 2, a2 = 3, ak = ak-1 + ak-2 + ak-3 for all integers k ≥ 3. Then an ≤ 2n for all integers n≥0. P(n) Proof (by strong induction) Basis step: The statement is true for n = 0: a0 = 1 ≤ 1 = 20 P(0) for n = 1: a1 = 2 ≤ 2 = 21 P(1) for n = 2: a2 = 3 ≤ 4 = 22 P(2)
Proving a Property of a Sequence Induction Examples (4/4) 3.3 Mathematical Induction Inductive step: For any k > 2, assume P(i) is true for all i with 0 ≤ i < k, i.e., ai ≤ 2i for all 0 ≤ i < k (1) Show that P(k) is true: ak ≤ 2k (2) Now consider ak = ak-1 + ak-2 + ak-3 ≤ 2k-1 + 2k-2 + 2k-3 based on (1) ≤ 20 + 21 + … + 2k-3 + 2k-2 + 2k-1 = 2k - 1 ≤ 2k Thus, P(n) is true by strong mathematical induction. Hence it proves the result