## How to Solve Optimization Problems in Calculus

Need to solve Optimization problems in Calculus? Let’s break ’em down and develop a strategy that you can use to solve them routinely for yourself.

### Overview

Optimization problems will always ask you to maximize or minimize some quantity, having described the situation using words (instead of immediately giving you a function to max/minimize). Typical phrases that indicate an Optimization problem include:

- Find the largest ….
- Find the minimum….
- What dimensions will give the greatest…?

*two*distinct Stages.

The first stage doesn’t involve Calculus at all, while by contrast the second stage is just a max/min problem that you recently learned how to solve:

**Stage I. Develop the function.**You must first convert the problem’s description of the situation into a function — crucially, a function that depends on only

*one*single variable.

**Stage II. Maximize or minimize that function.** Now maximize or minimize the function you just developed. You’ll use your usual Calculus tools to find the critical points, determine whether each is a maximum or minimum, and so forth.

A cylindrical can, with a top lid, must contain

*V*cm$^3$ of liquid. (A typical can of soda, for example, has

*V*= 355 cm$^3$.) What dimensions (height and radius) will minimize the cost of metal needed to construct the can?

### Stage I. Develop the function

**Step 1.**

In Optimization problems, **always begin by sketching the situation**. Always. If nothing else, this step means you’re not staring at a blank piece of paper; instead you’ve started to craft your solution.

The problem asks us to minimize the cost of the metal used to construct the can, so we’ve shown each piece of metal separately: the can’s circular top, cylindrical side, and circular bottom. We’ve labeled the can’s height *h* and its radius *r*. We’re looking for the values of *h* and *r* (in terms of *V*) that will minimize the cost of constructing the can.

**Step 2.**

**write an equation for the quantity we want to optimize**. Most frequently you’ll use your everyday knowledge of geometry for this step. In this problem, for instance, we want to minimize the cost of constructing the can, which means we want to use

*as little metal as possible*. Hence we want to

*minimize the can’s surface area*. So let’s write an equation for that total surface area:

\begin{align*}

A_\text{total} &= A_\text{top} + A_\text{cylinder} + A_\text{bottom} \\[8px]
&= \pi r^2 + 2\pi r h + \pi r^2 \\[8px]
&= 2\pi r^2 + 2 \pi r h

\end{align*}

That’s it; you’re done with Step 2! You’ve written an equation for the quantity you want to minimize $(A_\text{total})$ in terms of the relevant quantities (*r* and *h*).

**RELATED MATERIAL**

**Step 3.**

Here’s a key thing to know about how to solve Optimization problems: you’ll almost always have to use detailed information given in the problem to **rewrite the equation you developed in Step 2 to be in terms of one single variable.**

Above, for instance, our equation for $A_\text{total}$ has two variables, *r* and *h*. We *must* eliminate one of them in order to proceed. The choice of which to keep and which to eliminate is arbitrary; for our solution here, we choose to keep *r*. (We could just as easily choose *h*, and develop our solution along that path instead. We’d arrive at the same final result.) Since we’re choosing to work with *r*, we need to use other detailed information given in the problem to write *h* in terms of *r* so we can substitute for *h* as a variable.

*Begin subproblem.*

To accomplish this substitution, we look back to see what other constraints/information the problem gave us: recall that the can must hold an amount *V* of liquid, where *V* is some number. (*V* might be 355 cm$^3$, for instance.) Now a cylinder of radius *r* and height *h* has a volume of $V = \pi r^2 h,$ and so we can solve for *h* in terms of *V* and constants:

$$V = \pi r^2 h$$

thus

$$h = \dfrac{V}{\pi r^2} $$

That’s our expression for *h* in terms of *r* (and the constants *V* and $\pi).$

*End subproblem.*

We can now make this substitution $h = \dfrac{V}{\pi r^2}$ into the equation we developed earlier for the can’s total area:

