Chapter 19. Optimization problems

Now that we understand both critical points of 𝑓 and regions ℛ︀, we turn our attention to the problem of finding global minimums and maximums.

§19.1 [TEXT] The easy and hard cases

Suppose you have a function 𝑓:ℝ𝑛→ℝ that you can compute ∇𝑓 for, and a region ℛ︀. We’re going to distinguish between two cases:

We won’t cover the case where ℛ︀ has dimension 𝑛−2 or less in 18.02 (i.e. two or more constraints), although it can be done.

§19.2 [RECIPE] The easy case

Recipe for optimization without Lagrange Multipliers

Suppose you want to find the optimal values of 𝑓:ℝ𝑛→ℝ over a region ℛ︀, and ℛ︀ has dimension 𝑛.

  1. Figure out the boundary and limit cases for the region ℛ︀. (You don’t need to look at 𝑓 for this step.)
  2. Evaluate 𝑓 on all the critical points of 𝑓 in the region ℛ︀.
  3. Evaluate 𝑓 on all the boundary points of 𝑓 in the region ℛ︀.
  4. Evaluate 𝑓 on all the limit cases of 𝑓 in the region ℛ︀.
  5. Output the points in the previous steps that give the best values, or assert the optimal value doesn’t exist (if points in step 3 do better than steps 1-2).

If there are any points at which ∇𝑓 is undefined, you should check those as well. However, these seem to be pretty rare for the examples that show up in 18.02.

Warning: Don’t underestimate the boundary!

In 18.01, you probably only optimized functions over intervals 𝐼=[𝑎,𝑏], in which case the boundary was just two inputs 𝑎 and 𝑏. In 18.02, the situation is completely different: the boundary (if it is nonempty) will often have infinitely many points. So it can take a lot of work to do the boundary case! Don’t underestimate the possible complexity of Step 2.

In particular, Step 2 might even require you to use Lagrange multipliers, i.e. that one step of the easy case is an entire instance of the hard case. For that reason, the naming “easy case” and “hard case” is a bit of a misnomer.

We’ll start with an example with no boundary for which the limit cases are easy to examine, so Step 2 and Step 3 are mostly harmless. Later on we’ll do more examples where Step 2 and Step 3 are more intricate.

Sample Question

Compute the minimum and maximum possible value, if they exist of

𝑓(𝑥,𝑦)=𝑥+𝑦+8𝑥𝑦

over 𝑥,𝑦>0.

Solution. The region ℛ︀ is the first quadrant which is indeed two-dimensional (no = constraints), so we’re in the easy case and the recipe applies here. We check all the points in turn:

  1. ℛ︀ has no boundary and limit cases when any variable approaches 0+ or +∞.

  2. To find the critical points, calculate the gradient

    ∇𝑓(𝑥,𝑦)=(1−8𝑥2𝑦1−8𝑥𝑦2)

    and then set it equal to (00). This gives us the simultaneous equations

    1=8𝑥2𝑦=8𝑥𝑦2.

    This implies 𝑥2𝑦=𝑥𝑦2 or 𝑥=𝑦 (we have 𝑥,𝑦>0 in ℛ︀, so we’re not worried about division by zero) and so the only critical point is (𝑥,𝑦)=(2,2).

  3. The region ℛ︀ has no boundary, so there are no boundary points to check.

  4. The region ℛ︀ has four different kinds of limit cases:

    • 𝑥→0+
    • 𝑦→0+
    • 𝑥→+∞
    • 𝑦→+∞.

    In fact all four of these cases cause 𝑓→+∞. In each of the first two cases, the term 8𝑥𝑦 in 𝑓 causes 𝑓→+∞. In the case 𝑥→∞, the term 𝑥 causes 𝑓→+∞. In the case 𝑦→∞, the term 𝑦 causes 𝑓→+∞.

Putting these together:

□

§19.3 [TEXT] Lagrange multipliers

Let 𝑓:ℝ𝑛→ℝ be a function we’re optimizing over some region ℛ︀. We now turn to the case where ℛ︀, is dimension 𝑛−1, because of a single constraint of the form 𝑔(𝑥,𝑦)=𝑐 or 𝑔(𝑥,𝑦,𝑧)=𝑐.

We need a new definition of critical point. To motivate it, let’s consider a particular example in Figure 40. Here 𝑛=2, and

