\chapter{Maximum/Minimum Problems}


A \index{max/min problem} max/min problem is a story problem where we want to {\it optimize}
something, that is, we want to determine the situation where something is
the biggest possible (such as profit, volume of a container, etc.)  or
where something is the smallest possible (cost, amount of material needed,
time of travel, etc.)  Solving a max/min problem is the two-step process of
(1) reformulating the story problem as a ``pure math problem,'' and (2) solving
the ``pure math problem''.  We begin with a brief outline of the procedure,
then discuss how to solve the pure math problem, and then present several
examples illustrating the procedure.

The {\bf pure math problem} just alluded to was described at the beginning
of Chapter~13:
\begin{quote}\em
Find the maximum (or minimum) value of a function $f(x)$ on the interval
from $a$ to $b$.
\end{quote}
Here is a procedure for solving this type of problem:
\begin{enumerate}
\item 
Find the value of $f(x)$ at each point $x$ between $a$ and $b$ where
$f'(x)=0$.
\item 
Find the value of $f(x)$ at all points $x$ between $a$ and $b$ where
$f'(x)$ does not exist.
\item 
Find the value of $f(x)$ at the endpoints $a$ and $b$.  (If $a= -\infty$
and/or $b=+\infty$ you have to find the values that $f(x)$ approaches as
$x$ approaches $\pm\infty$.)
\item 
The maximum (minimum) value of $f(x)$ is the largest (smallest) of the
values found in steps (1)--(3).
\end{enumerate}

Here are three simple examples which illustrate the procedure.

% Example 1
\begin{example}
\label{eg:14.1}
 Let $f(x)=-x^2+4x-3$. 
Find the maximum value of $x$ on the interval between $0$ and $4$.

First note that $f'(x)= -2 x +4=0$ when $x=2$, and $f(2)= 1$.
Next observe that $f'(x)$ is defined for all $x$, so step (2) gives no
$x$-values. Finally, $f(0) = -3$ and $f(4)= -3$. The largest value of
$f(x)$ on the interval between $0$ and $4$ is $f(2)=1$.
\end{example}

% Example 2
\begin{example}
\label{eg:14.2}
Again let $f(x)=-x^2+4x-3$. Find the \index{maximum value} maximum value of $f(x)$ on the interval between
$-1$ and $+1$.

First note that $f'(x)= -2 x +4=0$ when $x=2$. But $x=2$ is not in the
interval, so we don't use it.
Next observe that $f'(x)$ is defined for all $x$, so step (2) gives no
$x$-values. Finally, $f(-1) = -8$ and $f(1)= 0$. So the largest value of
$f(x)$ on the interval between $-1$ and $1$ is $f(1)=0$.
\end{example}

{\bf Note:} The maximum value depends not only on the function but on the
interval as well. Later in this chapter, we will give examples of story
problems where this observation is important.

% Example 3
\begin{example} 
\label{eg:14.3}
Find the minimum value of the function $f(x)= 7+|x-2|$ for
$x$ between $1$ and $4$.

Note that $|x-2|=x-2 $ for $x\geq 2$ and $|x-2|=2-x$ for $x<2$.
Thus the function $f(x)$ is given by two separate formulas:

$$f(x) = 7+2-x =9-x \mbox{~for~} 1\leq x <2 \mbox{~and~} f(x) =7+x-2 = 5+x
\mbox{~for~} 2\leq x \leq 4.$$

Thus the derivative of $f(x)$ is given by:

$$f'(x) = -1 \mbox{~for~} 1 < x <2 \mbox{~and~} f'(x) =1 
\mbox{~for~} 2 < x < 4.$$ 

Thus, $f'(2)$ is undefined and  $f'(x)$ is never zero.
So we compute $f(2)= 7$. Finally, we check the end points $f(1)=8$ and
$f(4)=9$. The smallest of these numbers is $f(2)=7$, which is, therefore,
the minimum value of $f(x)$ on the interval $1 \leq x \leq 4$.

