 In single variable calculus you solve what are known as constrained optimization problems. These consisted of some constraint and an objective function. If we view the constraint as a function of two variables then the specific constraint is going to be a level curve. Now calculus problems are written by a secret cabal of mathematicians whose ranks include the following. There is no secret cabal of mathematicians. And this cabal ensures that every calculus tax has some version of the problem where we want to enclose a rectangular field with a certain amount of fencing and maximize the area. So the fencing forms the perimeter of the field and so we have a formula that will give us the perimeter given the length and width and that's really a function of two variables. And since there is 240v fencing the perimeter must be 240. And so we want the level curve or in function notation p of x, y is equal to 240. As the next example illustrates these constraint functions are not necessarily unique. So for example we have our coffee shop problem where we have the number of customers given as a function of the price. That already is a relationship of two variables. So all we're going to do is put all of our variables on one side of the equals and we can view the right hand side as a function of two variables and the constraint is going to be the level curve c of x, y equal to zero. There are other possibilities and the only thing that's actually important here is that all of our variables are on one side of the equality. So I can take my equation and rearrange it and again I want the variable portion to be my function of two variables and this time the constraint corresponds to the level curve f of x, y equals 5,000. So let's think about optimization. Suppose we want to maximize an objective function l of x, y subject to the constraint f of x, y is equal to c. Now f of x, y equal to c is some curve in the plane. Suppose my objective function l of x, y is equal to m. This is also a curve in the plane. Now if the two curves intersect at some point this corresponds to the following. First it's a point that meets the constraint because it's on the level curve f of x, y equals c. We say that this is a feasible value. It's also a point that makes the objective function equal to m because it's on the curve l of x, y equal to m. For example suppose we want to show that f of x, y equals x, y can have value 4 on x squared plus y squared equals 16 and could f of x, y have a value greater than 4 on the curve. So let's think about this. The function f of x, y equals x, y will have value 4 everywhere on x, y equal to 4. So we graph x squared plus 2, y squared equals 16 and also graph x, y equal to 4. And since they intersect at several points there are points on x squared plus 2, y squared equals 16 where the product is equal to 4. So could f of x, y equals x, y have larger values on the graph of x squared plus 2, y squared equals 16? Well let's consider the graph of x, y equals 5 and the thing to see here is that this graph also intersects our curve. So f of x, y could be 5 on the graph of x squared plus 2, y squared equals 16. And in fact we can get even larger values of f of x, y equals x, y until the graph of x, y equals n is cotangent to our curve. This suggests an important general approach. Suppose we want to maximize some objective function l of x, y subject to some constraint f of x, y equals c. We want to find a value of m where the level curve l of x, y equals m and the level curve f of x, y equals c are cotangent. And except for the appropriate adjustment to what we mean by tangent this approach also works if we have functions of 3, 4 or 5,000 variables. For example, let's let f of x, y again equal our product x, y. Let's find a value of m so that f of x, y equals m. That's one level curve and x squared plus 2, y squared equals 16. That's another level curve, our cotangent. So it helps if we know what the tangent line looks like and so let's find the slope of the tangent line. We can find the slope of the line tangent to the graph of x squared plus y squared equals 16 by implicit differentiation. And so at any point on this graph we know the slope of the tangent line. We also want to find m so that f of x, y equals m is cotangent. Well again, we'd like to know something about the tangent line and we can find the derivative using implicit differentiation. And it's worth noticing that the value of m doesn't matter. And so if f of x, y equals m, the tangent to the level curve will be dy dx equals negative y over x. Now if we want the curves to be cotangent, first of all we need to make sure that the tangent lines have the same slope. So we want the derivatives to be equal. So this gives us minus x divided by 2y equals minus y divided by x. Now this only gives us one equation but we have two unknowns so we need a second equation. Now remember that since we want the point to be cotangent it actually has to be on both curves. Since we have to be on the ellipse we also require x squared plus 2y squared equals 16. And now we have two equations we can solve. Let's go ahead and take this first equation and multiply to eliminate those fractions and solve. Now since we are restricting ourselves to being cotangent in the first quadrant the geometry requires x to be greater than 0. So we take the positive solution. Again we have to be on the curve x squared plus 2y squared equals 16. So once we know the x value we can compute the y value. And again since we're looking in the first quadrant we'll just take the positive y value. And we find the two graphs will be cotangent at square root of 8, 2. And finally we want to find the value of our objective function xy and so at this point f of xy is equal to 2 square root of 8.