Trying to optimize 𝑓 subject to 𝑔(𝑥,𝑦)=𝑐 in this picture is the same as finding the points on the level curve which are furthest or closest to the origin. I’ve marked those two points as 𝑃 and 𝑄 in the figure. The trick to understanding how to get them is to also draw the level curves for 𝑓 that pass through 𝑃 and 𝑄: then we observe that the level curves for 𝑓 that get those minimums and maximums ought to be tangent to 𝑔(𝑥,𝑦)=𝑐 at 𝑃 and 𝑄.

Figure 40: An example of a LM-type optimization problem, where one finds points on 𝑔(𝑥,𝑦)=𝑐 which optimize 𝑓

Now how can we check whether there’s a tangency? Answer: look at the gradient! We expect that ∇𝑓 and ∇𝑔, at the points 𝑃 and 𝑄, should point in the same direction. So that gives us the strategy: look for the points where ∇𝑓 and ∇𝑔 point the same way.

I don’t think the following term is an official name, but I like it, and I’ll use it:

Definition

An LM-critical point is a point 𝑃 on the curve/surface 𝑔(𝑃)=𝑐 such that either

  • ∇𝑓(𝑃)=𝜆∇𝑔(𝑃) for some scalar 𝜆; OR
  • ∇𝑔(𝑃)=𝟎.

Note that there are two possible situations. If you want, you can think about this as requiring that ∇𝑓(𝑃) and ∇𝑔(𝑃) are linearly dependent, so it’s only one item. However, in practice, people end up usually breaking into cases like this.

Digression

The parameter 𝜆 is the reason for the name “Lagrange multipliers”; it’s a scalar multiplier on ∇𝑔. Personally, I don’t think this name makes much sense.

Also, some sources will define an LM-critical point in the following (in my opinion, more confusing) way. Let’s say 𝑓(𝑥,𝑦,𝑧) is a three-variable function. Define a four-variable “Lagrangian function” 𝐿(𝑥,𝑦,𝑧,𝜆)=𝑓(𝑥,𝑦,𝑧)−𝜆𝑔(𝑥,𝑦,𝑧). Then an LM-critical point is a point for which either ∇𝑔=𝟎 or ∇𝐿=𝟎, i.e. a normal critical point of 𝐿. It can be checked this is equivalent to the original definition, but I personally find this unnatural. However, if you like this definition, feel free to use it instead.

Now that we have this, we can describe the recipe for the “hard” case. The only change is to replace the old critical point definition (where ∇𝑓(𝑃)=𝟎) with the LM-critical point definition.

§19.4 [RECIPE] Lagrange multipliers

Recipe for Lagrange multipliers

Suppose you want to find the optimal values of 𝑓:ℝ𝑛→ℝ over a region ℛ︀, and ℛ︀ has dimension 𝑛−1 due to a single constraint 𝑔=𝑐 for some 𝑔:ℝ𝑛→ℝ.

  1. Figure out the boundary and limit cases for the region ℛ︀. (You don’t need to look at 𝑓 for this step.)
  2. Evaluate 𝑓 on all the LM-critical points of 𝑓 that lie on the region ℛ︀.
  3. Evaluate 𝑓 on all the boundary points of 𝑓 of the region ℛ︀.
  4. Evaluate 𝑓 on all the limit cases of 𝑓 of the region ℛ︀.
  5. Output the points in the previous steps that give the best values, or assert the optimal value doesn’t exist (if points in step 3 do better than steps 1-2).

If there are any points at which ∇𝑓 or ∇𝑔 are undefined, you should check those as well. However, these seem to be pretty rare for the examples that show up in 18.02.

Again, this is the same recipe as Section 19.2, except we changed “critical point” to “LM-critical point”.

Tip

Remember how finding critical points could lead to systems of equations that required quite a bit of algebraic skill to solve? The same is true for Lagrange multipliers, but even more so, because of the new parameter 𝜆 that you have to care about. So the reason this is called the “hard case” isn’t because the 18.02 ideas needed are different, but because the algebra can become quite involved in finding LM-critical points.

In fact, in high school math competitions, the algebra can sometimes become so ugly that the method of Lagrange multipliers is sometimes jokingly called “Lagrange murderpliers” to reflect the extreme amount of calculation needed for some problems.

Sample Question

Compute the minimum and maximum possible value, if they exist, of

𝑓(𝑥,𝑦,𝑧)=𝑥+𝑦+𝑧

over 𝑥,𝑦,𝑧>0 satisfying the condition 𝑥𝑦𝑧=8.

