%\documentclass[c]{beamer}

%\usecolortheme{whale}


\documentclass[xcolor=dvipsnames,envcountsect]{beamer} 
%\documentclass{beamer}
\beamertemplatenavigationsymbolsempty 
\usecolortheme[named=Blue]{structure} %change
%\usecolortheme{seahorse}
%\usecolortheme{rose}
 %default blue to brown
%\usetheme{Warsaw}
%\usetheme{CambridgeUS}
\useoutertheme{infolines}
%\usecolortheme{dolphin}
%\usefonttheme{serif}
\usetheme{Madrid}

%\addtocounter{framenumber}{-5} 
%\setbeamertemplate{footline}[default] 
\usefonttheme{professionalfonts} % using non standard fonts for beamer
%\usefonttheme{serif} % default family is serif


\usepackage{multicol}
%\usepackage[compatibility=false]{caption}
%\usepackage{subfig}

%\usepackage[caption=false]{subfig}
\usepackage{amsmath}
\DeclareMathOperator{\sech}{sech}
\DeclareMathOperator{\csch}{csch}

%\usetheme{Frankfurt}
%\usetheme{AnnArbor}
% % % % % % % % % % %
%\usepackage{fancyhdr}
%\usepackage{graphicx}
%\usepackage{caption}
%\usepackage{tikz,siunitx}
%
%\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri}
%
%\usetikzlibrary{automata,arrows}
%\usepackage{subcaption}
%\usepackage{enumitem}
%\setlist{nolistsep}
%\usepackage{float}
% % % % % % % % % % %


\usepackage{verbatim}
\usepackage{bm}
\usepackage[all,cmtip]{xy}
\usepackage[framemethod=default]{mdframed}
\def\Ker{\textrm {Ker\,}}
\def\Im{\textrm{Im\,}}
\def\Z{\mathbb{Z}}
\def\N{\mathcal{N}}
\def\Z{\mathbb{Z}}
\def\F{\mathbb{F}}
\def\Aut{\mathrm{Aut}}
\def\rightiso{\xrightarrow{\simeq}}
\def\B{B}
\def\H{H}
\def\A{\mathcal{A}}
\def\Bb{\overline{B}}
\def\Rb{\overline{R}}
%\def\p{} 
\def\p{\pause}
\def\cl{\color{blue}}
\def\clg{\color{red}}
%\usefonttheme{structuresmallcapsserif}
\def\cl{\color{blue}}
\def\clg{\color{red}}



\setbeamertemplate{theorems}[numbered]



\newtheorem{proposition}{Proposition}[section]
\newtheorem*{conjecture}{Conjecture}
%\theoremstyle{definition} \newtheorem{algorithm}{Algorithm}[section]
\theoremstyle{definition} \newtheorem{remark}{Remark}[section]


\usepackage{ifthen}

% This is the file main.tex


