Optimization intuition: Worked example continued Right, so this over here is an example. There are no critical points for this graph.We've seen lots of functions have no critical points.A critical point is a point on a curve where the tangent line is horizontal, meaning itdoes not change direction. There are no critical points for this function, and so themaximum is on the boundary of the interval. To find the maximum on the boundary,we check each boundary point individually and determine whether it is one of manylocal maxima or if it is indeed the global maximum. There are three edges. Let's consider one at a time. First, let's think about the topedge. The top edge is a horizontal line; y equals 2 and x goes from 0 to 2—that isthe edge. Now we want to consider this function on the top edge. So f of x—if we'reon the top edge, y equals 2, so we're thinking about f of (x, 2). And then let's plug inwhat that is: 2x minus x squared minus 2, and x goes from 0 to 2.
To maximize this function, we must find the x-value that yields the largest output.Such a task can be accomplished through a simple calculus operation. We know thatthis graph is always negative and so the maximum occurs at -2.So the question was: what does one do with this diagonal edge where y is equal tox? But we're going to do the edges one at a time, and so first we're just going to thinkabout the top edge. Conclusion: maximum of f on top edge is negative 1. The region R is the red triangle there, and all the level curves of our function f passthrough that region. We'll be looking at the biggest value of f on the top edge, whichruns from x equals 0 over here to x equals 2 over there. On that top edge we first gothrough the negative 2 level curve, but then as we keep going, f increases up tonegative 1.5 and then goes back down towards negative 1.5 again before goingthrough it one final time for good.
Let's consider the diagonal edge.The top edge is straightforward to draw,and the leftedge is also fairly easy. So the function starts at 0, then it gets positive, and then itgoes back to 0, and then it gets negative. The maximum is going to be somewhere inhere—probably about in the middle, which would be over there. But now, how do wecompute the thing? Well, we have the diagonal edge. How can we describe thisdiagonal edge? It's the line y equals x; x is still going from 0 to 2.And we want to understand the relationship between y and x. We're thinking about ywhen x equals 2, and since y equals x, we can substitute 2 for x in the formula for y.That's 2x minus x squared minus y. But that's x, so we have that. And then thatsimplifies to x minus x squared. The function is maximized at the point (x, x) when x goes from 0 to 2. To find thispoint, we must first find the derivative of the function and set it equal to zero. In thisgraph, the x-axis ranges from 0 to 2, while the y-axis ranges from -1 to 1. Thequadratic function that best fits this curve is f(x, x) = x2 - x2. The maximum value ofthis function occurs at (1/2, 0), which is also the minimum value of the function.The maximum of f on the diagonal edge is 1/4. To finish the problem, you take allthree edges, find the maximum on each edge, and the biggest of those would be themaximum. We didn't actually do the left edge, but it turns out not to be the winnerbecause we can see from the picture that the diagonal wins. So the maximum of f is1/4.