Note that we did not include the endpoints in our investigation of $f'(x)$. They
are not needed in our procedure and need special handling even for definition
since the derivative at such points can only make sense from one direction

\end{example}


% Example 4
\begin{example}
\label{eg:14.4}
Of all rectangles of area 100, which has the smallest perimeter?

\smallskip

The first step toward solving this problem is to reduce it to a pure math
problem. If $x$ denotes one of the sides of the rectangle, then the adjacent side
must be $100/x$ (in order that the area be 100).  So the function we want
to minimize is 
\[
  f(x)=\text{perimeter~of}~x\text{~by~}\frac{100}{ x}~
    \text{rectangle}=2x+2\frac{100}{ x}.
\]
The perimeter function is given by the formula $2x+200/x$, where the {\it
domain} is $x>0$ (because it makes no sense to talk of a rectangle with
negative side).  We have reduced the problem to finding the minimum
value of $f(x)$ for $x$ between $0$ and $+\infty$.

We next find $f'(x)$ and set it equal to zero: $0=f'(x)=2-200/x^2$.  To
solve for $x$, we clear denominators and then move the constant to the
left, obtaining $200=2x^2$, which gives us $x=10$ (actually, $x=\pm 10$,
but $x=-10$ does not have practical meaning).  Since $f'(x)$ is defined for
all $x>0$, so there are no corners or cusps to check.  Our next step is to
examine the behavior of $f(x)$ at the endpoints.  The sketch this function
$f(x)=2x+200/x$ in the region of positive $x$ is shown below at the right.
We find that as $x$ gets close to 0 the function becomes larger and larger;
and the perimeter function also becomes large when $x$ gets very large.


\begin{rightindent}{2.5in}
\noindent
(More precisely, the line $x=0$ is a \index{vertical asymptote} vertical asymptote, and the
line $y=2x$ is a slanted asymptote that the function approaches as
$x\rightarrow\infty$.) Consequently, the minimum
value of $f(x)$ occurs at $x=10$, and the desired
rectangle is the $10\times 10$-rectangle, whose perimeter is 40.  Any other
rectangle of area 100 has perimeter greater than 40.  In the same way it is
not hard to show that for any fixed area $A$, the rectangle of area $A$
with smallest perimeter is the square of side $\sqrt{A}$.
\end{rightindent}
\hfill
%--- figure PA (max/min Example 1)--------------------
\begin{psfigure}{3.0in}{2.0in}{figPA.ps}
\end{psfigure}
%------------------------------

\smallskip

Another way to see that $x=10$ gives a minimum is to notice that $f(x)$
decreases for a while as we get away from 0 ; but if we go too far to the
right $f(x)$ is increasing.  In other words $f'(x)<0$ if $x<10$; while
$f'(x)>0$ if $x>10$.  So it is clear that the point $x=10$ where $f'(x)=0$
really is a minimum.

\end{example}

% Example 5
\begin{example}
\label{eg:14.5}
You want to sell a certain number $x$ of items in order to maximize your
profit.  Market research tells you that if you set the price at \$1.50, you
will be able to sell $5000$ items; and for every $10$ cents you lower the price
below \$1.50 you will be able to sell another 1000 items.  Suppose that
your fixed costs (``start-up costs'') total \$2000, and the per item cost
of production (``marginal cost'') is \$0.50.  Find the price to set per
item and the number of items sold in order to \index{maximize profit} maximize profit, and also
determine the maximum profit you can get.



\smallskip
To answer these questions, we first observe that our profit is equal to the
number of items sold times the price per item, minus the total cost to us.
If $P$ denotes the price, then this profit is $xP-(2000+0.50x)$.  (The term
in parentheses is fixed cost plus number of items times per item cost.)

