Optimization

Whenever you decide how much to make, how far to travel, or how to use limited resources, you're making an optimization choice: among the available options, which one works best? Depending on the situation, you might want to maximize volume, area, efficiency, or profit, or minimize cost, time, distance, material, risk, or loss. These goals often compete with one another, and real constraints keep us from improving anything without limit.
Optimization also brings us back to mathematical modeling. In a real-world situation, no one hands us the right function and domain on a silver platter; we have to decide what to measure, which features of the situation matter, and what assumptions are reasonable. Those choices shape the model we end up with, so calculus can identify the best option only within the world the model describes.
By the end of this lesson, you should be able to:
- Translate a situation into an objective function, a constraint, and a meaningful domain.
- Reduce a constrained model to one variable and identify critical points and boundary points as candidates.
- Compare candidates to determine and interpret absolute maxima and minima.
A manufacturing company is creating an open-topped box out of a \( 30 \)-centimeter by \( 20 \)-centimeter sheet of cardboard. A square of side length \( h \) centimeters is cut from each corner, and the four sides are then folded upward to make the box.
Look what happens when we move the slider to change the corner-square side length \( h \). Both views show the same design; watch how increasing the height changes the dimensions of the base.
Let \( \ell \), \( w \), and \( h \) represent the box's length, width, and height, respectively, measured in centimeters; then the volume of the rectangular box is \[V=\ell\cdot w\cdot h\text{.}\]
When the sides are folded up, the corner-square side length \( h \) becomes the box's height. As a result, the original \( 30 \)-centimeter length now consists of the new length \( \ell \) together with two removed lengths of \( h \): \[\ell+2h=30\text{.}\]
Similarly, the original width gives \( w+2h=20 \). Solving these two constraints for the base dimensions gives
\(\displaystyle \ell=\)\(\displaystyle \text{,}\)
\(\displaystyle w=\)\(\displaystyle \text{.}\)
Substituting both relationships into \( V=\ell\cdot w\cdot h \) expresses the objective as a function of the height alone:
\(\displaystyle V(h)=\)\(\displaystyle \text{ cubic centimeters.}\)
Notice that if we increase \( h \), we end up decreasing \( \ell \) and \( w \), so we have two competing effects on the volume of the box. A few trial cuts show the nonlinear result of these effects:
| Height \( h \) (cm) | Box dimensions (cm) | Volume \( V(h) \) (\( \text{cm}^3 \)) |
|---|---|---|
| \( 2 \) | \( 26\times16\times2 \) | |
| \( 4 \) | \( 22\times12\times4 \) | |
| \( 6 \) | \( 18\times8\times6 \) |
Among these three designs, the \( 4 \)-centimeter cut holds the most, but a table with three rows can't show that it's the best of every possible cut. Instead, we can use calculus to find the actual maximum.
Expanding the volume function gives \[V(h)=4h^3-100h^2+600h\text{,}\] whose derivative is \(\displaystyle V'(h)=\)\(\displaystyle \text{.}\)
To find where the maximum occurs, we can check where \( V'(h) \) is zero. Setting \( V'(h)=0 \) and solving gives two answers:
\(\displaystyle h\tsub{lower}=\)\(\displaystyle \text{,}\)
\(\displaystyle h\tsub{upper}=\)\(\displaystyle \text{.}\)
These solutions are approximately \( 3.92 \) and \( 12.74 \). The box dimensions must be nonnegative, so \( 0\le h\le10 \). The higher solution is .
The lower solution is the only critical point in the feasible interval. Substituting this value into the volume function (and rounding to two decimal places) gives
\(\displaystyle V(h\tsub{lower})\approx\)\(\displaystyle \text{ cm}^3\text{.}\)
The First Derivative Test or the Second Derivative Test could classify the interior critical point as a local maximum or minimum. Our question asks for an absolute maximum, however, so we need to compare the objective at every feasible candidate: the two boundary points \( h=0 \) and \( h=10 \), and the critical point \( h\tsub{lower}\approx 3.92 \):
| Candidate \( h \) (cm) | \( V(h) \) (\( \text{cm}^3 \)) |
|---|---|
| \( 0 \) | \( 0 \) |
| \( \approx3.92 \) | \( \approx1056.31 \) |
| \( 10 \) | \( 0 \) |
The boundary values represent collapsed constructions rather than usable boxes, but they still describe what happens at the edges of the feasible interval. These and \( h\tsub{lower} \) are all the feasible candidates. Since \( V(h\tsub{lower}) \) is greater than both \( V(0) \) and \( V(10) \), \( h\tsub{lower} \) gives .
We can mark this optimizing height with a superscript star: \( h^*=h\tsub{lower}\approx3.92 \) centimeters. The maximum possible volume is obtained by making the box approximately \( 22.15 \) centimeters long, \( 12.15 \) centimeters wide, and \( 3.92 \) centimeters high, with maximum volume \( V(h^*)\approx1056.31 \) cubic centimeters. Finding where the derivative is zero identified the interior candidate, while the constraints and boundary comparison completed the argument.
Objectives, constraints, and domains
An optimization problem asks for the greatest or least possible value of a quantity. The quantity being maximized or minimized is the objective, and an equation or inequality that feasible choices must satisfy is a constraint.
At first, the quantity we care about may depend on several measurements. In this case, the constraints let us rewrite some of those measurements until we get an objective function of one variable; however, we still need to make sure the domain reflects what is actually possible.
We could have chosen to make \( A \) a function of \( y \) instead, but that choice would have introduced fractions and made the algebra slightly less convenient. Choosing a variable is part of the modeling: a useful choice makes the constraint easy to solve and gives the objective a manageable formula, while a different choice can make the algebra longer or obscure the feasible domain.
Finding and testing candidates
Once we have an objective function, we need to look for which inputs are worth checking to find the minimum or maximum output.
In Section 2.2, we defined a critical point as an input in the domain where \( f'(x)=0 \) or where \( f'(x) \) doesn't exist. If an absolute maximum or minimum occurs at an interior point, that input must be critical. Otherwise the derivative would exist and be nonzero, so moving slightly in one direction would produce a more favorable nearby output.
Note these candidates are only possibilities; to figure out where the absolute maximum and minimum actually happen, we still have to evaluate the objective at each one and compare the results.
An open or unbounded domain may have no included boundary points to evaluate. In that case, knowing how the function behaves throughout the domain can help us decide whether an interior candidate is an absolute optimum.
An optimum doesn't always exist. For example, \( f(x)=x \) on \( 0<x<1 \) has values arbitrarily close to \( 1 \), but it never attains the value \( 1 \). The domain determines not only which candidates are feasible, but whether a “best” value is actually achieved.
Checking an optimal result
A mathematically optimal answer is optimal only within the assumptions of its model. After calculating, return to the original quantities and ask:
Are all dimensions and quantities feasible and expressed with units?
Does the requested decision have to be a whole number or satisfy an additional practical restriction?
Were material thickness, waste, fixed costs, safety margins, or other effects intentionally omitted?
Would small changes near the optimum matter greatly, or is there a broad range of nearly optimal choices?
If a factory must produce a whole number of items and calculus gives \( x=47.3 \), the relevant candidates may become \( 47 \) and \( 48 \). Both objective values should be checked rather than automatically rounding in one direction. Likewise, the \( 3.92 \)-centimeter corner cut from Explore maximizes the box's volume in the geometric model, but a manufacturer would still need to consider material thickness, folding tolerances, cost, and structural strength.
Putting the process together
The contexts and formulas in optimization problems vary, but the same sequence connects the model to a defensible decision.
The setup and the algebra may vary from one problem to another, but this structure keeps the calculus connected to the decision the model is meant to support.
Find the absolute maximum and absolute minimum of each function on the indicated domain.
\( f(x)=${f} \) on \( ${left}\le x\le${right} \)
Maximizer(s): Maximum: Minimizer(s): Minimum: Solution
Since \( f'(x)=${fp} \), the only interior critical point is \( x=${h} \). Comparing it with the boundary points gives \( f(${left})=${left_value} \), \( f(${h})=${k} \), and \( f(${right})=${right_value} \). Therefore the maximizer is \( x=${maximizer} \) and the maximum is \( ${maximum} \); the minimizer is \( x=${h} \) and the minimum is \( ${k} \).
The graph is shown only on the indicated domain, so both boundary points must be included among the candidates. \( g(x)=${g} \) on \( ${-boundary}\le x\le${boundary} \)
Maximizer(s): Maximum: Minimizer(s): Minimum: Solution
Since \( g'(x)=${gp} \), the interior critical points are \( x=${-a} \) and \( x=${a} \). The candidate values are \( g(${-boundary})=${minimum} \), \( g(${-a})=${maximum} \), \( g(${a})=${minimum} \), and \( g(${boundary})=${maximum} \). Thus \( x=${-a} \) and \( x=${boundary} \) are both maximizers, with maximum value \( ${maximum} \). Similarly, \( x=${-boundary} \) and \( x=${a} \) are both minimizers, with minimum value \( ${minimum} \).
Different inputs can tie for the same greatest or least output. \( h(x)=x^{2/3}(${b}-x) \) on \( 0\le x\le${b} \)
Maximizer(s): Maximum: Minimizer(s): Minimum: Solution
For \( x\ne0 \), the derivative is \( \displaystyle h'(x)=\frac{${2*b}-5x}{3x^{1/3}} \). The boundary points are \( x=0 \) and \( x=${b} \); the derivative also doesn't exist at \( x=0 \). The only interior critical point is \( x=${critical} \), where the derivative is zero. Their values are \( h(0)=0 \), \( h(${b})=0 \), and \( h(${critical})=${maximum_coefficient}(${maximum_base})^{2/3}\approx${maximum_decimal} \). Therefore the maximizer is \( x=${critical} \), with maximum value \( ${maximum_coefficient}(${maximum_base})^{2/3} \). Both \( x=0 \) and \( x=${b} \) are minimizers, with minimum value \( 0 \).
The graph has a sharp feature at the left boundary point, where the function exists but its derivative does not.
A bakery models its daily profit, in dollars, from producing \( x \) batches of pastries by
\[P(x)=-5x^2+${linear}x${signed(constant)}\qquad(0\le x\le${upper_domain})\text{.}\]
The formula treats \( x \) as a continuous variable, but the bakery can produce only a whole number of batches.
The maximizer of the continuous model is \( x^*= \) batches.
Solution
The derivative is \( P'(x)=-10x+${linear} \), which is zero at \( x=${continuous_text} \). The derivative is positive before \( ${continuous_text} \) and negative afterward, so the continuous model has its maximum at \( x=${continuous_text} \).
The feasible whole numbers on either side of the continuous maximizer are \( ${lower_batch} \) and \( ${upper_batch} \). Their modeled profits are
\(\displaystyle P(${lower_batch})\)\(\displaystyle =\$\)\(\displaystyle \text{,}\)\(\displaystyle P(${upper_batch})\)\(\displaystyle =\$\)\(\displaystyle \text{.}\)
The bakery should produce batches for a maximum modeled profit of \( \$ \).
Solution
Because profit increases up to \( x=${continuous_text} \) and decreases afterward, \( ${lower_batch} \) is the best feasible whole number below the continuous maximizer and \( ${upper_batch} \) is the best one above it. Comparing \( P(${lower_batch})=${lower_profit} \) with \( P(${upper_batch})=${upper_profit} \) shows that producing \( ${best_batch} \) batches gives the maximum modeled profit of \( \$${best_profit} \).
Why isn't \( ${continuous_text} \) an acceptable final answer, even though it maximizes the continuous model?
Solution
The bakery's actual decision is restricted to whole batches, so \( ${continuous_text} \) is not feasible. Calculus narrows the search to the nearby whole numbers, but the discrete constraint determines which candidates can be implemented.
A closed cylindrical can must hold \( 355 \) cubic centimeters. Let \( r>0 \) be its radius and \( h>0 \) its height, both measured in centimeters.
Move the slider to change the radius. The height adjusts so that the cylinder's volume remains \( 355 \) cubic centimeters. Use the volume constraint to express the can's surface area as a function of \( r \).
Solution
The constraint \( \pi r^2h=355 \) gives \( h=355/(\pi r^2) \). A closed can has two circular ends and a curved side, so
\[\begin{aligned}S(r)&=2\pi r^2+2\pi rh\\ &=2\pi r^2+\frac{710}{r}\qquad(r>0)\text{.}\end{aligned}\]
Find the interior critical point and the corresponding height.
Solution
Differentiating gives \( S'(r)=4\pi r-710/r^2 \). The equation \( S'(r)=0 \) implies
\[r=\sqrt[3]{\frac{355}{2\pi}}\approx3.84\text{ cm.}\]
At this radius, \( 355=2\pi r^3 \), so \( h=355/(\pi r^2)=2r\approx7.67 \) cm.
Explain why this candidate gives the absolute minimum surface area.
Solution
For smaller positive radii, \( S'(r)<0 \); for larger radii, \( S'(r)>0 \). In addition, \( S(r) \) grows without bound as \( r \) approaches zero or becomes very large. Therefore the sign change identifies the absolute minimum. The model predicts a minimum area of approximately \( 277.55 \) square centimeters, attained when the height equals the diameter.
A printed poster must contain \( ${printed_area} \) square centimeters of printed material. It will have margins \( ${side_margin} \) centimeters wide on the left and right and \( ${top_margin} \) centimeters wide at the top and bottom. Find the poster dimensions that minimize the total paper area.
The blue region has constant area \( ${printed_area} \) square centimeters. Move the slider to change its width; the printed height and the full poster dimensions adjust. Solution
Let \( x>0 \) be the printed width. The printed height is \( ${printed_area}/x \), so the full poster dimensions are \( x+${2*side_margin} \) and \( ${printed_area}/x+${2*top_margin} \). The objective function is
\[A(x)=(x+${2*side_margin})\left(\frac{${printed_area}}{x}+${2*top_margin}\right)=${constant_term}+${linear_coefficient}x+\frac{${reciprocal_coefficient}}{x}\text{.}\]
Its derivative is \( A'(x)=${linear_coefficient}-${reciprocal_coefficient}/x^2 \), which is zero at the only positive candidate, \( x=${printed_width} \). The derivative is negative before \( ${printed_width} \) and positive afterward, while the area becomes very large near either end of the positive domain. Therefore this candidate gives the absolute minimum. The printed region is \( ${printed_width} \) cm by \( ${printed_height} \) cm, and the full poster is \( ${poster_width} \) cm by \( ${poster_height} \) cm, with area \( ${minimum_area} \) square centimeters.
Find the points on the parabola \( y=x^2 \) that are closest to the point \( (0,${height}) \).
Move the slider to move the violet point along the parabola. The red segment shows its distance from \( (0,${height}) \). Let \( S(x) \) represent the square of the distance from \( (x,x^2) \) to \( (0,${height}) \). Find a formula for \( S(x) \), and explain why minimizing \( S \) also minimizes the distance.
Solution
A point on the parabola has coordinates \( (x,x^2) \), so
\[S(x)=x^2+(x^2-${height})^2\text{.}\]
The actual distance is \( \sqrt{S(x)} \). Because the square-root function is increasing on nonnegative inputs, whichever value of \( x \) minimizes \( S(x) \) also minimizes the distance. Working with squared distance avoids a square root and makes the differentiation easier.
Find and compare the candidates.
Solution
Differentiating gives
\[S'(x)=2x+4x(x^2-${height})=2x(2x^2-${2*height-1})\text{.}\]
The candidates are \( x=0 \) and \( x=\pm\sqrt{${critical_square}} \). At \( x=0 \), \( S(0)=${height^2} \). At either of the other candidates, \( x^2=${critical_square} \), so \( S(x)=${critical_square}+1/4=${distance_square} \). The squared distance also grows without bound as \( |x| \) grows.
State the closest points and the minimum distance.
Solution
The closest points are \( (\sqrt{${critical_square}},${critical_square}) \) and \( (-\sqrt{${critical_square}},${critical_square}) \). Both are \( \sqrt{${4*height-1}}/2 \) units from \( (0,${height}) \). The symmetry of the parabola explains why two different points tie for the absolute minimum.
A student minimizes the surface area of the \( 355 \)-cubic-centimeter can by solving \( S'(r)=0 \) and reports, “The answer is \( r=3.84 \).” Identify at least three ways the conclusion should be improved.
Solution
The report doesn't establish that the candidate is a minimum, give the corresponding height, include units, or interpret the result. A complete conclusion is that the model predicts a minimum-material can with radius approximately \( 3.84 \) cm and height approximately \( 7.67 \) cm, so its height equals its diameter. Because this conclusion comes from a simplified model, it isn't a universal manufacturing rule.
A small manufacturer models the revenue and total cost, in dollars, from producing and selling \( x \) units by
\[R(x)=${revenue_coefficient}x-x^2\qquad\text{and}\qquad C(x)=x^2+${fixed_cost}\text{.}\]
for \( 0\le x\le${upper_domain} \), treating production as continuous. When \( x>0 \), let \( A(x)=C(x)/x \) be the average cost per unit.
The Marginal revenue, cost, and profitMarginal revenue, marginal cost, and marginal profit are the derivatives of revenue, cost, and profit:\[MR(x)=R'(x),\qquad MC(x)=C'(x),\qquad MP(x)=P'(x)\text{.}\]Review in Section 2.1 → are the derivatives of revenue and cost:
\(\displaystyle R'(x)=\)\(\displaystyle \text{ dollars per unit,}\)
\(\displaystyle C'(x)=\)\(\displaystyle \text{ dollars per unit.}\)
Solution
Differentiating gives \( R'(x)=${revenue_coefficient}-2x \) and \( C'(x)=2x \). These functions estimate the additional revenue and additional cost associated with producing one more unit.
Profit is revenue minus cost, so
\(\displaystyle P(x)=R(x)-C(x)=\)\(\displaystyle \text{.}\)
Its derivative can be written in two equivalent ways:
\(\displaystyle P'(x)=\)\(\displaystyle =R'(x)-C'(x)\text{.}\)
Therefore an interior critical point of profit occurs when \( R'(x)-C'(x)=0 \), or equivalently when \( R'(x)=C'(x) \). For this model, the two marginal functions are equal when \( x= \).
The marginal revenue and marginal cost curves intersect where \( P'(x)=R'(x)-C'(x)=0 \). Solution
Subtracting cost from revenue gives \( P(x)=${revenue_coefficient}x-2x^2-${fixed_cost} \), so \( P'(x)=${revenue_coefficient}-4x \). Because \( P'=R'-C' \), the equation \( P'(x)=0 \) is equivalent to \( R'(x)=C'(x) \). Both equations give \( x=${profit_input} \).
The interior critical point and the two boundary points give the complete list of candidates:
\( x \) \( P(x) \) \( 0 \) \( ${profit_input} \) \( ${upper_domain} \) Thus the profit maximizer is \( x^*= \), and the maximum profit is \( \$ \).
Solution
The candidate values are \( P(0)=${-fixed_cost} \), \( P(${profit_input})=${maximum_profit} \), and \( P(${upper_domain})=${-fixed_cost} \). Therefore producing and selling \( ${profit_input} \) units gives the maximum modeled profit of \( \$${maximum_profit} \). In this model, the maximum-profit condition \( R'(x)=C'(x) \) identifies a candidate, and comparison with the boundary points confirms the absolute maximum.
Average cost divides the total cost among the units produced:
\(\displaystyle A(x)=\frac{C(x)}{x}=\)\(\displaystyle \qquad(0<x\le${upper_domain})\text{.}\)
For this model,
\(\displaystyle A'(x)=\)\(\displaystyle \text{.}\)
Solution
Dividing \( C(x)=x^2+${fixed_cost} \) by \( x \) gives \( A(x)=x+${fixed_cost}/x \), and differentiating gives \( A'(x)=1-${fixed_cost}/x^2 \).
More generally, applying the Quotient Rule to \( A(x)=C(x)/x \) gives
\[A'(x)=\frac{xC'(x)-C(x)}{x^2}\text{.}\]
At an interior critical point of average cost, the numerator must therefore be zero. Rearranging that condition gives
\[\begin{aligned}xC'(x)-C(x)&=0\\ C'(x)&=\frac{C(x)}{x}\\ &=A(x)\text{.}\end{aligned}\]
Thus any interior critical point of average cost occurs where marginal cost \( C'(x) \) equals average cost \( A(x) \).
The equation \( A'(x)=0 \) gives the feasible critical point \( x= \). On \( 0<x<${average_input} \), \( A'(x) \) is ; on \( ${average_input}<x\le${upper_domain} \), it is . Thus this critical point is the minimizer.
At that production level,
\(\displaystyle A(${average_input})=\)\(\displaystyle \text{ dollars per unit,}\)
\(\displaystyle C'(${average_input})=\)\(\displaystyle \text{ dollars per unit.}\)
Average cost reaches its minimum where the average-cost curve meets the marginal-cost curve. Solution
Solving \( 1-${fixed_cost}/x^2=0 \) gives \( x=${average_input} \) in the positive domain. The derivative changes from negative to positive there, so average cost decreases before \( ${average_input} \) and increases afterward. Hence the minimum average cost is \( A(${average_input})=${minimum_average} \) dollars per unit. The marginal cost is also \( C'(${average_input})=${minimum_average} \) dollars per unit.
Explain the two intersection conditions in context: why does \( R'(x)=C'(x) \) mark the turning point for profit, while \( C'(x)=A(x) \) marks the turning point for average cost?
Solution
Profit increases while the additional revenue from another unit exceeds its additional cost, so \( R'(x)>C'(x) \). Once marginal cost exceeds marginal revenue, another unit decreases profit. Their equality marks the transition and therefore supplies the interior profit-maximizing candidate.
Similarly, when the cost of one additional unit is below the current average cost, adding that unit pulls the average downward. When its cost is above the current average, it pushes the average upward. The equality \( C'(x)=A(x) \) marks the transition between decreasing and increasing average cost.