Solving problems involving maxima and minima

In this section we'll apply the calculus of curve sketching to solve problems in which the solution is the maximum or minimum of some relevant function. The solutions to these problems will generally have three phases:

Solving max/min problems

  1. Construct a function of one variable (see step 2) that models the quantity you're trying to minimize or maximize.

  2. Take any necessary steps to reduce the function to one of one variable by finding expression(s) for one variable in terms of another.

  3. Take the first derivative of the function and set it equal to zero; solve for the independent variable.

  1. Find the maximum or minimum value of the function using the result. Use precalculus skills or the second derivative to confirm that what you're finding by setting the derivative is really what you want, a max. or a min.

  2. Make sure to check the endpoints of the domain of your function, if they're included in it (i.e. if you're working in a closed interval [a, b] of the independent variable). Sometimes the max or min will occur at an included endpoint.

The best way to learn max/min problems is by example, so here are a few different kinds of problems and their solutions. Enjoy!

Example 1

A wire of length L is to be cut into two pieces and bent into squares. Where should the wire be cut in order to maximize the total area of the two squares.

Solution: Here's a picture of what's going on. A wire of length L is cut somewhere, and each piece is bent into two squares, of side lengths x/4 and (L-x)/4:

The squares look like this. Their areas are written below.

The area function that we will try to maximize is just the sum of these:

The derivative of the area with respect to x (where the wire is cut) is

The terms have the same denominator, so we can add them and set them equal to zero to find the critical point – the derivative is linear, so we expect only one.

The critical point is

which means that in order to maximize the area, we should cut the wire in half. That may have seemed obvious, but just wait. The area function, A(x), evaluated at x = L/2, is

Now let's sketch a graph of that area function with the x-axis spanning x = [0, L]. At x = 0 and x = L – which means cutting the wire at the very ends, or in other words, not cutting it at all, the area is L2/16, twice our "optimal" area.

What's the lesson?

What we actually found was the minimum area that could be obtained by folding the wire into squares, not the maximum.

When doing max/min problems like this, where the domain is a closed interval, always check the endpoints.

We might have also realized that this was actually a minimum of the area function by calculating the second derivative and noting that it was positive everywhere, indicating that the function has no maximum on [0, L], or anywhere.


Closed interval

A closed interval is one that contains the endpoints.

In interval notation, square brackets mean that the endpoint is to be included, and parentheses mean it is not. For example:

[a,b] means a ≤ x ≤ b

[a,b) means a ≤ x < b

(a,b] means a < x ≤ b

(a,b) means a < x < b

Example 2

Johannes Kepler (1571-1630) proposed this problem: What are the dimensions of the largest wine barrel (cylinder) that can be inscribed inside of a sphere of radius R?

Solution: Here is a sphere of radius R with a cylinder inscribed in it. Notice that the only points of contact between the sphere and cylinder are along the circular top and bottom of the cylinder. The radius of the cylinder is r and its half-height is h/2.

The volume of any cylinder is a function of its radius and height:

Now the Pythagorean theorem for the right triangle drawn in the figure above can be rearranged to find r2,

With that last relationship, the volume function can be rewritten in terms of only the height:

We can clean that up a bit before taking a derivative, multiplying through by π and h:

The derivative with respect to the height is then

Now to find the critical points, we set the first derivative equal to zero,

This quadratic function should give us two critical points, but one would give a negative height, so the single relevant root gives

Taking the square root gives a compact version of h, one of our main results:

Now before we had come up with an expression for r2. Plugging h into that equation gives us

Taking the positive root again gives us the r of the largest-possible cylinder:

For a sphere of radius R = 1, the resulting largest cylinder looks like this:

We should also be careful here to go back to the first derivative and understand that the second derivative will always be negative (check for yourself), so our values of h and r indeed represent a maximum in the volume function.

Here is the first page of Kepler's original wine barrel problem (in Latin).

Example 3

An orchard owner has a plot of land with 25 apple trees planted on it. Agricultural studies predict that for every new tree planted, the yield of each tree will decrease by 12 apples. With 25 trees, each tree now averages 400 apples. How many trees should the farmer plant or remove in order to maximize the number of apples produced?

Here's the basic picture. More trees take more nutrients from existing trees and reduce the yield. It may be that a better yield will result from removing trees, but let's see.

