advertisement

MITOCW | MIT18_01SCF10Rec_20_300k CHRISTINE Welcome back to recitation. BREINER: Today we're going to work on an optimization problem. So the question I want us to answer is, what point on the curve y equals square root of x plus 4 comes closest to the origin? I've drawn a sketch of this curve. The scale in this direction-- each hash mark is one unit in the x direction, each hash mark here is one unit in the y direction. Just want to point out two easy places to figure out the distance to the origin. Over here, where the curve starts at negative 4, 0, the distance to the origin is 4 units. And here at (0, 2) the distance to the origin is two units. It's probably, we could safely say, further away here. So we're anticipating that somewhere along the curve in this region is where we should find our place that's closest to the origin. The only reason I point that out is that, when you're doing these problems on your own you should always try and anticipate roughly where things should happen, in what kind of region, so that you don't-- you don't start thinking, if you do something wrong and you get x equals 100 and then you come back and look at the curve, you realize right away, well, that doesn't make any sense. So we want to always be thinking as we're solving the problems, does my answer make sense? So I'm actually going to give you a little bit of time to work on this yourself and then I'll come back and I'll work on it as well. Welcome back. Hopefully you were able to get pretty far into this problem. And so I will start working on it now. So again, the question is that we want to optimize-- in this case, minimize-- the distance to the origin from this curve. And so what we're really trying to do is we have a constraint, the constraint is we have to be on the curve, and then we also have something we're trying to minimize. And the thing we're trying to minimize is distance. And so we have to make sure that we understand the two equations that we need-- the optimization, or the constraint equation, and the optimizing equation. So to optimize we need to know how to measure distance in two-dimensional space. And one point I want to make is that if you want to optimize distance you might as well optimize the square of distance because it's much easier. So let me justify that briefly and then we'll go on. So I want to optimize the distance squared to the origin. It's, well distance, you remember, first in general, between two points (x, y) and (a, b) is something in this form. Distance squared is the difference between the x-value squared plus the difference between the y-value squared. This is, should remind you of the Pythagorean theorem, ultimately. So in this case, in our case, distance to the origin is x squared plus y squared. The distance squared is x squared plus y squared. I just told you that instead of trying to optimize distance, we can optimize distance squared. Why is that? Well, remember that when you optimize, what you're looking for is a place where the derivative of the function of interest is equal to 0. So what I want to point out is that when you take the derivative of distance squared and find where that's 0, it's going to be the same as the place where the derivative of distance is equal to 0. So let's notice that. So this is a little sidebar justification. Notice d squared prime is equal to 2d d prime. Where did that come from? That's this is implicit differentiation with respect to x and this is the chain rule. So if I want d prime to equal 0, I can also find where d squared prime equals 0. I'm assuming-- notice the distance is never at the origin-- so distance is never 0. So I don't have to worry about that. So that's a small sidebar, but just to justify why we can do that. Now let's come back into the problem at hand. What is our optimization problem, equation that we want to minimize? We want to minimize this equation with respect to a certain constraint. What's the constraint? The constraint is what y is. y depends on x. And so when I solve these problems I'm going to have to substitute in my constraint. So y squared is the square root of x plus 4 quantity squared, so I just get x plus 4. So now I have my optimization equation. How do I find a minimum or a maximum? I take the derivative and set it equal to 0. So let me come give myself a little more room and do that over here. So d squared prime, now I get derivative of x squared is 2x. The derivative of x is 1, and the derivative of 4 is 0. This will be optimized when this is equal to 0. So 0 equals 2x plus 1. So x is equal to minus 1/2. Does this pass, as we would say maybe, the smell test? Does it smell OK to us? The answer will be yes. Because remember, we said somewhere in this x region is where we expect that we will have a distance closest, point closest to the origin. And so we're right here on the x value. Now we have to find what the y value is to finish the problem. But this is not, so far, very surprising. It seems like maybe the right thing. Now we have x. So now how do we find y? Well, we know what y is. y is equal to the square root of x plus 4, so it's equal to the square root of negative 1/2 plus 4, which simplified is 3 and 1/2, which I think is 7/2. So the point is negative 1/2 comma square root of 7/2. And then you just want to double check and make sure, did I ask for the distance or did I ask for the point? And right now we have the point, so let's come over and make sure what point on the curve comes closest to the origin. So now we know that we've answered the correct question. So again, it was a maximize-- sorry, it was a minimizing problem. It was an optimization problem where we wanted to minimize distance. We had a constraint equation. We had the thing we wanted to minimize. And then we took the derivative of the minimizer, set it-- of the optimizing equation, set it equal to 0, solved for x, and then found the answer to the specific question by then finding the y-value. And I think I'll stop there.