\[ \begin{align*}

A_\text{total} &= 2\pi r^2 + 2 \pi r h \\[8px]
&= 2\pi r^2 + 2 \pi r \left( \frac{V}{\pi r^2}\right) \\[8px]
&= 2\pi r^2 + 2 \cancel{\pi} \cancel{r} \left(\frac{V}{\cancel{\pi} r\cancel{^2}}\right) \\[8px]
&= 2\pi r^2 + \frac{2V}{r}

\end{align*} \]

We’re done with Step 3: we now have the function in terms of a single variable, *r*:

$$A(r) = 2\pi r^2 + \frac{2V}{r}$$

We’re now writing $A(r)$ to emphasize that *A* is a function of only the single variable *r*, and we’ve dropped the subscript “total” from $A_\text{total}$ since we no longer need it.

This also concludes Stage I of our work: in these threes steps, we’ve developed the function we’re now going to minimize!

Notice, by the way, that so far in our solution we haven’t used any Calculus at all. That will always be the case when you solve an Optimization problem: you don’t use Calculus until you come to Stage II.

### Stage II: Maximize or minimize your function

*you*first have to develop the function you’re going to maximize or minimize, as we did in Stage I above. Having done that, the remaining steps are exactly the same as they are for the max/min problems you recently learned how to solve.

For instance, a few weeks ago you could have gotten this as a standard max/min homework problem:

“The surface area of a can is given by $A(r) = 2\pi r^2 + \dfrac{710}{r}\,.$ Find the value of *r* that minimizes that area.”

You would probably automatically find the derivative $A'(r)$ (which you could equivalently write as $\dfrac{dA}{dr})$, then find the critical points, then determine whether each represents a maximum or a minimum for the function, and so forth. That’s exactly what we’re now going to do in Stage II. Hence, you already know how to do all of the following steps; the only new part to maximization problems is what we did in Stage I above.

**Step 4.**

We want to minimize the function

$$ A(r) = 2\pi r^2 + \frac{2V}{r}$$

and so of course we must **take the derivative, and then find the critical points**.

Let’s thus first find the derivative. (Time to use Calculus!) Remember that *V* is just a constant — it’s some number, like 355.

\[ \begin{align*}

A'(r) &= \dfrac{d}{dr}\left(2\pi r^2 + \frac{2V}{r} \right) \\[8px]
&= \dfrac{d}{dr}\left(2\pi r^2 \right) + \dfrac{d}{dr}\left(\frac{2V}{r} \right) \\[8px]
&= 2\pi \dfrac{d}{dr}\left(r^2 \right) + 2V \dfrac{d}{dr}\left(r^{-1} \right) \\[8px]
&= 2\pi(2r) + 2V \left((-1)r^{-2} \right)\\[8px]
&= 4 \pi r\, – \frac{2V}{r^2}

\end{align*} \]

The critical points occur when $A'(r) = 0$:

\[ \begin{align*}

A'(r) = 0 &= 4 \pi r\, – \frac{2V}{r^2} \\[8px]
\frac{2V}{r^2} &= 4 \pi r \\[8px]
\frac{2V}{4 \pi} &= r^3 \\[8px]
r^3 &= \frac{V}{2\pi} \\[8px]
r &= \sqrt[3]{\frac{V}{2\pi}}

\end{align*} \]
We thus have only one critical point to examine, at $r = \sqrt[3]{\dfrac{V}{2\pi}}\,.$

**Step 5.**

Next we must **justify that the critical point we’ve found represents a minimum** for the can’s surface area (as opposed to a maximum, or a saddle point). We could reason physically, or use the First Derivative Test, but we think it’s easiest in this case to use the Second Derivative Test. Let’s quickly compute the second derivative, starting with the first derivative that we found above:

\[ \begin{align*}

A'(r) &= 4\pi r\, – 2V r^{-2} \\[8px]
A’^\prime(r) &= 4\pi \dfrac{d}{dr}(r) -2V \dfrac{d}{dr}\left(r^{-2} \right) \\[8px]
&= 4\pi -2V \left((-2)r^{-3} \right) \\[8px]
&= 4\pi + \frac{4V}{r^3}

\end{align*} \]

