\section{Maximum and Minimum Values}
In practical applications we are often interested in how large or small a function can become.  The following definitions make this concept precise.
\definition{
A function $f(x)$ has an \textbf{\absolute maximum} (or
  \textbf{\otherabsolute maximum}) at~$c$ if \mbox{$f(c)\ge f(x)$} for all $x$ in the
  domain $D$. The number $f(c)$ is called the \textbf{(\absolute) maximum value}
  of $f$ on~$D$.}

\definition{A function $f(x)$ has an \textbf{\absolute minimum} (or
  \textbf{\otherabsolute minimum}) at~$c$ if $f(c)\le f(x)$ for all $x$ in the
  domain $D$. The number $f(c)$ is called the \textbf{(\absolute) minimum value}
  of $f$ on~$D$.
}

\definition{
A function $f(x)$ has a \textbf{\relative maximum} (or
  \textbf{\otherrelative maximum}) at $c$ if $f(c)\ge f(x)$ over some open interval $(a,b)$ containing $c$.
The number $f(c)$ is called a \textbf{\relative{}} or \textbf{\otherrelative maximum} value of $f$.}
\definition{A function $f(x)$ has a \textbf{\relative minimum} (or
  \textbf{\otherrelative minimum}) at $c$ if $f(c)\le f(x)$ over some open interval $(a,b)$ containing $c$.
The number $f(c)$ is called a \textbf{\relative{}} or \textbf{\otherrelative minimum} value of $f$.
}

\begin{itemize}
\item \textbf{Note:} The \absolute maximum and \absolute minimum
values of $f$ are called the \textbf{extreme values} of $f$.  Similarly we define the \textbf{\relative{}} or \textbf{\otherrelative extreme values} to be the \relative maximum and minimum values.
\end{itemize}

\begin{example}For the graphically defined function:
\begin{center}
\resizebox{5.5in}{!}{%
\asycode{%
import graph;
import geometry;
size(250,0);
add(shift(-5,0)*grid(14,7,gray+linetype("4 4")));
real f(real x) {return 2*exp(-x^2/5)+2;}
pair F(real x) {return (x,f(x));}
xaxis(shift(-10,-10)*Label("$x$",fontsize(10),align=E),Arrow(HookHead,size=4),ticks=Ticks(n=1,Step=1,Size=3,Label(fontsize(9)),OmitFormat(-5),OmitTick(0,9)));
yaxis(shift(-8,-10)*Label("$y$",fontsize(10),align=N),Arrow(HookHead,size=4),ticks=Ticks(n=1,Size=3,Label(fontsize(9)),OmitFormat(-3),OmitTick(0,7)));
draw(graph(f,-5,0,operator ..),red+2);
draw((0,4){right}..(2,1){right}..(5,6){right}..(8,1){right},red+2);
dot((8,1),4+black);
dot((8,1),3+red);
label(shift(-2,2)*Label("$f(x)$",fontsize(9)),(6,6.2),E);
}%
}
\end{center}
Find the (\absolute) extreme values and \relative extreme values as well as their locations.
\end{example}

We note that a function need not have any extreme values, \absolute or \relative.  The function $y=x^3$ is such a function.
\begin{center}
\resizebox{4cm}{!}{%
\asycode{%
import graph;
size(150,0);
real f(real x) {return x^3;}
pair F(real x) {return (x,f(x));}
xaxis("$x$",Arrow(HookHead,size=4));
yaxis("$y$",Arrow(HookHead,size=4));
draw(graph(f,-1.4,1.4,operator ..),red+2);
label("$f(x)=x^3$",F(1.2),W);
}%
}
\end{center}

The following theorem gives sufficient conditions for absolute extrema to exist.
\theorem{Suppose $f$ is continuous on the closed interval $[a,b]$.  Then $f$ has an \absolute maximum and an \absolute minimum on $[a,b]$.  (i.e. There exist numbers $c$ and $d$ in $[a,b]$ such that $f(c)$ is the \absolute maximum and $f(d)$ is the \absolute minimum of $f$ on $[a,b]$.)  This is known as the \textbf{Extreme Value Theorem}.}

\begin{center}
\resizebox{13cm}{!}{%
\asycode{%
import graph;
size(350,0);
real f(real x) {return -sin(x)+1.5;}
pair F(real x) {return (x,f(x));}
xaxis("$x$",xmax=7,Arrow(HookHead,size=4));
yaxis("$y$",ymax=3,Arrow(HookHead,size=4));
draw(graph(f,.5,6,operator ..),red+2);
label("$f(x)$",F(3),NW);
dot(F(.5),4+black);
dot(F(.5),3+red);
dot(F(6),4+black);
dot(F(6),3+red);
xequals(.5,ymin=0,ymax=f(.5),dotted);
xequals(pi/2,ymin=0,ymax=0.5,dashed);
xequals(3*pi/2,ymin=0,ymax=2.5,dashed);
xequals(6,ymin=0,ymax=f(6),dotted);
yequals(.5,xmin=0,xmax=pi/2,dashed);
yequals(2.5,xmin=0,xmax=3*pi/2,dashed);
labelx("$a$",.5,S);
labelx("$d$",pi/2,S);
labelx("$c$",3*pi/2,S);
labelx("$b$",6,S);
labely("\absolute min",0.5,W);
labely("\absolute max",2.5,W);
}%
}
\end{center}

Note:
\begin{itemize}
\item The \absolute extreme values can occur at the endpoints of the interval.
\item The assumption that the interval be closed is required.
\item The locations of the \absolute extreme values are not necessarily unique.  (There could be two or more numbers, say, on the interval where the \absolute minimum is achieved.)
\end{itemize}