\smallskip
To find $P$ in terms of $x$, we first note that the information given
allows us to write $x$ in terms of $P$: $x=5000+1000(1.50-P)/0.10$ (i.e.,
$5000$ plus $1000$ times the number of multiples of $10$ cents that $P$ is below
\$1.50).  Solving for $P$ and simplifying gives: $P=2-0.0001x$.  Thus, the
profit function that we want to maximize is: 
\begin{align*}
  f(x)&=x\,P-(2000+0.50\,x)\\
  &=x(2-0.0001\,x)-2000-0.50\,x =1.5x-0.0001\,x^2-2000.  
\end{align*}
We are now ready to set the derivative equal to zero:
$0=f'(x)=1.5-0.0002x$, from which we obtain $x=7500$.  Thus, we plan to
sell 7500 items, which we accomplish by lowering the price to \$1.25.  It
costs us $\$2000+0.50\cdot7500=\$5750$ to produce these items, and we take
in $7500\cdot\$1.25=\$9375$, leaving us a profit of $f(7500)=\$9375-\$5750=
\$3625$. This is the largest profit we can get under the assumptions of this
problem.

{\bf Further analysis.}
We did not take all the usual steps and we now explain why they do not affect
the answer here. For a complete answer, they are necessary!

What is the interval of values for $x$? Clearly $x>0$ and $x$ cannot be too large.
By looking at the function, clearly $x$ cannot be too large as we cannot
be interested in a negative profit function. Thus our interval could be $[0,\infty)$
and neither endpoint will be of interest, since it leads to negative profit. Since we
have only one other point (zero of $f'(x)$) to consider, it must be the point with
maximum profit.

It is also possible to find a more precise interval for $x$ corresponding to non negative
profit, but it is hardly worth the effort!

\smallskip

\begin{centering}

%--- figure PB (max/min Example 2)--------------------
\begin{psfigure}{3in}{2.0in}{figPB.ps}
\end{psfigure}\\
%------------------------------

\end{centering}

\smallskip

To be safe, we should check that the value of $x$ which made the
profit-function have derivative 0 is really a maximum.  It is not hard to
compute that $f(x)$ is increasing (i.e., $f'(x)>0$) when $x<7500$, and
$f(x)$ is decreasing when $x>7500$, so that $f(x)$ reaches a peak at
$x=7500$.  In most of the examples that follow (and when you do the
homework problems) it is clear enough from the practical set-up that the
value we find really is the maximum point (if we are looking for a maximum)
or the minimum point (if we are looking for a minimum).  So it is not
necessary to belabor the matter.  However, we should be cautious, as shown
by Example~\ref{eg:14.9} below.

\end{example}




% Example 6
\begin{example}
\label{eg:14.6}
Find the largest rectangle that fits inside the graph of the \index{parabola} parabola
$y=x^2$ below the line $y=a$.  (The top side of the rectangle should be on
the horizontal line $y=a$ --- see the drawing on the following page.)

\smallskip
Here the problem is to find where along the parabola to put the lower-right
corner of the rectangle.  That corner will determine all the other corners.
Thus, if we let $(x,x^2)$ be the point on the parabola where the lower-right
corner is put, then the upper-right corner will be $(x,a)$, the lower-left
corner will be $(-x,x^2)$, and the 

\begin{rightindent}{3.0in}
\noindent
upper-left corner will be $(-x,a)$.  We
can now write the area of the rectangle in terms of $x$:
\[
      f(x)=\text{Area}=(2x)(a-x^2)=2ax-2x^3.
\]
To maximize this area function, we set 
\[
          0=f'(x)=2a-6x^2,
\]
i.e., $x=\sqrt{a/3}$.  The resulting rectangle has dimensions
$2\sqrt{a/3}\times 2a/3$, and its area is $4(a/3)^{3/2}$.

{\bf Additional considerations.}
It seems reasonable that the biggest possible rectangle should be situated 
with sides parallel to the $x$ and $y$ axes and corners on the parabola and the
line $y=a$ as stipulated. However, this has not been proved. We need to argue 
this carefully. If the rectangle is situated in a crooked manner, then we should
be able to straighten it and then make it slightly bigger! You should think and try
to establish these points.

\medskip
\
\end{rightindent}
\hfill 
%--- figure PC (max/min Example 3)--------------------
%
\begin{psfigure}{2.0in}{2.0in}{figPC.ps}
\puttext{45.,-5}{\Small$a$}
\puttext{40., 40.}{\Small$y=x^2$}
\end{psfigure}
%------------------------------

\end{example}


% Example 7
\begin{example}
\label{eg:14.7}
If you fit the \index{largest possible cone inside a sphere} largest possible cone inside a sphere, what fraction of the
volume of the sphere is occupied by the cone?  (Here by ``cone'' we mean a
right circular cone, i.e., a cone for which the base is perpendicular to
the axis of symmetry, and for which the cross-section cut perpendicular to
the axis of symmetry at any point is a circle.)


\noindent
\begin{rightindent}{3.5in}
Let $R$ be the radius of the sphere, and let $r$ and $h$ be the base radius
and height of the cone inside the sphere.  What we want to maximize is the
volume of the cone: $\frac{1}{ 3}\pi r^2h$.  Here $R$ is a fixed value, but
$r$ and $h$ can vary.  Namely, we could choose $r$ to be as large as
possible --- equal to $R$ --- by taking the height equal to $R$; or we
could make the cone's height $h$ larger at the expense of making $r$ a
little less than $R$.  See the side view depicted at the right where we
have situated the picture in a convenient way relative to the $x$- and
$y$-axes, namely, with the center of the sphere at the origin and the
vertex of the cone at the far left on the $x$-axis.
\end{rightindent}
\hfill
%--- figure PD (max/min Example 4)--------------------
%
\begin{psfigure}{1.95in}{1.75in}{figPD.ps}
%%\puttext{-50, 5}{\Small$-R$}
%%\puttext{57, 5}{\Small$R$}
\puttext{57.1, 35.7}{\Small$(h-R,r)$}
\end{psfigure}
%------------------------------

\smallskip

Notice that the function we want to maximize --- $\frac{1}{ 3}\pi r^2h$ ---
depends on \underline{two} variables.  This happens in many max/min
problems.  However, the two variables are related in some way --- by a
certain condition of the form $C(r,h)=$constant.  So our next step is to
find such a condition, and use it to solve for one of the variables in
terms of the other, so as to have a function of only one variable to
maximize.  In this problem, the condition can be read off the above
drawing: the upper corner of the triangle, whose coordinates are $(h-R,r)$,
must be on the circle of radius $R$.  That is,

\[
      (h-R)^2+r^2=R^2.
\] 
We can solve for $h$ in terms of $r$ or for $r$ in terms of $h$.  Let's do
the latter.  Then we substitute the result for $r$ in $\frac{1}{ 3}\pi r^2h$,
obtaining $\frac{1}{ 3}\pi\bigl(R^2-(h-R)^2\bigr)h$.  

Notice a simple trick that we used. We do not actually solve for $r$, but
write
$r^2 = R^2 - (h-R)^2$
and then plug in our result into our function. If you try to solve for
$r$, then you get two roots and you will have to simplify the expression
again.

Recall that $R$ is just
a constant --- the only variable now is $h$.  Let us take
$f(h)=\bigl(R^2-(h-R)^2\bigr)h=(R^2-h^2+2hR-R^2)h=2h^2R-h^3$.  What
happened to the $\frac{1}{ 3}\pi$?  Well, we dropped this constant factor for
convenience.  The value of $h$ that makes $\frac{1}{ 3}\pi f(h)$ maximum is
the same as the value of $h$ that makes $f(h)$ maximum, so we don't need to
keep that constant factor when we take the derivative and set it equal to
zero.


We're now ready to set $0=f'(h)=4hR-3h^2=h(4R-3h)$.  This gives us
$h=4R/3$.  In other words, we should, in fact, choose $h$ a little larger
than $R$, at the expense of having $r$ somewhat less than $R$.  The exact
value of $r$ is determined by the condition above: $(h-R)^2+r^2=R^2$.
Solving for $r$ here (after setting $h=4R/3$) gives: $r=(\sqrt{8/9})R$.
Finally, the fraction of the sphere occupied by this cone is:
\[
   \frac{\text{vol~of~cone}}{\text{vol~of~sphere}}=\frac{\frac{1}{ 3}\pi r^2h}{
\frac{4}{ 3}\pi R^3}=\frac{(8R^2/9)(4R/3)}{ 4R^3}=\frac{8}{ 27}.
\]
The cone takes up a little less than 30\% of the sphere.
 
\end{example}

{\bf Alternative Method:}
We can use the technique of \index{implicit differentiation} implicit differentiation to avoid solving for $h$ or $r$ as follows.

We wish to find a maximum value for $F(h,r)= r^2h$ (dropping $\pi/3$ as before),
subject to the condition $(h-R)^2+r^2=R^2$. Let us think of everything
as a function of $h$ and take derivatives with respect to $h$.

From the derivative of the relation, we get:
$$2(h-R) + 2r dr/dh = 0$$
 By calculation of the derivative of $F(h,r)$ and setting it to zero, we get:
$$2rh (dr/dh) + r^2h = 0$$

%Example 8 
\begin{example}
\label{eg:14.8}

You are making cylindrical containers to contain a given volume.  Suppose
that the top and bottom are made of a material that is $N$ times as
expensive (cost per unit area) as the material used for the lateral side of
the cylinder.  Find (in terms of $N$) the ratio of height to base radius of
the cylinder that minimizes the cost of making the containers.

\smallskip

Let us first choose letters for various things: $h$ for the height, $r$ for
the base radius, and $V$ for the volume of the cylinder, and $c$ for the
cost per unit area of the lateral side of the cylinder.  Using the area
formulas $2\pi r^2$ for the top and bottom together and $2\pi rh$ for the
lateral side, we find that the total cost of the material is
\[
  c(2\pi rh)+Nc(2\pi r^2).
\]
Here $c$ and $N$ are constants that are given to us, but $r$ and $h$ are
variables.  To eliminate one of the two variables, we use the {\it
condition} that the volume must be $V$, i.e., $\pi r^2h=V$.  We use this
relation to eliminate $h$ (we could eliminate $r$, but it's a little easier
if we eliminate $h$, which appears in only one place in the above formula
for cost).  Thus we solve $h=V/(\pi r^2)$ and substitute in the
cost function. As a result, we consider the function:
\[
   f(r)=\pi r(V/\pi r^2)+N\pi r^2=\frac{V}{ r}+N\pi r^2.
\]
(What happened to the $c$ and the 2 in the above formula?  For convenience,
we can factor out the constant $2c$ and drop it from the expression to be
minimized, as in the previous example.)  We now set $0=f'(r)=-V/r^2+2N\pi
r$, giving $r={\root 3 \of {V/(2N\pi)}}$.  Next, we know that $h=V/\pi
r^2$, and so the ratio $h/r$ is equal to 
\[
\frac{h}{ r}=\frac{V}{\pi r^3}=\frac{V}{\pi\bigl(V/(2N\pi)\bigr)}=2N,
\] 
i.e., we choose the height to
be $2N$ times the base radius for the most economical container.

\end{example}


% Example 9
\begin{example}
\label{eg:14.9}

Suppose you want to reach a point $A$ that is located across the sand from
a nearby road.  Suppose that the road is straight, and $b$ is the distance
from $A$ to the closest point $C$ on the road.  Let $v$ be your speed on
the road, and let $w$, which is less than $v$, be your speed on the sand.
Right now you are at the point $D$, which is a distance $a$ from $C$.  At
what point $B$ should you turn off the road and head across the sand in
order to minimize your travel time to $A$?

\smallskip

Let $x$ be the distance short of $C$ where you turn off, i.e., the distance
from $B$ to $C$.  We want to minimize the total travel time.  When you're
traveling at constant velocity, you have: time=distance/velocity.

\noindent
\begin{rightindent}{3.2in}

In this problem (see the diagram at the right), we travel the distance
$\overline{DB}$ at speed $v$, and then the distance $\overline{BA}$ at
speed $w$.  Since $\overline{DB}=a-x$ and, by the Pythagorean theorem,
$\overline{BA}=\sqrt{x^2+b^2}$, we want to minimize the time-of-travel function
\[
   f(x)=\frac{a-x}{ v}+\frac{\sqrt{x^2+b^2}}{ w}.
\]
We set $f'(x)=0$ and next simplify by moving $1/v$ to the left and
cross-multiplying:
\end{rightindent}
\hfill
%--- figure PE (max/min Example  (a))--------------------
%
%
\begin{psfigure}{2.45in}{1.5in}{figPE.ps}
\puttext{-35,-43}{\Small$D$}
\puttext{ 10,-43}{\Small$B$}
\puttext{35, -43}{\Small$C$}
\puttext{37,  43}{\Small$A$}
\puttext{-18,-30}{\Small$a-x$}
\puttext{25, -30}{\Small$x$}
\puttext{40,  -5}{\Small$b$}
\end{psfigure}
%------------------------------
\[
  0=f'(x)=-\frac{1}{ v}+\frac{x}{ w\sqrt{x^2+b^2}},\qquad\text{so~that}
   \qquad w\sqrt{x^2+b^2}=vx.
\]
We now square both sides and solve for $x$, obtaining
\[
  w^2b^2=(v^2-w^2)x^2,\qquad\text{i.e.,}\qquad x=\frac{wb}{\sqrt{v^2-w^2}}.
\]
This is our solution.

\smallskip

Notice, by the way, that our answer turns out not to depend on $a$; that
is, the point where you should turn off the road does not depend on how far
back you started.  But something's not completely right here.  What if $a$
is very small, i.e., suppose $a<wb/\sqrt{v^2-w^2}$.  Then our solution is
saying that we should go {\it back} along the road, and then head across
the sand.  This makes no sense.  What have we

\noindent
\begin{rightindent}{3.65in}
\noindent
done wrong in the case of small $a$?  The problem is with
the first term $(a-x)/v$ in our function $f(x)$.  If $a<x$ that gives
us negative time.  What we really should have is $|a-x|/v$.  In the
case when $a<wb/\sqrt{v^2-w^2}$, the graph of our revised function
\[
  f(x)=\frac{|a-x|}{ v}+ \frac{\sqrt{x^2+b^2}}{ w}
\]
is given at the right.  The minimum of this function cannot be obtained by
setting $f'(x)=0$ (in fact, the derivative of this function is never 0).
Rather, it occurs at a point where there is no derivative --- namely, at
the ``corner'' at $x=a$.  In practical terms, this says that if
$a<wb/\sqrt{v^2-w^2}$, then what you should do is head out immediately
across the sand in a straight line to $A$.
\end{rightindent}
\hfill
%--- figure PF (max/min Example  (b))--------------------
%
\begin{psfigure}{1.9in}{1.9in}{figPF.ps}
\puttext{-11.2, -55.}{\Small$a$}
\end{psfigure}
%------------------------------

\end{example}

\bigskip
{\bf SUMMARY --- STEPS IN A MAX/MIN STORY PROBLEM:}

\medskip

1.~Decide what the variables are and what the constants are, draw a
diagram if appropriate, understand clearly what it is that is to be
maximized or minimized.

\medskip

2.~Write a formula for what you are maximizing or minimizing.

\medskip

3.~Express that formula in terms of only one variable, that is, in
the form $f(x)$.

\medskip

4.~Set $f'(x)=0$ and solve.

\medskip

5.~Be sure that your answer makes sense, and that the max/min value
is not really somewhere else.






