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:

- Construct a function of one variable (see step 2) that models the quantity you're trying to minimize or maximize.
- Take any necessary steps to reduce the function to one of one variable by finding expression(s) for one variable in terms of another.
- Take the first derivative of the function and set it equal to zero; solve for the independent variable.

- 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.
- 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!

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****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:

$$A(x) = \frac{x^2}{16} + \frac{(L - x)^2}{16}$$

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

$$A'(x) = \frac{x}{8} + \frac{-(L - x)}{8}$$

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.

$$\frac{2x - L}{8} = 0$$

The critical point is

$$x = \frac{L}{2}$$

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

$$A(x) = \frac{L^2}{32}$$

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 L^{2}/16, twice our "optimal" area.

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

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.

X
### 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

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****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:

$$V_{cyl} = \pi r^2 h$$

Now the Pythagorean theorem for the right triangle drawn in the figure above can be rearranged to find **r**^{2},

$$\left( \frac{h}{2} \right)^2 + r^2 = R^2 \; \rightarrow \; r^2 = R^2 - \left( \frac{h}{2} \right)^2$$

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

$$V(h) = \pi \left( R^2 - \frac{h^2}{4} \right) h$$

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

$$V(h) = \pi R^2 h - \frac{\pi h^3}{4}$$

The derivative with respect to the height is then

$$V'(h) = \pi R^2 - \frac{3 \pi h^2}{4}$$

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

$$\frac{3 \pi h^2}{4} - \pi R^2 = 0$$

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

$$h = \sqrt{\frac{4 R^2}{3}}$$

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

$$h = \frac{2R}{\sqrt{3}}$$

Now before we had come up with an expression for **r ^{2}**. Plugging

$$r^2 = R^2 - \frac{R^2}{3} = \frac{2R^2}{3}$$

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

$$r = R\sqrt{\frac{2}{3}}$$

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).*

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:

$$Y(n) = (n \; trees)(n \; apples)$$

The function is

$$Y(n) = (25 + n)(400 - 12n)$$

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:

$$Y(n) = 7500 + 100 n - 12 n^2$$

The derivative of our yield function is

$$Y'(n) = 100 - 24 n$$

Setting it equal to zero and rearranging gives

$$100 - 24 n = 0 \; \longrightarrow \; 24n = 100$$

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.

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

$$ \begin{align} V(x) &= L \times W \times H \\ &= (50 - 2x)(50 - 2x) \cdot x \end{align}$$

Expanding that gives us a cubic function for the volume

$$ \begin{align} V(x) &= (2500 - 200x + 4x^2) \cdot x \\ &= 4x^3 - 200x^2 + 2500x \end{align}$$

Taking the first derivative gives

$$V'(x) = 12x^2 - 400x + 2500$$

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

$$12x^2 - 400x + 2500 = 0$$

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:

$$x^2 - \frac{100}{3}x = -\frac{625}{3}$$

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

$$x^2 - \frac{100}{3}x + \left( \frac{50}{3} \right)^2 = -\frac{625}{3} + \frac{2500}{9}$$

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

$$\left( x - \frac{50}{3} \right)^2 = \frac{-1875 + 2500}{9}$$

Taking the square root of both sides gives two solutions,

$$x = \frac{50 ± \sqrt{625}}{3}$$

They are:

$$x = \frac{50 ± 25}{3}$$

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 cm^{2} = 9.26 Liters) looks like this

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

$$L(x) = 150 - x + \sqrt{x^2 + 25^2}$$

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

$$s = \frac{d}{t} \; \longrightarrow \; t = \frac{d}{s}$$

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.

$$t(x) = \frac{150 - x}{9} + \frac{\sqrt{x^2 + 25^2}}{1.5}$$

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

$$t'(x) = -\frac{1}{9} + \frac{1}{2}\frac{2}{3}(x^2 + 25^2)^{-1/2}(2x)$$

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

$$t'(x) = -\frac{1}{9} + \frac{2x}{3(x^2 + 25^2)^{1/2}} = 0$$

Moving the -1/9 to the right gives

$$\frac{2x}{3(x^2 + 25^2)^{1/2}} = \frac{1}{9}$$

We can then cross-multiply to get

$$18x = 3(x^2 + 25^2)^{1/2}$$

Dividing by 3 gives

$$6x = (x^2 + 25^2)^{1/2}$$

and squaring both sides gives

$$36 x^2 = x^2 + 25^2$$

Gathering terms gives us

$$ \begin{align} 35x^2 &= 25^2 \\ \\ x^2 &= \frac{25^2}{35} \end{align}$$

and finally the result is

$$\bf x = 4.2 \; m$$

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.

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/cm^{2} and the material for the sides costs $0.01/cm^{2}. 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) = πr ^{2}h**

One liter is 1000 cm^{3}, so our volume equation is

$$1000 \; cm^3 = \pi r^2 h$$

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

$$C = 0.01(2 \pi r h) + 2(0.02)(\pi r^2)$$

Using the volume constraint, solve for h:

$$h = \frac{1000}{\pi r^2}$$

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

$$C(r) = \frac{0.01(2 \pi r)(1000)}{\pi r^2} = 0.04 \pi r^2$$

Reducing the function, we get

$$C(r) = \frac{20}{r} + 0.04 \pi r^2$$

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

$$C'(r) = -\frac{20}{r^2} + 0.08 \pi r$$

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

$$-\frac{20}{r^2} + 0.08 \pi r = 0$$

Rearranging gives

$$0.08 \pi r^3 = 20$$

and

$$r^3 = \frac{20}{0.08 \pi}$$

and finally, we can find r:

$$r = 4.3 \; cm$$

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

$$h = \frac{1000}{\pi r^2} = \frac{1000}{\pi\cdot (4.3)^2}$$

$$h = 17.2 \; cm$$

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

**xaktly.com** by Dr. Jeff Cruzan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. © 2012-2019, 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 jeff.cruzan@verizon.net.