Download presentation
Presentation is loading. Please wait.
1
Advanced Algorithms Analysis and Design
By Dr. Nazir Ahmad Zafar Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
2
Lecture No 4. Mathematical Induction
Lecture No Mathematical Induction (Proving, Validation and Verification etc.) Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
3
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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
4
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. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
5
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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
6
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) Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
7
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) Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
8
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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
9
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) Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
10
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. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
11
Proof by Induction Example 1 Prove that n2 n + 100 n 11 Solution
Let P(n) n2 n n 11 P(11) 112 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 k2 + k 100 (by 1 and 2) Hence P(k) P(K+1) Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
12
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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
13
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., …+(2k-1) = k2 Note that: …+(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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
14
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+. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
15
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, Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
16
Example 4: Harmonic Numbers
Now consider ∴P(k+1) is true. Hence the statement is true for all n Z+. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
17
Strong Mathematical Induction
Induction Examples (4/4) 3.3 Mathematical Induction Strong Mathematical Induction Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
18
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. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
19
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 . Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
20
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. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
21
Example 2: Another Example in Number Theory
If n Z, n >1, then n can be written as product of primes. Proof : Let P(n) n can be written as the product of primes. Basis : P(2) is true, since 2 is the first prime number Inductive : Assume that the statement is true for n = k, i.e. P(2), P(3), …, P(k) can be written as product of primes. Prove that: true for n = k, i.e. P(k + 1) is product of primes. Case 1 : k + 1 is prime, then nothing to prove Case 2 : k + 1 is composite, then k + 1 = xy, where 2 x y < k+1 Inductive hypothesis, a and b are product of primes. Hence P(k+1) can be written as product of primes. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
22
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 = 9 = 3.3 10 = 2.5 11 = 12 = 4.3 Now we generalize it? Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
23
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. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
24
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) k + 1= 3.(m + 2) + 5.(n - 1), m 2 and n 0 Hence the statement is true for n = k + 1 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
25
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) 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 Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.