In this section we are going to look at optimization
problems. In optimization problems we
are looking for the largest value or the smallest value that a function can
take. We saw how to solve one kind of
optimization problem in the Absolute Extrema
section where we found the largest and smallest value that a function would
take on an interval.
In this section we are going to look at another type of
optimization problem. Here we will be
looking for the largest or smallest value of a function subject to some kind of
constraint. The constraint will be some
condition (that can usually be described by some equation) that must
absolutely, positively be true no matter what our solution is. On occasion, the constraint will not be
easily described by an equation, but in these problems it will be easy to deal
with as we’ll see.
This section is generally one of the more difficult for
students taking a Calculus course. One
of the main reasons for this is that a subtle change of wording can completely
change the problem. There is also the
problem of identifying the quantity that we’ll be optimizing and the quantity
that is the constraint and writing down equations for each.
The first step in all of these problems should be to very
carefully read the problem. Once you’ve
done that the next step is to identify the quantity to be optimized and the
In identifying the constraint remember that the constraint
is the quantity that must be true regardless of the solution. In almost every one of the problems we’ll be
looking at here one quantity will be clearly indicated as having a fixed value
and so must be the constraint. Once
you’ve got that identified the quantity to be optimized should be fairly simple
to get. It is however easy to confuse
the two if you just skim the problem so make sure you carefully read the
Let’s start the section off with a simple problem to
illustrate the kinds of issues we will be dealing with here.
Example 1 We
need to enclose a rectangular field with a fence.
We have 500 feet of fencing material and a building is on one side of
the field and so won’t need any fencing.
Determine the dimensions of the field that will enclose the largest
In all of these problems we will have two functions. The first is the function that we are
actually trying to optimize and the second will be the constraint. Sketching the situation will often help us
to arrive at these equations so let’s do that.
In this problem we want to maximize the area of a field
and we know that will use 500 ft of fencing material. So, the area will be the function we are
trying to optimize and the amount of fencing is the constraint. The two
equations for these are,
Okay, we know how to find the largest or smallest value of
a function provided it’s only got a single variable. The area function (as well as the
constraint) has two variables in it and so what we know about finding
absolute extrema won’t work. However,
if we solve the constraint for one of the two variables we can substitute
this into the area and we will then have a function of a single variable.
So, let’s solve the constraint for x. Note that we could have
just as easily solved for y but
that would have led to fractions and so, in this case, solving for x will probably be best.
Substituting this into the area function gives a function
Now we want to find the largest value this will have on
the interval [0,250]. Note that the
interval corresponds to taking (i.e.
no sides to the fence) and (i.e.
only two sides and no width, also if there are two sides each must be 250 ft
to use the whole 500ft).
Note that the endpoints of the interval won’t make any
sense from a physical standpoint if we actually want to enclose some area
because they would both give zero area.
They do, however, give us a set of limits on y and so the Extreme Value Theorem
tells us that we will have a maximum value of the area somewhere between the
two endpoints. Having these limits
will also mean that we can use the process we discussed in the Finding Absolute
Extrema section earlier in the chapter to find the maximum value of the
So, recall that the maximum value of a continuous function
(which we’ve got here) on a closed interval (which we also have here) will
occur at critical points and/or end points.
As we’ve already pointed out the end points in this case will give
zero area and so don’t make any sense.
That means our only option will be the critical points.
So let’s get the derivative and find the critical points.
Setting this equal to zero and solving gives a lone
critical point of . Plugging this into the area gives an area
of 31250 ft2. So according
to the method from Absolute Extrema section this must be the largest possible
area, since the area at either endpoint is zero.
Finally, let’s not forget to get the value of x and then we’ll have the dimensions
since this is what the problem statement asked for. We can get the x by plugging in our y
into the constraint.
The dimensions of the field that will give the largest
area, subject to the fact that we used exactly 500 ft of fencing material,
are 250 x 125.
Don’t forget to actually read the problem and give the
answer that was asked for. These types
of problems can take a fair amount of time/effort to solve and it’s not hard
to sometimes forget what the problem was actually asking for.
In the previous problem we used the method from the Finding
Absolute Extrema section to find the maximum value of the function we wanted to
optimize. However, as we’ll see in later examples it will not always be easy to find endpoints. Also, even if we can find the endpoints we will see that sometimes dealing with the endpoints may not be easy either.
Not only that, but this method requires that the function we’re
optimizing be continuous on the interval we’re looking at, including the
endpoints, and that may not always be the case.
So, before proceeding with any more examples let’s spend
a little time discussing some methods for determining if our solution is in
fact the absolute minimum/maximum value that we’re looking for. In some examples all of these will work while
in others one or more won’t be all that useful.
However, we will always need to use some method for making sure that our
answer is in fact that optimal value that we’re after.
Method 1 : Use the method used in Finding Absolute Extrema.
This is the method used in the first example above. Recall that in order to use this method the
range of possible optimal values, let’s call it I, must have finite endpoints.
Also, the function we’re optimizing (once it’s down to a single
variable) must be continuous on I,
including the endpoints. If these
conditions are met then we know that the optimal value, either the maximum or
minimum depending on the problem, will occur at either the endpoints of the
range or at a critical point that is inside the range of possible solutions.
There are two main issues that will often prevent this
method from being used however. First,
not every problem will actually have a range of possible solutions that have
finite endpoints at both ends. We’ll see
at least one example of this as we work through the remaining examples. Also, many of the functions we’ll be
optimizing will not be continuous once we reduce them down to a single variable
and this will prevent us from using this method.
Method 2 :
Use a variant of the First Derivative Test.
In this method we also will need a range of possible optimal
values, I. However, in this case, unlike the previous
method the endpoints do not need to be finite.
Also, we will need to require that the function be continuous on the
interior I and we will only need the
function to be continuous at the end points if the endpoint is finite and the
function actually exists at the endpoint.
We’ll see several problems where the function we’re optimizing doesn’t
actually exist at one of the endpoints.
This will not prevent this method from being used.
Let’s suppose that is a critical point of the function we’re
trying to optimize, . We already know from the First Derivative
Test that if immediately to the left of (i.e.
the function is increasing immediately to the left) and if immediately to the right of (i.e.
the function is decreasing immediately to the right) then will be a relative maximum for .
Now, this does not mean that the absolute maximum of will occur at . However, suppose that we knew a little bit
more information. Suppose that in fact
we knew that for all x
in I such that . Likewise, suppose that we knew that for all x
in I such that . In this case we know that to the left of ,
provided we stay in I of course, the
function is always increasing and to the right of ,
again staying in I, we are always
decreasing. In this case we can say that
the absolute maximum of in I
will occur at .
Similarly, if we know that to the left of the function is always decreasing and to the
right of the function is always increasing then the
absolute minimum of in I
will occur at .
Before we give a summary of this method let’s discuss the
continuity requirement a little. Nowhere
in the above discussion did the continuity requirement apparently come into
play. We require that the function
we’re optimizing to be continuous in I
to prevent the following situation.
In this case, a relative maximum of the function clearly
occurs at . Also, the function is always decreasing to
the right and is always increasing to the left.
However, because of the discontinuity at ,
we can clearly see that and so the absolute maximum of the function
does not occur at . Had the discontinuity at not been there this would not have happened
and the absolute maximum would have occurred at .
Here is a summary of this method.
First Derivative Test
for Absolute Extrema
Method 3 :
Use the second derivative.
There are actually two ways to use the second derivative to
help us identify the optimal value of a function and both use the Second Derivative Test to one extent or
The first way to use the second derivative doesn’t actually
help us to identify the optimal value.
What it does do is allow us to potentially exclude values and knowing
this can simplify our work somewhat and so is not a bad thing to do.
Suppose that we are looking for the absolute maximum of a
function and after finding the critical points we find that we have multiple
critical points. Let’s also suppose that
we run all of them through the second derivative test and determine that some
of them are in fact relative minimums of the function. Since we are after the absolute maximum we
know that a maximum (of any kind) can’t occur at relative minimums and so we
immediately know that we can exclude these points from further consideration. We could do a similar check if we were
looking for the absolute minimum. Doing
this may not seem like all that great of a thing to do, but it can, on
occasion, lead to a nice reduction in the amount of work that we need to do in
The second way of using the second derivative to
identify the optimal value of a function is in fact very similar to the
second method above. In fact we will
have the same requirements for this method as we did in that method. We need an interval of possible optimal
values, I and the endpoint(s) may or
may not be finite. We’ll also need to
require that the function, be continuous everywhere in I except possibly at the endpoints as
Now, suppose that is a critical point and that . The second derivative test tells us that must be a relative minimum of the
function. Suppose however that we also
knew that for all x
In this case we would know that the function was concave up in all of I and that would in turn mean that the
absolute minimum of in I
would in fact have to be at .
Likewise if is a critical point and for all x
in I then we would know that the
function was concave down in I and
that the absolute maximum of in I
would have to be at .
Here is a summary of this method.
Test for Absolute Extrema
Before proceeding with some more examples we need to once
again acknowledge that not every method discussed above will work for every
problem and that, in some problems, more than one method will work. There are also problems where we may need to
use a combination of these methods to identify the optimal value. Each problem will be different and we’ll need
to see what we’ve got once we get the critical points before we decide which
method might be best to use.
Okay, let’s work some more examples.
Example 2 We
want to construct a box whose base length is 3 times the base width. The material used to build the top and
bottom cost $10/ft2 and the material used to build the sides cost
$6/ft2. If the box must
have a volume of 50ft3 determine the dimensions that will minimize
the cost to build the box.
First, a quick figure (probably not to scale…).
We want to minimize the cost of the materials subject to
the constraint that the volume must be 50ft3. Note as well that the cost for each side is
just the area of that side times the appropriate cost.
The two functions we’ll be working with here this time
As with the first example, we will solve the constraint
for one of the variables and plug this into the cost. It will definitely be easier to solve the
constraint for h so let’s do that.
Plugging this into the cost gives,
Now, let’s get the first and second (we’ll be needing this
So, it looks like we’ve got two critical points here. The first is obvious, ,
and it’s also just as obvious that this will not be the correct value. We are building a box here and w is the box’s width and so since it
makes no sense to talk about a box with zero width we will ignore this
critical point. This does not mean
however that you should just get into the habit of ignoring zero when it
occurs. There are other types of
problems where it will be a valid point that we will need to consider.
The next critical point will come from determining where
the numerator is zero.
So, once we throw out ,
we’ve got a single critical point and we now have to verify that this is in
fact the value that will give the absolute minimum cost.
In this case we can’t use Method 1 from above. First, the function is not continuous at
one of the endpoints, ,
of our interval of possible values.
Secondly, there is no theoretical upper limit to the width that will
give a box with volume of 50 ft3.
If w is very large then we
would just need to make h very
The second method listed above would work here, but that’s
going to involve some calculations, not difficult calculations, but more work
The third method however, will work quickly and simply
here. First, we know that whatever the
value of w that we get it will have
to be positive and we can see second derivative above that provided we will have and so in the interval of possible optimal
values the cost function will always be concave up and so must give the absolute minimum cost.
All we need to do now is to find the remaining dimensions.
Also, even though it was not asked for, the minimum cost
is : .
Example 3 We
want to construct a box with a square base and we only have 10 m2
of material to use in construction of the box. Assuming that all the material is used in
the construction process determine the maximum volume that the box can have.
This example is in many ways the exact opposite of the
previous example. In this case we want
to optimize the volume and the constraint this time is the amount of material
used. We don’t have a cost here, but
if you think about it the cost is nothing more than the amount of material
used times a cost and so the amount of material and cost are pretty much tied
together. If you can do one you can do
the other as well. Note as well that
the amount of material used is really just the surface area of the box.
As always, let’s start off with a quick sketch of the box.
Now, as mentioned above we want to maximize the volume and
the amount of material is the constraint so here are the equations we’ll
We’ll solve the
constraint for h and plug this into
the equation for the volume.
Here are the
first and second derivatives of the volume function.
Note as well
here that provided ,
which we know from a physical standpoint will be true, then the volume
function will be concave down and so if we get a single critical point then
we know that it will have to be the value that gives the absolute maximum.
first derivative equal to zero and solving gives us the two critical points,
In this case we
can exclude the negative critical point since we are dealing with a length of
a box and we know that these must be positive. Do not however get into the habit of just
excluding any negative critical point.
There are problems where negative critical points are perfectly valid
Now, as noted
above we got a single critical point, 1.2910, and so this must be the value
that gives the maximum volume and since the maximum volume is all that was
asked for in the problem statement the answer is then : .
Note that we
could also have noted here that if then and likewise if then and so if we are to the left of the critical
point the volume is always increasing and if we are to the right of the
critical point the volume is always decreasing and so by the Method 2 above
we can also see that the single critical point must give the absolute maximum
of the volume.
though these weren’t asked for here are the dimension of the box that gives
the maximum volume.
So, it looks like in this case we actually have a perfect
In the last two examples we’ve seen that many of these
optimization problems can be done in both directions so to speak. In both examples we have essentially the same
two equations: volume and surface area.
However, in Example 2 the volume was the constraint and the cost (which
is directly related to the surface area) was the function we were trying to
optimize. In Example 3, on the other
hand, we were trying to optimize the volume and the surface area was the
It is important to not get so locked into one way of doing
these problems that we can’t do it in the opposite direction as needed as
well. This is one of the more common
mistakes that students make with these kinds of problems. They see one problem and then try to make
every other problem that seems to be the same conform to that one solution even
if the problem needs to be worked differently.
Keep an open mind with these problems and make sure that you understand
what is being optimized and what the constraint is before you jump into the
Also, as seen in the last example we used two different
methods of verifying that we did get the optimal value. Do not get too locked into one method of
doing this verification that you forget about the other methods.
Let’s work some another example that this time doesn’t
involve a rectangle or box.
Example 4 A
manufacturer needs to make a cylindrical can that will hold 1.5 liters of
liquid. Determine the dimensions of
the can that will minimize the amount of material used in its construction.
In this problem the constraint is the volume and we want
to minimize the amount of material used.
This means that what we want to minimize is the surface area of the
can and we’ll need to include both the walls of the can as well as the top
and bottom “caps”. Here is a quick
sketch to get us started off.
We’ll need the surface area of this can and that will be
the surface area of the walls of the can (which is really just a cylinder)
and the area of the top and bottom caps (which are just disks, and don’t
forget that there are two of them).
Note that if you think of a cylinder of height h and radius r as just a bunch of disks/circles of radius r stacked on top of each other the equations for the surface area
and volume are pretty simple to remember.
The volume is just the area of each of the disks times the
height. Similarly, the surface area is
just the circumference of the each circle times the height. The equations for the volume and surface
area of a cylinder are then,
Next, we’re also going to need the required volume in a better
set of units than liters. Since we
want length measurements for the radius and height we’ll need to use the fact
that 1 Liter = 1000 cm3 to convert the 1.5 liters into 1500 cm3. This will in turn give a radius and height
in terms of centimeters.
Here are the equations that we’ll need for this problem
and don’t forget that there two caps and so we’ll need the area from each.
In this case it
looks like our best option is to solve the constraint for h and plug this into the area
this formula will only make sense from a physical standpoint if which is a good thing as it is not defined
Next, let’s get
the first derivative.
From this we
can see that we have two critical points : and . The first critical point doesn’t make sense
from a physical standpoint and so we can ignore that one.
So we only have
a single critical point to deal with here and notice that 6.2035 is the only
value for which the derivative will be zero and hence the only place (with of course) that the derivative may change
sign. It’s not difficult to check that
if then and likewise if then . The variant of the First Derivative Test
above then tells us that the absolute minimum value of the area (for )
must occur at .
All we need to
do this is determine height of the can and we’ll be done.
the manufacturer makes the can with a radius of 6.2035 cm and a height of
12.4070 cm the least amount of material will be used to make the can.
As an interesting side problem and extension to the above
example you might want to show that for a given volume, L, the minimum material will be used if regardless of the volume of the can.
In the examples to this point we’ve put in quite a bit of
discussion in the solution. In the
remaining problems we won’t be putting in quite as much discussion and leave it
to you to fill in any missing details.
Example 5 We
have a piece of cardboard that is 14 inches by 10 inches and we’re going to
cut out the corners as shown below and fold up the sides to form a box, also
shown below. Determine the height of
the box that will give a maximum volume.
In this example, for the first time, we’ve run into a
problem where the constraint doesn’t really have an equation. The constraint is simply the size of the
piece of cardboard and has already been factored into the figure above. This will happen on occasion and so don’t
get excited about it when it does.
This just means that we have one less equation to worry about. In this
case we want to maximize the volume. Here is the volume, in terms of h and its first derivative.
first derivative equal to zero and solving gives the following two critical
We now have an
apparent problem. We have two critical
points and we’ll need to determine which one is the value we need. In this case, this is easier than it
looks. Go back to the figure in the
problem statement and notice that we can quite easily find limits on h.
The smallest h can be is even though this doesn’t make much sense as
we won’t get a box in this case. Also
from the 10 inch side we can see that the largest h can be is although again, this doesn’t make much sense
that whatever h is it must be in
the range we can see that the second critical point is
outside this range and so the only critical point that we need to worry about
the volume is defined and continuous on all we need to do is plug in the critical
points and endpoints into the volume to determine which gives the largest
volume. Here are those function
So, if we take we get a maximum volume.
Example 6 A
printer need to make a poster that will have a total area of 200 in2
and will have 1 inch margins on the sides, a 2 inch margin on the top and a
1.5 inch margin on the bottom. What
dimensions will give the largest printed area?
This problem is a little different from the previous
problems. Both the constraint and the
function we are going to optimize are areas.
The constraint is that the overall area of the poster must be 200 in2
while we want to optimize the printed area (i.e. the area of the poster with the margins taken out).
Here is a sketch of the poster and we can see that once
we’ve taken the margins into account the width of the printed area is and the height of the printer area is .
Here are the equations that we’ll be working with.
Solving the constraint for h and plugging into the equation for the printed area gives,
The first and second derivatives are,
From the first derivative
we have the following three critical points.
we’re dealing with the dimensions of a piece of paper we know that we must
have and so only 10.6904 will make sense.
that provided the second derivative will always be
negative and so in the range of possible optimal values of the width the area
function is always concave down and so we know that the maximum printed area
will be at .
The height of the paper that gives the maximum printed
area is then,
We’ve worked quite a few examples to this point and we have
quite a few more to work. However this
section has gotten quite lengthy so let’s continue our examples in the next
section. This is being done mostly
because these notes are also being presented on the web and this will help to
keep the load times on the pages down somewhat.