Solution. We carry out the recipe.

  1. The region ℛ︀ is two-dimensional, consisting of strict inequalities 𝑥,𝑦,𝑧>0 and the condition 𝑔(𝑥,𝑦,𝑧)=𝑥𝑦𝑧=8. So there is no boundary, but there are limit cases if any variables approaches 0+ or +∞.

  2. To find the LM-critical points, we need to compute both ∇𝑓 and ∇𝑔. We do so:

    ∇𝑓(𝑥,𝑦,𝑧)=(111)∇𝑔=(𝑦𝑧,𝑧𝑥,𝑥𝑦).

    Now, there are no points with ∇𝑔=(000) in the region ℛ︀, because in ℛ︀ all the variables are constrained to be positive. So we now solve the system

    1=𝜆𝑦𝑧1=𝜆𝑧𝑥1=𝜆𝑥𝑦

    and see what values it takes.

    The trick to solving the system of equations is to divide the first two to get rid of the parameter 𝜆, which we don’t really care about, to get

    11=𝜆𝑦𝑧𝜆𝑧𝑥=𝑦𝑥.

    So we must have 𝑥=𝑦. Similarly, we find 𝑦=𝑧 and 𝑧=𝑥.

    Hence the LM-critical point must have 𝑥=𝑦=𝑧. Since 𝑥𝑦𝑧=8, it follows the only LM-critical point is (2,2,2). Evaluating 𝑓 here gives 𝑓(2,2,2)=6.

  3. The region ℛ︀ has no boundary, because no ≤ or ≥ constraints are present.

  4. The region ℛ︀ has limit cases when any of the variables 𝑥,𝑦,𝑧 either approach 0 or +∞. However, remember that 𝑥𝑦𝑧=8. So if any variable approaches 0+, some other variable must become large. Consequently, in every limit case, we find that 𝑓→+∞.

Collating all these results:

□

Remark
If you’re paying close enough attention, you might realize this sample question we just did is a thin rewriting of the example in Section 19.2. This illustrates something: sometimes you can rewrite a hard-case optimization problem in 3 variables to an easy-case one with 2 variables.

§19.5 [TEXT] Advice for solving systems of equations (reprise)

Back in Section 17.5, when we were finding all the critical points, I reminded you to be careful about division-by-zero, handle cases carefully, and gave you some advice for solving systems. Solving the system for LM-critical points is a similar situation: systems of equations are hard, and you have to treat it like a self-contained high school algebra puzzle.

For systems of equations generated by Lagrange multipliers, there’s a new feature: a variable 𝜆 whose value is never used, but which appears in every equation besides the constraint 𝑔=𝑐. So a couple tips specific to Lagrange Multiplier systems:

Tip: Advice for Lagrange Multiplier systems

In addition to the tips in Section 17.5, here are some strategies that sometimes help:

  • It might make sense to try to get rid of 𝜆 ASAP, if that’s easy to do. After all, we don’t actually care what 𝜆 is.
  • Alternatively, you can try to kill every variable except 𝜆! This is commonly used if each equations involves only one non-𝜆 variable. That is, solve for 𝑥 in terms of 𝜆; do the same for 𝑦 and 𝑧. Then plug these in the original constraint equation to solve for 𝜆, and hence extract (𝑥,𝑦,𝑧).

Note the second advice bullet is the opposite of the first advice bullet! Again, systems of equations can’t be solved by blindly following recipes. You should use whatever method you think makes sense for the given problem. You don’t need anyone’s permission to use so-and-so approach.

Warning: Make sure you only divide by nonzero things!

Remember: watch out for division by zero! For example, if you get to the equation 2𝜆𝑦=10𝑦, for example, this implies EITHER 𝜆=5 OR 𝑦=0.

During the 2024 midterm, an equation like this appeared as part of a step in a standard Lagrange multipliers question. Something like 50%-80% of students who got this equation would forget one of the two cases (which one they forgot about varied). Don’t let this be you! Whenever you try to cancel, check for division by zero!

Here’s an example where a good idea is to kill 𝜆 ASAP:

Sample Question
Use Lagrange multipliers to find the smallest possible value of 𝑥2+𝑥𝑦+𝑦2+𝑦 subject to the constraint 𝑥+2𝑦=3.

