Skip to main content

Section 4.3 Optimization

Figure 4.3.1. A simple optimization problem

In Section 3.1 we learned about extreme values — the largest and smallest values a function attains on an interval. We motivated our interest in such values by discussing how it made sense to want to know the highest/lowest values of a stock, or the fastest/slowest an object was moving. In this section we apply the concepts of extreme values to solve “word problems,” i.e., problems stated in terms of situations that require us to create the appropriate mathematical framework in which to solve the problem.

We start with a classic example which is followed by a discussion of the topic of optimization.

Example 4.3.2. Optimization: perimeter and area.

A man has \(100\) feet of fencing, a large yard, and a small dog. He wants to create a rectangular enclosure for his dog with the fencing that provides the maximal area. What dimensions provide the maximal area?

Solution.

One can likely guess the correct answer — that is great. We will proceed to show how calculus can provide this answer in a context that proves this answer is correct.

It helps to make a sketch of the situation. Our enclosure is sketched twice in Figure 4.3.3, either with treetop grass and nice fence boards or as a simple rectangle. Either way, drawing a rectangle forces us to realize that we need to know the dimensions of this rectangle so we can create an area function — after all, we are trying to maximize the area.

Figure 4.3.3. A sketch of the enclosure in Example 4.3.2.

We let \(x\) and \(y\) denote the lengths of the sides of the rectangle. Clearly,

\begin{equation*} \text{ Area } =xy\text{.} \end{equation*}

We do not yet know how to handle functions with two variables; we need to reduce this down to a single variable. We know more about the situation: the man has \(100\) feet of fencing. By knowing the perimeter of the rectangle must be \(100\text{,}\) we can create another equation:

\begin{equation*} \text{ Perimeter } = 100 = 2x+2y\text{.} \end{equation*}

We now have two equations and two unknowns. In the latter equation, we solve for \(y\text{:}\)

\begin{equation*} y = 50-x\text{.} \end{equation*}

Now substitute this expression for \(y\) in the area equation:

\begin{equation*} \text{ Area } = A(x) = x(50-x)\text{.} \end{equation*}

Note we now have an equation of one variable; we can truly call the Area a function of \(x\text{.}\)

This function only makes sense when \(0\leq x \leq 50\text{,}\) otherwise we get negative values of area. So we find the extreme values of \(A(x)\) on the interval \([0,50]\) using Key Idea 3.1.18.

To find the critical points, we take the derivative of \(A(x)\) and set it equal to \(0\text{,}\) then solve for \(x\text{.}\)

\begin{align*} A(x) \amp = x(50-x)\\ \amp = 50x-x^2\\ A'(x) \amp = 50-2x \end{align*}

We solve \(50-2x=0\) to find \(x=25\text{;}\) this is the only critical point. We evaluate \(A(x)\) at the endpoints of our interval and at this critical point to find the extreme values; in this case, all we care about is the maximum.

Clearly \(A(0)=0\) and \(A(50)=0\text{,}\) whereas \(A(25) = 625\)ft2. This is the maximum. Since we earlier found \(y = 50-x\text{,}\) we find that \(y\) is also \(25\text{.}\) Thus the dimensions of the rectangular enclosure with perimeter of 100 ft. with maximum area is a square, with sides of length 25 ft.

This example is very simplistic and a bit contrived. (After all, most people create a design then buy fencing to meet their needs, and not buy fencing and plan later.) But it models well the necessary process: create equations that describe a situation, reduce an equation to a single variable, then find the needed extreme value.

“In real life,” problems are much more complex. The equations are often not reducible to a single variable (hence multi-variable calculus is needed) and the equations themselves may be difficult to form. Understanding the principles here will provide a good foundation for the mathematics you will likely encounter later.

We outline here the basic process of solving these optimization problems.

