%% LyX 2.0.0 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{beamer}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{amsmath}
\usepackage{graphicx}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
 % this default might be overridden by plain title style
 \newcommand\makebeamertitle{\frame{\maketitle}}%
 \AtBeginDocument{
   \let\origtableofcontents=\tableofcontents
   \def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
   \def\gobbletableofcontents#1{\origtableofcontents}
 }
 \long\def\lyxframe#1{\@lyxframe#1\@lyxframestop}%
 \def\@lyxframe{\@ifnextchar<{\@@lyxframe}{\@@lyxframe<*>}}%
 \def\@@lyxframe<#1>{\@ifnextchar[{\@@@lyxframe<#1>}{\@@@lyxframe<#1>[]}}
 \def\@@@lyxframe<#1>[{\@ifnextchar<{\@@@@@lyxframe<#1>[}{\@@@@lyxframe<#1>[<*>][}}
 \def\@@@@@lyxframe<#1>[#2]{\@ifnextchar[{\@@@@lyxframe<#1>[#2]}{\@@@@lyxframe<#1>[#2][]}}
 \long\def\@@@@lyxframe<#1>[#2][#3]#4\@lyxframestop#5\lyxframeend{%
   \frame<#1>[#2][#3]{\frametitle{#4}#5}}
 \def\lyxframeend{} % In case there is a superfluous frame end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.

\usepackage{appearance}\newcommand{\reals}{\mathbb R}

\makeatother

\usepackage{babel}
\begin{document}
%MODULE 1: Optimization


%USER DEFINED COMMANDS
\global\long\def\ds{{\displaystyle }}
 \global\long\def\nsp{\hspace{1em}*{9pt}}
 \global\long\def\lns{\rule{0pt}{11pt} }
 \global\long\def\xp{\mbox{\Large\sl e} }


%INPUT THE INSTRUCTIONS PAGE 


%BUILD  TITLE PAGE 



\title{Extrema}


\subtitle{A common problem is one of find {\hilite extrema}, which are {\hilite
minimum} and {\hilite maximum} values of a function. Methods of
approximating an exremum are possible, but generally unsatisfactory.
Derivatives give us an way to compute extrema in a very efficienty
manner. }

\makebeamertitle

\lyxframeend{}\lyxframe{{Sample problems}}

\label{page:modf-problem} \begin{question} 
\begin{itemize}
\item Find the maximum and minimum values of $\ec xe^{x}$ on the interval
$\ec[-10,10]$. 
\item Where does the graph of a function change direction from increasing
to decreasing or vice versa? 
\item A manufacturer's profit depends on the volume of sales: if not enough
units are sold, income is insufficient to cover the costs, but if
too many units are sold, the costs of making too much of a product
grow faster than income. The profit function for the manufacturer
Widgets-R-Us is known to be $\ec p(x)=-{x}^{3}+{2.66{x}^{2}}+{3.8649x}+{0.113526}$,
where $\ec x$ is the number of units sold, in thousands. What number
of units sold should the manufacturer target in order to maximize
profit? 
\end{itemize}
\end{question}

%1



\lyxframeend{}\lyxframe{{SAGE worksheets}}

\noindent For this module you will need a blank SAGE worksheet.


\lyxframeend{}\lyxframe{{Extrema?}}
\begin{definition}%{}
\noindent An {\hilite extremum} is either a minimum or a maximum
value of a function.
\begin{itemize}
\item The function $\ec f(x)$ has a {\hilite maximum} at $\ec x=c$
on the interval $\ec[a,b]$ if $\ec f(c)>f(x)$ for all other values
$\ec x\in[a,b]$. 
\item The function $\ec f(x)$ has a {\hilite minimum} at $\ec x=c$
on the interval $\ec[a,b]$ if $\ec f(c)<f(x)$ for all other values
$\ec x\in[a,b]$. 
\end{itemize}
\end{definition}%{}

\lyxframeend{}\lyxframe{{Extrema: Approximation}}
\begin{overlayarea}
{\textwidth}{6in}

\noindent The first example asks us to \begin{question} Find the
maximum and minimum values of $\ec xe^{x}$ on the interval $\ec[-10,10]$.
\end{question}
\begin{onlyenv}%{}
<1-3>

\noindent We can approximate the minimum by looking at $y$ values
of $\ec xe^{x}$ on the interval. Use SAGE to make a table of values
and approximate the extrema.


\bigskip{}



\pause{}
\begin{onlyenv}%{}
<2>

(\emph{Hint:} The sequence of commands\\
 {\ttcolor f = x{*}e\^{}x\\
 {[}round(f(each),2) for each in {[}-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10{]}{]}}\\
 will compute the values of $\ec f(-10)$, $\ec f(-9)$, \ldots{},
$\ec f(10)$ rounded to the hundredths place.)

