[MUSIC] So, I get a number like the square root of two. And square root of two is irrational. So, how am I going to figure out what it's approximately equal to? Well, it turns out that it's approximately, you know, 1.414 and a bit more. But how would ever figure that out? How would I know that that's approximately the value of the square root of two? Let's use the intermediate value theorem to try to pull it. I want to use the intermediate value theorem to approximate the square root of two. To do that, I'm going to use this function, f(x) = x^2 - 2. Notice something about this function. This function is equal to zero when x is the square root of 2. And how is that? f of the square root of 2 is the squared of two squared, which is two, minus two, which is zero. So, if I'm trying to approximate the square root of 2, what I'm going to think about this, is that I'm going to look for a positive value, that I can plug into this function to make it a square root of zero. How am I going to find such a value? You know, the other good thing about this function is that it's continuous. And then, I can plug in some values, like f(1). Now, what's f(1)? It's one squared minus two and that's minus one. And I can plot that on my graph right here, and it's this point right here. And take a look at, say, f(2). f(2) would be two squared minus two, which is two. And I can plot that on my graph, right here. It's 2, 2. Now, f is a continuous function and at one, it's negative. And at two, it's positive. So, it's a continuous function. It's negative at one and it's positive at two. By the intermediate value theorem, there must be a point in between when the functions value is equal to zero. And you can see that on the graph. We're looking for that point. That is the square root of two where this graph crosses the x-axis, the positive x-axis. And that's the point that we're looking for, right? The intermediate value theorem promises me there's a value in between where the functions value equals zero. And I can see that there must be such a point on the graph. And now, I know that that value is between one and two. And I can do better. I can cut this interval between one and two in half and I get that f(1.5). Well, 1.5 squared is 2.25 - 2 is 0.25. [SOUND] Alright. So, that's, say, this point on my graph. Now, what do I know? I know that the squared of two, which is where this graph crosses the x-axis, is between one, where the function is negative and 1.5, where the function is positive. And I can do better, alright? I can pick some other point. Let's be brave and pick 1.4. And if I plug in 1.4, well, 14 squared is 196. So, 1.4 squared is 1.96 - 2, that makes this -0.4, alright? This is barely below the x-axis. And I can plot that point here. And now, I know that the square root of two, the positive input to this function, which is equal to zero, well, it must be between 1.4 and 1.5. Because the function's value at 1.4 is negative and the function's value at 1.5 is positive. So, this is not so bad. I mean, we, we could do this with a few calculations on the blackboard. Let's, let's bring out some sort of computation device so we can try to get an even better approximation to the square root of two. So here, I've got a function. The function is f(x) = x^2 - 2. And you can see that if I plug zero into the function, I get out -2 because 0^2 - 2 is -2. Now, this is a physical function. I've got this knob here. And as I spin this knob, the function's input value changes. So, for example, if I spin it up to f(05.), f(1/2), that's negative 1.75 and that's right because if I take a half squared, I get a quarter, and a quarter minus two is -1.75. Now, I could spin the input up to one. f(1) is -1 = because 1^2 - 2 is -1 or f(1.5), well, 1.5 squared is 2.25, 2.25 - 1 is 0.25. Now, this is positive or I could wheel it back down a little bit. And I see that when I get to 1.41, the function's output is negative again. Then, I could increase the function's input a bit. Oh, now the function's output is positive again, at f(1.145). And then, I could decrease the value a little bit. Oh, now, the function's output value is negative again and that would increase the output value a little bit. Oh, now, the function's output is positive and I could decrease the input a bit. Now, the function's output is negative, could increase the input a little bit. Now, it's positive, could decrease the input a little bit. Now, it's negative again. Now, Look at what happened, right? What's going on? I'm looking at the function f(x) = x^2 - 2 and I'm walking back and forth across the point where this function is equal to zero. And as I walk to the left and to the right, the function is positive and the function is negative. And I'm getting closer and closer to a, to the actual place where the function is equal to zero and what is 1.41421356? It's awfully close to the square root of two. And if you think the square root of two and square it and subtract two, you get zero. What we just saw with the knob that I was turning is actually an incredibly general technique for figuring out where a continuous function crosses the x-axis. And we can do it very efficiently. Let's take a look at how we might do this a little bit more carefully. Here, I've drawn a graph with some random looking continuous function and I've labeled some points along the x-axis. Imagine that we couldn't see this whole graph. Just imagine that the only thing you can do is interrogate this function. You can ask this function at some input point, are you positive or negative? We're trying to figure out where, approximately, this continuous function crosses the x-axis. We're looking for a zero of this continuous function. How might the game begin? I'll let it begin by asking the function, are you positive or negative at zero? And the function is positive at zero. And then, maybe I'd ask at sixteen. At sixteen, is this function positive or negative? And I'd see the function is negative. The function's value is negative at sixteen. Because it's a continuous function and the function's value at zero is positive and the function's value at sixteen is negative, I know that there's a zero in between. There's some point in between that if I plug it into the function, I get zero out. Now, I could cut that interval in half. I could plug in eight and I could ask the function at f(8), are you positive or negative? And the function f(8), the value of the function at eight is positive. Now, look. I know the function's value at eight is positive, the function's value at sixteen is negative. So, by the Intermediate Value Theorem, there must be a value in between, right there, where the function's value is zero. And now, I could take that interval and cut it in half again. I could take a look at twelve, which is exactly between eight and sixteen. And I could ask the function, at f(12),12), are you positive or negative? And the function's value at twelve is negative. [SOUND] So now, I know by the intermediate Value Theorem, the function zero zero of this function must land between eight and twelve and I could cut that interval in half again. I could look at ten, and I could ask the function, well, if I plug in ten, are you positive or negative? And the function's value with ten is negative. And now, I know that the zero must land between eight and ten, because the function's value at eight is positive and the function's value at ten is negative, so there must be a zero in between, a point where the function's value is equal to zero. Now, I could cut that interval between eight and ten in half again. I could look at nine. And I could ask the function, at nine, are you positive or negative? And if I plug in nine, it looks like the function is positive. And that means that a value that I can plug into the function to make the output zero lies between nine and ten. And this is really quite remarkable. I, I, I could cut the interval between nine and ten and half again and see if it was between nine and 9.5 or 9.5 and ten. And I could keep doing this every time I'm getting a little bit more precision as to the exact value of the input that would make the function zero. The other really neat thing about this is that I could have just tried all of the values between zero and sixteen. I could have plugged all seventeen of those numbers into the function to figure this out. But by doing this clever cutting in half method, this bisection method, I managed to only ask six questions, right? I asked the function's value at zero and sixteen, at eight and twelve, at ten and at nine, and by only asking six questions, I was able to narrow down a region where a zero resided. Now, that's pretty quite efficient, much better than asking seventeen questions. So, this is a very general technique for figuring out where zeroes of continuous functions lie. And I encourage you to pick your favorite function and see if you can approximate a root, a zero of that function. [MUSIC]