Key Idea 4.3.4. Solving Optimization Problems.

  1. Understand the problem. Clearly identify what quantity is to be maximized or minimized. Make a sketch if helpful.

  2. Create equations relevant to the context of the problem, using the information given. (One of these should describe the quantity to be optimized. We'll call this the fundamental equation.)

  3. If the fundamental equation defines the quantity to be optimized as a function of more than one variable, reduce it to a single variable function using substitutions derived from the other equations (we'll call these constraint equations).

  4. Identify the domain of this function, keeping in mind the context of the problem.

  5. Find the extreme values of this function on the determined domain.

  6. Identify the values of all relevant quantities of the problem.

We will use Key Idea 4.3.4 in a variety of examples.

Example 4.3.5. Optimization: perimeter and area.

Here is another classic calculus problem: A woman has a 100 feet of fencing, a small dog, and a large yard that contains a stream (that is mostly straight). She wants to create a rectangular enclosure with maximal area that uses the stream as one side. (Apparently her dog won't swim away.) What dimensions provide the maximal area?

Solution.

We will follow the steps outlined by Key Idea 4.3.4.

  1. We are maximizing area. A sketch of the region will help; Figure 4.3.6 gives two sketches of the proposed enclosed area. A key feature of the sketches is to acknowledge that one side is not fenced.

    Figure 4.3.6. A sketch of the enclosure in Example 4.3.5
  2. We want to maximize the area; as in the example before,

    \begin{equation*} \text{ Area } = xy\text{.} \end{equation*}

    This is our fundamental equation. This defines area as a function of two variables, so we need another equation to reduce it to one variable.

    We again appeal to the perimeter; here the perimeter is

    \begin{equation*} \text{ Perimeter } = 100 = x+2y\text{.} \end{equation*}

    The perimeter is our constraint equation. Note how this is a different equation for perimeter than in Example 4.3.2, since one of the sides does not need to be fenced.

  3. We now reduce the fundamental equation to a single variable using our constraint equation. In the perimeter equation, solve for \(y\text{:}\) \(y = 50 - x/2\text{.}\) We can now write Area as

    \begin{align*} \text{ Area } = A(x) \amp= x(50-x/2)\\ \amp = 50x - \frac12x^2\text{.} \end{align*}

    Area is now defined as a function of one variable.

  4. We want the area to be non-negative. Since \(A(x) = x(50-x/2)\text{,}\) we want \(x\geq 0\) and \(50-x/2\geq 0\text{.}\) The latter inequality implies that \(x\leq100\text{,}\) so \(0\leq x\leq 100\text{.}\)

  5. We now find the extreme values. At the endpoints, the minimum is found, giving an area of \(0\text{.}\)

    Find the critical points. We have \(A'(x) = 50-x\text{;}\) setting this equal to 0 and solving for \(x\) returns \(x=50\text{.}\) This gives an area of

    \begin{equation*} A(50) = 50(25) = 1250\text{.} \end{equation*}
  6. We earlier set \(y = 50-x/2\text{;}\) thus \(y = 25\text{.}\) Thus our rectangle will have two sides of length \(25\) and one side of length \(50\text{,}\) with a total area of 1250 ft2.

Keep in mind as we do these problems that we are practicing a process; that is, we are learning to turn a situation into a system of equations. These equations allow us to write a certain quantity as a function of one variable, which we then optimize.

Example 4.3.7. Optimization: minimizing cost.

A power line needs to be run from a power station located on the beach to an offshore facility. Figure 4.3.8 shows the distances between the power station to the facility.

It costs \(\$50/\text{ ft }\) to run a power line along the land, and \(\$130/\text{ ft }\) to run a power line under water. How much of the power line should be run along the land to minimize the overall cost? What is the minimal cost?

Figure 4.3.8. Running a power line from the power station to an offshore facility with minimal cost in Example 4.3.7
Solution 1.

We will follow the strategy of Key Idea 4.3.4 implicitly, without specifically numbering steps.

There are two immediate solutions that we could consider, each of which we will reject through “common sense.” First, we could minimize the distance by directly connecting the two locations with a straight line. However, this requires that all the wire be laid underwater, the most costly option. Second, we could minimize the underwater length by running a wire all 5000 ft along the beach, directly across from the offshore facility. This has the undesired effect of having the longest distance of all, probably ensuring a non-minimal cost.

The optimal solution likely has the line being run along the ground for a while, then underwater, as the figure implies. We need to label our unknown distances — the distance run along the ground and the distance run underwater. Recognizing that the underwater distance can be measured as the hypotenuse of a right triangle, we choose to label the distances as shown in Figure 4.3.9.

Figure 4.3.9. Labeling unknown distances in Example 4.3.7

By choosing \(x\) as we did (instead of letting \(x\) be the distance along the land), we make the expression under the square root simple. We now create the cost function.

\begin{alignat*}{3} \text{Cost} \amp ={}\amp\amp \text{land cost} \amp\amp +\text{water cost}\\ \amp\amp\amp \$50\times \text{land distance} \amp\amp +\$130 \times \text{water distance}\\ \amp\amp\amp 50(5000-x) \amp\amp +130\sqrt{x^2+1000^2}\text{.} \end{alignat*}

So we have \(c(x) = 50(5000-x)+ 130\sqrt{x^2+1000^2}\text{.}\) This function only makes sense on the interval \([0,5000]\text{.}\) While we are fairly certain the endpoints will not give a minimal cost, we still evaluate \(c(x)\) at each to verify.

\begin{align*} c(0) \amp = 380{,}000\amp c(5000) \amp \approx 662{,}873\text{.} \end{align*}

(Notice that if \(x=0\text{,}\) the line is run the full 5000 ft along land and a full 1000 ft under water. If \(x=5000\text{,}\) the line is run the maximum distance underwater.)

We now find the critical values of \(c(x)\text{.}\) We compute \(c'(x)\) as

\begin{equation*} c'(x) = -50+\frac{130x}{\sqrt{x^2+1000^2}}\text{.} \end{equation*}

Recognize that this is never undefined. Setting \(c'(x)=0\) and solving for \(x\text{,}\) we have:

\begin{align*} -50+\frac{130x}{\sqrt{x^2+1000^2}} \amp = 0\\ \frac{130x}{\sqrt{x^2+1000^2}} \amp = 50\\ \frac{130^2x^2}{x^2+1000^2} \amp = 50^2\\ 130^2x^2 \amp = 50^2(x^2+1000^2)\\ 130^2x^2-50^2x^2 \amp = 50^2\cdot1000^2\\ (130^2-50^2)x^2 \amp = 50,000^2\\ x^2 \amp = \frac{50,000^2}{130^2-50^2}\\ x \amp = \frac{50,000}{\sqrt{130^2-50^2}}\\ x \amp = \frac{50,000}{120} =\frac{1250}3\approx 416.67\text{.} \end{align*}

Evaluating \(c(x)\) at \(x=416.67\) gives a minimal cost of about \(\$370{,}000\text{.}\) The distance the power line is laid along land is \(5000-416.67 = 4583.33\) ft., and the underwater distance is \(\sqrt{416.67^2+1000^2} \approx 1083\) ft.

Solution 2. The trigonometric approach

Word problems often have some flexibility in how we label the drawing, and what we chose to be the fundamental variable that we optimize against. Since the sketch of the situation in this example prominantly features a triangle, an attractive alternative is to attempt to frame the problem in terms of angles and trigonometric functions.

In this solution, we will attempt to express all distances and costs in terms of an angle \(\theta\text{,}\) which I have chosen to represent as the angle between the shoreline and the submarine portion of the cable, as indicated in Figure 4.3.10. I have also chosen to keep all distances as in the picture labeled with symbolic variables, rather than exact numbers. As we shall see at the end of the problem, these choices will allow us to gain some deeper understanding of the general solution to problems with this structure, which we were not able to capture using the approach in the first solution.

Figure 4.3.10. Running a power line from the power station to an offshore facility with minimal cost in Example 4.3.7

As before, we begin by labeling the important distances in the problem in terms of our new fundamental variable \(\theta\) and the distances \(A\) along the coast and \(B\) from the coast to the offshore facility. Using the basic trigonomietric definitions, we know that the length of the submarine cable \(w\) obeys the relationship \(\sin(\theta) = \frac{B}{w}\text{,}\) which we can solve for \(w\text{.}\) Recognizing that the cosecant function is defined to be the reciprocal of the sine function, we obtain the expression \(B\csc(\theta)\text{,}\) as shown in Figure 4.3.11, for the length of the triangle's hypotenuse.

Similarly, we arrive at the conclusion that the adjacent side of the triangle has length \(B\cot(\theta)\text{,}\) as indicated in the figure. We complete the sketch by labeling the cable length along the shoreline as \(A-B\cot(\theta)\text{.}\)

Figure 4.3.11. Labeling unknown distances in Example 4.3.7 based on an angle variable.

The cost function for the problem is still the sum of cost of the land portion and the cost of the water portion of the cable. If we use the symbols \(c_L\) and \(c_W\) to represent the cost per length to lay cable on land and water respectively, we obtain the following form of the cost function

\begin{equation*} c(\theta) = c_L(A-B\cot(\theta)) + c_WB\csc(\theta)\text{.} \end{equation*}

We now take a moment to consider the domain of the angles which are relevant to the problem. The angle \(\theta\) increases as the length of cable on land increases, and so the largest angle that is sensible happens when the land portion of the cable extends the full distance \(A\text{.}\) In this situation the angle \(\theta\) is a right angle, so we find that the angle \(\theta \le \frac{\pi}{2}\text{.}\) The smallest angle occurs when the cable is laid entirely underwater, in which case we have \(\tan(\theta)=\frac{B}{A}\text{,}\) indicating that \(\theta \ge \tan^{-1}(\frac{B}{A})\text{.}\) Therefore the domain of the angle is the closed interval \([\tan^{-1}(\frac{B}{A}), \frac{\pi}{2}]\text{.}\) It is important to consider this domain, since it is entirely possible for the cheapest possible plan to be located at one of these endpoints.

Figure 4.3.12. The smallest angle in the domain of the problem corresponds to building in a straight line between the two facilities, shown as a dashed line. The largest angle corresponds to building on the thick solid line, when the angle made by the cable when it leaves the shore is 90 degrees.

Returning to our cost function, we attempt to find critical values. Computing the derivative with respect to the angle, we find that

\begin{align*} c'(\theta) \amp = c_LB\csc^2(\theta) - c_WB\csc(\theta)\cot(\theta)\\ \amp = B\csc(\theta)(c_L\csc(\theta) - c_W\cot(\theta))\\ \amp = \frac{B}{\sin(\theta)} \left(\frac{c_L}{\sin(\theta)} - \frac{c_W\cos(\theta)}{\sin(\theta)}\right)\\ \amp = \frac{B}{\sin(\theta)}\cdot\frac{c_L-c_W\cos(\theta)}{\sin(\theta)}\text{.} \end{align*}

This derivative form can give rise to both types of critical point, locations where there is a zero as well as locations where the derivative is undefined. We notice that the derivative will be undefined whenever \(\sin(\theta)=0\text{,}\) and we recall from our previous studies of trigonometry that this will occur at any integer multiple of \(\pi\) (i.e., \(\ldots, -2\pi, -\pi, 0, \pi, 2\pi, \ldots\text{.}\))

Since our expression for \(c'(\theta)\) can be expressed as a product of two terms, we know that a zero of the entire function can be obtained only when at least one of those terms is zero. The first term can only be zero if the numerator \(B=0\text{,}\) in which case the entire problem is moot, since the "offshore" facility would not be offshore at all. The second term can only be zero when the numerator is zero, which happens when \(c_L = c_W\cos(\theta)\text{,}\) implying that

\begin{equation*} \theta = \cos^{-1}\left(\frac{c_L}{c_W}\right)\text{.} \end{equation*}

This critical angle has a simple interpretation, it is the angle associated with a triangle whose hypotenuse has length \(c_W\) and the adjacent side has length \(c_L\text{,}\) as shown in Figure 4.3.13.

Figure 4.3.13. The critical point occurs when the angle corresponds to the similar triangle where the length of the hypotenuse is the cost per length to build underwater and the adjacent side is the cost per length to build on land.

We now check which of these potential critical points are actually inside the problem's domain, which we earlier found to be \([\tan^{-1}(\frac{B}{A}),\frac{\pi}{2}]\text{.}\) First, from Figure 4.3.12 and the fact that both \(A\) and \(B\) are positive numbers representing distances, we can see that the smallest angle in the domain will be a positive number, while the largest angle is a right angle. Thus, our entire domain is contained within the interval \([0,\pi/2]\text{.}\) This means that we can ignore all of the undefined-type critical points, as they will not be in the domain of the problem.

This leaves us with only one potential critical point to consider, at \(\cos^{-1}(\frac{c_L}{c_W})\text{.}\) Figure 4.3.13 gives us a good understanding of when this angle will be in the domain, and when it will not be. The critical point is inside the domain if the triangle in Figure 4.3.13 will fit inside the triangle shown in Figure 4.3.12. The critical point is not in the domain if \(c_L\) is too long relative to \(c_W\text{,}\) resuling giving a triangle which is short and fat, where the angle \(\theta\) is smaller than the angle associated with heading directly to the offshore facility.

Figure 4.3.12 also helps us understand that when the critical point is in the domain, it must be associated with a minimum of the cost function. If the angle is smaller than the critical angle, then the adjacent side will be slightly elongated relative to the hypotenuse, which means that the expression \(c_L - c_W\cos(\theta)\) will be a negative value, leading to the entire derivative being negative. (Signalling that the cost function is decreasing.) Conversely, if the angle is slightly larger than the critical angle, then the adjacent side of the triangle will be slightly shorter, and the derivative will be positive instead, meaning that the cost function is increasing.

At this point, it is fruitful to review and summarize our findings. The domain of the problem depends only on the ratio \(B/A\text{,}\) which describes the overall shape (but not the size!) of the triangle that results from running the cable directly from the power plant to the offshore facility. Furthermore, there is only one possible location of a critical point, and that critical point depends only on the ratio \(c_L/c_W\text{,}\) the relative expense of the land and water construction costs. This potential critical point may, or may not, be inside the domain of the problem, depending on how the angles associated with these two triangles compare to each other.

The situations where the critical point is not inside the domain correspond to large ratios \(c_L/c_W\text{,}\) indicating that the land cost is not significantly cheaper than the water construction costs. If this critical point is outside the domain, then we know that the minimum cost must occur at one of the domain endpoints, and the only real logical possibility in this situation is that the direct route will be the cheapest one.

Thus we have arrived at a deeper understanding of the general solution to the problem. It turns out that the only truly relevant quantities are the ratios \(B/A\) and \(c_L/c_W\text{,}\) a fact that was not at all obvious in the first solution. Secondly, we have found that only when \(\tan^{-1}(B/A)\lt\cos^{-1}(c_L/c_W)\) will the minumum cost construction plan include a component that travels along the coast. If this is not the case, the cheapest option will be to build directly towards the offshore facility.

It is left as an excercise to the reader to plug in the values given for the quantities \(A\text{,}\) \(B\text{,}\) \(c_L\text{,}\) and \(c_W\) in the problem and verify that the result is identical to the answer presented in the first solution to this problem.

In the exercises you will see a variety of situations that require you to combine problem-solving skills with calculus. Focus on the process; learn how to form equations from situations that can be manipulated into what you need. Eschew memorizing how to do “this kind of problem” as opposed to “that kind of problem.” Learning a process will benefit one far longer than memorizing a specific technique.

Before you begin the exercises, here is one more example, presented in video form.

Figure 4.3.14. Optimizing construction of a box with no top

Section 4.6 introduces our final application of the derivative: differentials. Given \(y=f(x)\text{,}\) they offer a method of approximating the change in \(y\) after \(x\) changes by a small amount.

Exercises Exercises

Terms and Concepts

1.

  • True

  • False

An “optimization problem” is essentially an “extreme values” problem in a “story problem” setting.

2.

  • True

  • False

This section teaches one to find the extreme values of a function that has more than one variable.

Problems

3.

Find the maximum product of two numbers (not necessarily integers) that have a sum of 64.

4.

Find the minimum sum of two positive numbers whose product is 440.

5.

Find the maximum sum of two positive numbers whose product is 460.

6.

Find the maximum sum of two numbers, each of which is less than or equal to \(350\text{,}\) whose product is 490.

7.

Find the maximal area of a right triangle with hypotenuse of length \(5\text{.}\)

8.

A rancher has \(1300\) feet of fencing in which to construct adjacent, equally sized rectangular pens. What dimensions should these pens have to maximize the enclosed area?

9.

A standard soda can is roughly cylindrical and holds \({355\ {\rm cm^{3}}}\) of liquid. What dimensions should the cylinder have to minimize the material needed to produce the can? Based on your dimensions, determine whether or not the standard can is produced to minimize the material costs.

Discuss whether or not your calculation suggests that a real world soda can is designed to minimize the materials cost.

10.

Find the dimensions of a cylindrical can with a volume of \({206\ {\rm in^{3}}}\) that minimizes the surface area.

The “#10 can”is a standard sized can used by the restaurant industry that holds about \({206\ {\rm in^{3}}}\) with a diameter of \(6\,\frac{3}{16}\,\text{in}\) and height of \(7\,\text{in}\text{.}\) Does it seem these dimensions where chosen with minimization in mind?

Discuss whether or not your calculation suggests that a #10 can is designed to minimize the materials cost.

11.

A standard soda can is roughly cylindrical and holds \({355\ {\rm cm^{3}}}\) of liquid. A real-world soda can has material on the top and bottom that is thicker than the material around the side. Assume that the top/bottom material is twice as thick as the material around the side. What dimensions should the cylinder have to minimize the material needed to produce the can? Based on your dimensions and the assumption about material thickness, determine whether or not the standard can is produced to minimize the material costs.

Discuss whether or not your calculation suggests that a real world soda can is designed to minimize the materials cost.

12.

The United States Postal Service charges more for boxes whose combined length and girth exceeds \(108\) inches. (The “length” of a package is the length of its longest side; the girth is the perimeter of the cross section, i.e., \(2w+2h\)).

What is the maximum volume of a package with a square cross section (\(w=h\)) that does not exceed the \(108\) inch standard?

13.

The strength \(S\) of a wooden beam is directly proportional to its cross sectional width \(w\) and the square of its height \(h\text{.}\) that is, \(S = kwh^2\) for some constant \(k\text{.}\)

Given a circular log with diameter of \(12\) inches, what sized beam can be cut from the log with maximum strength?

14.

A power line is to be run to an offshore facility in the manner described in Example 4.3.7. The offshore facility is \(3\) miles at sea and \(5\) miles along the shoreline from the power plant. It costs \({\$35{,}000}\) per mile to lay a power line underground and \({\$80{,}000}\) to run the line underwater.

How much of the power line should be run underground? What is the minimum overall cost?

15.

A power line is to be run to an offshore facility in the manner described in Example 4.3.7. The offshore facility is \(5\) miles at sea and \(2\) miles along the shoreline from the power plant. It costs \({\$40{,}000}\) per mile to lay a power line underground and \({\$80{,}000}\) to run the line underwater.

How much of the power line should be run underground? What is the minimum overall cost?

16.

A woman throws a stick into a lake for her dog to fetch; the stick is \(11\) feet down the shore line and \(26\) feet into the water from there. The dog may jump directly into the water and swim, or run along the shore line to get closer to the stick before swimming. The dog runs about \({18\ {\textstyle\frac{\rm\mathstrut ft}{\rm\mathstrut s}}}\) and swims about \({1.3\ {\textstyle\frac{\rm\mathstrut ft}{\rm\mathstrut s}}}\text{.}\)

How far along the shore should the dog run to minimize the time it takes to get to the stick? (Hint: the figure from Example 4.3.7 can be useful.)

17.

A woman throws a stick into a lake for her dog to fetch; the stick is \(31\) feet down the shore line and \(30\) feet into the water from there. The dog may jump directly into the water and swim, or run along the shore line to get closer to the stick before swimming. The dog runs about \({21\ {\textstyle\frac{\rm\mathstrut ft}{\rm\mathstrut s}}}\) and swims about \({2.2\ {\textstyle\frac{\rm\mathstrut ft}{\rm\mathstrut s}}}\text{.}\)

How far along the shore should the dog run to minimize the time it takes to get to the stick? (Google “calculus dog” to learn more about a dog’s ability to minimize times.)

18.

What are the dimensions of the rectangle with largest area that can be drawn inside the unit circle?