# Optimization

Literally, optimization is making something the best, but we use it in math to mean maximization, which is making something the biggest. (You can imagine that the thing that you're maximizing is a numerical measure of how good the thing that you're optimizing is.) Essentially the same principles apply to minimization, which is making something the smallest. (And pessimization is making something the worst, although people don't use that term very much, because who would want to do that?) A generic term for making something the largest or smallest is extremization.

The key principle of optimization is this:

A quantity u can only take a maximum (or minimum) value when its differential du is zero or undefined.
If you write u as f(x, y), where f is a fixed differentiable function of (say) 2 variables, and x and y are quantities whose range of possible values you already understand (typically intervals), then du = D1f(x, y) dx + D2f(x, y) dy, or equivalently, du = ∂u/∂x dx + ∂u/∂y dy.

So one way that u might conceivably take an extreme value is if either (or both) of its partial derivatives are undefined. Another way is if both (not just one) of its partial derivatives are zero. If you can vary x and y smoothly however you please (essentially, if you are in the interior of the domain of f and you are free to access the entire domain), then these are the only possibilities. However, if you cannot vary them smoothly (essentially, if you are on the boundary of the domain of f or if the sitaution is otherwise constrained so that you cannot access the entire domain of f), then there are more possibilities!

If your constraint (essentially, the boundary of f) can be written as an equation g(xy) = 0 (or really, with any constant on the right-hand side), then as long as ∇g is never zero on this boundary, then you can use the method of Lagrange multipliers. Here, you set up an equation ∇f(x, y) = λ g(x, y), combine this with the equation g(x, y) = 0, and try to solve for x, y, and λ. (Since a vector equation is equivalent to 2 sclar equations, this amounts to a system of 3 equations in 3 variables, so there is hope to solve for it.) If you're working in 3 variables, then you might need two equations to specify the constraint, in which case there are two functions in the place of g and two Lagrange multipliers, making 4 equations in 4 variables. (But you can also have just one g even in 3 dimensions; it's a question of whether the boundary in question is a surface or a curve.) While λ ultimately doesn't matter, the solutions that you get for the original variables give you additional critical points to check for extreme values.

On the other hand, you don't need Lagrange multipliers. Writing v for g(x, y), if the constraint is v = 0 (or v equals any constant), then differentiate this to et dv = 0. (In fact, you could take any equation and just differentiate both sides.) Then if you try to solve the system of equations consisting of du = 0 and dv = 0 for the differentials dx and dy, you should immediately see that dx = 0 and dy = 0 is a solution. However, if you actually go through the steps of solving this as a system of linear equations (which you can always do because differentials are always linear in the differentials of the indepednent variables), you'll find that at some point you need to divide by some quantity involving x and y, which is invalid if that quantity is zero! So, setting whatever you divide by to zero and combining that with the constraint equation v = 0, you get two equations to solve for the two variables x and y. This will give you the other critical points to check for extreme values.

Be careful, because u might not have a maximum or minimum value! Assuming that u varies continuously (which it must if Calclulus is to be useful at all), then it must have a maximum and minimum value whenever the domain of the function (including any constraints) is both closed and bounded (which is called compact); this means that if you pass continuously through the possibilities in any way, then you are always approaching some limiting possibility. However, if the range of possibilities heads off to infinity in some way, then you also have to take a limit to see what value u is approaching, which can be very difficult to do in more than one dimension. Or if there is a boundary that's not included in the domain, then you have to take a limit approaching that boundary, although in that case you can hope that you can check the bondary as if it were included, the same way as above. If any such limit is larger than every value that u actually reaches (which includes the possibility that a limit is ∞), then u has no maximum value; if any such limit is smaller than every value that u actually reaches (which includes the possibility that a limit is −∞), then u has no minimum value.

So in the end, you look at these possibilities:

• when any partial derivative of u is undefined,
• when all partial derivative of u are zero,
• any boundary possibilities given by a constraint,
• any corners (boundaries of the boundaries) given by two constraints,
• any corners or corners given by three constraints (not possible with only two independent variables),
• etc (in more than 3 dimensions), and
• the limits approaching impossible limiting cases.
Whichever of these has the largest value of u gives you the maximum, and whichever has the smallest value of u gives you the minimum; but if the largest or smallest value is only approached in the limit, then the maximum or minimum technically does not exist.

Here is a typical problem: The hypotenuse of a right triangle (maybe it's a ladder leaning against a wall) is fixed at 20 feet, but the other two sides of the triangle could be anything. Still, since it's a right triangle, we know that x2 + y2 = 202, where x and y are the lengths of legs of the triangle. (If we think of x and y as independent variables, then this equation is our constraint.) Differentiating this, 2x dx + 2y dy = 0. Now suppose that we want to maximize or minimize the area of this triangle. Since it's a right triangle, the area is A = ½xy, so dA = ½y dx + ½x dy. If this is zero, then ½y dx + ½x dy = 0, to go along with the other equation 2x dx + 2y dy = 0.

The equations at this point are linear in the differentials (and they always must be), so think of this is a system of linear equations in the variables dx and dy. There are various methods for solving systems of linear equations; I'll use the method of addition aka elimination, but any other method should work just as well. So ½y dx + ½x dy = 0 becomes 2xy dx + 2x2 dy = 0 (multiplying both sides by 4x), while 2x dx + 2y dy = 0 becomes 2xy dx + 2y2 dy = 0 (multiplying both sides by y). Subtracting these equations gives (2x2 − 2y2) dy = 0, so either dy = 0 or x2 = y2. Now, x and y can change freely as long as they're positive, but we have limiting cases: x → 0+ and y → 0+. Since x2 + y2 = 400, we see that x2 → 400, so x → 20, as y → 0. Similarly, y → 20 as x → 0. In those cases, A = ½xy → 0. On the other hand, if x2 = y2, then x = y, so x, y = 10√2, since x2 + y2 = 400. In that case, A = ½xy = 100.

So the largest area is 100 square feet, and while there is no smallest area, the area can get arbitrarily small with a limit of 0.

Go back to the course homepage.

This web page was written in 2015 and 2016 by Toby Bartels, last edited on 2016 February 1. Toby reserves no legal rights to it.

The permanent URI of this web page is `http://tobybartels.name/MATH-2080/2016WN/minmax/`.