This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Handout #42 CS103A February 22, 2008 Robert Plummer Introduction to Induction One of the most important tasks in mathematics is to discover and characterize regular patterns or sequences. The main mathematical tool we use to prove statements about sequences is induction . Induction is a very important tool in computer science for several reasons, one of which is the fact that a characteristic of most programs is repetition of a sequence of statements. To illustrate how induction works, imagine that you are climbing an infinitely high ladder. How do you know whether you will be able to reach an arbitrarily high rung? Suppose you make the following two assertions about your climbing abilities: 1) I can definitely reach the first rung. 2) Once I get to any rung, I can always climb to the next one up. If both statements are true, then by statement 1 you can get to the first one, and by statement 2, you can get to the second. By statement 2 again, you can get to the third, and fourth, etc. Therefore, you can climb as high as you wish. Notice that both of these assertions are necessary for you to get anywhere on the ladder. If only statement 1 is true, you have no guarantee of getting beyond the first rung. If only statement 2 is true, you may never be able to get started. Assume that the rungs of the ladder are numbered with the positive integers (1,2,3...). Now think of a specific property that a number might have. Instead of "reaching an arbitrarily high rung", we can talk about an arbitrary positive integer having that property. We will use the shorthand P(n) to denote the positive integer n having property P. How can we use the ladder-climbing technique to prove that P(n) is true for all positive n? The two assertions we need to prove are: 1) P(1) is true 2) for any positive k, if P(k) is true, then P(k+1) is true Assertion 1 means we must show the property is true for 1; assertion 2 means that if any number has property P then so does the next number. If we can prove both of these statements, then P(n) holds for all positive integers, just as you could climb to an arbitrary rung of the ladder. 2 The foundation for arguments of this type is the Principle of Mathematical Induction , which can be used as a proof technique on statements that have a particular form. We can state it this way: A proof by mathematical induction that a proposition P(n) is true for every positive integer n consists of two steps: BASE CASE: Show that the proposition P(1) is true. INDUCTIVE STEP: Assume that P(k) is true for an arbitrarily chosen positive integer k, and show that under that assumption, P(k+1) must be true. From these two steps we conclude (by the principle of mathematical induction) that for all positive integers n, P(n) is true....
View Full Document
- Winter '07
- Computer Science