Solution. We want to minimize the function 𝑓(𝑥,𝑦)=𝑥2+𝑥𝑦+𝑦2+𝑦 subject to the constraint 𝑔(𝑥,𝑦)=𝑥+2𝑦=3.

  1. The constraint region has no boundary, but limit cases along the line 𝑥+2𝑦=3 if either 𝑥→+∞ and 𝑦→−∞ and either 𝑥→−∞ and 𝑦→+∞.

  2. Computing the gradients gives

    ∇𝑓=(2𝑥+𝑦𝑥+2𝑦+1)∇𝑔=(12).

    Note ∇𝑔 is never 𝟎. Thus, the Lagrange multiplier equation becomes:

    (2𝑥+𝑦𝑥+2𝑦+1)=𝜆(12).

    This gives the following system of equations:

    2𝑥+𝑦=𝜆𝑥+2𝑦+1=2𝜆.

    Combining these two equations gives us an easy way to get rid of 𝜆:

    𝑥+2𝑦+1=2⋅(2𝑥+𝑦)⏟=𝜆=4𝑥+2𝑦.

    Cancel 2𝑦 on both sides gives us 𝑥:

    𝑥+1=4𝑥⟹𝑥=13

    Now substitute 𝑥=13 into the constraint 𝑥+2𝑦=3 to get:

    2𝑦=3−13=83⟹𝑦=43.

    In other words, the only LM-critical point is (13,43), at which point we have

    𝑓(13,43)=(13)2+(13)(43)+(43)2+43=19+49+169+43=113.
  3. There is no boundary to check.

  4. If any of the variables goes to +∞ (and hence the other goes to −∞), the value of 𝑓 will become large too.17

In conclusion, the global minimum is 𝑓(13,43)=113.□

And here’s an example where we kill every variable except 𝜆:

Sample Question
Use Lagrange multipliers to find the smallest possible value of 𝑥2+𝑦2+𝑧2+𝑦−𝑧 subject to the constraint 𝑥+2𝑦+3𝑧=4.

Solution. We want to minimize the function 𝑓(𝑥,𝑦,𝑧)=𝑥2+𝑦2+𝑧2+𝑦−𝑧 subject to the constraint 𝑔(𝑥,𝑦,𝑧)=𝑥+2𝑦+3𝑧=4.

  1. The 𝑔=4 region is a plane with no boundary but limit cases if any variable becomes ±∞.

  2. Let’s find all the LM-critical points. We start by calculating all the gradients:

    ∇𝑓=(2𝑥2𝑦+12𝑧−1)∇𝑔=(123).

    Note the gradient ∇𝑔 is never 𝟎. Thus, the Lagrange multiplier equation becomes:

    (2𝑥2𝑦+12𝑧−1)=𝜆(123)

    or

    2𝑥=𝜆,2𝑦+1=2𝜆,2𝑧−1=3𝜆.

    Let’s get rid of every variable besides 𝜆, by solving in 𝜆:

    2𝑥=𝜆⟹𝑥=𝜆22𝑦+1=2𝜆⟹𝑦=𝜆−122𝑧−1=3𝜆⟹𝑧=3𝜆+12.

    Now substitute 𝑥=𝜆2, 𝑦=𝜆−12, and 𝑧=3𝜆+12 into the constraint 𝑥+2𝑦+3𝑧=4:

    𝜆2+2(𝜆−12)+3(3𝜆+12)=4⟹𝜆2+2𝜆−1+9𝜆+32=4⟹10𝜆+32+2𝜆−1=4⟹10𝜆+3+4𝜆−2=8⟹14𝜆+1=8⟹𝜆=12.

    Now that we have 𝜆, plug back in to get (𝑥,𝑦,𝑧):

    𝑥=𝜆2=14,𝑦=𝜆−12=12−12=0,𝑧=3𝜆+12=3(12)+12=32+12=54.

    This gives a single LM-critical point (𝑥,𝑦,𝑧)=(14,0,54), where 𝑓(14,0,54)=38.

  3. There are no boundary cases to consider.

  4. The limit cases are if one of the variables goes to ±∞. However, in such a situation 𝑓 obviously becomes large, so there are no minimums in the situation.

In conclusion, the global minimum is 𝑓(14,0,54)=38.□

Digression: Clever geometric approach for observant students

We show a way you can skip all the calculus steps in the previous problem if you can see how to rewrite the question as a geometry one. This approach is so clever that you don’t even need to find (14,0,54); it will directly tell you the minimum value. Don’t try this on an exam unless you really know what you’re doing.

Let 𝑃≔(𝑥,𝑦,𝑧) be a point. Let ℋ︀ denote the plane 𝑥+2𝑦+3𝑧=4. The magic trick is to rewrite

𝑓=𝑥2+𝑦2+𝑧2+𝑦−𝑧=𝑥2+(𝑦+12)2+(𝑧−12)2−12=𝑃𝑄2−12

