[MUSIC] The goal of computing is not numbers but insight. I don't care that f(2) is equal to four. I do care about the qualitative features of a function. Here's a graph of some random function I just made up. A significant qualitative feature of this graph is that right here is a valley in the graph and up here is a mountaintop. Speaking of mountaintops and valleys is maybe too metaphorical, not precise enough. Let's try to work out a better definition. So, instead of calling this a mountain top, I'm going to call that a local maximum. Let's be even a little bit more precise. Let's suppose that that maximum value occurs at the input c, where the output is f(c). I'm going to call f(c) the local maximum value of the function near the input c. Here's a precise definition, f(c) is a local maximum value for f if whenever x is near the input c, f(c) is bigger than or equal to f(x). Maybe this isn't even precise enough. A big sticking point with this is this word near. That's sort of a weasley word. I can make this near precise just like we've been doing with limits. I'll introduce sum epsilon. So f(c) is a local maximum value for the function f, if there's some small number, that's what I mean by near. So that whenever x is near c, and by near c, now, I'm in between c- epislon and c+ epsilon. This is really close to c if epsilon is real small. Okay. So that, whenever x is contained in this interval, f(c) is bigger then or equal to f(x). We can give a similar sort of definition for the valleys. Here's that same graph again and I've highlighted a local minimum on the graph of this function. Near the input c, f(c) is the smallest output for the function. A little bit more precisely, I'm calling it a local minimum value, because whenever x is near c, f(c) is less than or equal to f(x). Or even a little bit more precisely again just like for local maximums, I can replace near with espilon. So f(c) is a local minimum value for the function, if there's some epsilon measuring the nearness, so that whenever x is between c- epsilon, and c+ epsilon, f(c) is less than or equal to f(x). Sometimes, I'm going to want to talk simultaneously about local maximums and local minimums. So, we'll call either a local minimum or a local maximum a local extremum. And this is kind of a pretentious word, but it's just a word that we can use so that we can talk about both of these concepts simultaneously, because they actually share quite a few features in common. What if I want to talk about multiple extremums? Well, what if we wanted to talk about an octopus? Well, that's not really a problem, but, what if you wanted to talk about two of these things? You might not call it an octopus, you might call it an octopuses now. But, you'll find some people will get angry at you if you do that and I want you to call these octopi. I probably don't really agree with them, but, the same problem comes up with minimums and maximums and extremums. You're going to find some people who will demand that you call these minima, maxima, and extrema if you're talking about more than one of these things, but really, either is fine. The world local here is really in contrast to the world global. We'll say, in fact, everyone will say that f(c) is a global maximum value for the function f if no output of the function is larger than f(c). Maybe that's too cute of a way to say it. Here's a more precise way to say it, f(c) is a global maximum value for the function if whenever x is in the domain of f, I'm only going to be considering inputs in the domain, of course, then f(c) is bigger than or equal to f(x). Do the same deal for minimal values, f(c) is a global minimum value for the function if whenever I've got a point in the domain f(c) is less than or equal to f(x). One subtle thing to point out here is that I'm not claiming, say for global maximum values that this is the biggest output of the function. What I'm saying is that any other output isn't larger than f(c), f(c) is bigger than or equal to any other output of the function and the same deal for this global minimum. I'm not saying this is the smallest output of the function, I'm just saying that any other output is bigger than or equal to this output. Now we can see some examples of this. Of this. Here's that same graph we've been looking at so many times here. Let's try to figure out where the local extrema are. this point here is a local maximum, that's the biggest output value for nearby input values. This point here is a local minimum, right? You're sitting in that valley, that's the smallest output valley among nearby inputs. And, up here is another local max and this local maximum is also a global maximum. I mean, if you're really assuming that this graph just continues down to the left and the right-hand sides, you should also note that if you really believe this thing continues down like this, this function has no global minimum. Nobody's promising you that there is a global minimum or a global maximum, but in this case, there isn't one. There's no global minimum. There can definitely be multiple local maximums, but there can also be multiple global maximums. So here, I've drawn another graph, where I've rigged it so that these two output values are the same. So these are both local maximums, but they're also both global maximums. Alright? So in this case, these are both global and also local maximums. There's even more, dare I say it, extreme version of this. Here, I've graphed the constant function y=17 is both a global maximum and a global minimum for this constant function. The distinction between local and global maximums is really quite important, even in everyday life. When you're standing at a local maximum, on the top of this mountain, small changes to your situation just make things worse, and yet, if you're willing to go through this valley, you'll eventually come up here to what at least appears to be to global maximum of this function. [MUSIC]