1 00:00:00,012 --> 00:00:05,087 [MUSIC] The goal of computing is not numbers but insight. 2 00:00:05,087 --> 00:00:11,462 I don't care that f(2) is equal to four. I do care about the qualitative features 3 00:00:11,462 --> 00:00:16,262 of a function. Here's a graph of some random function I 4 00:00:16,262 --> 00:00:21,212 just made up. A significant qualitative feature of this 5 00:00:21,212 --> 00:00:27,774 graph is that right here is a valley in the graph and up here is a mountaintop. 6 00:00:27,774 --> 00:00:34,020 Speaking of mountaintops and valleys is maybe too metaphorical, not precise 7 00:00:34,020 --> 00:00:36,973 enough. Let's try to work out a better 8 00:00:36,973 --> 00:00:41,162 definition. So, instead of calling this a mountain 9 00:00:41,162 --> 00:00:44,472 top, I'm going to call that a local maximum. 10 00:00:44,472 --> 00:00:49,722 Let's be even a little bit more precise. Let's suppose that that maximum value 11 00:00:49,722 --> 00:00:53,582 occurs at the input c, where the output is f(c). 12 00:00:53,582 --> 00:00:59,922 I'm going to call f(c) the local maximum value of the function near the input c. 13 00:00:59,922 --> 00:01:06,207 Here's a precise definition, f(c) is a local maximum value for f if 14 00:01:06,207 --> 00:01:12,617 whenever x is near the input c, f(c) is bigger than or equal to f(x). 15 00:01:12,617 --> 00:01:19,669 Maybe this isn't even precise enough. A big sticking point with this is this 16 00:01:19,669 --> 00:01:22,674 word near. That's sort of a weasley word. 17 00:01:22,674 --> 00:01:27,495 I can make this near precise just like we've been doing with limits. 18 00:01:27,495 --> 00:01:32,263 I'll introduce sum epsilon. So f(c) is a local maximum value for the 19 00:01:32,263 --> 00:01:37,109 function f, if there's some small number, that's what I mean by near. 20 00:01:37,109 --> 00:01:41,640 So that whenever x is near c, and by near c, now, I'm in between c- 21 00:01:41,640 --> 00:01:45,943 epislon and c+ epsilon. This is really close to c if epsilon is 22 00:01:45,943 --> 00:01:47,289 real small. Okay. 23 00:01:47,289 --> 00:01:53,773 So that, whenever x is contained in this interval, f(c) is bigger then or equal to 24 00:01:53,773 --> 00:01:57,103 f(x). We can give a similar sort of definition 25 00:01:57,103 --> 00:02:01,338 for the valleys. Here's that same graph again and I've 26 00:02:01,338 --> 00:02:05,932 highlighted a local minimum on the graph of this function. 27 00:02:05,932 --> 00:02:11,272 Near the input c, f(c) is the smallest output for the function. 28 00:02:11,272 --> 00:02:16,847 A little bit more precisely, I'm calling it a local minimum value, 29 00:02:16,847 --> 00:02:21,907 because whenever x is near c, f(c) is less than or equal to f(x). 30 00:02:21,907 --> 00:02:28,412 Or even a little bit more precisely again just like for local maximums, I can 31 00:02:28,412 --> 00:02:33,905 replace near with espilon. So f(c) is a local minimum value for the 32 00:02:33,905 --> 00:02:39,798 function, if there's some epsilon measuring the nearness, so that whenever 33 00:02:39,798 --> 00:02:44,026 x is between c- epsilon, and c+ epsilon, f(c) is less than or equal to f(x). 34 00:02:44,026 --> 00:02:50,031 Sometimes, I'm going to want to talk simultaneously about local maximums and 35 00:02:50,031 --> 00:02:53,825 local minimums. So, we'll call either a local minimum or 36 00:02:53,825 --> 00:02:57,962 a local maximum a local extremum. And this is kind of a pretentious word, 37 00:02:57,962 --> 00:03:02,306 but it's just a word that we can use so that we can talk about both of these 38 00:03:02,306 --> 00:03:06,252 concepts simultaneously, because they actually share quite a few 39 00:03:06,252 --> 00:03:09,654 features in common. What if I want to talk about multiple 40 00:03:09,654 --> 00:03:13,947 extremums? Well, what if we wanted to talk about an octopus? Well, that's not 41 00:03:13,947 --> 00:03:16,889 really a problem, but, what if you wanted to talk about two 42 00:03:16,889 --> 00:03:20,903 of these things? You might not call it an octopus, you might call it an octopuses 43 00:03:20,903 --> 00:03:23,043 now. But, you'll find some people will get 44 00:03:23,043 --> 00:03:26,682 angry at you if you do that and I want you to call these octopi. 45 00:03:26,682 --> 00:03:31,620 I probably don't really agree with them, but, the same problem comes up with 46 00:03:31,620 --> 00:03:36,297 minimums and maximums and extremums. You're going to find some people who will 47 00:03:36,297 --> 00:03:40,888 demand that you call these minima, maxima, and extrema if you're talking 48 00:03:40,888 --> 00:03:44,972 about more than one of these things, but really, either is fine. 49 00:03:44,972 --> 00:03:50,549 The world local here is really in contrast to the world global. 50 00:03:50,549 --> 00:03:57,387 We'll say, in fact, everyone will say that f(c) is a global maximum value for 51 00:03:57,387 --> 00:04:03,039 the function f if no output of the function is larger than f(c). 52 00:04:03,039 --> 00:04:09,593 Maybe that's too cute of a way to say it. Here's a more precise way to say it, 53 00:04:09,593 --> 00:04:15,139 f(c) is a global maximum value for the function if whenever x is in the domain 54 00:04:15,139 --> 00:04:18,460 of f, I'm only going to be considering inputs 55 00:04:18,460 --> 00:04:23,500 in the domain, of course, then f(c) is bigger than or equal to 56 00:04:23,500 --> 00:04:26,592 f(x). Do the same deal for minimal values, 57 00:04:26,592 --> 00:04:32,240 f(c) is a global minimum value for the function if whenever I've got a point in 58 00:04:32,240 --> 00:04:33,948 the domain f(c) is less than or equal to f(x). 59 00:04:33,948 --> 00:04:39,457 One subtle thing to point out here is that I'm not claiming, say for global 60 00:04:39,457 --> 00:04:44,103 maximum values that this is the biggest output of the function. 61 00:04:44,103 --> 00:04:48,785 What I'm saying is that any other output isn't larger than f(c), 62 00:04:48,785 --> 00:04:53,368 f(c) is bigger than or equal to any other output of the function and the same deal 63 00:04:53,368 --> 00:04:56,968 for this global minimum. I'm not saying this is the smallest 64 00:04:56,968 --> 00:05:01,658 output of the function, I'm just saying that any other output is bigger than or 65 00:05:01,658 --> 00:05:05,422 equal to this output. Now we can see some examples of this. 66 00:05:05,422 --> 00:05:09,452 Of this. Here's that same graph we've been looking 67 00:05:09,452 --> 00:05:14,302 at so many times here. Let's try to figure out where the local 68 00:05:14,302 --> 00:05:18,062 extrema are. this point here is a local maximum, 69 00:05:18,062 --> 00:05:22,747 that's the biggest output value for nearby input values. 70 00:05:22,747 --> 00:05:28,552 This point here is a local minimum, right? You're sitting in that valley, 71 00:05:28,552 --> 00:05:34,427 that's the smallest output valley among nearby inputs. And, up here is another 72 00:05:34,427 --> 00:05:38,917 local max and this local maximum is also a global maximum. 73 00:05:38,917 --> 00:05:44,682 I mean, if you're really assuming that this graph just continues down to the 74 00:05:44,682 --> 00:05:48,976 left and the right-hand sides, you should also note that if you really 75 00:05:48,976 --> 00:05:53,449 believe this thing continues down like this, this function has no global 76 00:05:53,449 --> 00:05:56,394 minimum. Nobody's promising you that there is a 77 00:05:56,394 --> 00:06:00,645 global minimum or a global maximum, but in this case, there isn't one. 78 00:06:00,645 --> 00:06:06,465 There's no global minimum. There can definitely be multiple local 79 00:06:06,465 --> 00:06:10,050 maximums, but there can also be multiple global 80 00:06:10,050 --> 00:06:13,937 maximums. So here, I've drawn another graph, where 81 00:06:13,937 --> 00:06:18,210 I've rigged it so that these two output values are the same. 82 00:06:18,210 --> 00:06:24,840 So these are both local maximums, but they're also both global maximums. 83 00:06:24,840 --> 00:06:31,300 Alright? So in this case, these are both global and also local maximums. 84 00:06:31,300 --> 00:06:36,498 There's even more, dare I say it, extreme version of this. 85 00:06:36,498 --> 00:06:44,620 Here, I've graphed the constant function y=17 is both a global maximum and a 86 00:06:44,620 --> 00:06:48,236 global minimum for this constant function. 87 00:06:48,236 --> 00:06:55,071 The distinction between local and global maximums is really quite important, even 88 00:06:55,071 --> 00:06:59,966 in everyday life. When you're standing at a local maximum, 89 00:06:59,966 --> 00:07:05,594 on the top of this mountain, small changes to your situation just make 90 00:07:05,594 --> 00:07:09,989 things worse, and yet, if you're willing to go through 91 00:07:09,989 --> 00:07:16,238 this valley, you'll eventually come up here to what at least appears to be to 92 00:07:16,238 --> 00:07:19,712 global maximum of this function. 93 00:07:19,712 --> 00:07:22,868 [MUSIC]