\end{onlyenv}%{}

\pause{}
\begin{onlyenv}%{}
<3>

(\emph{Hint:} Another trick that works is the sequence of commands\\
 {\ttcolor f = x{*}e\^{}x\\
 {[}round(f(each-10),2) for each in range(21){]}}\\
 because the command {\ttcolor range(21)} gives a list of numbers
from 0 to 20.)

\end{onlyenv}%{}
\end{onlyenv}%{}

\pause{}
\begin{onlyenv}%{}
<4->

Checking every integer in the interval, we see the values 


\begin{center}
\vspace{-2ex}
{\ec{\scriptsize }%
\begin{tabular}{c|ccccccccc}
{\scriptsize $x$ } & {\scriptsize -10 } & {\scriptsize -9 } & {\scriptsize -8 } & {\scriptsize -7 } & {\scriptsize -6 } & {\scriptsize -5 } & {\scriptsize -4 } & {\scriptsize -3 } & {\scriptsize -2 }\tabularnewline
\hline 
{\scriptsize $xe^{x}$ } & {\scriptsize -0.0 } & {\scriptsize -0.0 } & {\scriptsize -0.0 } & {\scriptsize -0.01 } & {\scriptsize -0.01 } & {\scriptsize -0.03 } & {\scriptsize -0.07 } & {\scriptsize -0.15 } & {\scriptsize -0.27 }\tabularnewline
\end{tabular}}
\par\end{center}


\begin{center}
\vspace{-2ex}
{\ec{\scriptsize }%
\begin{tabular}{c|ccccccc}
{\scriptsize $x$ } & {\scriptsize -1 } & {\scriptsize 0} & {\scriptsize 1 } & {\scriptsize 2 } & {\scriptsize 3 } & {\scriptsize 4 } & {\scriptsize 5 }\tabularnewline
\hline 
{\scriptsize $xe^{x}$ } & {\scriptsize -0.37 } & {\scriptsize 0.0 } & {\scriptsize 2.72 } & {\scriptsize 14.78 } & {\scriptsize 60.26 } & {\scriptsize 218.39 } & {\scriptsize 742.07 }\tabularnewline
\end{tabular}}
\par\end{center}


\begin{center}
\vspace{-2ex}
{\ec{\scriptsize }%
\begin{tabular}{c|ccccc}
{\scriptsize $x$ } & {\scriptsize 6 } & {\scriptsize 7 } & {\scriptsize 8 } & {\scriptsize 9 } & {\scriptsize 10 }\tabularnewline
\hline 
{\scriptsize $xe^{x}$ } & {\scriptsize 2420.57 } & {\scriptsize 7676.43 } & {\scriptsize 23847.66 } & {\scriptsize 72927.76 } & {\scriptsize 220264.66 }\tabularnewline
\end{tabular}}
\par\end{center}

\end{onlyenv}%{}

\pause{}


\noindent \vspace{-2ex}



\noindent It \emph{looks} as if the minimum and maximum values are
approximately $\ec-0.37$ and $\ec220264.66$. They appear at $\ec x=-1$
and $\ec x=10$. How can we be \emph{certain} about this, and how
can we find the \emph{precise} minimum and maximum?

\end{overlayarea}

\lyxframeend{}\lyxframe{{Extrema: Certainty of computation}}

Think about what must happen to the $y$ values around a minimum $\ec m=f(c)$
at $\ec x=a$. 
\begin{figure}[h!]
\centering{}\includegraphics[scale=0.2]{figures/x_ex_left_decreasing}
\end{figure}

\begin{itemize}
\item The $y$ values should be larger than $\ec m$, because $\ec m$ is
a minimum. 
\item If $\ec x<c$ but close to $\ec c$, the slopes of the secant lines
will be negative:
\[
\ec\frac{f(x)-f(c)}{x-c}=\frac{\mathrm{positive}}{\mathrm{negative}}
\]
so the slopes of the tangent lines should also be negative. Thus the
derivative should be negative for $\ec x<c$. 
\end{itemize}

\lyxframeend{}\lyxframe{{Extrema: Certainty of computation}}

Think about what must happen to the $y$ values around a minimum $\ec m=f(c)$
at $\ec x=a$. 
\begin{figure}[h!]
\centering{}\includegraphics[scale=0.2]{figures/x_ex_right_decreasing}
\end{figure}

\begin{itemize}
\item The $y$ values should be larger than $\ec m$, because $\ec m$ is
a minimum. 
\item If $\ec x>c$ but close to $\ec c$, the slopes of the secant lines
will be positive:
\[
\ec\frac{f(x)-f(c)}{x-c}=\frac{\mathrm{positive}}{\mathrm{positive}}
\]
so the slopes of the tangent lines should also be positive. Thus the
derivative should be positive for $\ec x>c$. 
\end{itemize}

