[MUSIC] If we care about extreme values, it would really help to know how to find them. We can use a theorem, a theorem of Fermat. Here's Fermat's theorem. Suppose f is a function and it's defined on the interval between a and b. c, is some point in this interval, this backwards e, means that c is in this interval. Okay, so that's the set up. Here's Fermat's Theorem. If f(c) is an extreme value of the function f, and the function is differentiable at the point c, then the derivitive vanishes at the point c. It's actually easier to show something slightly different. So, instead of dealing with this, I'm going to deal with a different statement. Same setup as before, but now I'm going to try to show that if f is differentiable at point c and the derivative is nonzero, then f(c) is not an extreme value. It's worth thinking a little bit about the relationship between the original statement where I'm starting off with the claim that f(c) is an extreme value and then concluding that the derivative vanishes. And here, I'm beginning, by assuming the derivative doesn't vanish and then concluding that f(c) is not an extreme value. This is the thing that I want to try to prove now. Why is that theorem true? I'm going to get some intuitive idea as to why this is true. Why is it that if you differentiable a point c with nonzero derivative there, then f(c) isn't an extreme value? Well, to get a sense of this, let's take a look at this graph. Here, I've drawn a graph of some random function. I've picked some point and f'(c) is not zero. Differentiable there, but the derivative's nonzero. It's negative. Now, what does that mean? That means if I wiggle the input a little bit, I actually do affect the output. If I increase the input a bit, the output goes down. If I decrease the input a bit, the output goes up. Consequently, that can't be an extreme value. That's not the biggest or the smallest value when I plug in inputs near c, and that's exactly what this statement is saying. If the derivative is not zero, that means I do have some control over the output if I change the input a little bit. That means this output isn't an extreme value because I can make the output bigger or smaller with small pervations to the input. I'd like to have a more formal, a more rigorous argument for this. So, let's suppose that f is differentiable at c, and the derivative is equal to L, L some nonzero number. Now, what that really means from the definition of derivative is that the limit of f(c+h)-f(c)/h as h approaches zero is equal to L. Now, what does this limit say? Well, the limit's saying that if h is near enough zero, I can make this difference quotient as close as I like to L. In particular, I can guarantee that f(c+h)-f(c)/h is between 1/2L and 3/2L. Notice what just happened. So, I started with infinitesimal information. I'm just starting with a limit as h approaches zero. And I've promoted this infinitesimal information to local information. Now I know that this difference quotient is between these two numbers as long as h is close enough to zero. Now, we can continue the proof. So, I know that if h is close enough to zero, this difference quotion is between 1/2L and 3/2L, I'm going to multiply all this by h. What do I find out then? Then, I find out that if h is near enough zero, multiplying all this by h, I find that f(c+h)-f(c)/h*h is between 1/2hL and 3/2hL. I get from here to here just by multiplying by h. Now, what can I do? Well, I can add f(c) to all of this. And I'll find out that if h is near enough zero, then f(c+h) is between 1/2hL+f(c) and 3/2hL+f(c). Okay. So, this is what we've shown. We've shown that if h is small enough, f(c+h) is between these two numbers. Now, why would you care? Well, think about some possibilities. What if L is positive? If L is positive and h is some small but positive number, this is telling me that f(c+h), being between these two numbers, f(c+h) is in particular bigger than f(c). That means that f(c) can't be a local maximum. Same kind of game. What if L is positive but I picked h to be negative but real close to zero. Then, f(c+h) being between these two numbers, f(c+h) must actually be less than f(c). That means that f(c) can't be a local minimum. You play the same game when L is negative. Let's summarize what we've shown. So, what we've shown is this. We've shown that if a differentiable function has nonzero derivative at the point c, then f(c) is not an extreme value. And we can play this in reverse. That means that if f(c) is a local extrema, right? If f(c) is an extreme value, then either the derivative doesn't exist to prevent this first case from happening, where f is differentiable at c, or the derivatives equal to zero, which prevents this second thing, f'(c) being nonzero. So, this is another way to summarize what we've done. If f(c) is a local extremum, then one of these two possibilities occurs. Both of these possibilities do occur. Here's the graph of the absolute value function. There's a local and a global minimum at the point zero. The derivative of this function isn't defined at that point. Here's another example. Here's the graph of y=x^2. This function also has a local and a global minimum at the point zero. Here, the derivative is defined but the derivative is equal to zero at this point. We'll often want to talk about these two cases together, the situation where the derivative doesn't exist and the situation where the derivative vanishes. Let's give it a name to this phenomenon. Here we go. If either the derivative at c doesn't exist, meaning the function's not differentiable at c, or the derivative is equal to zero, then I'm going to call the point c a critical point for the function f. This is a great definition because it fits so well into Fermats theorem. Here's another way to say Fermot's Theorem. Suppose f is a function as defined in this interval and c is contained in there, then if f(c) is an extreme value of f, well, we know that one of two possibilities must occur. At that point, either the function's not differentiable, or the derivative's equal to zero. And that's exactly what we mean when I say that c is a critical point of f. So, giving a name to this phenomena gives us a really nice way of stating Fermat's Theorem. The upshot is that if you want to find extreme values for a function, you don't have to look everywhere. You only have to look at the critical points where the derivative either doesn't exist or the derivative vanishes. and you should probably also worry about the end points. In other words, if you're trying to find rain, you should just be looking for clouds. You just have to check the cloudy days to see if it's raining. In this same way, if you're looking for extreme values, you only need to look for the critical points because an extreme value gives you a critical point. So, this is a super concrete example. Here's a function, y=x^3-x. I've graphed this function. I'm going to try to find these local extrema, this local maximum and this local minimum, using the machinery that we've set up. So, if I'm looking for local extrema, I should be looking for critical points. So, here's the function, f(x)=x^3-x. I'm looking for for critical points in this function. Those are points whose derivative doesn't exist, function is not differentiable, or the derivative vanishes. But this function is differentiable everywhere. Its derivative is 3x^2-1. So, the only critical points are going to be where the derivative is equal to zero, right? I'm looking for solutions to 3x^2-1=0. I'll write one to both sides, 3x^2=1, so I am trying to solve. I'll divide both sides by 3, x^2=1/3. So, I am trying to solve. Take the square root of both sides. x is plus or minus the square root of a third, which is about 0.577. And that let's me find these critical points, right? These are places where the derivative is equal to zero. The tangent line is horizontal and now I know the x coordinate of these two red points. Here, are the x coordinates about 0.577, and here the x coordinate is -0.577, about.