Since $r > 0$, this second derivative $\left(A’^\prime(r) = 4\pi + \dfrac{4V}{r^3}\right)$ is always positive $\left(A’^\prime(r) > 0 \right)$. That is, the graph of *A(r)* versus *r* is always concave up. Hence this single critical point gives us a *minimum* (as opposed to a maximum or saddlepoint), which is what we’re after:

The minimum surface area occurs when $r = \sqrt[3]{\dfrac{V}{2\pi}}\,. \quad \triangleleft$

**Step 6.**

Now that we’ve found the critical point that corresponds to the can’s minimum surface area (thereby minimizing the cost), let’s **finish answering the question**: The problem asked us to find the dimensions — the radius and height — of the least-expensive can. We’ve already found the relevant radius, $r = \sqrt[3]{\dfrac{V}{2\pi}}\,.$

To find the corresponding height, recall that in the Subproblem above we found that since the can must hold a volume *V* of liquid, its height is related to its radius according to

$$h = \dfrac{V}{\pi r^2}\,. $$

Hence when $r = \sqrt[3]{\dfrac{V}{2\pi}}\,,$

\[ \begin{align*}

h &= \frac{V}{\pi}\,\frac{1}{r^2} \\[8px]
&= \frac{V}{\pi}\,\frac{1}{\left( \sqrt[3]{\frac{V}{2\pi}}\right)^2} \\[8px]
&= \frac{V}{\pi}\,\frac{2^{2/3}\pi^{2/3}}{V^{2/3}} \\[8px]
&= 2^{2/3}\frac{V^{1/3}}{\pi^{1/3}} \\[8px]
h &= 2^{2/3}\sqrt[3]{\frac{V}{\pi}} \quad \triangleleft

\end{align*} \]
The preceding expression for *h* is correct, but we can gain a nice insight by noticing that

$$2^{2/3} = 2 \cdot\frac{1}{2^{1/3}}$$

and so

\[ \begin{align*}

h &= 2^{2/3}\sqrt[3]{\frac{V}{\pi}} \\[8px]
&= 2 \cdot\frac{1}{2^{1/3}}\,\sqrt[3]{\frac{V}{\pi}} \\[8px]
&= 2 \sqrt[3]{\frac{V}{2\pi}} = 2r

\end{align*} \]
since recall that the ideal radius is $r = \sqrt[3]{\dfrac{V}{2\pi}}\,.$ Hence the ideal height *h* is exactly twice the ideal radius.

To summarize, we conclude that the optimum dimensions for a closed-topped can that must contain a volume *V *of liquid are

\[ \begin{align*}

\text{radius } r &= \sqrt[3]{\dfrac{V}{2\pi}} \quad \cmark \\[8px]
\text{height } h &= 2\sqrt[3]{\dfrac{V}{2\pi}} \quad \cmark

\end{align*} \]

**Step 7. One last check**

**check what quantity/quantities the problem requested, and make sure you’ve provided that**—

*especially*on an exam, where you’ll lose points if you don’t answer the exact question that was asked. For example, the problem

*could*have asked to find the value of the smallest possible surface area

*A*, or the minimum cost.

Instead, in this case, the problem stated, “What *dimensions* (height and radius) will minimize the cost of metal to construct the can?” We have provided those two dimensions, and so we are done. $\checkmark$

### Summary: Problem Solving Strategy

We’ve now illustrated the steps we use to solve every single Optimization problem we encounter, and they always work.

### Stage I: Develop the function.

Your first job is to develop a function that represents the quantity you want to optimize. It can depend on only *one* variable. The steps:

**Draw a picture**of the physical situation.

Also note any physical restrictions determined by the physical situation.**Write an equation**that relates the quantity you want to optimize in terms of the relevant variables.- If necessary, use other given information to
**rewrite your equation in terms of a single variable.**

### Stage II: Maximize or minimize the function.

You now have a standard max/min problem to solve.

**Take the derivative**of your equation with respect to your single variable. Then find the critical points.**Determine the maxima and minima as necessary.**