where 𝑄≔(0,−12,12). In other words, 𝑓(𝑃) is a shift of the squared distance of 𝑃 from 𝑄. So actually, the global minimum we found (14,0,54) is the point on the plane ℋ︀ closest to 𝑄=(0,−12,12).

But if all you care about is the distance from 𝑄=(0,−12,12) to the ℋ︀, then using calculus is overkill: instead use the recipe from way back in Section 5.6:

min(𝑃𝑄)=|1⋅0+2⋅−12+3⋅12−4|12+22+32=7214.

So the minimum is

min(𝑓)=min(𝑃𝑄)2−12=(7214)2−12=38.

Thus, an extremely clever student could have bypassed the entire problem by translating it into a geometry question. Don’t worry, you won’t be expected to come up with something like this in 18.02.

To top all that of, here is a Lagrange multipliers example that requires considering tons of cases. This is probably too lengthy of a calculation for 18.02 because of the amount of arithmetic required; it’s here just to illustrate.

Sample Question
Compute the minimum and maximum possible of 𝑥3+3𝑦3+4𝑧3 subject to 𝑥4+𝑦4+𝑧4=2.

Solution. The region has no boundary nor limit cases. So, we will only focus on calculating the LM-critical points.

The gradients of 𝑓(𝑥,𝑦,𝑧)=𝑥3+3𝑦3+4𝑧3 and 𝑔(𝑥,𝑦,𝑧)=𝑥4+𝑦4+𝑧4 are given by

∇𝑓=(3𝑥29𝑦212𝑧2)∇𝑔=(4𝑥34𝑦34𝑧3).

We begin by simplifying each equation:

This gives a total of eight cases! We will go through them all individually.

Case 1 where 𝑥=0, 𝑦=0, 𝑧≠0

From the constraint 𝑧4=2, we get:

𝑧=±24.

Thus, 𝜆=3𝑧=±324.

Case 2 where 𝑥=0, 𝑦≠0, 𝑧=0

From the constraint 𝑦4=2, we get:

𝑦=±24.

Thus, 𝜆=94𝑦=±9424.

Case 3 where 𝑥≠0, 𝑦=0, 𝑧=0

From the constraint 𝑥4=2, we get:

𝑥=±24.

Thus, 𝜆=34𝑥=±3424.

Case 4 where 𝑥=0, 𝑦≠0, 𝑧≠0

From the constraint 𝑦4+𝑧4=2, we solve using 𝜆=94𝑦 and 𝜆=3𝑧. Equating these, we get:

94𝑦=3𝑧⟹𝑧=43𝑦.

Substitute into the constraint:

𝑦4+(43𝑦)4=2⟹𝑦4+25681𝑦4=2.

This simplifies to:

33781𝑦4=2⟹𝑦4=162337⟹𝑦=±1623374.

Thus, 𝑧=±431623374.

Case 5 where 𝑥≠0, 𝑦=0, 𝑧≠0

From the constraint 𝑥4+𝑧4=2, we solve using 𝜆=34𝑥 and 𝜆=3𝑧. Equating these, we get:

34𝑥=3𝑧⟹𝑧=4𝑥.

Substitute into the constraint:

𝑥4+(4𝑥)4=2⟹𝑥4+256𝑥4=2⟹257𝑥4=2.

Thus, 𝑥4=2257, and:

𝑥=±22574,𝑧=±422574.
Case 6 where 𝑥≠0, 𝑦≠0, 𝑧=0

From the constraint 𝑥4+𝑦4=2, we solve using 𝜆=34𝑥 and 𝜆=94𝑦. Equating these, we get:

34𝑥=94𝑦⟹𝑦=3𝑥.

Substitute into the constraint:

𝑥4+(3𝑥)4=2⟹𝑥4+81𝑥4=2⟹82𝑥4=2.

Thus, 𝑥4=141, and:

𝑥=±1414,𝑦=±31414.
Case 7 where 𝑥≠0, 𝑦≠0, 𝑧≠0

Equating the three expressions for 𝜆:

34𝑥=94𝑦=3𝑧.

From 34𝑥=94𝑦, we get 𝑦=3𝑥, and from 34𝑥=3𝑧, we get 𝑧=4𝑥. Substitute into the constraint:

𝑥4+(3𝑥)4+(4𝑥)4=2⟹𝑥4+81𝑥4+256𝑥4=2⟹338𝑥4=2.

Thus, 𝑥4=2338, and:

