 Suppose we want to maximize some objective function l of x, y subject to a constraint f of x, y equals c. We want to find some constant m, so the graph of f of x, y equals c, and the graph of l of x, y equals m meet in one point. If the graphs are smooth, which is to say they have no corners or gaps, this means that the curves are cotangent. Since m is a constant, the slope of the tangent line to l of x, y equals m does not depend on m. And while we could find the derivatives and compare them, is there an easier way? We can find this easier way by looking at things from a higher dimensional perspective. Suppose our objective function is l of x, y, and our constraint is f of x, y equals c. We can view f of x, y equals c as the z equals c level curve of the graph of the surface z equals f of x, y. Now consider this surface z equals l of x, y minus m. If the level curve c equals l of x, y minus m intersects the level curve f of y, x, y equals c, any intersection point is on f of x, y equals c, so it satisfies the constraint. It also has l of x, y minus m equals c, so it gives the objective function the value l of x, y equal to m plus c. Now suppose our level curves aren't cotangent. Then increasing or decreasing m to some other value m prime will change our level curve to l of x, y minus m prime equals c. And just as before, any intersection points will also satisfy the constraint equation and correspond to an objective function value of m prime plus c. And what this means is that if our level curves aren't cotangent, higher and lower values of the objective function will be possible. So if there's any possibility a point corresponds to an extreme value of the objective function, the two curves must be cotangent. Now we could find when two curves are cotangent by using implicit differentiation to find the derivatives, then equate them. But if they're cotangent, their normals are the same, and they can find the normal vector using the gradient. And so this suggests the following approach. To make the level curves f of x, y equals c and g of x, y equals c cotangent will make their normals the same. But we can find the normal vector using the gradient. And so we want the gradient of f to be the gradient of g. But since the gradient is a vector, two vectors can point in the same direction without being equal. We have to allow for the possibility that one is a scalar multiple of the other. And so we really want the gradient of f to be lambda times the gradient of g. We could also have lambda gradient of f equals gradient of g. The constant lambda is called a Lagrange multiplier named after an 18th century mathematician who would probably have been the most important mathematician of the 18th century if he didn't have an older contemporary in Euler and a younger contemporary in Laplace. Now before we go any further we do have to add in some boilerplate. All this holds as long as our curves are smooth. This also holds if the curves have cusps or corners geometrically. However, since the derivatives fail to exist at a cusp, the equation that we're solving, the gradient of f equals lambda times the gradient of g, might be unsolvable. We'll worry about those cases separately and focus first on the case where our curves are smooth and differentiable.