\newcommand\uleft[2]{\,{}^{#1}\hspace*{-.1em}{#2}}
\def\idgroup{\mathbf{1}}
\newcommand\rdef[1]{\textit{\textcolor{blue}{#1}}}
\newcommand\mdef[1]{\textcolor{Brown}{#1}}

\newcommand\link[2]{\hyperlink{#2}{\beamergotobutton{#1}}}

\def\GAP{{\sf GAP} }
\def\HAP{{\sf HAP} }
\def\XMod{{\sf XMod}}
\def\C{\mathcal{C}}
\def\ZG{\mathbb{Z}G}
\input{rbg}
\def\minusvspace{\vspace*{-18pt}}
\def\xyscale{\xymatrixrowsep{0.25in} \xymatrixcolsep{0.25in}}

\def\xysmall{\xymatrixrowsep{0.15in} \xymatrixcolsep{0.15in}} 
\def\Ne{\mathcal{N}}
\def\CW{\textrm{CW}}
\parskip 0.1in

\input{def}

\def\xd{\vspace*{10pt}}
\def\ixd{\vspace*{3pt}}



 




\title[]{MA140-Engineering Calculus}
\author[ Lecture 17 ]{\large{ Lecture 17} 
\and %\\ \small{Supervisor: Dr. John Burns}
\\ 
 \includegraphics[scale=0.0]{Figures/lec14.jpg}}
%\date[June 2-4, 2016]{June 2-4, 2016}
%\institute[Uppsala University]{ }


\begin{document}
\begin{frame}
\titlepage
\end{frame}


\section{MA140}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}

{\textbf {\textcolor{red}{Solving Applied Optimization Problems:}}}
\begin{itemize}
\item[(1)] \textit{Read the problem.} Read the problem until you understand it. What is given?
What is the unknown quantity to be optimized?
\item[(2)] \textit{Draw a picture.} Label any part that may be important to the problem.
\item[(3)] \textit{Introduce variables.} List every relation in the picture and in the problem as an equation or algebraic expression, and identify the unknown variable.
\item[(4)] \textit{Write an equation for the unknown quantity.} If you can, express the unknown
as a function of a single variable or in two equations in two unknowns.
This may require considerable manipulation.  
\end{itemize}
\end{frame}
\begin{frame}
\begin{example}
A rectangle has the following side lengths
\begin{center}
			\includegraphics[scale=0.7]{Figures/lec400.pdf}
		\end{center}
		Find $x$ and $y$ if the area is to be maximized if the perimeter equals 30m. 		
		\end{example}
\end{frame}
\begin{frame}
The perimeter equals $30m$, it means $2(x+y)=30$ or $x+y=15$, so $$y=15-x, (\textcolor{red} {\star})$$
$Area=A=x\cdot y$, Using $(\textcolor{red} {\star})$, we have  $$A=x(15-x)$$ Now A is a function of $x$, in order to find the maximum value of A, we differentiate it:  $$\frac{dA}{dx}=15-2x$$
Let: $$\frac{dA}{dx}=0 \Rightarrow x=\frac{15}{2} (y=\frac{15}{2})$$
So $x=\frac{15}{2}$ is a critical point.
\end{frame}
\begin{frame}
Now we use the second derivative test
$$\frac{d^{2}A}{dx^{2}}=2<0$$ so $x=\frac{15}{2}$ is a local maximum
\end{frame}
\begin{frame}
\begin{example}
Find the point on the parabola $y^{2}=2x$, closest to the point $(1,4)$ 
\begin{center}
			\includegraphics[scale=0.2]{Figures/lec402.pdf}
		\end{center}
		
\end{example}
\end{frame}
\begin{frame}
The distance between the two points $(x,y)$ and $(1,4)$ equals:
$$d=\sqrt{(x-1)^{2}+(y-4)^{2}}$$
Instead of minimizing $d$ we can minimize distance squared. 
$$r=(x-1)^{2}+(y-4)^{2}$$
As the coordinates of the point satisfy $y^{2}=2x$ or $\frac{y^{2}}{2}=x$, let $y=t$ then $x=\frac{t^{2}}{2}$.  So $(x,y)=(\frac{t^{2}}{2},t)$ and $(1,4)$ have distance squared equal to 
$$r(t)=(\frac{t^{2}}{2}-1)^{2}+(t-4)^{2}$$
\end{frame}
\begin{frame}
$$r(t)=\frac{t^{4}}{4}-t^{2}+1+t^{2}+16-8t=\frac{t^{4}}{4}-8t+17$$
$$r'(t)=t^{3}-8=0$$
So $t=2$ is the only critical point.
$$r''(t)=3t^{2} \Rightarrow r''(2)=12>0$$ 
So $t=2$ is a local minimum, therefore $(2,2)$ is the point on $y^{2}=2x$ closest to $(1,4)$  
\end{frame}

\begin{frame}
Suppose that $f(a)=g(a)=0$, that $f'(a)$ and $g'(a)$ exist, and $g'(a)\neq 0$.\\
Then: $$\lim_{x \to a}\frac{f(x)}{g(x)}=\frac{f'(a)}{g'(a)}$$
 {\textcolor{red}{Proof:}} Working backward from $f'(a)$ and $g'(a)$, which are themselves limits, we have $$\frac{f'(a)}{g'(a)}=\frac{\lim_{x \to a}\frac{f(x)-f(a)}{x-a}}{\lim_{x \to a}\frac{g(x)-g(a)}{x-a}}=\lim_{x \to a}\frac{\frac{f(x)-f(a)}{x-a}}{\frac{g(x)-g(a)}{x-a}}$$ 
 $$=\lim_{x \to a}\frac{f(x)-f(a)}{g(x)-g(a)}=\lim_{x \to a}\frac{f(x)-0}{g(x)-0}=\lim_{x \to a}\frac{f(x)}{g(x)}$$
\end{frame}
\begin{frame}
\begin{theorem}
  {\textcolor{red}{L'H\^opital's Rule:}}  \\
If $f$ and $g$ are differentiable and $g'(x)\neq 0$ near $a$ (except possibly at $a$),
\begin{itemize}
\item if $\lim_{x \to a}f(x)=0$ and $\lim_{x \to a}g(x)=0$ \\ or 
\item  $\lim_{x \to a}f(x)=\pm \infty$ and  $\lim_{x \to a}g(x)=\pm \infty$
 \end{itemize}
 Then: $$\lim_{x \to a}\frac{f(x)}{g(x)}=\lim_{x \to a}\frac{f'(x)}{g'(x)}$$
\end{theorem}

\end{frame}
\begin{frame}
\begin{example}
Find the following limit: $$\lim_{x \to 1}\frac{\ln x}{x-1}$$
\end{example}
As $\lim_{x \to 1}(\ln x)=\ln (1)=0$ and $\lim_{x \to 1}(x-1)=0$, we can apply L'H\^opital's Rule: $$\lim_{x \to 1}\frac{\ln x}{x-1}\overset{\mathrm{H}}=\lim_{x \to 1}\frac{\frac{d}{dx}(\ln x)}{\frac{d}{dx}(x-1)}=\lim_{x \to 1}\frac{\frac{1}{x}}{1}=\lim_{x \to 1} \frac{1}{x}=\frac{1}{1}=1$$
\end{frame}
\begin{frame}
\begin{example}
Find $$\lim_{x \to \infty} \frac{e^{x}}{x^{2}}$$
\end{example}
$\lim_{x \to \infty}e^{x}=\infty$ and $\lim_{x \to \infty}x^{2}=\infty$, so we can apply the L'H\^opital's Rule: $$\lim_{x \to \infty}\frac{e^{x}}{x^{2}}\overset{\mathrm{H}}=\lim_{x \to \infty}\frac{e^{x}}{2x}$$  This result is also of the form $\frac{\infty}{\infty}$, so we can apply the L'H\^opital's Rule again: $$\lim_{x \to \infty}\frac{e^{x}}{2x}\overset{\mathrm{H}}=\lim_{x \to \infty}\frac{e^{x}}{2}=\infty$$ 
\end{frame}
\begin{frame}
\begin{example}
Find $$\lim_{x \to 0}\frac{\sin (x)-x}{x^{3}}$$
\end{example}
$\lim_{x \to 0}(\sin (x)-x)=0$ and $\lim_{x \to 0}x^{3}=0$, as we see the limit is of the form $\frac{0}{0}$. so $$\lim_{x \to 0}\frac{\sin (x)-x}{x^{3}}\overset{\mathrm{H}}=\lim_{x \to 0}\frac{\cos (x)-1}{3x^{2}}$$ Note that $\lim_{x \to 0} (\cos x-1)=0$ and $\lim_{x \to 0}(3x^{2})=0$, so again we get $\frac{0}{0}$, so we can to apply L'H\^opital's Rule again, 
$$\lim_{x \to 0}\frac{\cos (x)-1}{3x^{2}}\overset{\mathrm{H}}=\lim_{x \to 0}\frac{-\sin x}{6x}=\frac{0}{0}$$ We can use L'H\^opital's Rule again: 
$$\lim_{x \to 0}\frac{-\sin x}{6x}\overset{\mathrm{H}}=\lim_{x \to 0}\frac{-\cos x}{6}=\frac{-1}{6}$$    
\end{frame}



\end{document}