[music] Why do critical points have to include places where the function fails to be differentiable? Here's a specific example that we can work through to see why it's necessary to check points of non-differentiability. You'll notice that I've included some absolute value brackets to introduce some non-differentiability, okay? Anyway, here's the problem. Find maximum and minimum values of this function. X minus the absolute value of x squared minus 2 x, and do it on the interval between 0 and 3. Well, how do I proceed? Let's differentiate, okay? So, I differentiate f prime is, well, the derivative of x is 1 minus the derivative. Okay, whoa, wait, what am I going to do about differentiating this absolute value? I can rewrite this function as a piece wise function, getting rid of the absolute value. So, here's the original function where I got an absolute value, and remember what absolute value does. Absolute value negates this input if the input's negative, right? So, the absolute value guarantees that it's output is positive with the same magnitude as the original input. So all I've got to do to rewrite f as a piece-wise function is to deal with that, right? I've just got to make sure that if this input is negative, then I better flip the sign, the sign of the absolute value. Now, I want to know the derivative of this function and I can compute that by just differentiating each piece in my piece-wise define function. So, here I go. I'm going to differentiate these two pieces separately. So, the derivative of f is also now a piece-wise function and I should differentiate this. The derivative of x is 1 minus the derivative of this which is 2 x, that's the derivative of x squared, and the derivative of 2 x is just 2. And this is if x squared minus 2 x. So, bigger than zero. And the derivative of this is 1 plus the derivative of this, which is 2 x minus 2. And this is if x squared minus 2 x is less than zero. And you'll notice that I'm careful to change the greater than or equal to here to just greater than. And the reason is because this derivative is not going to be defined when this quantity is equal to 0. Now, it is time to hunt for critical points. So, to simplify our hunt for the critical points, I can rewrite f prime a little bit to make it a little bit easier to see what's going on. So, what can we do here? Well, 1 minus 2 x minus 2, that's the same thing as three minus 2 x and 1 plus 2 x minus 2. That's the same thing as minus 1 plus 2 x. Alright, and then I can rewrite this x squared minus 2 x greater than 0, and x squared minus 2 x less than 0. To say that x squared minus 2 x is bigger than 0 is the same as saying that x is less than 0, or x is bigger than 2, and to say that this is less than 0 is just to say that x is trapped between 0 and 2. Alright, now that I've got this nicer way of writing the derivative I can very visibly see that something terrible is happening when, when x is equal to 2. Because if this thing were differentiable there, you'd expect this quantity and this quantity to agree when x equals 2. But these things disagree when x is equal to 2, alright? So, this function ends up not being differentiable at 2. Where is this thing equal to zero? Well, 3 minus 2x would vanish if x were 3 halves. But 3 halves doesn't satisfy this. So, this first thing never results in a critical point where the derivative vanishes. What about this? What about minus 1 plus 2 x? Well, this is equal to 0 if x is equal to a half. And that is in this region. So here, what we know the derivative is equal to 0 if x is equal to a half and the function's not differentiable when x is equal to 2. Well, a function's also not differentiable when x is equal to zero. But remember, the end points of our interval that we're considering are 0 and 3. So, if you like, you can include 0 as a point of non-differentiability. But, it's in this list of end points so we're going to have to consider it anyhow. Note that there's something really special in this particular example. I really want to emphasize that 2 is a critical point not because the derivative is equal to 0, but because the function is not differentiable at the .2. So, to finish off this problem, to find the minimum and maximum values of my function f, all I have to do is check the critical points and the endpoints. So, here's our endpoints, 0 and 3, a place where the derivative vanishes when x is equal to 1 half and a place where the derivative is not defined when x is equal to 2. And where were the original function is? Alright, f of x is x minus the absolute value of x squared minus 2 x. So, what do we get when I plug in 0? I just get 0. And when I plug in 3, I also get 0, right? 3 minus, well, 3 squared is 9 minus 2 times 3, that's 9 minus 3, that's 3. 3 minus 3 is also 0. When I plug in 1 half, I get minus a quarter. And when I plug in 2, I get 2. So, I've got my table. Where is the maximum and where is the minimum? So, the minimum value is here, when x is equal to 1 half, the functions minimum value is minus quarter. And the maximum value is when x is equal to 2, the function's output is 2. Had I not been careful to include x equals 2, the point where the function fails to be differentiable,. I would have totally missed out on finding the maximum value of this function. It's really easy to see why this is so important by taking a look at a graph. We'll use the graph of this function x minus absolute value of x squared minus 2 x on the intervals 0 to 3. And you can see the minimum value occurs when x is equal to 1 half and the maximum value occurs when x is equal to 2. And that point really is a place where the function's not differentiable. I mean, that's exactly why I see a corner there. The upshot here is that a point of non-differentiability, a place where the function fails to be differentiable could very well be where the maximum value occurs. You can think of calculus as a maximum finding machine and you're trying to find those maximum values. So, if Calculus fails you at some place, if the maximum finding machine is broken for some particular input, that could very well be where the maximum value is hiding. So, you're going to need to check there.