First we construct a yield function, with an independent variable, n, representing the number of additional trees planted:

The function is

where 25 + n represents the number of trees and 400 - 12n is the number of apples per tree after the change. Multiplying those binomials gives us a quadratic function with a negative leading coefficient, so we know that this function has a maximum value:

The derivative of our yield function is

Setting it equal to zero and rearranging gives

So n = 4 (after rounding to the nearest tree), which means that the farmer should plant four more trees on the plot. That will reduce the yield of each tree by 48 apples, but with the addition of the new trees, the overall yield will be greater.

Example 4

A box without a top is to be constructed by cutting square flaps out of the corners of a 50 cm x 50 cm piece of cardboard, and folded as shown below. Find the dimensions of such a box that has the greatest volume.

The box is to be cut and folded as shown here. The "glue flaps" hold the sides at right angles to the bottom and to one another.

Here's a more fully-constructed version of the box, which will have a square bottom.

The layout of the flat piece of cardboard looks like this. The x-by-x squares are not really part of the surface area of the box; they overlap with the sides. The bottom of the box has sides measuring 50 - 2x cm, where x is the length of the square glue flaps.

The volume of our box, as a function of x, its height, is

Expanding that gives us a cubic function for the volume

Taking the first derivative gives

Now we set the derivative equal to zero to find critical points:

This quadratic equation can be solved by completing the square. To do that we move the constant term to the right by subtraction and divide everything by the leading coefficient, 12:

Completing the square (adding the square of half of the coefficient of x to both sides) gives:

Simplification and reduction of the left side to the perfect square gives

Taking the square root of both sides gives two solutions,

They are:

Now the minus solution says we cut the box 25 cm in from the edge, but that's half way across, so we wouldn't actually have a box at all. The plus solution is the correct one.

The resulting box of maximum volume (9260 cm2 = 9.26 Liters) looks like this

Example 5

You are standing on a beach when you spot a drowning person. You are 150 m down the beach and the person is 25 m out into the water. You can run 9 m/s on the sand and you can swim at a rate of 1.5 m/s. How far should you run down the beach before swimming, in order to minimize the time it takes to reach the swimmer?

Here's a picture of this situation. This is actually quite an important problem; it's even useful in the field of optics. Of course, your brain pretty much does this calculation automatically in an emergency, but it's still fun to find the optimum path.

We begin by refining the diagram. We'll run a distance 150-x m along the beach before swimming. the resulting right triangle gives us a nice function for the total distance.

The distance is

Now the definition of speed can be rearranged to find the time.

We find a time function by dividing the two distances by their respective speeds, 9 m/s in sand (that's actually pretty fast in sand) and 1.5 m/s in the water.

We want to find the minimum of this function so we take the first derivative:


which we can simplify and set equal to zero to find critical point(s):

Moving the -1/9 to the right gives

We can then cross-multiply to get

Dividing by 3 gives

and squaring both sides gives

Gathering terms gives us

and finally the result is

So the answer is to run almost all the way down the beach before swimming toward the victim. Changing the speeds would alter the course.

Example 6

A tin can is to be manufactured so that it has a volume of 1 Liter. The material for the top and bottom costs $0.02/cm2 and the material for the sides costs $0.01/cm2. Find the dimensions of the can that minimizes its cost.

Here's a picture of the situation. The volume of a cylinder is V(r, h) = πr2h

One liter is 1000 cm3, so our volume equation is

Now we write a cost function representing the total cost of manufacturing a can. It's a function of two variables, r and h.

Using the volume constraint, solve for h:

and replace h in the cost function with it to get a cost function of one variable:

Reducing the function, we get

Now take the derivative of that function with respect to r:

and set it equal to zero to find the critical point(s):

Rearranging gives


and finally, we can find r:

Going back to our formula for h, derived from the volume constraint, we find h:


The approximate dimensions of the can are that the height is twice the diameter. It will look roughly like this.

Creative Commons License   optimized for firefox by Dr. Jeff Cruzan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. © 2012, Jeff Cruzan. All text and images on this website not specifically attributed to another source were created by me and I reserve all rights as to their use. Any opinions expressed on this website are entirely mine, and do not necessarily reflect the views of any of my employers. Please feel free to send any questions or comments to