\theorem{If a function $f$ has a \relative extremum (maximum or minimum) at $c$ and if $f'(c)$ exists, then $f'(c)=0$.  This is known as \textbf{Fermat's Theorem}.}

\begin{center}
\resizebox{6.7cm}{!}{%
\asycode{%
import graph;
size(250,0);
real f(real x) {return .5*x*sin(x)+x;}
pair F(real x) {return (x,f(x));}
xaxis("$x$",Arrow(HookHead,size=4));
yaxis("$y$",Arrow(HookHead,size=4));
draw(graph(f,.5,6,operator ..),red+2);
label("$f(x)$",F(5.8),NW);
xequals(2.6954,ymin=0,ymax=f(2.6954),dashed);
xequals(4.4812,ymin=0,ymax=f(4.4812),dashed);
yequals(f(2.6954),xmin=2.1954,xmax=3.1954,blue+2);
yequals(f(4.4812),xmin=3.9812,xmax=4.9812,blue+2);
labelx("$c_1$",2.6954,S);
labelx("$c_2$",4.4812,S);
}%
}
\end{center}

Notes:
\begin{itemize}
\item The converse is not true: $f'(c)=0$ does not imply a \relative extremum occurs at $c$.  $f(x)=x^3$ has no \relative extrema yet $f'(0)=0$.
\item A \relative extremum can occur at a number where the derivative $f'$ does not exist.  So $f(x)=|x|$ has a \relative minimum at $x=0$ but $f'(0)$ does not exist as is clear from the following graph of the function.
\end{itemize}

\begin{center}
\begin{asy}
import graph;
size(150,0);
real f(real x) {return abs(x);}
pair F(real x) {return (x,f(x));}
xaxis("$x$",Arrow(HookHead,size=4));
yaxis("$y$",Arrow(HookHead,size=4));
draw(graph(f,-2,2,operator ..),red+2);
label("$f(x)=|x|$",F(1),SE);
\end{asy}
\end{center}

\definition{If $c$ is a number in the domain $D$ of function $f$ such that the derivative vanishes ($f'(c)=0$) or does not exist, then $c$ is a \textbf{critical number} of $f$.}

\begin{example}
Find the critical numbers of the following functions:
\begin{enumerate}
\item $\displaystyle f(x)=x^3-2x^2$
\item $\displaystyle g(t)=t(t-2)^2$
\item $\displaystyle f(x)=\sqrt[3]{x}(4-x)$
\item $\displaystyle g(t)=\frac{t^2+5}{t-2}$
\item$\displaystyle f(\theta)=\cos(2\theta)+\theta$
\item$\displaystyle h(z)=\sqrt{z}\left(z^2+2\right)$
\item$\displaystyle g(t)=4\sin^3t+3\sqrt{2}\cos^2t$
\end{enumerate}
\end{example}

The next theorem narrows down the values where \relative extrema can potentially occur.
\theorem{If $f$ has a \relative extremum (minimum or maximum) at $c$, then $c$ is a critical number of~$f$.}

Knowing that an \absolute extrema of a continuous function $f$ on
$[a,b]$ will either occur in $(a,b)$ at a \relative extrema or at an
endpoint, we can now construct a method to find the \absolute maximum
and minimum values of a continuous function $f$ on a closed interval
$[a,b]$.
\begin{method}
\textbf{Method for Finding \Absolute Extrema of continuous $\bm f$ on $\bm{[a,b]}$}
\begin{enumerate}
\item Find all critical numbers in $(a,b)$\,.
\item Evaluate $f$ at the critical numbers.
\item Evaluate $f(a)$ and $f(b)$\,.
\item The largest of the values from 2. and 3. is the \absolute maximum value and the smallest of these values is the \absolute minimum value.
\end{enumerate}
\end{method}

\begin{example}
Find the \absolute maximum and minimum of the following functions on the given closed intervals:
\begin{enumerate}
\item $\displaystyle f(x)=4x^3-15x^2+12x+7$ on $[0,3]$
\item $\displaystyle f(x)=(x^2-4)^2$ on $[-3,1]$
\item $\displaystyle f(x)=1-x^{\frac{2}{3}}$ on $[-1,8]$
\end{enumerate}
\end{example}

\textbook{\clearpage}
\begin{exercise}
\input{DERIVATIVE_APPLICATIONS/local-and-global-extreme-values}
\end{exercise}


\section[Mean Value Theorem]{The Mean Value and Other Derivative Theorems}

We now consider several theorems whose results are used in proving deeper calculus theorems.

\theorem{Let $f$ be a continuous function on $[a,b]$ that is differentiable on $(a,b)$.  If $f(a)=f(b)$ then there exists a number $c$ in $(a,b)$ such that $f'(c)=0$.  (i.e. The tangent line at the point $(c,f(c))$ is horizontal.)  This is known as \textbf{Rolle's Theorem}.}

The situation is illustrated below.
\begin{center}
\begin{asy}
import graph;
size(250,0);
real f(real x) {return 3*x*(x-1)*(x-2);}
pair F(real x) {return (x,f(x));}
//xaxis(shift(-10,-10)*Label("$x$",fontsize(10),align=E),Arrow(HookHead,size=4),ticks=Ticks(n=1,Step=1,Size=3,Label(fontsize(9)),OmitFormat(-5),OmitTick(0,9)));
//yaxis(shift(-8,-10)*Label("$y$",fontsize(10),align=N),Arrow(HookHead,size=4),ticks=Ticks(n=1,Size=3,Label(fontsize(9)),OmitFormat(-3),OmitTick(0,7)));
xaxis("$x$",xmax=2.25,Arrow(HookHead,size=4));
yaxis("$y$",ymax=f(0.42265)+.2,Arrow(HookHead,size=4));
draw(graph(f,0.25777,2.13716,operator ..),red+2);
//label(shift(-2,2)*Label("$f(x)$",fontsize(9)),F(1.4),E);
label("$f(x)$",F(2.1),W);
xequals(0.42265,ymin=0,ymax=f(0.42265),dashed);
xequals(1.57735,ymin=f(1.57735),ymax=-0.25,dashed);
//xequals(1.57735,ymin=-0.05,ymax=0,dashed);
yequals(f(0.42265),xmin=0.22265,xmax=0.62265,blue+2);
yequals(f(1.57735),xmin=1.37735,xmax=1.77735,blue+2);
yequals(1,xmin=-0.05,xmax=2.13716);
labelx("$c_1$",0.42265,S);
labelx("$c_2$",1.57735,S);
labely("$f(a)=f(b)$",1,W);
dot(F(0.25777),4+black);
dot(F(0.25777),3+red);
dot(F(2.13716),4+black);
dot(F(2.13716),3+red);
\end{asy}
\end{center}

Notes:
\begin{itemize}
\item For the trivial case where $f(x)$ is a constant function we can take any $c$ in $(a,b)$ to prove the theorem.
\item The proof of the theorem for the non-trivial case hinges on the observation that if $f(a)=f(b)$ then at least one \absolute extremum (which exists by the Extreme Value Theorem) must occur at $c$ within $(a,b)$ and hence be a \emph{\relative} extremum which by Fermat's Theorem has $f'(c)=0$.
\item There may be more than one $c$ with $f'(c)=0$ as illustrated in the diagram.
\end{itemize}

\begin{example}
Verify that Rolle's Theorem applies for $f(x)=x\sqrt{x+6}+1$ on the interval $[-6,0]$.  Next find a $c$ it predicts must exist.
\end{example}

\begin{example}
Show that the equation $1+2x+x^3+4x^5=0$ has exactly one real root on $[-1,0]$.
\end{example}

Rolle's Theorem is used to prove the more general Mean Value Theorem to which we now turn.

\textbook{\clearpage}
\theorem{Let $f$ be a continuous function on $[a,b]$ that is differentiable on $(a,b)$.  Then there exists a number $c$ in $(a,b)$ such that
\[f'(c)=\frac{f(b)-f(a)}{b-a}\ .\]
This is known as the \textbf{Mean Value Theorem}.}

Geometrically the Mean Value Theorem states that the slope of the secant line between the endpoints of the curve $A(a,f(a))$ and $B(b,f(b))$,
\[m=\frac{f(b)-f(a)}{b-a}\ ,\]
 is equal to the slope of the tangent line, $f'(c)$, at at least one point $C(c,f(c))$ along the curve (not an endpoint).

\begin{center}
\resizebox{7cm}{!}{%
\asycode{%
import graph;
size(250,0);
real f(real x) {return (x-3)^2+1;}
pair F(real x) {return (x,f(x));}
xaxis("$x$",xmax=6,Arrow(HookHead,size=4));
yaxis("$y$",ymax=6,Arrow(HookHead,size=4));
draw(graph(f,2,5,operator ..),red+2);
draw(F(2)..F(5),purple+2);
draw((3,.75)..(4,1.75),blue+2);
label("$f(x)$",F(4.25),NW);
label("$A$",F(2),NW);
label("$B$",F(5),NW);
label("$C$",F(3.5),SE);
xequals(2,ymin=0,ymax=f(2),dotted);
xequals(5,ymin=0,ymax=f(5),dotted);
xequals(3.5,ymin=0,ymax=f(3.5),dashed);
labelx("$a$",2,S);
labelx("$b$",5,S);
labelx("$c$",3.5,S);
dot(F(2),4+black);
dot(F(2),3+red);
dot(F(5),4+black);
dot(F(5),3+red);
dot(F(3.5),4+black);
}%
}
\end{center}

If we consider one dimensional motion then the Mean Value Theorem states that the average velocity for the trip over the time interval $[a,b]$ will equal the (instantaneous) velocity at at least one time $c$ in $(a,b)$ during the trip.

To prove the Mean Value Theorem one shows that the new function $g(x)$ defined to be the difference between $f(x)$ and the secant line between $(a,f(a))$ and $(b,f(b))$, i.e.
\[g(x)=f(x)-\left[\frac{f(b)-f(a)}{b-a}(x-a)+f(a)\right]\ ,\]
satisfies Rolle's Theorem.  The $c$ guaranteed for $g(x)$ by the latter can be shown to be the $c$ required for $f(x)$ for the Mean Value Theorem.  Also note that Rolle's Theorem itself follows immediately from the Mean Value Theorem for if $f(b)=f(a)$ then $f'(c)=0$ in the Mean Value Theorem.

\begin{example}
Verify that the Mean Value Theorem applies for the following functions on the given closed intervals and find a value of $c$ it predicts must exist.
\begin{enumerate}
\item $\displaystyle f(x)=2x^3+x^2-x-1$ on $[0,2]$
\item $\displaystyle f(x)=x-3x^{\frac{1}{3}}$ on $[0,8]$
\end{enumerate}
\end{example}

Two corollaries of the Mean Value Theorem are the following:
\theorem{Suppose $f'(x)=0$ for all $x$ in $(a,b)$, then $f$ is constant on the interval.}
\theorem{\label{thm:mvtcorb}Suppose $f'(x)=g'(x)$ for all $x$ in $(a,b)$, then $f(x)=g(x)+C$ for some constant $C$.}

The former corollary results by applying the M.V.T. to the interval
$[x_1,x_2]$ generated by any two values $x_1$ and $x_2$ in $(a,b)$.
Since the resulting $c$ has $f'(c)=0$ by assumption, this implies
$f(x_2)-f(x_1)$ must vanish.  (i.e. $f(x_2)=f(x_1)$.) Since $x_1$ and
$x_2$ are arbitrarily chosen it follows that all values of $f(x)$ must
equal each other and hence some constant $C$.

The second corollary follows from the first by applying it to the
function $h(x)=f(x)-g(x)$ whose derivative $h'(x)=f'(x)-g'(x)$ will
identically vanish.  Graphically it means that if two functions have
the same derivative they differ at most by a vertical shift.

\begin{exercise}
\input{DERIVATIVE_APPLICATIONS/rolles-theorem-and-the-mean-value-theorem}
\end{exercise}

\section{Increasing and Decreasing}

We now consider how the knowledge of the properties a function and its
derivatives can help us in understanding the behaviour of its graph,
in particular finding where the function is \emph{interesting}.  This
analysis will allow us to sketch a function with limited functional
evaluation being necessary.

We first consider what it means for a function to be increasing or
decreasing.  The following definitions make the intuitive idea of
increase and decrease clear:

\definition{A function $f(x)$ is \textbf{increasing} on an interval $I$ if its
  graph continuously rises as $x$ goes from left to right through the
  interval.  (i.e.  if $x_1$ and $x_2$ are in the interval
  and $x_1<x_2$, then $f(x_1)<f(x_2)$.)}
\definition{A function $f(x)$ is \textbf{decreasing} on an interval $I$ if its
  graph continuously falls as $x$ goes from left to right through the
  interval.  (i.e. if $x_1$ and $x_2$ are in the interval
  and $x_1<x_2$, then $f(x_1)>f(x_2)$ .)}

\begin{center}
\hfil
\raisebox{3.22cm}{%
\resizebox{5cm}{!}{%
\asycode{%
import graph;
size(150,0);
real f(real x) {return x^2;}
pair F(real x) {return (x,f(x));}
xaxis("$x$",Arrow(HookHead,size=4));
yaxis("$y$",Arrow(HookHead,size=4));
draw(graph(f,-1.4,1.4,operator ..),red+2);
label("$f(x)=x^2$",F(1.2),W);
draw((-1.4,-.5)--(0,-.5),blue,Arrow(size=6));
draw((0,-.5)--(1.4,-.5),purple,Arrow(size=6));
label(Label("Decreasing",fontsize(14)+blue),(-.7,-.5),S);
label(Label("Increasing",fontsize(14)+purple),(.7,-.5),S);
}%
}%
}
\hfil
\resizebox{5cm}{!}{%
\asycode{%
import graph;
import geometry;
size(150,0);
real f(real x) {return x^3;}
pair F(real x) {return (x,f(x));}
xaxis("$x$",Arrow(HookHead,size=4));
yaxis("$y$",Arrow(HookHead,size=4));
draw(graph(f,-1.4,1.4,operator ..),red+2);
label("$f(x)=x^3$",F(1.2),W);
draw((-1.4,-.5)--(1.4,-.5),purple,Arrow(size=6));
label(Label("Increasing",fontsize(14)+purple),(0,-.5),S);
}%
}
\hfil
\end{center}

\begin{example}
From the diagrams, $y=x^2$ decreases on $(-\infty,0]$ and increases on $[0,\infty)$ while $y=x^3$ increases on the interval $(-\infty,\infty)$.
\end{example}

\textbook{\clearpage}
Where a function increases or decreases can be determined by the \textbf{first derivative} of a function since whether a function increases or decreases is related to its tangent slope.

\begin{center}
\begin{asy}
import graph;
//import geometry;
size(150,0);
real f(real x) {return x^2;}
pair F(real x) {return (x,f(x));}
//xaxis(shift(-10,-10)*Label("$x$",fontsize(10),align=E),Arrow(HookHead,size=4),ticks=Ticks(n=1,Step=1,Size=3,Label(fontsize(9)),OmitFormat(-5),OmitTick(0,9)));
//yaxis(shift(-8,-10)*Label("$y$",fontsize(10),align=N),Arrow(HookHead,size=4),ticks=Ticks(n=1,Size=3,Label(fontsize(9)),OmitFormat(-3),OmitTick(0,7)));
xaxis("$x$",Arrow(HookHead,size=4));
yaxis("$y$",Arrow(HookHead,size=4));
draw(graph(f,-1.4,1.4,operator ..),red+2);
//label(shift(-2,2)*Label("$f(x)$",fontsize(9)),F(1.4),E);
label("$f(x)=x^2$",F(1.2),W);
draw((-1.3,1.6)--(-.7,.4),blue+2);
draw((.7,.4)--(1.3,1.6),purple+2);
draw((-1.4,-.5)--(0,-.5),blue,Arrow(size=6));
draw((0,-.5)--(1.4,-.5),purple,Arrow(size=6));
dot(F(-1),4+black);
dot(F(1),4+black);
label(Label("Slope $-$",fontsize(14)+blue),(-.7,-.5),S);
label(Label("Slope $+$",fontsize(14)+purple),(.7,-.5),S);
\end{asy}
\end{center}

\begin{method}
\textbf{Test for Increasing/Decreasing}\footnotemark
\newline
Suppose $f$ is differentiable on $(a,b)$\,.
\begin{enumerate}
\item If $f'(x)>0$ for all $x$ in $(a,b)$\,, then $f$ is increasing on
  $(a,b)$\,.
\item If $f'(x)<0$ for all $x$ in $(a,b)$\,, then $f$ is decreasing on
  $(a,b)$\,.
\end{enumerate}
\end{method}
\footnotetext{To prove this result assume $f'>0$ on $(a,b)$ and let $x_1$ and $x_2$ be arbitrary points in $(a,b)$ with $x_1<x_2$.  Since $f$ is differentiable on $(a,b)$ it is continuous on $[x_1,x_2]$ and differentiable on $(x_1,x_2)$.  By the Mean Value Theorem there exists $c$ in $(x_1,x_2)$ with $f'(c)=[f(x_2)-f(x_1)]/(x_2-x_1)$.  But $c$ lies in $(a,b)$ so $f'(c)=[f(x_2)-f(x_1)]/(x_2-x_1)$ is positive.  Since $x_2-x_1>0$ it follows that $f(x_2)-f(x_1)>0$ or $f(x_2)>f(x_1)$.  Since $x_1$ and $x_2$ were arbitrarily chosen, $f$ is increasing on $(a,b)$.  A similar argument shows that if $f'<0$ on the interval the function is decreasing there.}

\begin{example}
One may verify for the above examples that $\frac{d}{dx}x^2=2x$ is negative when $x<0$ ($y=x^2$ decreasing on $(-\infty,0)$) and positive when $x>0$ ($y=x^2$ increasing on $(0,\infty)$).  On the other hand $\frac{d}{dx}x^3=3x^2$ is always positive so $y=x^3$ is increasing everywhere.
\end{example}

Critical numbers usually separate intervals of increase or decrease.\footnote{Though not always, consider $y=\tan^2x$ at $x=\pi/2$.}  Analysis of whether a function is increasing or decreasing on each side of a critical number allows us to determine whether a critical number is a relative extremum and if so, of which kind (maximum or minimum).

\begin{method}
\textbf{First Derivative Test for a \Relative Extremum}\newline
Let $I=(a,b)$ be an interval containing critical number $c$ of function $f$ and further let $f$ be continuous on $I$ and differentiable on $I$ (except perhaps at $c$).  Let $L=(a,c)$ and $R=(c,b)$ be the subintervals to the left and right of $c$\,.
\begin{enumerate}
\item If $f'$ is positive on $L$ and negative on $R$, then $f$ has
  a \relative maximum at $c$\,.
\item If $f'$ is negative on $L$ and positive on $R$, then $f$ has a
  \relative minimum at $c$\,.
\item If $f'$ has the same sign on $L$ and $R$ (either both positive or negative), then $f$ has no \relative extremum at $c$\,.
\end{enumerate}
\end{method}

\begin{example}
The function $y=x^2$ has a single critical number of $c=0$ where the derivative vanishes.  Since the function decreases to the left of $0$ and increases to the right of it, a relative minimum occurs at $x=0$ which is readily verified from the graph of the function.  $y=x^3$ also has a critical number of $c=0$ but in this case the function is increasing on the intervals to the left and right of it so there is no \relative extremum at $0$.
\end{example}

\begin{example}
Find the open intervals upon which the function
\[f(x)=\frac{x^2-2x+1}{x}\]
is increasing or decreasing. Also find any relative minima and maxima
and their locations.
\end{example}

Appendix~\ref{ap:inequalities} reviewing inequalities may be helpful in determining when $f'$ is positive and negative.

\begin{exercise}
\input{DERIVATIVE_APPLICATIONS/first-derivative-test}
\end{exercise}

\section{Concavity}

Like increasing and decreasing, concavity is a property of intervals on a graph.

\definition{The graph of function $f(x)$ is \textbf{concave upward} on $(a,b)$ if $f'$ is an increasing function on $(a,b)$\,.  Graphically, the curve $y=f(x)$ lies above all its tangent lines on $(a,b)$\,.}

\definition{The graph of function $f(x)$ is \textbf{concave downward} on $(a,b)$ if $f'$ is a decreasing function on $(a,b)$\,.  Graphically the curve $y=f(x)$ lies below all its tangent lines on $(a,b)$\,.}

\begin{center}
\begin{asy}
import graph;
//import geometry;
size(150,0);
real f(real x) {return x^3;}
pair F(real x) {return (x,f(x));}
//xaxis(shift(-10,-10)*Label("$x$",fontsize(10),align=E),Arrow(HookHead,size=4),ticks=Ticks(n=1,Step=1,Size=3,Label(fontsize(9)),OmitFormat(-5),OmitTick(0,9)));
//yaxis(shift(-8,-10)*Label("$y$",fontsize(10),align=N),Arrow(HookHead,size=4),ticks=Ticks(n=1,Size=3,Label(fontsize(9)),OmitFormat(-3),OmitTick(0,7)));
xaxis("$x$",Arrow(HookHead,size=4));
yaxis("$y$",Arrow(HookHead,size=4));
draw(graph(f,-1.4,1.4,operator ..),red+2);
//label(shift(-2,2)*Label("$f(x)$",fontsize(9)),F(1.4),E);
label("$f(x)=x^3$",F(1.2),W);
draw((0.18, -0.115)--(0.82, 0.365),purple+2);
dot(F(.5),4+black);
draw((0.874, 0.621)--(1.126, 1.379),purple+2);
dot(F(1),4+black);
draw((1.223,1.805)--(1.377, 2.589),purple+2);
dot(F(1.3),4+black);

draw((-0.18, 0.115)--(-0.82, -0.365),blue+2);
dot(F(-.5),4+black);
draw((-0.874, -0.621)--(-1.126, -1.379),blue+2);
dot(F(-1),4+black);
draw((-1.223,-1.805)--(-1.377, -2.589),blue+2);
dot(F(-1.3),4+black);
draw((-1.4,-3)--(0,-3),blue,Arrow(size=6));
label(Label("Concave Down",fontsize(10)+blue),(-.7,-3),S);
draw((0,-3)--(1.4,-3),purple,Arrow(size=6));
label(Label("Concave Up",fontsize(10)+purple),(.7,-3),S);
dot(F(-1),4+black);
dot(F(1),4+black);
\end{asy}
\end{center}

\begin{example}
For $y=x^3$ the graph is concave upward on $(0,\infty)$ because the curve lies above the tangent lines at any point on the interval.  Alternatively one sees that as we move from left to right on the interval the tangent slopes are increasing.  Similarly $y=x^3$ is concave down on $(-\infty,0)$ as the curve lies below the tangent line at any point in the interval.  Alternatively the tangent slopes are decreasing as one moves from left to right through the interval.
\end{example}

An easy way to remember concavity is to note that if the interval looks like part of the mouth of a happy face, {\Large\smiley}, then it is concave upward.  If it is part of the mouth of a sad face, {\Large\frownie}, then it is concave downward.

\textbook{\clearpage}
Since the second derivative $f''(x)$ tells us whether the derivative (and hence tangent slope) is increasing or decreasing we can determine the concavity on an interval using it as follows.

\begin{method}
\textbf{Test for Determining Concavity}\newline
Suppose function $f$ is twice differentiable on an interval $(a,b)$\,.
\begin{enumerate}
\item If $f''(x)>0$ for all $x$ in $(a,b)$, then the graph of $f$ is concave
  upward on $(a,b)$\,.
\item If $f''(x)<0$ for all $x$ in $(a,b)$, then the graph of $f$ is concave
  downward on $(a,b)$\,.
\end{enumerate}
\end{method}

To remember this note that $f''$ is positive when the function is concave upward (\raisebox{-.2em}{\Large\smiley}) and negative when the function is concave downward (\raisebox{-.2em}{\Large\frownie}). 

\begin{example}
For $y=f(x)=x^3$ we have $f''(x)=6x$ which is positive for $x>0$ and negative for $x<0$ which indicates the curve is concave upward and concave downward on those intervals as was already observed.
\end{example}

Just as intervals of increasing and decreasing are often punctuated by locations of \relative maxima and minima, regions of concavity for a graph are often broken up by inflection points:

\definition{An \textbf{inflection point} is a point $P$ on the graph of a
  function at which the function is continuous and the graph changes
  from concave upward to concave downward or vice versa.}

Due to the concavity test, possible inflection points are located where $f''(c)=0$ or $f''(c)$ does not exist.

Note that an inflection point is a point $P$ and is therefore reported as $(c,f(c))$.

\begin{example}
For our function $y=x^3$ the point $(0,0)$ is an inflection point as the function is continuous there and the concavity changes.
\end{example}

\begin{example}
For the graphically defined function:
\begin{center}
\resizebox{3.2in}{!}{%
\asycode{%
import graph;
import geometry;
size(250,0);
add(shift(-5,0)*grid(14,7,gray+linetype("4 4")));
real f(real x) {return 2*exp(-x^2/5)+2;}
pair F(real x) {return (x,f(x));}
xaxis(shift(-10,-10)*Label("$x$",fontsize(10),align=E),Arrow(HookHead,size=4),ticks=Ticks(n=1,Step=1,Size=3,Label(fontsize(9)),OmitFormat(-5),OmitTick(0,9)));
yaxis(shift(-8,-10)*Label("$y$",fontsize(10),align=N),Arrow(HookHead,size=4),ticks=Ticks(n=1,Size=3,Label(fontsize(9)),OmitFormat(-3),OmitTick(0,7)));
draw(graph(f,-5,0,operator ..),red+2);
draw((0,4){right}..(2,1){right}..(5,6){right}..(8,1){right},red+2);
dot((8,1),4+black);
dot((8,1),3+red);
label(shift(-2,2)*Label("$f(x)$",fontsize(9)),(6,6.2),E);
}%
}
\end{center}
Find intervals where the function is increasing, decreasing, concave upward, and downward.  Identify any inflection points. 
\end{example}

\begin{example}
Find the intercepts, \relative maxima and minima, intervals of increase and decrease, intervals of concave upward and downward, and inflection points of the following functions.  Then sketch their graphs.
\begin{enumerate}
\item $\displaystyle f(x)=x^4-6x^2$
\item $\displaystyle f(x)=x-3x^{\frac{1}{3}}$
\item $\displaystyle f(x)=y=3\sin x-\sin^3x$ on $[0,2\pi]$
\end{enumerate}
\end{example}

\begin{example}
Sketch the graph of a function satisfying all of the following:
\begin{itemize}
\item $f(0)=0$
\item $f'(1)=f'(3)=f'(5)=0$
\item $f'(x)>0$ if $0<x<1$ or $3<x<5$
\item $f'(x)<0$ if $1<x<3$ or $x>5$
\item $f''(x)>0$ if $2<x<4$
\item $f''(x)<0$ if $0<x<2$ or $x>4$
\item $f(-x)=-f(x)$
\end{itemize}
\end{example}

The second derivative can also be used to evaluate whether critical numbers are the locations of relative extrema and, if so, whether they are maxima or minima:

\begin{method}
\textbf{Second Derivative Test for a \Relative Extremum}\newline
Suppose $f''$ is continuous on an open interval that contains $c$ and
that $f'(c)=0$.
\begin{enumerate}
\item If $f''(c)<0$, then $f$ has a \relative maximum at $c$ .
\item If $f''(c)>0$, then $f$ has a \relative minimum at $c$ .
\item If $f''(c)=0$, then the test is inconclusive.
\end{enumerate}
\end{method}

This result follows from the fact that a negative second derivative at
$c$ means the graph of the function is concave downward
(\raisebox{-.2em}{\Large\frownie}) at that value (and hence will have
a relative maximum), while a positive second derivative means the
graph of the function is concave upward
(\raisebox{-.2em}{\Large\smiley}) at that value (and hence will have a
relative minimum).

\textbook{\clearpage}
\begin{example}
\begin{itemize}
\item $y=x^2$ has $f'(0)=0$ and $f''(0)=2$.  Since $f''(0)$ is greater than zero the function is concave upward at $x=0$ and hence has a relative minimum at that critical number.
\item $y=x^3$ has $f'(0)=0$.  However $f''(0)=0$ as well so the Second Derivative Test is inconclusive.  We need to use a different test (First Derivative Test) to determine that no extrema occurs at~0.
\item $y=x^4$ has $f'(0)=0$ and $f''(0)=0$ so the Second Derivative Test is also inconclusive here. However in this case the First Derivative Test confirms a \relative minimum occurs at 0.
\end{itemize}
\end{example}

\begin{example}
Find the \relative maxima and minima (and their locations) of
\begin{enumerate}
\item $\displaystyle f(x)=x^3-2x^2+x$
\item $\displaystyle B(x)=3x^{\frac{2}{3}}-x$
\end{enumerate}
Use the Second Derivative Test where possible.
\end{example}

\begin{exercise}
\input{DERIVATIVE_APPLICATIONS/inflection-points}
% The next set of problems has some negative \vspace
\input{DERIVATIVE_APPLICATIONS/second-derivative-test}
% The next set of problems has some negative \vspace
\input{DERIVATIVE_APPLICATIONS/curve-sketching-I} 

\end{exercise}


\section{Limits at Infinity and Horizontal Asymptotes}
We have seen how $y$-values of $y=f(x)$ may approach infinity at a vertical asymptote.  We now consider the behaviour of a function as $x$ approaches infinity.

\begin{center}
\begin{asy}
import graph;
//import geometry;
size(300,0);
real f(real x) {return -2*atan(5*x)/(pi/2)+1;}
pair F(real x) {return (x,f(x));}
//xaxis(shift(-10,-10)*Label("$x$",fontsize(10),align=E),Arrow(HookHead,size=4),ticks=Ticks(n=1,Step=1,Size=3,Label(fontsize(9)),OmitFormat(-5),OmitTick(0,9)));
//yaxis(shift(-8,-10)*Label("$y$",fontsize(10),align=N),Arrow(HookHead,size=4),ticks=Ticks(n=1,Size=3,Label(fontsize(9)),OmitFormat(-3),OmitTick(0,7)));
xaxis("$x$", Arrow(HookHead,size=4));
yaxis("$y$",ymin=-2, ymax=4, Arrow(HookHead,size=4));
draw(graph(f,-4,4,operator ..),red+2);
yequals(3, xmin=-4, xmax=-1, dashed);
yequals(3, xmin=-.05, xmax=.05, dashed);
//yequals(-1, xmin=-4, xmax=-1.2, dashed);
yequals(-1, xmin=-.05, xmax=4, dashed);
labely(3,"$L=3$");
labely(-1,"$L=-1$");
//label(shift(-2,2)*Label("$f(x)$",fontsize(9)),F(1.4),E);
label("$y=f(x)$",F(3),N);
\end{asy}
\end{center}

\definition{If the values of $f(x)$ can be made arbitrarily close to the value $L$ as $x$ is made sufficiently large then we write:\footnote{A rigorous definition of this limit can be made as follows.  Suppose function $f$ is defined on some interval $(a,\infty)$. Then $\displaystyle \mylim{x}{\infty}f(x)=L$ if and only if for any $\epsilon>0$ there exists $c\in(a,\infty)$ such that $|f(x)-L|<\epsilon$ whenever $x>c$\,.  A similar definition $\mylim{x}{-\infty}f(x)=L$ may also be formulated.}
\[\mylim{x}{\infty}f(x)=L~.\]
}

\definition{If the values of $f(x)$ can be made arbitrarily close to the value $L$ as $x$ is made sufficiently large negatively then we write:
\[\mylim{x}{-\infty}f(x)=L~.\]}

\begin{example}
For the above graphically defined example one has:
\[\mylim{x}{\infty}f(x)=-1\]
and
\[\mylim{x}{-\infty}f(x)=3\]
\end{example}

\textbook{\clearpage}
The following theorem, in conjunction with our other limit theorems, allows us to evaluate many limits as $x\rightarrow\infty$ or $-\infty$.

\theorem{Let $r>0$ be a rational number.  Then
\begin{itemize}
\item $\displaystyle \mylim{x}{\infty}\frac{1}{x^r}=0$
\item $\displaystyle \mylim{x}{-\infty}\frac{1}{x^r}=0$
\end{itemize}
In the second case ($x\rightarrow-\infty$), $r$ must be such that
$x^r$ is defined.\footnote{We note in passing that the theorem is also valid for $0<r<1$, not just $r\ge1$. So, for instance, $\displaystyle\lim_{x\to\infty}\frac{1}{x^{1/2}}=\lim_{x\to\infty}\frac{1}{\sqrt{x}}=0$ despite the fact that for large $x$, $\sqrt{x}<x$.  The point is that $\sqrt{x}$ increases without bound as $x$ does so the limit vanishes.}}

When one tries to evaluate limits where the magnitude of $x$
approaches infinity, direct substitution of ``$x=\infty$'' may lead to
the indeterminate form $\displaystyle\frac{\infty}{\infty}$. As a
general strategy one divides the numerator and denominator in an
expression by the highest power term found in either to evaluate the limit.

\begin{example}
Evaluate the following:
\begin{enumerate}
\item $\displaystyle\mylim{x}{\infty}\frac{2x^2-5x+7}{7x^2+3x+2}$
\item $\displaystyle\mylim{x}{\infty}\frac{x^3-1}{x^4+1}$
\item $\displaystyle\mylim{x}{\infty}\frac{x^5+3x+5}{x^2-2x+1}$
\item $\displaystyle\mylim{x}{-\infty}\frac{x^3+5x+1}{2x^3-4x^2+3}$
\item $\displaystyle\mylim{x}{\infty}\frac{\sqrt{x^2+3}}{x+2}$
\item $\displaystyle\mylim{x}{-\infty}\frac{\sqrt{x^2+1}}{x-3}$
\item $\displaystyle\mylim{x}{\infty}\left(\sqrt{x^2+3x+1}-x\right)$
\item $\displaystyle\mylim{x}{\infty}\left(x-\sqrt{4x^2+5x-3}\right)$
\end{enumerate}
\end{example}

\subsection*{Horizontal Asymptotes}
Recall that a vertical line $x=a$ is called a \textbf{vertical asymptote} of the curve $y=f(x)$ if at least one of the following statements is true:

\hfil$\displaystyle\mylim{x}{a}f(x)=\pm\infty$\hfil$\displaystyle\mylim{x}{a^+}f(x)=\pm\infty$\hfil$\displaystyle\mylim{x}{a^-}f(x)=\pm\infty$\hfil

\definition{The horizontal line $y=L$ is called a \textbf{horizontal asymptote} of the curve $y=f(x)$ if either of the following statements is true:

\hfil$\displaystyle\mylim{x}{\infty}f(x)=L$\hfil$\displaystyle\mylim{x}{-\infty}f(x)=L$\hfil}

The following function has horizontal asymptotes $y=-1$ and $y=1$.
\begin{center}
\begin{asy}
import graph;
//import geometry;
size(300,0);
real f(real x) {return -2*atan(5*x)/(pi/2)+1;}
pair F(real x) {return (x,f(x));}
//xaxis(shift(-10,-10)*Label("$x$",fontsize(10),align=E),Arrow(HookHead,size=4),ticks=Ticks(n=1,Step=1,Size=3,Label(fontsize(9)),OmitFormat(-5),OmitTick(0,9)));
//yaxis(shift(-8,-10)*Label("$y$",fontsize(10),align=N),Arrow(HookHead,size=4),ticks=Ticks(n=1,Size=3,Label(fontsize(9)),OmitFormat(-3),OmitTick(0,7)));
xaxis("$x$", Arrow(HookHead,size=4));
yaxis("$y$",ymin=-2, ymax=4, Arrow(HookHead,size=4));
draw(graph(f,-4,4,operator ..),red+2);
yequals(-1, xmin=-3, xmax=4, blue+2);
yequals(3, xmin=-4, xmax=3, blue+2);
label("$y=3$",(3,3),E);
label("$y=-1$",(-3,-1),W);
//label(shift(-2,2)*Label("$y=f(x)$",fontsize(9)),F(1.4),E);
label("$y=f(x)$",F(3),N);
\end{asy}
\end{center}


\begin{example}
In the above graphically defined example the horizontal asymptotes are the lines $y=-1$ and $y=3$.
\end{example}

\begin{example}
Find the horizontal and vertical asymptotes of the following functions.
\begin{enumerate}
\item $\displaystyle y=\frac{x+3}{x^2-9}$
\item $\displaystyle f(x)=\frac{\sqrt{4x^2+1}}{x+1}$
\end{enumerate}
\end{example}

\textbook{\clearpage}
\begin{exercise}
\input{DERIVATIVE_APPLICATIONS/limits-at-infinity-and-horizontal-asymptotes}
\end{exercise}

\section{Slant Asymptotes}

A function has a \textbf{slant asymptote} if it approaches an oblique (slanted) line as $x$ approaches infinity as shown in the following graph.
\begin{center}
\resizebox{8.7cm}{!}{%
\asycode{%
import graph;
size(300,0);
real f(real x) {return 1.1*x+sin(3*x)*exp(-(x/1.5)^2)+1;}
pair F(real x) {return (x,f(x));}
xaxis("$x$", Arrow(HookHead,size=4));
yaxis("$y$", Arrow(HookHead,size=4));
draw(graph(f,-3,3,operator --),red+2);
draw((-3,-2.3)--(3,4.3),blue+2);
label("$y=f(x)$",(.8,2.5),N);
label("$y=mx+b$",(1,1.5),S);
}%
}
\end{center}
A slant asymptote will occur if
\[\mylim{x}{\infty}\left[f(x)-(mx+b)\right]=0\ \mbox{or}\ \mylim{x}{-\infty}\left[f(x)-(mx+b)\right]=0\]
for some constants $m$, and $b$, the slope and $y$-intercept of the asymptote, respectively.  The equation of the slant asymptote is therefore:
\[y=mx+b~.\]

A rational function $f(x)=P(x)/Q(x)$ will have a slant asymptote if
the degree of the numerator $P(x)$ is one more than the denominator
$Q(x)$.  In this case use long division to find the equation of the
slant asymptote.  While a function may have a different slant
asymptote as $x\rightarrow\infty$ and $x\rightarrow-\infty$, for the
rational functions under consideration here these will be the same.
\begin{example}
Find the slant asymptotes of the following:
\begin{enumerate}
\item $\displaystyle f(x)=\frac{x^3}{x^2+2}$
\item $\displaystyle y=\frac{6x^4+5}{2x^3-4}$
\item $\displaystyle y=\frac{2x^4-x^3+x-3}{x^3-2}$
\end{enumerate}
\end{example}

\begin{exercise}
\input{DERIVATIVE_APPLICATIONS/slant-asymptotes}
\end{exercise}


\section{Curve Sketching}
We have now developed many tools to analyze a function that enable us to accurately sketch a curve.

\begin{method}
\textbf{Sketching the Graph of $\bm{y=f(x)}$}
\begin{description}
\item[Domain:] Determine $D$, the set of $x$-values for which the function is defined.
\item[Intercepts:] The $y$-intercept is $y=f(0)$ while the $x$-intercepts are $x=c$ where $c$ are the solutions of $f(c)=0$.
\item[Symmetry:]  Is the function even, $f(-x)=f(x)$, odd, $f(-x)=-f(x)$, or periodic, $f(x+p)=f(x)$?
\item[Asymptotes:] Find any vertical $\left( x=a\ \mbox{where}\ \mylim{x}{a^{(\pm)}}f(x)=\pm\infty\right)$,\newline horizontal $\left( y=L\ \mbox{where}\ \mylim{x}{\pm\infty}f(x)=L\right)$,\newline or slant $\left(y=mx+b\ \mbox{where}\ \mylim{x}{\pm\infty}\left[f(x)-(mx+b)\right]=0\right)$
asymptotes.
\item[Intervals:] Partition $D$ into open intervals using locations of any vertical asymptotes, critical numbers ($c$ in $D$ where $f'(c)=0$ or does not exist), and numbers $c$ in $D$ where $f''(c)=0$ or does not exist.
\item[Increasing/Decreasing:] Use increasing/decreasing test to determine intervals of increase ($f'(x)>0$) or decrease ($f'(x)<0$).
\item[\Relative Extrema:] For any critical numbers determine \relative extrema.  Evaluate them using the First Derivative Test ($f'$ goes from negative to positive at $c$ $\Rightarrow$ \relative minimum, positive to negative $\Rightarrow$ \relative maximum, no change $\Rightarrow$ no extremum) or Second Derivative Test ($f''(c)>0$ $\Rightarrow$ \relative minimum, $f''(c)<0$ $\Rightarrow$ \relative maximum, $f''(c)=0$ $\Rightarrow$ inconclusive).  Evaluate $f(c)$ to find the value of any \relative extrema.
\item[Concavity:] Use the concavity test ($f''(x)>0$ $\Rightarrow$ concave upward, $f''(x)<0$ $\Rightarrow$ concave downward) to find intervals of concavity.
\item[Inflection Points:] Consider $x$-values $c$ where $f''(c)=0$ or does not exist but $f$ is continuous.  Inflection points $(c,f(c))$ occur where concavity changes (positive to negative or vice versa).
\item[Sketch:] Sketch the above information on a graph choosing axis limits that will include the interesting regions of the graph.
\end{description} 
\end{method}

\begin{example}
Sketch the graph of $\displaystyle f(x)=\frac{2x^2+2x-3}{x^2+x-2}$.
\end{example}

\textbook{\clearpage}
\begin{exercise}
\input{DERIVATIVE_APPLICATIONS/curve-sketching-II}
\end{exercise}

\section{Optimization}
A particularly useful application of calculus is optimization.  We have already seen how we can find \absolute and \relative extrema of functions.  When these functions represent physical quantities solutions of extrema problems give optimal settings of the independent variable that will result in the lowest or highest possible value of the dependent variable.

So in business one may be interested in minimizing cost or maximizing profit by setting selecting the value of a design specification in its production or determining the sale price of an item.  Environmentally one may be interested in minimizing the production of some toxic compound whose formation depends on an alterable temperature at production.  Often we are interested in minimizing distance or time.

As with any word problem, the challenge with an optimization problem is to convert this into a calculus problem.  Once this is accomplished one follows the steps already discussed for finding the \absolute extremum of interest.  In summary do the following:

\begin{method}
\textbf{Optimization Problem Steps}
\begin{description}
\item[1) Identify Variables:] Identify the dependent variable to be
  maximized or minimized and the independent variable to be varied.
  (If the problem is geometrical in nature try sketching a diagram.)
  Determine the physically valid domain $D$ of the independent
  variable.
\item[2) Determine Function:] Write the dependent variable as a function of the independent variable.  (If another variable appears in the
  function, try to find a constraint involving the independent variable
  and it so that the latter may be removed from the function.\footnotemark)
\item[3) Differentiate:] Take the derivative of the dependent variable
  with respect to the independent one.
\item[4) Critical Numbers:] Find any critical numbers of the independent variable (where the derivative vanishes or does not exist).
\item[5) Evaluate Dependent Variable:] If seeking an \absolute
  maximum, check which critical numbers are \relative maxima (using
  the Second or First Derivative Test) and evaluate the dependent
  variable at those points.  Also evaluate the dependent variable at
  the endpoints of $D$.  The largest of these is the \absolute maximum
  of the dependent variable while its location is the optimal setting
  of the independent variable.  Do similarly if seeking an \absolute
  minimum.\footnotemark
\end{description}
\end{method}
\addtocounter{footnote}{-1}
\footnotetext{If no such constraint exists so that the other
    variable is actually independent, then multivariate calculus would
    be required.}
\addtocounter{footnote}{1}
\footnotetext{As a final step, note that plotting your function to confirm the location and value of the extremum is a good idea in practice.}

\begin{example}
Solve the following optimization problems.
\begin{enumerate}
\item A farmer intends to put a rectangular garden along one side of a
  barn.  The remaining three sides of the garden will be fenced. Find
  the dimensions and area of the largest garden that can be enclosed using
  40~metres of fencing material.

\item Find the dimensions of the rectangle with fixed area $a$ having
  the smallest perimeter possible.

\item A polygonal window is composed of a rectangle topped with an
  equilateral triangle.  Find the dimensions of the window that will
  maximize the area if the perimeter of the window must be $6$~m.

\item In a certain type of cheese production the cheese is pressed
  into a cylindrical mold with a circular base and no top.  If the
  total area of the mold is to be $1600$~cm$^2$, find the radius and
  height of the mold that will maximize the volume it contains.
% Note the high pressure when pressing is why cylindrical molds are used.

\item A plastic rectangular box for transporting vegetables needs to
  be designed to have a volume of 72000~cm${}^3$.  The box is to have
  an open top.  The cost of material for the base is
  $0.25$~cents/cm${}^2$ while for the sides it is only
  $0.2$~cents/cm${}^2$.  If the length of the base is desired to be
  $1.5$ times its width, find the dimensions and cost for the least
  expensive box meeting these requirements.

\item A page in a children's book is to have a total area of
  $600$~cm$^{2}$.  Its top and bottom margins are to be $3$~cm while
  its side margins are to be $2$~cm each.  What should the dimensions
  of the page be to maximize the printed area between the margins?

\item Earth is located at the fixed point $(1,0)$ in a coordinate
  system superimposed on the plane of the solar system with the sun at
  the origin.  Here measurements are in Astronomical
  Units~(AU).\footnotemark\, A spaceship follows a hyperbolic
  trajectory $y=\sqrt{x^2+1}$ through the plane.  At what point is the
  spaceship closest to Earth and how far away is it at that point?

\item A semicircle has a radius of $2$~cm.  What are the dimensions of
  the rectangle with largest area that can be inscribed within it?

\end{enumerate}
\end{example}
\footnotetext{One Astronomical Unit equals the average distance from the
  earth to the sun, approximately 150 million kilometres.}

\begin{exercise}
\input{DERIVATIVE_APPLICATIONS/optimization-problems}
\end{exercise}

\begin{reviewexercise}
\input{DERIVATIVE_APPLICATIONS/derivative-applications-review}
\end{reviewexercise}

%TODO: Add a geometry appendix.  It should have info on cartesian coordinates,
% including distances between horizontal points and arbitrary points.
% Also need an appendix with perimeters and areas of planar shapes and
% surface areas and volumes of 3D shapes.  See resources directory for examples.
%
% Maybe add an optimization problem tips section where I mention
% distance formula, geometry appendix, and cost = cost/length*length, etc.