𝑥=±11694,𝑦=±311694,𝑧=±411694.

Since 169=132 is a square, this could be written more simply as

𝑥=±113,𝑦=±313,𝑧=±413.
Case 8 where 𝑥=0, 𝑦=0, 𝑧=0
This doesn’t yield a valid solution because it doesn’t lie on the constraint 𝑥4+𝑦4+𝑧4=2.

Hence there are a whopping total of 14 LM-critical points. They are:

When searching for the maximum, we should always take + for ± to maximize 𝑓(𝑥,𝑦,𝑧); similarly, the minimum uses only − for ±. Note also that plugging in all −‘s is the negative of plugging in all +’s. So this reduces us from 14 cases to just 7. If we actually try all seven, we find that the last one is the optimal one; that is, the maximum and minimums are

𝑓(113,313,413)=213𝑓(−113,−313,−413)=−213.

□

§19.6 [TEXT] Example of easy case with a “common-sense” boundary

As we alluded to earlier, the boundary of the so-called “easy case” can have infinitely many points, so you cannot just plug them in one by one to inspect them all. In some situations, it will still be doable just by inspection, because the function is really easy to describe on the boundary. We give one such example below.

Sample Question

Compute the minimum possible value of

𝑓(𝑥,𝑦)=2𝑥2+𝑦2+𝑥𝑦−6𝑦

in the first quadrant 𝑥,𝑦≥0.

Solution. Follow the recipe:

  1. The first quadrant has limit cases if either 𝑥→+∞ or 𝑦→+∞. The boundary consists of two rays: the positive 𝑥 axis (from (0,0) due east) and the positive 𝑦 axis (from (0,0) due north).

  2. We calculate the critical points. The gradient is given by

    ∇𝑓=(4𝑥+𝑦2𝑦+𝑥−6).

    Setting the gradient to the zero vector, we need to solve the system

    4𝑥+𝑦=0𝑥+2𝑦−6=0

    which is an easy linear system. If we let 𝑦=−4𝑥 from the first equation, we get

    2(−4𝑥)+𝑥−6=0⟹−8𝑥+𝑥−6=0⟹−7𝑥=6⟹𝑥=−67.

    Since we are working in the first quadrant where 𝑥≥0, this value is not valid. Therefore, there are no critical points in our region ℛ︀.

  3. As we saw, we have two boundaries. There are infinitely many points on the positive 𝑥 and 𝑦 axis, so we cannot just plug them all in one by one. In principle, you could redo the entire easy-case recipe for each boundary parts, and it will work.

    However, luckily, the function is quite easy to analyze on each part, and we can do it with just high school algebra, no calculus needed. This way we don’t need to go through the whole recipe again.

    The boundary of 𝑥=0 and 𝑦≥0

    Substitute 𝑥=0 into the function: 𝑓(0,𝑦)=2(0)2+𝑦2+0⋅𝑦−6𝑦=𝑦2−6𝑦. In other words, we need to see what the smallest value of

    𝑓(0,𝑦)=𝑦2−6𝑦 across all 𝑦≥0

    could be. You could use the derivative of 𝑦, but I think the fastest thing to do is actually complete the square: the function

    𝑓(0,𝑦)=(𝑦−3)2−9

    obviously has the smallest value at 𝑓(0,3)=−9. (And 𝑓(0,0)=0 and 𝑓(0,+∞)=+∞ are both worse.)

    The boundary of 𝑦=0 and 𝑥≥0

    Substitute 𝑦=0 into the function:

    𝑓(𝑥,0)=2𝑥2+02+𝑥(0)−6(0)=2𝑥2.

    It’s obvious that 𝑓(𝑥,0) is minimized at 𝑥=0. (Note that 𝑓(+∞,0)=+∞ is worse.)

  4. In the limit case where either 𝑥→+∞ and 𝑦→+∞ it’s clear that 𝑓→+∞.

In conclusion, the best value is actually the one from Step 2: we have 𝑓(0,3)=−9 being the smallest possible value.□

§19.7 [TEXT] Example of easy case that ends up using Lagrange multipliers for the boundary

Now here’s a case where the boundary requires Lagrange multipliers. So, it’s really a hard-case optimization problem within an easy-case optimization problem. If you’ve seen the movie Inception, yes, one of those.

Sample Question

Compute the minimum and maximum possible value, if they exist, of

𝑓(𝑥,𝑦,𝑧)=𝑥4+𝑦4+𝑧4

over the region 𝑥2+𝑦2+𝑧2≤1.