\lyxframeend{}\lyxframe{{Extrema: Certainty of computation}}

The preceding argument implies the following result.
\begin{theorem}%{}
If the function $\ec f(x)$ is continuous on the interval $\ec[a,b]$,
it has a {\hilite minimum} at $\ec x=c$ when 
\begin{itemize}
\item $\ec f'(x)<0$ for all $\ec x\in[a,c)$, and 
\item $\ec f'(x)>0$ for all $\ec x\in(c,b]$. 
\end{itemize}
\end{theorem}%{}
\bigskip{}
A similar theorem exists for a {\hilite maximum}, but reversing
the inequalities: 
\begin{itemize}
\item $\ec f'(x)>0$ for all $\ec x\in[a,c)$, and 
\item $\ec f'(x)<0$ for all $\ec x\in(c,b]$. 
\end{itemize}

\lyxframeend{}\lyxframe{\noindent {How to find extrema}}

\noindent If $\ec f(x)$ is continuous on the interval $\ec[a,b]$,
you can find extrema in the following way: \begin{method} 
\begin{itemize}
\item Find all places where $\ec f'(x)=0$ or $\ec f'(x)$ does not exist.
These $x$ values are called {\hilite critical points}. 
\item Find the $\ec y$ values at each critical points \emph{and} at the
endpoints. 
\item The smallest $\ec y$ value found is the minimum, and the largest
$\ec y$ value found is the maximum. 
\end{itemize}
\noindent \end{method}


\lyxframeend{}\lyxframe{{First example}}
\begin{overlayarea}
{\textwidth}{6in}

Recall the first example: \begin{question} Find the maximum and minimum
values of $\ec xe^{x}$ on the interval $\ec[-10,10]$. \end{question}
How would we find the extrema?


\pause{}


\noindent Let $\ec f(x)=xe^{x}$.


\bigskip{}

\begin{onlyenv}%{}
<2-3>

First we check where $\ec f'(x)$ is zero or undefined:
\begin{align*}
\ec f'(x) & {\ec=xe^{x}+e^{x}=(x+1)e^{x}}.
\end{align*}



\pause{}
\begin{onlyenv}%{}
<3>

This derivative is never undefined, and is zero when $\ec x=-1$:
\[
{\ec(x+1)e^{x}=0}\mathrm{\ when\ }{\ec x+1=0}\mathrm{\ or\ }{\ec e^{x}=0}.
\]
\begin{explanation}Remember that $e^{x}$ is never zero, so $x+1=0$
is the only equation that can give us a solution. Thus $x=-1$.\end{explanation}

\end{onlyenv}%{}
\end{onlyenv}%{}

\pause{}
\begin{itemize}
\item {\dims There is one critical point at $x=-1$}. 
\end{itemize}

Now find the $y$ values at the critical point and at the endpoints:


\pause{}


\begin{center}
{\ec%
\begin{tabular}{c|ccc}
$x$  & -10  & -1  & 10 \tabularnewline
\hline 
$f(x)$  & $-10e^{-10}\approx0.00$  & $-e^{-1}\approx-0.37$  & $10e^{10}\approx220264.66$ \tabularnewline
\end{tabular}}
\par\end{center}


The minimum is $\ec-e^{-1}\approx-0.37$ at $\ec x=-1$. The maximum
is $\ec10e^{10}\approx220264.66$ at $\ec x=10$.

\end{overlayarea}

\lyxframeend{}\lyxframe{{Second Example}}

Now we turn to the second example: \begin{question} Where does the
graph of a function change direction from increasing to decreasing
or vice versa? \end{question}


\pause{}

\noindent The graph of a function \emph{increases} when, if the $x$
values are increasing, so are the $y$ values. The graph of a function
\emph{decreases} when, if the $x$ values are increasing, the $y$
values are decreasing. This is the same as finding the extrema. The
graph of a function changes direction from increasing to decreasing
at any point where the derivative is zero, or where it is undefined.


\lyxframeend{}\lyxframe{\noindent {Third Example}}
\begin{overlayarea}
{\textwidth}{6in}

\noindent The third example was a word problem.\vspace{-1ex}
 \begin{question} A manufacturer's profit depends on the volume of
sales: if not enough units are sold, income is insufficient to cover
the costs, but if too many units are sold, the costs of making too
much of a product grow faster than income. The profit function for
the manufacturer Widgets-R-Us is known to be $\ec p(x)=-{x}^{3}+{2.66{x}^{2}}+{3.8649x}+{0.113526}$,
where $\ec x$ is the number of units sold, in thousands. What number
of units sold should the manufacturer target in order to maximize
profit? \end{question}\vspace{-1ex}
We want to find the maximum value of $\ec p(x)$ on the interval $\ec[0,\infty)$.


