In this section, we will study optimization subject to constraints. For example, suppose we would like the find the maximum value of subject to the constraint . We can think of this as restricting ourselves to the line , and finding the maximum value of over this line.

These types of problems often arise in real-world applications: you have some limitation on resources, which provide the constraint, and want to optimize some sort of performance. A classical problem from geometry and single variable calculus is to maximize the area of a rectangle, subject to the constraint that the perimeter is . Setting up the problem algebraically, this is equivalent to finding the maximum value of subject to the constraint . In single variable calculus, we could solve for in the second equation, and use this to reduce the objective function, , to a single variable function, which we would them optimize. That is, from , we would have

Differentiating , we get So, we have when . The second derivative of is , so has a local maximum at . Since is continuous on all of and has only one critical point, this means that has an absolute maximum at . So, the maximum value of is

For optimization subject to a constraint for multivariable functions in general, we’ll follow a similar process: use the constraint to make a substitution, and then optimize the resulting function. However, we’ll soon see that this can be much more complicated than it was in the single variable case, and it requires paying careful attention to constraints and domains.

Optimization with Constraints

Let’s consider a higher dimensional version of the problem from the introduction. That is, let’s try to find the maximum value of subject to the constraint that . Taking the constraint and solving for , we have . Using substitution, we can reduce the function to a function of two variables,

So, we’d like to optimize . In order to do this, we’ll find the critical points of . For this, we first find the gradient of . Solving , we find two critical points: and . Let’s use the Hessian matrix of to determine the behavior of at these critical points. At , the Hessian matrix is This corresponds to the quadratic form , which is indefinite. So, has a saddle point at .

At , the Hessian matrix is Using Sylvester’s Theorem, this matrix is negative definite. So, has a local maximum at . But does this mean that has an absolute maximum at ? Let’s look at the graph of to investigate.

We see that actually doesn’t have any absolute maximum (or minimum) - it’s values get arbitrarily large, and arbitrarily small. So, here we see an example where the multivariable situation is more nuanced than the single variable situation. Often, it will be difficult to determine if multivariable functions have absolute extrema using the methods that we’ve covered so far. However, in the case where we’re optimizing a continuous function over a compact region, we know that absolute extrema exist. Because of this fact, we will focus most of our attention on this special situation.

With that in mind, let’s consider a revised version of our previous problem.

We’ll now look at another example where optimizing a multivariable function subject to a constraint using substitution is deceptively difficult.

The moral of this section is: weird things can happen with multivariable functions, and you need to be very careful with constraints.