Chapter 2 - Proofs, Induction and Recursion Recursion Basic...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Proofs, Induction and Recursion Recursion Basic Proof Techniques Mathematical Induction Recursive Functions and Recursive Recurrence Relations Recurrence Basic Proof Techniques Basic Mathematical proofs all have their basis in Mathematical formal logic. formal There are some basic techniques for proving There things, on the basis of different logical truths. things, Why are proofs really necessary? Because Why intuition and guessing don't always work. intuition n! < n2 for all integers. True for n = 1, n = 2, 2, and n = 3, but is it really true? How about but n = 4? Basic Proof Techniques Basic There are more integers than there are even There integers. integers. Intuition tells us that this must be true. But, if you give me an integer, I can come back But, with a unique even integer every time! with So there are no more integers than even integers. That's why we need to prove things. Basic Proof Techniques Basic Luckily for you, you will seldom be called Luckily upon to prove anything in this course (or any other courses at FDU) other Unluckily for you, you DO need to Unluckily understand why proofs work, what they mean and how they are formulated. mean Let's look at some proof techniques: Basic Proof Techniques Basic Exhaustive proof Prove theorem by showing it is true in every Prove possible case individually. Also called Brute force. Brute not usually effective because it is, of course, not exhausting. exhausting. • • • • • Prove that the set {a, b, c, d} has 16 subsets. Prove {}, {a}, {b}, {c}, {d}, {a, b}, {a, c}, {a, d}, {b, c}, }, {b, d}, {c, d}, {a, b, c}, {a, b, d}, {a, c, d}, {b, c, d}, }, {a, b, c, d} That's 16. Imagine having to prove that a set with 10 That's elements has 1024 subsets! elements Basic Proof Techniques Basic Direct proof proof use basic mechanisms of deduction. use examples are any of the proofs we saw in the examples previous weeks' lectures. previous Can be very difficult. Basic Proof Techniques Basic Contraposition instead of proving the statement itself, which instead might be hard to do, prove the contrapositive. Instead of p h q, prove q' h p' prove Example: Prove that in the universe of integers, if n2 is odd, then n is odd. is Contrapositive: Prove that if n is even, then n2 is even. Assume that n is even. Assume is n = 2k n2 = 4k2 = 2(2k2) which, by definition, is even. 2(2 Basic Proof Techniques Basic Contradiction Show that if we assume what we want to prove Show is false, then we must arrive at a contradiction. is Show that 2 can not be represented as a Show fraction. fraction. • Suppose 2 is represented by the fraction p/q which is in lowest terms. That is, the greatest common divisor of p and q is 1 (gcd(p, q) = 1). ). • If gcd(p, q) = 1, then gcd(p2, q2) = 1 If gcd 1, gcd • But if p/q = 2 , then p2/q2 = 2 and so gcd(p2 ,q2) = 2. But gcd Basic Proof Techniques Basic Contradiction Show that if we assume what we want to prove is Show false, then we must arrive at a contradiction. false, Show that if x + x = x, then x = 0. Show then • Suppose that x + x = x for some x ≠0 Suppose • 2x = x, x ≠0 • Dividing both sides by x (allowable since x ≠0) we we get that 2 = 1. get • Contradiction! • Therefore if x + x = x, then x = 0. Therefore then Basic Proof Techniques Basic Contradiction Show that the set of real numbers is uncountable Show (i.e. – that you can not start listing all the real numbers in such a way that any real number will eventually appear in such a list. Such a proof by contradiction is called Diagonalization. Diagonalization We will prove this by contradiction and see why We it's called diagonalization. it's Basic Proof Techniques Basic Contradiction 0 .a a Some numbera12a13a14a15 …………. a1n ............................ 10 11 is missing from this list!!!! • 1 • 2 .a a a a a a a .a a a a a a 20 21 22 23 24 25 …………. Suppose we could create a list of real numbers Suppose such that 00 01 02 real number will eventually every 03 04 05 …………. 0n ............................ • appear. It would look like: appear. a 2n ............................ Basic Proof Techniques Basic Contradiction Suppose such a list can be made. It would look Suppose like: like: Now, consider the number .a00a11a22a33a44a55 …………. ann ............................ • Basic Proof Techniques Basic Contradiction Now consider the number created by changing Now each digit to another digit (for example 0 becomes a 1, 1 becomes a 2. etc. becomes .a'00a'11a'22a'33a'44a'55 …………. a'nn .................. a' where a'nn ≠ ann for all n a'nn nn for Basic Proof Techniques Basic Contradiction .a'00a'11a'22a'33a'44a'55 …………. a'nn .................. a' .................. 00 01 02 03 04 05 …………. 0n ............................ This number is not in the list!!!!! • 0 • 1 • 2 .a a a a a a a .a a a a a a 20 21 22 23 24 25 …………. .a a a a a a 10 11 12 13 14 15 …………. a a 1n ............................ 2n ............................ Contradiction. Therefore it can't be done. Basic Proof Techniques Basic Serendipity In a tennis tournament, players are eliminated In round by round and only the winner goes to the next round until there is a final round in which the winner gets the trophy. winner If there are n players, prove that there are exactly If n – 1 games played. Everyone except the champion loses exactly 1 Everyone game. game. There are n – 1 non-champions. There There are n – 1 games. There Mathematical Induction Mathematical Based on creating a one to one correspondence with Based the integers and showing that it is true for the the basis: Simplest possible case (usually n = 1) Simplest the hypothesis: assume it is true for some n ≥ 1 the hypothesis assume some statement is true. statement the induction: then show it is true for n + 1, where n is the induction then number from the basis number Since it is true for the basis, it is true for the next Since highest number, and the next, and the next. highest Therefore it is true for all n Therefore all note the difference!!!! Mathematical Induction Mathematical Since it is true for the basis it is true for the next higher number, and then the next higher, and so on. That is, if the first domino is knocked over, all of them will fall. Mathematical Induction Mathematical The sum of the first n integers equals The n(n + 1) ∑k = 2 k =1 1 1(1 + 1) 1(2) Basis: When n = 1, ∑k = 2 = 2 =1 k =1 Hypothesis: n n(n +1) ∑k = 2 , for some n ≥1 k =1 Induction: Show that Show n +1 ( n + 1)( n + 2) , for the n from the hypothesis ∑k = 2 k =1 n Mathematical Induction Mathematical Show that n +1 ( n + 1)( n + 2) , for the n from the hypothesis ∑k = 2 k =1 ∑k k =1 n +1 n(n + 1) = + (n + 1) 2 n(n + 1) + 2(n + 1) (n + 2)(n + 1) (n + 1)(n + 2) = = = 2 2 2 Therefore, since the result is in the proper form Therefore, for n + 1, by Mathematical Induction, it is true by for all n ≥ 1. Mathematical Induction Mathematical Understand Mathematical Induction? Believe that it is a valid way of proving Believe things? things? Let's double-check that! Mathematical Induction Mathematical Now I will prove that all marbles in the world Now are the same color. are Proof by induction: (on bags containing n marbles Proof collected at random) collected • Basis: For all bags containing 1 marble, clearly all the For marbles in any of these bags is of the same color, trivially. trivially. • Hypothesis: Assume that for some n ≥ 1, all bags Assume some all containing n marbles contain only marbles of the same color. color. Mathematical Induction Mathematical • Hypothesis: Assume that for some n, all bags Assume some all containing n marbles contain only marbles of the same color. color. • Induction: I will now show that for any bag containing will n + 1 marbles, all the marbles in the bag are of the same color. same All Marbles Are The Same Color All remove one of those same-colored marbles and put the first marble back in n marbles, all the same color bring back that same-colored marble Consider any bag containing n +1 marbles the a marble remove bag has nfrom mhe bag t arbles by the hypothesis, all the marbles in the bag are the same color n+1 marbles all the same color QED Mathematical Induction Mathematical What happened? How is it even possible that all marbles are How the same color? the What was wrong with that proof? Mathematical Induction Mathematical What we saw is sometimes called strong What induction. induction. Another form of induction is called weak Another induction: induction: Basis: as before Hypothesis: Assume premise is true for all k, Assume with 1 ≤ k ≤ n, where n is some number ≥ 1. where Induction: as before Weak Induction Weak 1 2 n-1 1 2 3 n-1 n For any fence with n posts, there are n-1 sections Basis: 1 post, 0 sections Hypothesis: For all 1 ≤ k ≤ n, for some n ≥ 1, k posts means k-1 sections. Induction: For n + 1 posts, n sections Weak Induction Weak 1 2 3 4 5 6 7 As you can see, removing one section of a fence with n + 1 posts yields two fences with k1 and k2 posts respectively, with k1 + k2 = n +1 By the hypothesis, the left fence with k1 posts has k1 – 1 sections. The right fence with k2 posts has k2 – 1 sections, with k1 + k2 = n + 1. So we have a total of k1 – 1 + k2 – 1 = k1 + k2 – 2 = n + 1 – 2 = n – 1 sections. Add that section back in and you have one fence with n + 1 posts and n sections. Recursion Recursion Recursive definitions. Recursive sequences. Recursively defined sets. Recursion Recursion Recursive definitions. A recursive definition has two parts: • A basis: simple (trivial case) • A recursive step: new cases of the definition are defined new in terms of previously defined cases. in Example: Recursive sequence of Fibonacci numbers • Basis: fibonacci(1) = 1, fibonacci(2) = 1 • Recursion: fibonacci(n) = fibonacci(n-1) + fibonacci(n-2) fibonacci( Recursion Recursion S(1) = 2 S(n) = 2S(n-1) 2, 4, 8, 16, 32, … Recursion Recursion Recursively defined sets A recursively defined set is a set of objects where recursively the definition is given recursively. the • Example: well-formed formulas Any simple statement P is a well-formed formula. If P and Q are well-formed formulae, then so are (P'), (Pr Q), h Q), (P→Q), (P↔Q), and (Pr Q). h Q). (P Nothing else is a well-formed formula strings Recursion Recursion Recursively defined sets A recursively defined set is a set of objects where recursively the definition is given recursively. the • Example: strings Basis: λ, which represents a string with no characters is a Basis: which string. a, where a is any symbol of the alphabet is a string. where Recursion: If x and y are strings then xy, the concatenation of Recursion: xy the strings x and y is a string/ Disclaimer: These are the only strings! ...
View Full Document

Ask a homework question - tutors are online