Solution. At first glance, this seems like it should be in the easy case! The region ℛ︀ consisting of the closed ball 𝑥2+𝑦2+𝑧2≤1 is indeed three-dimensional. But the reason this sample question is in this section is because we will find that checking the boundary case requires another application of Lagrange multipliers.

Let’s carry out the easy case recipe.

  1. There are no limit cases, but a boundary 𝑥2+𝑦2+𝑧2=1, the unit sphere (not filled).

  2. First let’s find the critical points of 𝑓(𝑥,𝑦,𝑧)=𝑥4+𝑦4+𝑧4. Write

    ∇𝑓=(4𝑥34𝑦34𝑧3).

    Solving the insultingly easy system of equations 4𝑥3=4𝑦3=4𝑧3=0 we see the only critical point is apparently 𝑥=𝑦=𝑧=0. The value there is 𝑓(0,0,0)=0.

  3. The boundary of ℛ︀ is 𝑥2+𝑦2+𝑧2=1, the unit sphere; we denote this sphere by 𝒮︀. So now we have to evaluate 𝑓 on this boundary. The issue is that there are too many points on this unit sphere! We can’t just check them one by one. And unlike the previous example, the function is not simple enough that we can use common sense to deal with it.

    Therefore, we will use Lagrange multipliers with the constraint function 𝑔(𝑥,𝑦,𝑧)=𝑥2+𝑦2+𝑧2 to find the minimum possible value of 𝑓 on this new region 𝒮︀.

    1. The new region 𝒮︀ has no boundary and no limit cases.

    2. Let’s find the LM-critical points for 𝑓 on 𝒮︀. Take the gradient of 𝑔 to get

      ∇𝑔=(2𝑥2𝑦2𝑧).

      The only point at which ∇𝑔=𝟎 is 𝑥=𝑦=𝑧=0 which isn’t on the sphere 𝒮︀, so we don’t have to worry about ∇𝑔=𝟎 the case. Now we instead solve

      (4𝑥34𝑦34𝑧3)=𝜆(2𝑥2𝑦2𝑧).

      This requires some manual labor to solve, because there are lots of cases. The equation for 𝑥 says that

      4𝑥3=𝜆⋅2𝑥⟺𝑥=0 or 𝑥=±𝜆2

      and similarly for 𝑦 and 𝑧:

      4𝑦3=𝜆⋅2𝑦⟺𝑦=0 or 𝑦=±𝜆24𝑧3=𝜆⋅2𝑧⟺𝑧=0 or 𝑧=±𝜆2

      A priori, this seems like it will require us to take a lot of cases. However, we can take advantage of symmetry to reduce the amount of work we have to do. The trick is to get rid of 𝜆 as follows: Observation: All the nonzero variables 𝑥, 𝑦, 𝑧 should have the same absolute value. To spell it out:

      • If all three variables are nonzero, then |𝑥|=|𝑦|=|𝑧|=13 (because 𝑥2+𝑦2+𝑧2=1 as well).
      • If two variables are nonzero, then their absolute values are 12 by the same token.
      • And if only one variable is nonzero, it is ±1.

      (Note of course that (0,0,0) does not lie on 𝒮︀.) Think about why this works.

      So there are 26 LM-critical points given by the following list:

      • (±13,±13,±13); there are 8 points in this case. The 𝑓-values are all 13.
      • (±12,±12,0); there are 4 points in this case. The 𝑓-values are all 12.
      • (±12,0,±12); there are 4 points in this case. The 𝑓-values are all 12.
      • (0,±12,±12); there are 4 points in this case. The 𝑓-values are all 12.
      • (±1,0,0); there are 2 points in this case. The 𝑓-values are all 1.
      • (0,±1,0); there are 2 points in this case. The 𝑓-values are all 1.
      • (0,0±1); there are 2 points in this case. The 𝑓-values are all 1.

      Phew! Okay. The other cases are much shorter:

    3. 𝒮︀ has no boundary to consider.

    4. 𝒮︀ has no limit cases to consider.

  4. ℛ︀ has no limit cases to consider.

Okay, marathon done. Collate everything together. The values of 𝑓 we saw were 0, 13, 12 and 1, and there were no limit cases of any sort. So:

□

§19.8 [SIDENOTE] A little common sense can save you a lot of work

If you step back and think a bit before you try to dive into calculus, you might find that having a bit of “common sense” might save you a lot of work. What I mean is, imagine you gave the question to your high school self before you learned any calculus at all. Would they be able to say anything about what properties the answer could have? The answer is, yes, pretty often.

