Description: An introduction to proof techniques, covering proof by contradiction and induction, with an emphasis on the inductive techniques used in proof by induction.
Speaker: Tom Leighton
The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To make a donation, or view additional materials from hundreds of MIT courses, visit MIT OpenCourseWare at ocw.mit.edu.
PROFESSOR: Last week we talked about the key components of a proof, propositions, axioms, and logical deductions, and as you probably talked about during recitation, we're not going to worry too much about what axioms or logical deductions that you use. Anything that is reasonable, is fine by us. We're not going to ask you to know what modus ponens is, or to label some law when you make a logical deduction. Just, you know, be reasonable. Any facts you knew coming into this course about mathematics, probably close enough to use as an axiom. Want to make sure your axioms are consistent, but that's OK.
Now the exception to this would be, is say we're on an exam, and we ask you to prove some proposition, p. Well you can't say, I already knew p, it's an axiom, check. That's not so good. We're asking you to prove it from some more elementary facts. OK it's also don't want me making wild leaps of faith, or saying it's obvious that, unless it really is obvious. That kind of stuff can get you in trouble. Much better to sort of explain the reasoning in the proof.
Now the proofs that we covered last week in recitation, the problems set, were all examples of what are called direct proofs. You start with some axioms, you have some theorems you knew before or you proved along the way, and you make logical deductions until you get to where you want to go, the theorem. We're going to start today with an indirect proof. For example, a proof by contradiction. And this is a little bit different. In a proof by contradiction, you assume the opposite of what you're trying to prove. Then you just take steps for logical deductions forward until you arrive at a contradiction, something where you prove false equals true.
Now if you can ever get to the point we approve something is false and true, that means what you assumed at the start had to be wrong. Namely, what you're trying to prove has to be true. So let's write that down, because it can be a little confusing the first time.
So to prove a proposition p is true, you will assume that it's false. In other words, that not p is true. And then you use that hypothesis, namely the p is false, to derive a falsehood. In other words, you prove a falsehood is true. And this is called deriving a contradiction.
And so it must be that, in fact, p is not false, namely that it's true. Now this works because if you can prove, if not p implies false is true, well from last time, the only way this is a true statement is if this is false, namely p is true. All right? So we can conclude that p is true, if we can show that not P implies a falsehood. Any questions about that? It's sort of a lot of sort of notation, and until you've seen, it can be confusing.
So maybe we should do an example. Let's prove that square root of 2 is irrational. Is irrational. OK, everybody knows what an irrational number is? That's something that can't be expressed as the ratio of integers. OK, and probably most people already know that-- how many people have not seen a proof that square root of 2 is a rational before? So most of you have seen a proof of that, good. You know, if you try to do a direct proof for this, it's pretty hard. How do you show there's no way to represent the square root of 2 is as integers a over b?
But it's very easy, if we do a proof by contradiction. Now when you're doing a proof by contradiction, always start off by saying, by contradiction. Write that down. And then what you do next is you say, I'm going to assume, for the purpose of contradiction, that p is false and when not p is true. In this case, that would be square root of 2 is rational.
So in this case, here's what we're trying to prove. That's p. I'm going to assume not p, namely that square root of 2 is irrational number. Then I'm going to get a contradiction or falsehood, and then I'm going to know that p was true after all. All right, so let's see where this leads us. Well, if square root of 2 is rational then we can express it as a over b, where a over b is a fraction in lowest terms. That means a and b have no common divisors. And then I can square both sides, and I get two is a squared over b squared. Then I multiply by b squared, and I get 2b squared equals a squared.
And what does that imply about a? What can you tell me about a if it equals-- if a squared is 2b squared? Anything special about a? Could a be anything? A squared is even, all right? Because 2b squared is an even number, so a squared is even, and what does that mean about a? A is even. B squared is even, then a is even. So a is even. So we could write that as two divides a. That's the divide symbol. You'll see a lot of that next week.
All right if a is even, what do I know about a squared? I know more than just, it's even. What is it? It's multiple of 4, yeah. So that means that four divides a squared. A squared is 2b squared, so that means that four divides 2b squared. Divide each side by 2 means 2 divides b squared. What does that imply about b? B is even. All right, b is even, good. Well, I've got a is even and b is even. I got a contradiction here, somewhere? Yeah a over b was not a fraction in lowest terms, because both and b are even. All right, so that implies a over b is not in lowest terms. And that is a contradiction.
Now you'll see that written lots of ways. One is, you can say a contradiction, sometimes you'll see just this sharp symbol written, and that means you've got to a contradiction. Because here, we had it being in lowest terms, and here we have it not in lowest terms. You can't have both at the same time, so you got a contradiction. And that means we've now proved that this assumption was wrong. Square root of 2 is not rational, so it must be irrational. and then we put a little box here at the end, or sometimes you'll see a check, sometimes you'll see QED, that says the proof's done now. It's over. Any questions about that proof?
We're going to do a lot of proofs by contradiction. Actually, there's an interesting story behind this proof. As far as we know, it was first discovered by the Pythagoreans, way back when in ancient Greece. And the Pythagoreans were a religious society started by Pythagoras, of Pythagoras theorem frame. Now it sounds weird today, but back then, in ancient Greece, math was a religion, all right? Every once in while you'll see somebody around MIT, and you'll think he must think math is a religion, but back then it really was, and it was ruled by God, because this is ancient Greece.
And there were two key gods in this religion, Apeiron and Peros. Now Apeiron was the bad god, and he was the god of infinity, because infinity was considered all that was bad. And I don't think we'll do a lot with infinity this term, but if we do you'll appreciate why that's the case. And Peros was a good god. He was the god of the finite world, and represented everything that was good to the ancient Greeks.
Now one of their main axioms, or beliefs, was that there were no irrational numbers. They just didn't exist. Now the reason is, they didn't like irrational numbers. They were bad. Because, well they're infinite. You can't write them as a decimal without repeating forever, and you know, just an infinite sort of decimal representation. They liked rational numbers, you know, like one seventh? That's a good number, because you can write it as 0.142857 repeating. So rational numbers are finite, in that you can always find a repeating pattern of finite length. Irrational numbers are not. They're infinite in that sense of the ancient Greeks.
So they said there were no irrational numbers. That was an early axiom. Now they also had an axiom that said that every length of a line was finite, therefore rational. All right, you know the ancient Greeks were good with a compass, and drawing lines with straight edges and stuff. So they said any line that you can construct has a finite length to it, so therefore it has a rational length.
That was axiom number two. Now they were good geometers, so they knew, of course, they developed the Pythagorean theorem. But if you took a triangle, and you have side lengths one, the length of the hypotenuse was square root 2. Therefore they had a theorem that said square root 2 was rational. Because you've got the 2 axioms there, right? Now eventually, they discovered a proof like that, that it wasn't rational. It was irrational.
This caused quite a stir. First it meant that their axioms were inconsistent. Every theorem they proved was now suspect, once you have inconsistent axioms. Even worse, the devil is in their midst. Square root 2 is infinite is the bad god, and this is the most basic length they had, besides one. So that's a very bad thing. Sort of like, you know, today we were to wake up and discover that there were only nine commandments, and the 10th was planted there by the devil. And you're not sure which one, maybe. That would be a big mess, sacrilege.
Well, so what were they to do? This is a disaster of major proportions. So they covered it up, and they denied the result. So they didn't want to publish that proof. So they kept on saying square root 2 was rational. But then, according to legend there was a Deep Throat. Somebody who let out the word and the proof the square root 2 is irrational, because that would be very destabilizing for the society, and so they killed them.
This is the legend. Now, hard to imagine getting killed over the irrationality of 2. All right, we're going to do a lot more of these kind of proofs in homework and throughout the term. The next proof I want to show you is one of my favorite proof techniques. One of my favorite proofs. And that is a false proof. And we're going to see a lot of these during the term, too. And if we could bring the screens down. Somebody back there to-- yeah. Great. Bring the screens down, I'm going to-- and then turn this on for me. So I'm going to prove to you that 90 is bigger than 92. All right? And that hopefully, is not really true. But, you know, watch this proof and see if there's any problems with it.
All right, the proof, by PowerPoint. Right away you should be suspicious. I'm going to take two triangles with total area 90 and put them together, and then divide them up into four triangles with area greater than 92. And by the conservation of area axiom, which you want to be maybe thinking about, this will imply an area of 90 is larger than an area of 92. And therefore that 90 is bigger than 92.
All right, those are my triangles. They are right triangles, 9 by 10. If I put them together, I get a 9 by 10 rectangle. Of course it has area 90, 9 times 10. Now I'm going to slide these triangles across their diagonal so that I get, instead of having 10 on the side, I'm going to slide it so I get a 2 and an 8. OK I had 10 there before, now it's 2 and 8. And then you see I've got this-- I'm going to cut off along the dotted line, and as you can see that dotted line, yeah but won't compute it exactly, but it's a little bit bigger than 2. All right? It's a little bit longer than that 2 there, you could see that. All right, so I'll call it 2 plus, bigger than 2.
Now I slice off along the dotted line, and now I'm going to put those two triangles together, and I create a rectangle. Two by two-- little more than two. Now the area of the little rectangle is bigger than 4, cause I got 2 times something bigger than 2, and you can see here I have the 8 left over, and I have 9 plus 2 plus, means it's a little bit bigger than 11 by 8. I got area bigger than 88, add them up, get area bigger than 92. So I started with 90 and I created more than 92.
All right, what's the problem here? This would be good if I could do it. I'd get some gold, you know, bars of gold and cut them up, and do the game, and I make more gold. That would be pretty good if I could do that. Because of the conservation of area axiom? Did I assume something there that was too powerful that if I manipulate the area of rectangles like this, that the area needs to be the same? Yeah? My bigger ones aren't closed. Well, let's see, I don't know. Let's go back and see I made those bigger ones. All right, I got my triangles, right? I'm just chopping along the line there, and I got 2 plus and 9. Those are rectangles. They look like rectangles. Yeah.
PROFESSOR: Well it looks bigger than 2, doesn't it? Yeah, 2 pluses. Well bigger than 2 is bigger than 2, but, yeah, maybe that should have been a 2 minus. Would that change anything? Yeah, if that had been a 2 minus, then we'd have area less than 4, area less than 88, and then 90 would be less than 92. That would be OK. But it sure as heck looks bigger than-- the 2 plus looks bigger than the 2 doesn't it? I don't know, do they got distortion out there? I guarantee you, if I measured on my screen, that 2 plus is bigger than the length of the tube. I guarantee you. We can to take a ruler on my screen, and the 2 plus will be longer on the ruler than the 2. That I guarantee you, but you're on the right track. Yeah
Good, all right, now how did you-- but it is true, if I measured on my screen, it's bigger. Yeah.
AUDIENCE: Are the triangles, like, drawn to scale? It's like, on the SAT they always say, not to scale, right?
PROFESSOR: Yeah. Yeah, they're not drawn to scale. In fact, if I go back to the beginning, it says 9 by 10. But in fact, if I measure the nine, it's bigger than the 10. All right? So this is one of the big problems of proofs by picture. Because look at it, you're not thinking which is bigger, 9 or 10 up there? 10's bigger even though it's not, it's shorter. But when you get down into the proof, well, clearly the 2 plus was bigger than the 2, because it looks that way. It is, on the paper. All right? In fact if you go on a computer, you're probably right, it's 1.8, not 2 plus.
But that's how the error crept in and how it was drawn, and then you're going along with a proof, and everything else is just fine. So the mistake is right up front. I drew it wrong. OK. And this happens, you're doing graphs-- we'll talk about graphs here in a couple weeks-- over and over again, people do this. They draw it, it looks like this, you accept that and then you're dead. Everything else, there's no hope. Everybody clear what went wrong in this picture? How we got off track? This is sort of a nasty one.
OK. Now one of the nice things about proofs is that when there is a bug, if you really write it out step by step, and there's a bug, you can go back and find it. And so this, I didn't sort of really write it out very well step by step, and it was harder to find. Now, all right, so we can pull the screens up. Thanks. OK, so for the rest of today and the rest of this week, we're going to talk about a different kind of proof technique, which is induction. Now, induction is by far the most powerful and commonly used proof technique in computer science. If there's one thing you should know by the time you're done with this class, it's how to do a proof by induction. In fact, if there's one thing you will know by the time we're done with this class, is how to do a proof by induction.
And in some sense, when we get to grading the final, how we measure ourselves as instructors, the first test is, can you do the proof by induction question, and do a good proof there? You will see it on the midterm and the final, probably in multiple instances. Now just to make sure you become intimately familiar with induction, we're going to do over a dozen proofs with induction in class, and many more in homework over the next five to six weeks. You'll probably be dreaming about induction, if we're successful here. Soon.
The good news is that induction is very easy. Once you get your mind around it, get some practice, it really is not a hard thing. In fact, induction is really just an axiom. So let me state it. Let P(n) be a predicate. If P(0) is true, and for all natural numbers n, p of n implies p of n plus 1 is true. So here I'm saying that this is true for all n. OK. Then for all n, natural numbers, P of n is true. I had another way of saying this without the for alls there, is that if P(0) is true, if P(0) implies P(1) is true, if P(1) implies P(2) is true, and so on, forever, then p of n is true for all that. So then, P(0), P(1), P(2), forever, are true.
OK. Now you can sort of see why this is a reasonable axiom, because if P(0) is true, and P(0) implies P(1), then by that modus ponens thing or one of the logical deductions, we know P(1) is true. And if P(1) is true, and P(1) implies P(2) is true, then we know by the same reasoning, P(2) is true, and so on, forever. Now the reason it becomes an axiom is that and so on forever bit is part of it. That's why we need it as an axiom. You could sort of view this as a series of dominoes. You know, I got a domino for each n, and each domino knocks over the next in terms of truth, knocking over corresponds to the truth here. And if I know P(0) is true, that means I knock over P(0), P(0) implies P(1) means P(1) one goes down. P(1) implies P(2) means P(2) goes down, and so forth.
Pretty basic. Raise your hand if you think you don't have a lot of experience with induction. All right, yeah, that's pretty typical. About a third to a half of you. So we're going to change that. Let's do a simple proof using induction. So let's prove that for all n bigger than or equal to 0, again natural numbers, that 1, plus 2, plus 3, plus n equals n times n plus 1 over 2. This is actually a useful thing to remember. We're going to use this all term, this identity.
Now the first thing, before we prove it, I want to make sure we understand this dot, dot, dot, notation. Because it is the source of a lot of errors. What it means is that you need to fill in the pattern here, which is vague. What it means in this case, you fill in four, five, six all the way up to n minus 1, and then n. That's what it means. Figure out the pattern and fill it in. Pretty risky thing. Now in this case, because that's so vague, there's other terminology we use for this. For example, we would use a big sigma, capital sigma i equals 0 to n of i. That means the sum of i, where i is the integers from 0 to n inclusive. Actually, let me put 1 here.
Another way to write this-- these are all equivalent ways to write it-- is you could put 1 less than or equal to i, less than or equal to n of i. So you could put something i over the range, from one to n, or you can write it on the bottom if you want. So these are four different ways of writing the same thing, the sum of the natural numbers from 1 to n. And we'll use them all during the term. All right, now there's some special cases that make this a little more interesting. What if n equals 1?
I've got 1 plus 2 plus dot, dot, dot, plus n. What do you suppose it equals if n equals 1? 1, because we're summing the numbers from 1 to 1. That's just 1, the number 1. There is no 2. And there aren't two copies of 1. So this notation is very ambiguous. You'll see a 2 here in the sum. If n is 1, you'll see a 1 here and a 1 here.
So you've got to be careful. I guarantee you, you'll make a mistake with this. In fact I'm going to show you another false proof later where this comes into play. What about if n is less than or equal to zero? What is it then? Any thoughts? 0.
There are no integers to sum, no 1, no 2, no n, because you never get started because-- sorry, n is less than or equal to 0-- because you're summing from 1 to 0, 0 is below. You never-- it doesn't include anything. So these are the conventions to keep in mind with the edge cases here. All right, it's easy enough to check that the theorem is true for certain values of n.
For example, if n equals 4, I've got 1 plus 2 plus 3 plus 4. That's 10. And 10 equals 4 times 5 over 2, plugging in the formula. So for any value of n you could check this formula is true. Proving is true for all n. It takes a little more effort unless you use induction. So let's do that.
So we'll prove the theorem. Now, whenever you're using a proof by induction, first thing you do is you write down by induction so we know what you're going to do. And the next thing you need to do is figure out, what's your predicate. What's your inductive hypothesis? What's p?
So usually p will be the thing you're trying to prove, namely that 1 plus 2 plus 3 up to n is n times n plus 1 over 2. And you state that. You say let p of n be the proposition, the predicate, that the sum i equals 1 to n of i equals n times n plus 1 over 2.
And once you've got that established, now we're going to go verify that p 0 is true and that p n implies p n plus 1. So we always have to write this down. The next thing to do is to check what's called the base case, p zero. So let's do that.
So we write down base case. Some people call it the basis step. And we have to check that p 0 is true. Well, what's the sum of i equals 1 to 0 of i? 0. There are no terms in this sum. And if I look over there, n times n plus 1 over 2. If n is 0, it equals 0.
So we're done with the base case. We've now proved that p0 is true. And the second part is called the inductive step. And here we have to show, for n greater than or equal to 0, we need to show that pn implies pn plus 1 is true.
Now how do we show an implication is true? How do I show this is true? What am I going to do to show that's true in general? Yeah?
PROFESSOR: Right. Because an implication is true in every case, except for true implies false.
So if pn is false, we're done. This implication is true. The only case we have to worry about is p of n is true. So we assume p of n is true. And now we confirm that that means pn plus 1 is true. So we write that down. Assume pn is true. And you might also write down, "for purposes of induction" or "purposes of it verifying the inductive hypothesis." just to let us know why you're assuming it.
In other words, you're not assuming pn is true for purposes of contradiction. You're assuming it for purposes of induction. All right, let's do that. That means, in this case, i.e. we assume 1 plus 2 plus up to n equals n times n plus 1 over 2.
And we need to show that the n plus 1 case is true, and the 1 plus 2 plus n plus 1 equals n plus 1 times n plus 2 over 2. It's sort of weird, and this does confuse people that aren't familiar yet with induction. It looks like we just assumed what we're trying to prove. We're trying to prove this is true for all n. And we just assumed it.
But we're assuming it in the context of establishing this implication is true. And then we apply the induction axiom to conclude pn is true for all n. All right, well, let's rewrite this as 1 plus 2 plus n plus n plus 1. Because I've assumed pn, I can rewrite this as an n plus 1 over 2. And now plus n plus 1 out here.
That equals, well, I got n squared plus n, here, over 2, plus 2 n plus 2. And that equals n plus one times n plus 2 over 2, which is what we're trying to show. So we've completed, now, the inductive step. We have shown that for all n, pn implies pn plus one for all n greater than or equal to 0.
Any questions about that? So, the proof is done. We've done everything we need to imply induction. We've got p0 is true. And pn implies pn plus 1 for n bigger than or equal to zero.
Now induction helped us prove the theorem. Did it help us understand why the theorem is true? Do you have any feel for why the theorem is true after seeing the proof? Not really. I don't think-- sometimes induction will give you an understanding. Sometimes it won't. Here you've got no understanding of why the theorem's true, which is sort of unfortunate.
Did induction help you figure out the answer to the sum? Namely, say you were trying to derive this answer from this sum. Did induction give you the answer? No. You had to know the answer, namely this, in order to prove it was true. Now later we'll see examples where induction actually can give you the answer, but often it does not.
Often, induction gives you no hints, no answer, just prove that it's right once you had the clever idea that, oh, maybe that's the answer. You'll see that with things like the beaver flu problem. Figuring out the inductive hypothesis or the answer, you know, the details of it is hard. But once you do it, then applying the induction, not so hard. It gives you a concrete proof.
OK, let's do another one. In fact, we're just going to spend the rest of today doing induction proofs. So for all natural numbers n, 3 divides n cubed minus n. Means than n cubed minus n is a multiple of three. For example, n is 5. 3 divides 125 minus 5, because that's 120.
Let's prove that. And we're going to use induction. What do you suppose pn's going to be? What's my predicate or my inductive hypothesis here? Any thoughts? Yeah?
PROFESSOR: Yeah, that's you. Go ahead.
PROFESSOR: Yeah. First thing you always want to try is you assume that is your induction hypothesis. So we say, let pn be 3 divides n cubed minus n. What's the next thing we do in our proof? Base case. Always easy to forget, but not a good idea. Base case is n equals 0. And sure enough, 3 divides 0 minus 0. So that's done.
What's the next step we do? What is it? Next step? Inductive step. And for that we're going to need to show for n bigger than or equal to 0, we want to show pn implies pn plus 1 is true.
So to do that we assume pn is true. In other words, we assume that 3 divides n cubed minus n. And we're trying to show that 3 divides n plus 1 cubed minus n plus 1. So we take a look at, we examine n plus 1 cubed minus n plus 1. And we want to show it's a multiple of three.
Well, let's expand that out. This is n cubed plus 3n squared, plus 3n plus 1. And I subtract off n plus 1. So I get n cubed plus 3n squared plus 2n. Is this a multiple of 3? I need to show that's a multiple of 3 and then I'd be all done. Is it a multiple of 3?
Beats me. It doesn't look like a multiple of 3, necessarily. So maybe we need to massage it a little bit. I do know that this is a multiple of 3. I can use that fact. And in proofs by induction you always want to-- if you're not making use of that fact, then you're not really making use of induction. Sort of a warning sign.
So I want to use this fact to prove this. Well, let's get a minus n in here. This equals n cubed minus n plus 3n squared plus-- if I subtracted an n I got to add an n-- plus 3n. So I've rewritten it. Now is it clear? Now it's clear.
Very simple, because 3 divide this by pn. 3 divides that. And 3 divides that. So this is a multiple of 3, because I've got 3 divides 3n squared, 3 divides 3n, and 3 divides n cubed minus n by pn. Or you could say, by the inductive hypothesis. pn is the inductive hypothesis, another name for it.
So therefore, 3 divides that, which means 3 divides this. So that means 3 divides n plus 1 cubed minus n plus 1. And we are done with the proof by induction. Any questions about that one?
So the key steps in induction are always the same. You write down "proof by induction." You identify your predicate. You do the base case, usually n equals 0, but it could be something else. And then you do your inductive step.
Now in general, you could start your induction-- you don't have to start it at 0, you could start it at some value b, some integer b. Let's take a look at that.
So you could have for the base case, you could have p of b is true, not p of 0. And then for your induction step you would have for all n bigger than or equal to b, pn implies pn plus 1. And then your conclusion is that for all n bigger than or equal to b, pn is true.
So inductions don't always have to start at 0. You can pick where you start. Just make sure that you verify the starting point and you verify the implication for all n at that starting point and beyond.
All right, let's now do a false proof using induction. We're going to prove that all horses are the same color. So let's go through the process. So the proof, we write down "by induction."
Now we need our induction hypothesis, the predicate. So we're going to let that be-- we can't let it be this. Why can't this be our predicate? All horses are the same color. What's wrong with making that be the induction hypothesis? You can't plug anything into it. There's no number here. I've got to have a number, n, to induct on.
So what I'm going to say is that in any set of n horses-- and let's make n bigger than or equal to 1-- the horses are all the same color. All right, now if I prove this is true for all n, well then all horses are the same color. Because in any set of n horses, they're all the same color. So all horses must be the same color.
What's the next thing I do? What's the next step? Base case. Now, what am I going to use as my base case here? One horse, OK, or n equals 1. So p of 1. That would say that any set of one horses the horses are all the same color.
That's true. I've got one horse. It's the same color as itself. So that's easy. It's true since just one horse. All right, what's the next step of the proof? What's the next thing I do? Inductive step.
So I'm going to assume that pn is true to prove pn-- and show pn plus 1 is true. All right, so I'm going to assume that in any set of n horses, the horses are all the same color that I start with. And now I look at a set of n plus 1 horses.
So we consider a set of n plus 1 horses. And let's call those horses h1, h2, hn plus 1. What do I know about horses h1 to hn? They're the same color, because pn is true. There are a set of n horses. By p1 they're all the same color.
Also, what do I know but h2, h3 and hn plus 1? All the same color, because they're a set of n horses. All right. Well, since the color of h1 equals the color of those guys, h2 to hn, I know h1 is the same color as these guys. I also know that hn plus 1 is the same color as those guys.
That means that h1 is the same color as hn plus 1. And all n plus 1 are the same color. And that's pn plus 1. That implies pn plus 1. And I'm done. Now a few years ago we assigned this problem as homework. And we asked students to figure out what went wrong with the problem. Why doesn't this work?
And the responses were a little discouraging. Half the class responded, effectively as follows, this example just goes to show that induction doesn't always work. A third of the class said, I always knew that you can't trust mathematics. This example just proves it. That really hurt.
And most of the rest were something similar to that. Not exactly what we were looking for in the homework. So now we don't leave it to homework. We do it in class. What's the flaw here? What was it?
AUDIENCE: P of n.
PROFESSOR: P of n? What's wrong with p of n?
PROFESSOR: No, this is a real assumption in any set of n horses-- depends on n-- the horses are all the same color. That is a proposition. Because it depends on n, it's a predicate. It's true or it's false. Now we know it's false, because you could get a set of a couple horses with different color. But it is a proposition.
Yeah, way back there?
AUDIENCE: [INAUDIBLE] for like a certain set of horses. So even though it's the same number of horses, so it was the same number as a different set of horses it's not something you can assume anymore.
PROFESSOR: That's a great point. I did gloss over something here, because in the predicate I've got "in any set." So there's really a "for all sets" sitting out here. So I've going to be careful that I establish that when I'm trying to prove pn implies pn plus 1. So to establish pn plus 1 here, I assume pn which means in any set of n horses they're all the same color. That I'm given. That's pn.
I've got to look at any set of n plus 1 horses. So consider any set, not a set, any set of n plus 1 horses. So you pick any set you want. Call them this, h1 through hn plus 1. Well then, the first n are a set of n horses, so I can apply pn, therefore they have the same color.
The last n horses in the set are a set of n horses, so I can imply pn. So these guys all have the same color, and I'm on my merry way here. So you're right, I had to do a little bit more work, but I can do that work and I still get a proof. Yeah?
PROFESSOR: Good question. Is there a problem with the base case? So my base case was here, n equals 1. In any set of one horse, the horses-- let's say in the set just to be really careful-- are all the same color. No, in any set of one horses there's only one horse, so it's the same color as itself. Yeah?
PROFESSOR: n plus 1 is not the same as n, yeah.
AUDIENCE: [INAUDIBLE]. So you can't have the same assumption because it's not a set of n horses. It's a set of n plus 1?
PROFESSOR: Well, let's see. So you're arguing I made a mistake here, right? Well, I've got horses-- horse 2, 3, up to n plus 1. How many horses are in this set here?
AUDIENCE: Oh, in that set?
PROFESSOR: In this set. How many horses are there?
PROFESSOR: N. So I can apply p of n to this set just the same as that set, because p of n is any set of n horses. Well, I'm picking this one now and applying pn to it. And so therefore they're all the same color. Yeah?
AUDIENCE: H1, h2, dot, dot, dot.
AUDIENCE: Because it does work it there's two or more, but you didn't prove it with just one-- or from one to two.
PROFESSOR: Exactly. Remember I told you that dot, dot, dot is so reasonable, so easy to use. Everybody uses it. It was going to catch us up. The bug is in the dot, dot, dot. And in particular, it has to do with the case n equal 2. So there's two ways to look at the bug, dot, dot, dot, or we didn't completely do all the inductive steps.
So let's look at the case-- actually it's the case n equals 1, here, in this inductive step. Did I prove p1 implies p2? Let's just double check that worked for n equals 1. n equals 1. I've got a set of two horses. This becomes 2. So I've got h1, h2. Nothing in the dot, dot, dot. It's just h1 and h2.
Then this becomes h1. So sure enough, h1 is the same color as itself. This becomes-- what does this become, this set of horses? What is it really? h2. All right, so I've got the color of h1 equals the color of-- oh man, this is so hard to see this bug. I wrote down h2 dot, dot, dot, to hn because-- take out h1, what's left? What's left is h2 through hn.
But this set is only h1. What's really left here? What is this set? What is this set? h2, h1? No. You see, what is the whole set? h1, dot, dot, dot, hn. What is the whole thing? It's just h1. pull out h1 and look at the rest of it, how many horses are here? 0 horses.
This is the empty set. There are no horses here to compare to. Even though I got an h2, I got an hn, I got a dot, dot, dot. Because generally, if n is big, this has n minus 1 horses are here. There's n total. I got n minus 1 right here. But n minus 1 is 0. There are no horses here. And so this bridge in the equality totally breaks.
I got color of h1 equals-- there's no information here-- equals the color of h2. There's no equality here, because there's no horses in this set, all because of that dot, dot, dot. Do you see where the problem is by using the dot, dot, dot?
For the case n equals-- it was true for every other case of n. n equals 2, n equals 3, it's all true. In fact, what we proved, we proved the base case of p1 is true. This is an argument that p2 implies p3. That is true. p3 implies p4, that is true. And so forth.
We proved for all n bigger than or equal to 2, pn implies pn plus 1. That we proved. What is the one missing implication we did not prove? The missing link, p1 implies p2. We did not prove that. Now is that true? No. You can find a set of two horses are not the same color. And just because every horse is the same color as itself, does not give you that.
That was missing in this proof. And so we have to be really careful when you're doing these proofs that you establish the inductive step for all n bigger than or equal to the base case. And then make sure, if you're going to use this really convenient dot dot dot notation, that you don't wind up here saying, oh this is horses h2 through hn when there's no horses there, because n is 1.
Any questions about this? Yeah?
PROFESSOR: Great question. All right, let's fix the proof. Start with the base case of p of 2, and now I've got all this done. So therefore, that's another proof. Yeah? Say it again.
PROFESSOR: This is still the same. In any set of n bigger than or equal to two horses, all the horses in the set are the same color. That's what he saying. And he's saying, hey look, the proof worked here. The inductive step is just fine. p2 does imply p3. Yeah?
AUDIENCE: The base case for 2 isn't true.
PROFESSOR: That's right. The base case fails. That's why you've always got to check the base case. Yeah?
AUDIENCE: What it does prove is that if you find any two horse and they're always going to be the same color, then all horses have to be the same color.
PROFESSOR: That's correct. That's a great point. We have given a proof that if you look at any pair of horses and they're the same color, then all horses are the same color. That's true. That is true. Of course, there are pairs of horses that aren't the same color. So the base case would fail.
So always check the base case. You could prove some great stuff if you don't check the base case. All right, any other questions about that? Yeah?
AUDIENCE: Negative number [INAUDIBLE]?
PROFESSOR: Yeah. As long as it's an integer. And as long as you prove pn implies pn plus 1 starting there all the way out. Yeah, you can start at negative numbers if you want. Usually there's not many cases where that comes up you want to, but you can. Nothing wrong with that. Any other questions?
Yeah, you can see why it was a messy homework problem. So far we've seen examples of how induction is useful in proving the hypothesis is true, but not in solving the problem, per se. Or even figuring out what the hypothesis should be. Now in the last example, we're going to show you how induction can be used to prove there is a solution to a problem, and also how to find the solution.
So it's actually going to be a very useful, constructive thing in this case. Now this problem arose in the construction of the status center, the building we're in now. This whole building was originally supposed to cost, completely furnished, under $100 million. That was the goal.
But the first mistake they made was the first step, was hiring the architect. They hired Frank Gehry. I think MIT is now in a lawsuit with Frank Gehry. So he was the architect. And costs just went nuts. As you could imagine, all these slanted walls and crazy things happening actually are expensive. And the cost quickly got over $300 million, literally.
That that's parts true. Now I'm going to fabricate a little bit. Now actually, fund raising became a huge priority once they're more than $200 million over budget they haven't even bought the furniture yet. So some pretty radical ideas were proposed.
And one of them was to build a large 2 to the n by 2 to the n courtyard and put a statue of a wealthy, potential donor in the center of the courtyard. So let's draw this. So the courtyard-- and of course, you know, it's computer science, so it has to be a power of 2. So it's 2 to the n by 2 to the n. And I've drawn here the case n equals 2.
And we've got to get the statue of the wealthy guy in the middle. And I'm not supposed to reveal his name. So we're just going to call him Bill. So Bill's got to go in the center. Now this would be fine, except to that nothing was easy with Frank Gehry, everything was some weird, weird thing going on. And he insisted on using l-shaped tiles for the courtyard.
So the tiles that we're going to use looked like this. So it's almost a two by two, except you're missing that piece. So what you need to figure out how to do is tie all this courtyard perfectly leaving one spot for Bill using tiles like this, these l-shaped tiles. And this is 2 by 2 here. So that's the task.
So let's see if we can do that for n equals 2 here. Let's see, we can do a tile here. We can do a tile here. A tile here. A tile here. And a tile there. So we can. In this case we can tile the courtyard perfectly using these L shaped tiles, leaving one square in the Center for the statue.
All right, everyone understand what we're trying to do? The goal? Now I want to do it for n. So let's start proving it by induction, even though we don't know how to do it yet. Because we're going to see how induction's going to help us show it's possible and maybe even show us how to do it.
So let's state a theorem. For all n there exists away to tile a 2 to the n by 2 to the n region, or courtyard, with a center square missing for Bill. And the proof will be by induction.
And our induction hypothesis, the predicate, pn is going to be what we're trying to prove. So this is the induction hypothesis. Almost always when you do the induction you want to start out with that as your hypothesis. What's the next step? Base case. Never ever forget the base case or you'll be thinking all horses are the same color. p0.
Well, the courtyard for n equals 0 is just 1 square. And that's for Bill. So you're done. There's no tiles at all to worry about. That's easy. So that's true. And then we do the inductive step.
So inductive step. For n bigger than or equal to 0, got to remember to keep track of that now, we assume pn to verify the inductive hypothesis, or to prove pn plus 1. A lot of ways to write this down, but you always want to say what you're assuming and why.
So we need to show pn plus 1 is true. Well, so let's look at a 2 to the n by-- 2 to the n plus 1 by 2 to the n plus 1 courtyard. So let's draw it out here. 2 to the n plus 1 by 2 to the n plus 1.
What are we going to do to use our inductive hypothesis? Yeah?
PROFESSOR: For the-- yeah. So you're on a good track there, for sure. But I've got to apply-- I'm not going from 1 to 2, I want to get-- I want to use pn here. So I've got a 2 to the n plus 1 by 2 to the n plus 1 courtyard. How do I use pn? 2 to the n by 2 to the n courtyard. Yeah?
AUDIENCE: Oh, never mind. I don't think it works. I was about to say that would be as if 2 to the n would divide that into four blocks.
PROFESSOR: Good idea, yeah. Let's divide our courtyard into four blocks. That's a great idea. And now each of these is 2 to the n by 2 to the n. Right? And I can apply the inductive hypothesis there.
PROFESSOR: Yeah. Hm. Yeah, something-- yeah, it doesn't quite work because Bill wants to be here. Got a little square for Bill there. But I can't use my inductive hypothesis to tile this, because there's no square missing. In fact, even if there wasn't a square missing, I'm in trouble.
If I've got-- say this is size 4 by 4 here. Can I tile a 4 by 4 region with L shaped tiles? No, they're size 3. 3 doesn't divide into 16. Yeah?
AUDIENCE: [INAUDIBLE] There's one tile missing from each of those blocks at the corner that [INAUDIBLE].
PROFESSOR: There's a great idea. All right, we're making progress now. Take a corner out of each of them. Put my l-shaped tile here. Now I can use the inductive hypothesis to tile each one of these. Yeah? Yeah?
AUDIENCE: Well, why can't you put a 4 in the center and then you have a bunch of 2s on the side?
PROFESSOR: A 4 in the center--
AUDIENCE: Like a 2 by 2 in the center.
PROFESSOR: I got that. I got Bill and the tile.
AUDIENCE: No, but like make it bigger. Not just like 4 single tiles, but like-- so you have something like that over there, right? Put that in the center.
PROFESSOR: Put that in the center, OK.
AUDIENCE: And the rest of them will have like [INAUDIBLE].
PROFESSOR: Well, the rest of them aren't 2 by 2, because this is n. I've got to use pn here. And pn says that I can-- in a region 2 to the n by 2 to the n with a square out of the center, I can tile it. Am I good here so far? I claimed I was sort of done. Yeah?
AUDIENCE: No, because p of n tells us-- well, assume p of n tells us that you can set up a 2 to the n by 2 to the n courtyard with a centerpiece of--
PROFESSOR: Yeah. And what's the problem for this 2 to the n by 2 to the n region? Bill's not in the center. He wants to be in the center. We put Bill in the corner. So you can't use the inductive hypothesis here. So I went a little too fast, here. This is not a proof so far. I've got a problem. Yeah?
PROFESSOR: Great. OK, let's then change the inductive hypothesis. Good. Let's say there exists a way to tile a 2 to the n by 2 to the n region with a corner square missing for Bill. All right, but now I got to put-- oh, but I can make this work. Yeah. Yeah. We can make something-- we can prove this now.
The inductive step is going to work because I'll put Bill-- say he's in one of the four regions. Then use the l down here. Put the l here. And now I've got a corner out of each one. And now I'm done by induction. I have proved there's a way to tile any 2 to the n by 2 to the n region with a corner square missing. I think that proof works, Yeah?
AUDIENCE: [INAUDIBLE] with Bill in the middle, because to prove that you can put Bill in the corner in a 2 by 2 case, you can just blow that square off. [INAUDIBLE] just becomes just another square, which is 4 by 4 and then you can put him in the middle.
PROFESSOR: That is true. So you've jumped ahead. We have successfully now proved this is true for p of n. But Bill didn't want to be in the corner. We're trying to prove there's a way to do it with Bill in the center, which is not what we proved. And you've come up with a way-- yeah, that might be doable.
First prove you can put Bill in the corner. And do it in 2 to the n by 2 to the n's. I don't know about this, actually. I got Bill in the corner. There's some way to do it. But it might have involved doing this. And now I can't rotate that. I don't think we have-- I don't think that proof necessarily works.
AUDIENCE: [INAUDIBLE] prove that he could be here. But likewise, we could prove that if the block just rotates you can [INAUDIBLE].
PROFESSOR: Yes, I agree with you and I liked it when I first heard it. And you might still convince me. But all we proved is this, there's a 2 to the n by 2 to the n-- any 2 to the n by 2 to the n region, we could tile it with a corner, Bill in a corner, any corner square missing.
Good, so now you want to say, I can get Bill in the middle. And what you want to say is OK, I tile this region with Bill here, in a 2 to the n by-- maybe you're right. So then I would apply the theorem here, with Bill here. Oh, Bill here. No, I think I like it now.
And then I would take these out.
AUDIENCE: [INAUDIBLE] just takes up up three blocks. And that big square is just like a zoomed out version of a little square. And since you know that little square fits in a 2 by 2-- like for example in the 4 by 4 case. We proved the 2 by 2 case. In the 4 by 4 case you have a big size. It's just like a-- you have four squares, right?
And each of those four squares has [INAUDIBLE]. So you take that top right square and you put Bill within the smaller square exactly where you want him to be. And then you fill those other-- all those empty spaces.
PROFESSOR: I agree. You could make a proof. So in this case you'd make a Lemma that uses induction that says you can do it with Bill in the corner. And then as a corollary or a theorem you'd take that and apply it to four sub-squares. Put Bill in here. Take these out. And then now you'd have your result of Bill in the center.
So that is is a way to do it. It ends up being more complicated. There is a simpler approach. But that is a way that works. It is a natural thing you would do if you had this on homework. Is you'd think of a different thing to prove by induction, then use that as a Lemma to get you where you wanted to go.
There's another way to do it without having that first step. And that's-- yeah?
AUDIENCE: That courtyard where n equals 2. Divide each cell into a 2 by 2--
PROFESSOR: Well, yeah. You want to do it bottoms up. You want to take it and make that your inductive step, 2 by 2's inside. I haven't thought about that approach.
AUDIENCE: [INAUDIBLE] So if you could do that then you're all set except for the 2 by 2 where Bill was.
PROFESSOR: I'm worried about a lot of 2 by 2's with a corner missing if I do it that way. I'll think about that. There is-- let me get to another approach here. We couldn't make it work with the center. We could make it work with a corner. But then we had to do more work after. One general technique to use with induction, when you're having struggling, what's the induction hypothesis to use.
If what you've got doesn't work, you could pick a different one, but better to pick a stronger one. Yeah?
PROFESSOR: Yes. You could. And that is a good thing to do. Make the induction hypothesis be much stronger. I had trouble proving there's a way to do it with a center square missing. Turns out to be easier to prove it where you say any square could be missing.
Seems like this should be harder, right? We had a hard enough time just showing this square missing was doable. But by assuming something-- by trying to prove a harder problem, assuming something stronger in pn, it gets easier to prove. All right, now we better check the base case, p0, but that's easy. There's only one square Bill can be.
But now let's look at pn implies pn plus 1. So we go back to this. We've got a 2 to the n plus 1 by 2 to the n plus 1 courtyard. And now Bill can be anywhere. Put him here. There's Bill.
Now I'm going to place my first l-shaped tile here, in the other three regions. And now I apply pn to each region. A pn says I can do it with any square missing. So I'll pick this one out here, this one out here, that one there, that one there. And now I'm done.
That was easy. No extra steps. Now, how is it possible that it was easier to prove something that was harder? Yeah?
AUDIENCE: First need to be in the center [INAUDIBLE], you're putting another constraint on yourself.
PROFESSOR: Yes. That is true. But by allowing him to be anywhere, I could have started-- I have to-- that's a possibility. See, what I'm trying to do here, this inductive step is all about proving pn implies pn plus 1 is true. That's what I'm trying to show.
Now, how is it useful for me if pn is stronger? Has more?
AUDIENCE: You grow it. You prove that he can be in a corner. But when you grow it, the corner moves. But since we proved that it can be in any, it's fine if it moves.
PROFESSOR: Exactly. That's exactly right. ph got more powerful, which means I get more to assume here. In the recursive problem, Bill can be anywhere now. It gives me more power. I can tile any courtyard with any square missing. This is more powerful. So this got more powerful. So did this.
So what it means is that my tool set is bigger with a stronger pn. And what I'm trying to construct or prove got harder. And sometimes, if I've got more tools, it becomes easier to prove, even a harder thing.
And so a general rule with induction is if you don't first succeed, try, try again. Well, the rule with induction is if you don't succeed at first, try something harder. All right? And it's amazing, but it actually works a lot of time, as it did here. If I don't assume something strong enough, and pn is some little weak thing like Bill just in the center, it's not enough to go anywhere.
But if I could assume a lot more, like Bill could be anywhere he pleases. Then I could prove lots of things here. So it's all the art-- and you're going to learn this over the next several weeks-- it's all the art of what's your induction hypothesis. Picking a good one, life is easy. Picking the wrong one, very painful, as you'll see with beaver flu. OK, that's it for today.