# Optimization

Optimization, within the context of mathematics, refers to the determination of the best result (given the desired constraints) of a set of possible outcomes.

We can use the first and second derivative tests to find the global minima and maxima of quantities involved in word problems. Generally, we parse through a word problem to derive a formula for the quantity of f that we attempt to optimize subject to a constraint equation g = 0. We normally will use the constraint g = 0 to solve for intermediate variables and express f as a function of a single variable x, i.e. we can write f(x) instead of f(x, y) or f(x, y, z). x will often be limited to an interval, I, so we must check the endpoints of I in addition to the critical points in I to find the global extrema.

Example 1

Find the dimensions of the rectangle with fixed perimeter, P, and maximal area.

Call the length of the rectangle x and the height of the rectangle y. Then the perimeter P can be written as:

P = 2x + 2y

which gives us our constraint equation. The quantity that we are trying to maximize is the area, A, which is given by:

A = xy

We need to express A as a function of 1 variable, either x or y. It does not matter which one so we will just write everything in terms of x. To write y in terms of x we manipulate the constraint equation to get: which we plug back into the area formula to get The A(x) on the left means that A is now purely a function of x. We solve for the critical points of A(x) by setting : implying Since A(x) is a quadratic function with leading coefficient -1, A(x) curves downward and the global maximum is achieved at . Therefore, the maximum area is When this maximum is achieved, x = , which implies as well. Therefore the rectangle of the largest area with given perimeter P is the square:

We can give a geometric reason for why the square is the rectangle with maximal area and fixed perimeter. If the perimeter P is fixed, then x decreases as y increases and vice versa. In the extreme case, one of x or y equals and the other is 0, in which case the area would be . Since the entire configuration is symmetric with respect to x and y (the formulas for P and A do not change if we switch x and y), the optimal case should be in the middle of the two extremes, and . This happens when , which is when x and y are equal, thereby forming a square. This type of geometric reasoning can be useful when guessing or checking whether a solution is reasonable, but we need the rigor of calculus to prove that our answer is correct.

Example 2

A company is making cylindrical cans to hold a product. Each can must contain a fixed volume V of the product. Assuming the cans are always filled completely with the product, what are the dimensions of the can, in terms of V, with minimal surface area?

Call the height of the can h and the base radius r. Our constraint equation is the formula for the volume V:

V = hπr2

The quantity we are trying to optimize is the surface area A given by:

A = 2πr2 + 2πrh

The 2πrh represents the curved surface and the 2πr2 represents the two flat caps on either end of the cylinder.

The equations for V and A are not symmetric with respect to h and r, i.e. the influence of h and r on the problem are inherently different. We need to write A in terms of purely 1 variable. We use the constraint equation and choose to write h in terms of r to get: instead of writing r in terms of h because otherwise we would get: which is not as easy to work with due to the square root. We can plug in the expression for h in terms of r into the surface area equation to get: We find the critical points and global minimum by setting : implying: Keep in mind that r can be anything on the interval (0, ∞) and that is continuous on (0, ∞). When r is close to 0, the becomes really large and so A(r) "blows up." On the other hand, when r grows large, the 2πr2 term dominates and A(r) blows up. Since is the only critical point in the valid interval, (0, ∞), for r, it must be where the global minimum occurs. At the global minimum, and the absolute minimum surface area is:

 A = = = = The above formula for the minimum area is not as important as the shape of the cylinder that attains this minimum. The shape of the cylinder is determined by the ration between the parameters h and r. Studying the shape of the minimum-area cylinder for a fixed volume tells us something deeper about the relative influences of each parameter on the area of a cylinder. When the minimum area is attained, notice that We can make a geometric argument for why the minimum occurs when h = 2r. Imagine that you are looking at the cylinder from the side, such that the cylinder looks like a rectangle. This rectangle has height h, width 2r (the diameter of the original cylinder), area 2rh, and perimeter 2(2r + h).

The area of this cross-sectional rectangle is analogous to the volume of the original cylinder while the perimeter of the rectangle is analogous to the surface area of the cylinder. Therefore, we guess that to minimize the surface area of the original cylinder subject to a fixed volume, we must minimize the perimeter of the rectangle subject to a fixed cross-sectional area. The way to minimize the perimeter of the rectangle with fixed area would be to make the rectangle a square as in Example 1. This would imply h = 2r. As in Example 1, while this geometric reasoning helps us to guess the solution, we can never be sure until we prove it with calculus.

Example 3

Claire is trying to get from point A to a point B that is l units east and h units south across a river. She can run on land with speed s1 and swim with speed s2. She could swim in a straight line across the river directly from A to B, or she could run eastwards on land for some distance x and then swim across the river directly to B for the remainder of the trip. Find the value of x that minimizes the total time spent traveling across land and water. Assume that the speed of the river flow is negligible.

To simplify our calculations, we assume that only the ratio of the speeds s1 and s2 have any influence on the time-minimizing value of x, not the values of s1 and s2 themselves. Therefore, for the purpose of finding the optimal x, we can assume that s1 = 1 and we will write s in place of s2. This step is justified because if both s1 and s2 are scaled by some constant c ≠ 0, then the minimum time will be scaled by but the actual path that achieves the minimal time will not be affected.

We can also write T as a function of θ, the angle between the riverside and Claire's path toward B, shown in the figure above. We write T in terms of θ instead of x because we will have to express the diagonal distance across the river as if we write T in terms of x, which is unwieldy due to the square root.

The optimum x is between 0 ≤ x ≤ l, since x > l would mean running farther than necessary to reach the desired point, while x < 0 indicates running a negative distance relative to the desired endpoint. Thus, the optimum θ is between . In terms of θ, = = We find the critical points by setting : Canceling h's and manipulating the expression using algebra and trig identities yields: provided is in the valid interval . This is only true when: When , Claire's swim speed, s, is fast enough that it would be most efficient to swim in a straight line from A to B rather than try to minimize the time spent in the water by initially running along the river. When Claire swims in a line directly from A to B, her global minimum occurs at the endpoint where x = 0.

When s ≅ 0 and Claire's swim speed is very slow, she should try to minimize the time spent in the water by crossing the river from directly north of B. In that case, her global minimum occurs very near the endpoint where x ≅ l. In all other cases, the global minimum occurs at θ = cos-1(s). At θ = cos-1(s), x = l - hcot(θ), cot(θ) = cot(cos-1(s)) = , and An important lesson of Example 3 is that we must always know the valid interval I of the independent variable we are working with so that we can check the endpoints of I as candidates for global extrema.