Let’s take the example we just did: we asked for the minimum and maximum of

𝑓(𝑥,𝑦,𝑧)=𝑥4+𝑦4+𝑧4

over the region 𝑥2+𝑦2+𝑧2≤1. To show the recipe, I turned off my brain and jumped straight into a really long calculation. But it turns out you can cut out a lot of the steps if you just use some common sense, not involving any calculus:

That means if we had used a bit of common sense, we could have gotten the minimum with no work at all, and we could have skipped straight to the LM step for the maximum. So if you aren’t too overwhelmed by material already in this class, look for shortcuts like this when you can.

Digression: Even faster solution for observant students

We saw the minimum is obviously 0 if you just thought about it. In fact, you can also similarly find the maximum with no calculus at all if you realize the answer should be 𝑓(1,0,0)=1.

Here’s how. What we’re trying to prove is that

𝑥4+𝑦4+𝑧4≤1

whenever 𝑥2+𝑦2+𝑧2≤1. Because 𝑦2 and 𝑧2 are nonnegative, it’s obvious that 𝑥2≤1. But in fact it’s easy to see that

𝑥4≤𝑥2 is true whenever 𝑥2≤1.

Similarly, 𝑦4≤𝑦2 and 𝑧4≤𝑧2. Thus

𝑥4+𝑦4+𝑧4≤𝑥2+𝑦2+𝑧2=1.

§19.9 [SIDENOTE] Compactness as a way to check your work

This is an optional section containing a nice theorem from 18.100 that could help you check your work, but isn’t necessary in theory if you never make mistakes. (But in practice…)

I need a new word called “compact”, and like before, it’s beyond the scope of 18.02 to give a proper definition. However, I will hazard the following one: for 18.02 examples, ℛ︀ is compact if there are no limit cases. That is,

Then the theorem I promised you is:

Tip: Compact optimization theorem
If ℛ︀ is a compact region, and 𝑓 is a function to optimize on the region which is continuously defined everywhere, then there must be at least one global minimum, and at least one global maximum.

This works in both the easy case (no Lagrange multipliers) and the hard case (with Lagrange multipliers).

Here’s some examples of how this theorem can help you:

Example
  • Suppose you are asked to optimize a continuous function 𝑓(𝑥,𝑦) on the square −1≤𝑥≤1, −1≤𝑦≤1. We saw this square has no limit cases. Then the compact optimization theorem promises you that the answer “no global minimum” or “no global maximum” will never occur.

  • Suppose you are asked to optimize a continuous function 𝑓(𝑥,𝑦,𝑧) on the sphere 𝑥2+𝑦2+𝑧2=1 (which means you are probably going to use Lagrange multipliers). We saw this sphere has no limit cases (and not even a boundary). Then the compact optimization theorem promises you that the answer “no global minimum” or “no global maximum” will never occur.

  • Suppose you are asked to optimize a continuous function 𝑓(𝑥,𝑦,𝑧) on the closed ball 𝑥2+𝑦2+𝑧2≤1, like in the last example. This closed ball also has no limit cases, so the compact optimization theorem promises you that the answer “no global minimum” or “no global maximum” will never occur.

§19.10 [RECAP] Recap of Part Foxtrot on Optimization

§19.11 [EXER] Exercises

Exercise 19.1. Let 𝐴𝐵𝐶 be the triangle in the 𝑥𝑦-plane with vertices 𝐴=(0,12), 𝐵=(−5,0), 𝐶=(9,0). For what point 𝑃 in the plane is the sum

𝑃𝐴2+𝑃𝐵2+𝑃𝐶2

as small as possible?

Exercise 19.2. Compute the minimum possible value of 𝑥+𝑦 given that sin(𝑥)+sin(𝑦)=1 and 𝑥,𝑦≥0.

Exercise 19.3 (Suggested by Ting-Wei Chao). Compute the global minimum of the function

𝑓(𝑥,𝑦)=|𝑥2+𝑦2−25|−3𝑥−4𝑦.
  1. 17This is actually a bit tricky to see, because in this limit case you have two positive terms 𝑥2 and 𝑦2 and one negative term 𝑥𝑦. One idea is to write

    𝑓(𝑥,𝑦)≈34𝑥2+(𝑥2+𝑦)2=34𝑦2+(𝑥+𝑦2)2

    for large 𝑥 and 𝑦. The first expression shows that if 𝑥 is big, then so is 𝑓; the second expression shows that if 𝑦 is big, then so is 𝑓.