If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains ***.kastatic.org** and ***.kasandbox.org** are unblocked.

Main content

Current time:0:00Total duration:6:29

hey everyone so in the next couple videos I'm going to be talking about a different sort of optimization problem something called a constrained optimization problem and an example of this is something where you might see you might be asked to maximize some kind of multi variable function and let's just say it was the function f of X y is equal to x squared times y but that's not all you're asked to do you're subject to a certain constraint where you're only allowed values of x and y on a certain set and I'm just going to say the set of all values of x and y such that x squared plus y squared equals 1 and this is something you might recognize as the unit circle this particular constraint that I've I've put on here this is the unit circle so one way that you might think about a problem like this you know you're maximizing a certain two variable function is to first think of the graph of that function that's what I have pictured here is the graph of f of X y equals x squared times y and now this constraint x squared plus y squared is basically just a subset of the xy-plane so if we look at it head-on here and we look at the xy-plane this circle represents all of the points X Y such that this holds and what I've actually drawn here isn't isn't the circle on the XY plane but I've projected it up on to the graph so this is showing you basically the values where this constraint holds and also what they look like when graphed so a way you can think about a problem like this is that you're looking on this circle this kind of projected circle onto the graph and looking for the highest points and you might notice kind of here there's sort of a a peak on that wiggly circle and over here there's another one and then the low points would be you know around that point and around over here now this is good and I think this is a nice way to sort of wrap your head around what this problem is asking but there's actually a better way to visualize it in terms of finding the actual solution and that's to look only in the XY plane rather than trying to graph things and just limit up affective to the input space so what I have here are the contour lines for f of X y equals x squared plus y squared and if you're unfamiliar with contour lines or a contour map I have a video on that you can go back and take a look it's going to be pretty crucial for the next couple videos to have a feel for that but basically each one of these lines represents a certain constant value for F so for example one of them one of them might represent all of the values of x and y where f of XY is equal to you know two right so if you looked at all the values of x and y where this is true you'd find yourself on one of these lines and each line represents a different possible value for what this constant here actually is so what I'm going to do here is I'm actually going to just zoom in on one particular contour line right so this here is something that I'm going to vary where I'm going to be able to change what the constant we're setting F equal to is and look at how the contour line changes as a result so for example if I put it around here ish what you're looking at is the contour line the contour line for f of X y equals zero point one so all of the values on these two blue lines here tell you what values of x and y satisfy zero point one but on the other hand I could also shift this guy up and maybe I'll shift it up I'm going to set it to where that constant is actually equal to one so that would be kind of an alternative I'll just kind of separate over here that would be the line where f of X Y is set equal to one itself and the main thing I want to highlight here is that at some values like zero point one this contour line intersect with the circle it intersects with our constraint and let's just think about what that means if there's a point x and y on that intersection there that basically gives us a pair of numbers x and y such that this is true that fact that f of x y equals zero point one and also that x squared plus y squared equals one so it means this is something that actually exists and is possible in fact we can see that there's four different pairs of numbers where that's true where they intersect here where they intersect over here and then the other two kind of symmetrically on that side but on the other hand if we look at this other world where we shift up to the line f of X y equals 1 this never intersects with the constraint so what that means is XY the pairs of numbers that satisfy this guy are off the constraint they're off of that circle x squared plus y squared equals 1 so what that tells us as we try to maximize this function subject to this constraint is that we can never get as high as 10.1 would be achievable and in fact you know if we kind of go back to that and we look at 0.1 if I upped that value and you know changed it to the line where instead what you're looking at is 0.2 that's also possible because it intersects with the circle in fact you know you could play around with it and increase it a little bit more and if I go to 0.3 instead and I go over here and I say 0.3 that's also possible and what we're basically trying to do is find the maximum value that we can put here the maximum value so that if we look at the line that represents f of X y equals that value it still intersects with the circle and the key here the key observation is that that maximum value happens when these guys are tangent and in the next video I'll start going into the details of how we can use that observation this notion of tangency to solve the problem to find the actual value of x and why it maximizes this subject to the constraint but in the interim I kind of want you to mole on that and think a little bit about how you might use that what is tangency mean here how can you take advantage of certain other notions that we've learned about in multivariable calculus like hint hint the gradient to actually solve something like this so with that I will see you next video