Remember to**check the endpoints**if there are any.**Justify your maxima or minima**either by reasoning about the physical situation, or with the first derivative test, or with the second derivative test.- Finally,
**check to make sure you have answered the question as asked**: Re-read the problem and verify that you are providing the value(s) requested: an*x*or*y*value; or coordinates; or a maximum area; or a shortest time; whatever was asked.

For now, over to you:

- What tips do you have to share about how to solve Optimization problems?
- What questions do you have? Optimization problems can be tricky to start, and we’re happy to help!
- How can we make posts such as this one more useful to you?

Please head to our Forum and post!

*[Thanks to S. Campbell for his specific research into students’ learning of Optimization: *

*“College Student Difficulties with Applied Optimization Problems in Introductory Calculus,” unpublished masters thesis, The University of Maine, 2013.]*

Man, if only everyone was a thorough in their explanations as this one is

Thank you for the compliment. We are very happy to have helped! : )

Nice explanation and methodical approach. Setting up the problem is 99% of the problem. I’m still trying to figure out on other optimization solutions what yo do if the 2nd derivative is simply a constant. If f ‘(x) has a desired min or max, and f ‘’(x) differentiates to a constant, what does this mean to the max or min in the first derivative test? Does the sign of the constant alone in f ‘’(x) then determine concavity since there’s no potential inflection point? If that constant’s sign is negative (concave down) and the solution requires an optimization max, does that satisfy a proof? And vice versa if concavity is positive (concave up) confirm a minimum in the first derivative test?

Thanks, Chris. We’re glad to know you liked our explanation and approach. And agreed about getting the problem set-up right as the vast majority of the work here.

The answer to all of your questions is: yes! If the second derivative is a negative constant, then the function is concave down everywhere, and so you’re *guaranteed* that the point x=c you found where f'(c) = 0 is a maximum. (See the figure below.) Similarly, if the second derivative is a positive constant, then the function is concave up everywhere, and so the point x=c where f'(c) = 0 is guaranteed to be a minimum. And the fact that there’s no point of inflection anywhere doesn’t affect those conclusions.

The only thing that you wrote that isn’t quite right are the very last words, “in the first derivative test”; instead, you’re using the **Second Derivative Test**. That test is just as conclusive as the First Derivative Test, and is often easier to use. The one exception is if the second derivative is zero at the point of interest (f”(c)=0), in which case the Second Derivative Test is inconclusive and you have to revert to the First Derivative Test. But otherwise, the conclusion you reach with the Second Derivative test is indeed conclusive.

Hope that helps, and thanks for asking!

what problems can help to solve optimization

Thanks for asking! We have more completely solved optimization problems on this page: Optimization: Problems and Solutions.

We hope that helps!

very nicely organized! however i think it would have been more effective with some numbers, instead of variables. it can get hard to follow, especially when there’s multiple(in this case). but it was still lovely and easy to follow

Thank you for your nice comment, and for your suggestion. We’ll keep it in mind for future posts. For now: thanks very much!

I am having a tough time differentiating what it means when they say minimize(or maximize) a situation, as in how do the answers vary one from the other? I understand all the steps. I just want to be sure I pick the right “direction” when presented with an optimization problem….

Thanks for asking, Jon!

We’re happy to try to answer your question. First, we’d like to ask for a bit of clarification so we can be sure we address the question you actually have. Can you say a bit more about “how do the answers vary one from the other” ? Even better, could you give us an example, or two, of a problem where you don’t know what direction to pick initially? Is it that you’re not sure whether you need to maximize or minimize a particular quantity, or that when you’re presented with a situation you don’t know where to begin at all, or ??

And we know it’s tough to ask a clear question when you’re learning a new topic, so please just add whatever you can.

Thanks very much, and thanks again for posting your question, which I’m sure other students have as well!

What if you want to know the optimal volume needed for one product to finish at the same time with the other

We’re sorry that we don’t quite understand the question you’re asking. If you would like to provide more detail, perhaps with the statement of a problem you’re working to solve, we’ll be very happy to try to assist.

For now, thank you for your initial query!

## As of September 2022, we're using our Forum for comments and discussion of this topic, and for any math questions. We'd love to see you there and help! Please tap to visit our Forum: community.matheno.com