\pause{}
\begin{onlyenv}%{}
<2>

\noindent The first thing to do is to find the critical points. First,
compute the derivative, and find where it is zero or undefined. {\scriptsize 
\begin{align*}
\ec0 & \ec=p'(x)=-3x^{2}+5.32x+3.8649\ec x & {\ec=\frac{-5.32\pm\sqrt{5.32^{2}-4\cdot(-3)\cdot3.8649}}{2\cdot(-3)}\approx-0.55,2.33}.
\end{align*}
}{\scriptsize \par}

\end{onlyenv}%{}

\pause{}
\begin{itemize}
\item There is a critical point at $x=2.33$. \end{itemize}
\begin{onlyenv}%{}
<3>

The negative critical point $\ec-0.55$ is outside the domain $\ec[0,\infty)$.
Since $\ec p'(x)$ is never undefined, there are no other critical
points.

\end{onlyenv}%{}

\pause{}


\vspace{-1ex}
Comparing the $y$ values, we see\vspace{-2ex}
\begin{align*}
\ec p(2.33) & \ec=10.91028\\
\ec p(0) & {\ec=0.113526}.
\end{align*}



\vspace{-1ex}
 The manufacturer should sell 2,300~units to maximize profit.

\end{overlayarea}

\lyxframeend{}\lyxframe{{Local Extrema}}

One can distinguish in Calculus between {\hilite global} extrema
and {\hilite local} extrema. An extremum is global if it the largest
or smallest $y$ value on the entire interval specified. An extremum
is local if it is the largest or smallest $y$ value on some interval,
but not perhaps the one specified.


\lyxframeend{}\lyxframe{\noindent {Local Extrema: Example}}

\noindent As an example, we compute the local extrema of $\ec f(x)=x\sin x$
on the interval $\ec[0,2\pi]$.


\pause{}

The derivative is $\ec f'(x)=\sin x+x\cos x$. To find where this
is zero, you will have to use some method of approximating the zero
of a function. You can do this with the {}``Newton's Method'' SAGElet.


\pause{}

You should find that critical points occur at $\ec x=0$, $\ec x\approx2.03$,
and $\ec x\approx4.91$.


\pause{}

 Compute the $y$ values of the critical points and the endpoints: 

\begin{center}
{\ec%
\begin{tabular}{c|cccc}
$x$  & 0  & 2.03  & 4.91  & $2\pi$\tabularnewline
\hline 
$f(x)$  & 0  & 1.82  & -4.81  & 0 \tabularnewline
\end{tabular}}
\par\end{center}
\begin{itemize}
\item At $\ec x=0$, we have a \emph{local} minimum; 
\item at $\ec x=2.03$, we have a \emph{global} maximum; 
\item at $\ec x=4.91$, we have a \emph{global} minimum; and 
\item at $\ec x=2\pi$, we have a \emph{global} minimum. 
\end{itemize}

\lyxframeend{}\lyxframe{{Local Extrema: Caution}}

Be careful when analyzing this, because some functions have critical
points that are neither minima nor maxima! For a minimum, the function
\emph{must} decrease to the value, then increase. For a maximum, the
function \emph{must} increase the to value, then decrease.

\noindent \bigskip{}
For example, if $\ec f(x)=x^{3}$, there is a critical point at $\ec x=0$
(check this yourself!) but it cannot be a local minimum or maximum
on the interval $\ec[-1,1]$: 
\begin{itemize}
\item $\ec f'(x)>0$ for all $\ec x\in[-1,0)$; and 
\item $\ec f'(x)>0$ for all $\ec x\in(0,1]$. 
\end{itemize}
\noindent This does not meet the definition of either a minimum or
a maximum, no matter how small you make the interval around $\ec x=0$.


\lyxframeend{}\lyxframe{{Conclusion} }

\noindent In this module, we discussed: 
\begin{itemize}
\item How to find the extrema, or minima of a function $\ec f$:\setlength{\shadeboxwidth}{4in}\vspace{-1ex}
\begin{method} 

\begin{itemize}
\item find all $x$ values where the derivative of $\ec f$ is zero or undefined; 
\item compute the $y$ values of $\ec f$ at those points and at the endpoints; 
\item select the largest $y$ value as the maximum, and the smallest $y$
value as the minimum. 
\end{itemize}

\end{method} 

\item How to find the extrema by guess and check, but that would be unreliable. 
\item How extrema are related to where the graph of a curve changes direction. 
\item How extrema can be used in applications of mathematics. 
\end{itemize}
Later we will use the example of where a graph changes direction to
help draw the sketches of curves. 


\lyxframeend{}
\end{document}
