148/171
\begin{frame}
\frametitle{Optimization}

\vspace{-1ex}
\begin{exampleblock}{}
Find the area of the largest rectangle that can be inscribed in a semi-circle
circle of radius $r$.
\pause\medskip

\begin{minipage}{.45\textwidth}
\begin{center}
\begin{tikzpicture}[default,scale=.45,nodes={scale=.9}]
\diagram{-3.5}{3.5}{-.5}{3.5}{1}
\diagramannotatexx{-3/-r,3/r}
\diagramannotatez
\begin{scope}[ultra thick]
\draw[cgreen] plot[smooth,domain=-3:3,samples=100] function{sqrt(9-x**2)};
\mpause[1]{
\draw[cred] (-2,0) rectangle (2,{pow(9-2*2,.5)});
}
\end{scope}
\mpause[3]{
\node[include=cred] (a) at (2,{pow(9-2*2,.5)}) {};
\node[anchor=south west] at (a) {$(x,y)$};
}
\end{tikzpicture}
\end{center}
\end{minipage}~%
\begin{minipage}{.54\textwidth}
\pause
\mpause[1]{
Introducing notation:
\begin{itemize}
\pause\pause
\item let $(x,y)$ be the upper right corner of the rectangle
\pause
\item let $A$ be the area
\end{itemize}
}
\end{minipage}
\smallskip

\mpause[1]{
\pause
$A(x) = \mpause[1]{2xy} \mpause[2]{= 2x\sqrt{r^2-x^2}} \mpause[3]{\quad\quad\text{for$x$in$[\mpause[4]{0},\mpause[4]{r}]$}}$
\pause\pause\pause\pause\smallskip

$A$ is continuous on $[0,r]$, we use the Closed Interval Method:\vspace{-.7ex}
\begin{talign}
A'(x) &= \mpause[1]{ 2\sqrt{r^2-x^2} + \frac{2x}{2\sqrt{r^2-x^2}}(-2x) }
\mpause{= \frac{2(r^2-2x^2)}{\sqrt{r^2-x^2}} } \\[-.5ex]
\mpause{A'(x) &= 0 \;\iff\; }\mpause{x^2 = r^2/2} \mpause{\stackrel{x\ge 0}{\iff} x = r/\sqrt{2}}
\end{talign}
\pause\pause\pause\pause\pause\pause
Note that $A(0) = \mpause[1]{0}$ and $A(r) = \mpause[1]{0}$. \pause\pause Thus the \alert{maximum area} is:\vspace{-.7ex}
\begin{talign}
\alert{A(r/\sqrt{2}) =} \mpause[1]{ 2\frac{r}{\sqrt{2}}\sqrt{r^2 - \frac{r^2}{\sqrt{2}^2}} }
\mpause[2]{ = \sqrt{2}r\sqrt{\frac{r^2}{2}} }