%\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{algcompatible}
\usepackage[section]{algorithm}
\usepackage{algorithmicx}
%\usepackage{algorithmic}
\usepackage{algpseudocode}

%\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{extarrows}
\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]


\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\renewcommand{\algorithmicprocedure}{\textbf{Procedure:}}
\renewcommand{\Procedure}{\textbf{Function:}}
\renewcommand{\EndProcedure}{\textbf{EndFunction:}}

\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[ Dr. Adib Makrooni ]{\large{ Dr. Adib Makrooni} 
\and %\\ \small{Supervisor: Dr. John Burns}
\\ 
 \includegraphics[scale=0.4]{Figures/lec14.jpg}}
%\date[June 2-4, 2016]{June 2-4, 2016}
%\institute[Uppsala University]{ }


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


\section{MA140}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Introduction}
\begin{frame}
\begin{itemize}
\item {\textbf {\textcolor{red}{Lectures:}}} 10 am, ENG-G018, Tuesday, Wednesday, Thursday
\item {\textbf {\textcolor{red}{Lecturer:}}} Dr. Adib Makrooni \\ \hspace{1.5cm} Office: ADB-2003 \\ email: mohammadadib.makrooni@nuigalway.ie
\item {\textbf {\textcolor{red}{Tutorials:}}} details will be announced later, normally they start two weeks after the first lecture
\item {\textbf {\textcolor{red}{Supporting centre:}}} SUMS, visit the homepage to see the timetables: http://www.maths.nuigalway.ie/sums/
\item {\textbf {\textcolor{red}{Text books:}}} Modern Engineering Mathematics by Glyn James,\\
Thomas' Calculus or any basic calculus text book 
\end{itemize}
\end{frame}
\subsection{Numbers}
\begin{frame}{Lecture 1}
In this lecture we review real and complex numbers.
\begin{itemize}
\item Natural Numbers=$\mathbb{N}=\{1,2,3,\cdots\}$\\
$1+3=4$, $4$ is a natural number or $4$ belongs to the set of natural numbers $\simeq 4\in \mathbb{N}$\\
\visible<2->{$$1-1=0, \quad 0\notin \mathbb{N}$$}
\visible<3->{\item Whole Numbers=$\mathbb{N}_{0}=\{0,1,2,\cdots\}$ so we see that $2-2=0\in \mathbb{N}_{0}$ but $1-3=-2\notin \mathbb{N}_{0}$\\
$\mathbb{N}$ is a subset of $\mathbb{N}_{0} \quad \longleftrightarrow \quad \mathbb{N}\subset \mathbb{N}_{0}$ \\}
\visible<4->{Remark: 
\begin{itemize}
\item $A\subset B$ it means for all elements in $A$ or for any element in $A$ like $x$ then $x$ is in $B \quad \longleftrightarrow \quad (\forall x\in A \quad \rightarrow x\in B)$\\
So $\forall$ means ''for all''
\item $A\not\subset B$ it means there exists an element in $A$ like $x$ which is not in 
$B \quad \longleftrightarrow \quad (\exists x\in A \quad .s.t \quad x\notin B)$ 
\end{itemize}}
\end{itemize}
\end{frame}

\begin{frame}

\begin{itemize}
\visible<1->{\item Integers=$\mathbb{Z}=\{\cdots,-2,-1,0,1,2,\cdots\}$\\
$1+(-4)=-3\in \mathbb{Z}$ and $1-5=-4\in \mathbb{Z}$ so the addition and subtraction of two integers is again an integer but what about the division?\\
$\displaystyle{ \frac{4}{2}}=2\in \mathbb{Z}$, $\displaystyle(\frac{4}{3})\notin \mathbb{Z}$}
\visible<2->{\item Rational Numbers=$\mathbb{Q}=\{\displaystyle{\frac{a}{b}} \quad | \quad a,b\in \mathbb{Z} \quad and \quad b\neq 0 \}$\\ for example $\displaystyle{\frac{-3}{4}}=-0.75000...$ or $\displaystyle{\frac{1}{3}}=-0.33333...$\\ But $\sqrt{2}\notin \mathbb{Q}$}
\end{itemize}
\end{frame}
\begin{frame}
\begin{itemize}
\item Real Numbers=$\mathbb{R}$, the set of real numbers includes all the rational numbers and numbers like $\sqrt{2}, \pi=3.14..., 0.11236$, these numbers are called irrational numbers so \\real numbers=(rational numbers)$\cup$(irrational numbers)\\
$\mathbb{R}=\mathbb{Q} \cup  (\mathbb{R}\backslash \mathbb{Q})$
\visible<2->{\begin{center}
			\includegraphics[scale=0.1]{Figures/lec11.jpg}
		\end{center}
		$$\mathbb{N}\subset \mathbb{N}_{0} \subset \mathbb{Z} \subset \mathbb{Q} \subset \mathbb{R}$$}
		\visible<3->{\item Complex Numbers=$\mathbb{C}$\\
		If $c\in \mathbb{C}$, we can write $c=a+ib, \quad a,b\in \mathbb{R} \quad and \quad i=\sqrt{-1}$  $$\mathbb{N}\subset \mathbb{N}_{0} \subset \mathbb{Z} \subset \mathbb{Q} \subset \mathbb{R} \subset \mathbb{C}$$}
		 
\end{itemize}
\end{frame}
\subsection{Functions}
\begin{frame}
We represent a function in one of the two ways:$$f:x\rightarrow y \quad or \quad y=f(x)$$
\begin{itemize}
\item $x$ is called the independent variable and $y$ is called the dependent variable.
\item when we write $y=f(x)$, $"x"$ is known as the \textit{argument} of the function.
\visible<2->{\item here $x$ is in the set $X$ and the set $X$ is called the \textit{domain} of the function
\item  and $y$ is in the set $Y$, the set $Y$ is called the \textit{codomain}}
\end{itemize} 
\visible<3->{\begin{definition}
A \textit{function} from a set $X$ to a set $Y$ is a rule that assigns a \textcolor{red}{unique} (single) element $f(x)\in Y$ to each element $x\in X$.
\end{definition}}

\end{frame}
\begin{frame}

{\textbf {\textcolor{red}{Note:}}} $f$ associates each value of $x$ in $X$ with exactly one value of $y$ in $Y$. It means we can not have different outputs for the same input.
\visible<2->{\begin{center}
			\includegraphics[scale=0.6]{Figures/lec12.jpg}
		\end{center}}
\end{frame}
\begin{frame}
\begin{itemize}

\item when $y=f(x)$, $y$ is said to be the \textit{image} of $x$ under $f$
\item the set of all images is called the \textit{image set} or \textit{range} of $f$
\end{itemize}


\visible<2->{{\textbf {\textcolor{red}{Note:}}} It is not necessary for all elements of the codomain set $Y$ to be images under $f$
\begin{center}
			\includegraphics[scale=0.6]{Figures/lec13.jpg}
		\end{center}}

\end{frame}
\begin{frame}
\begin{example}
Identify the domain, codomain and range of 
\begin{itemize}
\item[(a)] $f(x)=3x^{2}+1$
\item[(b)] $f(x)=\sqrt{(x+4)(3-x)}$
\end{itemize}
\end{example}
\visible<2->{{\textcolor{red}{solution (a):}}\\
{\textcolor{blue}{$f(x)$ can be evaluated for all $x\in \mathbb{R}$, so domain=$ \mathbb{R}$.\\ The lowest value $f(x)$ can take is $1$ (when $x=0$) so range=$[1,\infty]$. \\ We could write this as $\{y \enspace | \enspace  y\geq 1 \enspace , \enspace y\in \mathbb{R}\}$.\\We could take the codomain as $\mathbb{R}$ as it contains the range.}}\\}

\end{frame}
\begin{frame}

{\textcolor{red}{solution (b):}}\\
{\textcolor{blue}{The domain is $[-4,3]$, outside this range the function is not real valued i.e. it involves $\sqrt{-1}$.\\ The function takes value $0$ at $x=-4$ and $x=3$ and takes $7/2$, its highest value at $x=-1/2$. Therefore its range is $[0,7/2]$. we can take the codomain to be $\mathbb{R}$ (as it contains the range)}}

\end{frame}

\subsection{Polynomials}
\begin{frame}
A polynomial is a function of the form:
$$y=a_{n}x^{n}+a_{n-1}x^{n-1}+\cdots+a_{1}x+a_{0}$$
where $a_{n},a_{n-1},\cdots,a_{0}$ are constants.\\
These constants are called the \textit{coefficients } of the polynomial. \\
The number $n$ is the degree of the polynomial.
\visible<2->{\begin{example}
$y=x,$ is a \textit{linear} polynomial
\end{example}}
\visible<3->{\begin{center}
			\includegraphics[scale=0.2]{Figures/lec15.png}
		\end{center}}
\end{frame}
\begin{frame}
\begin{example}
$y=x^{2}-4x+3$ is a \textit{quadratic} polynomial.
\end{example}
\visible<2->{\begin{center}
			\includegraphics[scale=0.3]{Figures/lec16.png}
		\end{center}}
		\end{frame}
		\begin{frame}
\begin{example}
$y=x^{3}-4x^{2}+x+6$ is a \textit{cubic} polynomial.
\end{example}
\visible<2->{\begin{center}
			\includegraphics[scale=0.3]{Figures/lec17.png}
		\end{center}}
\end{frame}
\begin{frame}

{\textbf {\textcolor{red}{General facts on polynomial sketching:}}}\\
A polynomial of degree $n$ has up to $n-1$ bends.
\visible<2->{\begin{example}
a typical fourth degree polynomial has $3$ bends. for example $y=x^{4}-2x^{2}+x$

\end{example} 
\begin{center}
			\includegraphics[scale=0.3]{Figures/lec18.png}
		\end{center}}
		\end{frame}
		\begin{frame}
		\begin{example}
the fourth degree polynomial $y=x^{4}-2x$ has only one bend.
\end{example} 
\begin{center}
			\includegraphics[scale=0.3]{Figures/lec19.png}
		\end{center}
		\end{frame}
		\begin{frame}
		
{\textbf {\textcolor{red}{Find the intercepts:}}}\\
The $y-$intercept can be found by letting $x=0$.\\
The $x-$intercepts are the roots (or zeros).\\
{\textbf {\textcolor{red}{Note:}}} you do not have to use the same scale on the $x$ and $y$ axis.

\visible<2->{\begin{example}
$y=x^{3}-4x^{2}+x+6$
\end{example}}
{\visible<3->{\textcolor{blue}{$x=0 \enspace \Rightarrow \enspace y=6$ ($y-$intercept)}\\
\visible<4->{(The constant coefficient=$-$ product of the roots if the coefficient of the highest power=$1$)\\
By trial roots are $x=-1,2,3$}}}
\end{frame}
\begin{frame}
\begin{center}
			\includegraphics[scale=0.3]{Figures/lec20.png}
		\end{center}
\end{frame}
\subsection{Rational Functions}
\begin{frame}
\begin{definition}
Rational functions have the general form $$f(x)=\frac{p(x)}{q(x)}$$
where $p(x)$ and $q(x)$ are polynomials.
\end{definition}
\begin{itemize}
\item \textbf{IF} degree of $p(x) <$ degree of $q(x)$, then $f(x)$ is a strictly proper rational function. 
\item \textbf{IF} degree of $p(x) =$ degree of $q(x)$, then $f(x)$ is a proper rational function. 
\item \textbf{IF} degree of $p(x) >$ degree of $q(x)$, then $f(x)$ is an improper rational function. 
\end{itemize}

\end{frame}
\begin{frame}
An improper or proper rational function can be expressed in terms of a strictly proper rational function
\begin{example}
Express $f(x)=\displaystyle{\frac{3x^{4}+2x^{3}-5x^{2}+6x-7}{x^{2}-2x+3}}$ in terms of a strictly proper rational function
\end{example}
\visible<2->{{\textcolor{blue}{$f(x)=3x^{2}+8x+2-\displaystyle{\frac{14x+13}{x^{2}-2x+3}}$}}}
\end{frame}
\begin{frame}

{\textbf {\textcolor{red}{1. Linear factors to the power of $1.$}}} 
\begin{example}
Express $\displaystyle{\frac{3x}{(x-1)(x+2)}}$ in partial fractions.
\end{example}

{\textcolor{blue}{\visible<2->{$\hspace{2.7cm}\displaystyle{\frac{3x}{(x-1)(x+2)}}=\displaystyle{\frac{A}{x-1}}+\displaystyle{\frac{B}{x+2}}$} \visible<3->{$$\hspace{2.6cm}=\displaystyle{\frac{A(x+2)+B(x-1)}{(x-1)(x+2)}}$$}\\\visible<4->{$\hspace{5.4cm}=\displaystyle{\frac{x[A+B]+[2A-B]}{(x-1)(x+2)}}$}}}
\end{frame}
\begin{frame}

{\textcolor{blue}{Compare $x[3]+[0]$ with $x[A+B]+[2A-B]$, so $$\left\{
  \begin{array}{rcr}
    A+B & = & 3 \\
    2A-B & = & 0 \\
  \end{array}
\right.$$
\visible<2->{So $3=3A \enspace \Rightarrow A=1$}\\ \visible<3->{From first equation $3=1+B \enspace \Rightarrow B=2$\\ so $$\displaystyle{\frac{3x}{(x-1)(x+2)}}=\displaystyle{\frac{1}{x-1}}+\displaystyle{\frac{2}{x+2}}$$ }}}
\visible<4->{\textcolor{red}{Exercise:}\\
Find the constants $A, B$ and $C$, so that:
$$\frac{2x+1}{(x-2)(x+1)(x-3)}=\frac{A}{x-2}+\frac{B}{x+1}+\frac{C}{x-3}$$}
\end{frame}
\begin{frame}

{\textbf {\textcolor{red}{2. Linear Factors to Powers Greater than $1$ (i.e. repeated linear factors):}}}\\
If $(x-\alpha)^{k}$ appears in the denominator, it will give rise to the following terms:$$\frac{A_{1}}{x-\alpha}+\frac{A_{2}}{(x-\alpha)^{2}}+\cdots+\frac{A_{k}}{(x-\alpha)^{k}}$$
\visible<2->{\textcolor{red}{Exercise:}\\
Show from the start $$\frac{3x+1}{(x-1)^{2}(x+2)}=\frac{5/9}{x-1}+\frac{4/3}{(x-1)^{2}}+\frac{-5/9}{x+2}$$} 
\end{frame}
\begin{frame}

{\textbf {\textcolor{red}{3. Irreducible quadratic factors:}}}\\
Irreducible quadratic factors can not be factorised using real numbers e.g. $x^{2}+x+1$\\
An irreducible quadratic $ax^{2}+bx+c$ gives rise to partial fractions of the form $$\frac{Ax+B}{ax^{2}+bx+c}$$
\begin{example}
Express the following in partial fractions:$$\frac{5x}{(x^{2}+x+1)(x-2)}$$
\end{example}
\end{frame}
\begin{frame}

{\textcolor{blue}{\visible<2->{$\displaystyle{\frac{5x}{(x^{2}+x+1)(x-2)}}=\displaystyle{\frac{Ax+B}{x^{2}+x+1}}+\displaystyle{\frac{C}{x-2}}$}  \visible<3->{$$\hspace{1cm}=\frac{(Ax+B)(x-2)+C(x^{2}+x+1)}{(x^{2}+x+1)(x-2)}$$} \visible<4->{Therefore: $5x=(Ax+B)(x-2)+C(x^{2}+x+1)$} \\ \visible<5->{Now let $x=2$ then $$5(2)=0+C(2^{2}+2+1)$$ $\hspace{3.37cm} \Rightarrow \quad 10=C(7)$ \\ $\hspace{3.37cm} \Rightarrow \quad C=10/7$} \\
\visible<6->{constant term on the RHS=$0$ so $$0=-2B+C$$ $\hspace{4.2cm} \Rightarrow 2B=C$ \\ $\hspace{4.2cm} \Rightarrow B=C/2=5/7$} }}

\end{frame}

\begin{frame}

{\textcolor{blue}{The coefficient of $x^{2}=0$ so $0=A+C \quad \Rightarrow \quad A=-C=-10/7$, so $$\frac{5x}{(x^{2}+x+1)(x-2)}=\frac{\frac{-10}{7}x+\frac{5}{7}}{x^{2}+x+1}+\frac{\frac{10}{7}}{x-2}$$}}
\end{frame}
\begin{frame}

{\textbf {\textcolor{red}{4. Irreducible quadratic factors to powers greater than $1$:}}}\\
If $ax^{2}+bx+c$ is an irreducible quadratic factor, then $(ax^{2}+bx+c)^{k}$ in the denominator gives rise to $$\frac{A_{1}x+B_{1}}{ax^{2}+bx+c}+\frac{A_{2}x+B_{2}}{(ax^{2}+bx+c)^{2}}+\cdots+\frac{A_{k}x+B_{k}}{(ax^{2}+bx+c)^{k}}$$ 
\end{frame}


\subsection{Limit}
\begin{frame}
\begin{example}
What is the difference between these two functions:
$$\frac{x^{2}-1}{x-1} \quad and \quad x+1$$
\end{example}
{\textcolor{blue}{\visible<2->{we simplify $\frac{x^{2}-1}{x-1}$ $$\frac{x^{2}-1}{x-1}=\frac{(x-1)(x+1)}{x-1}$$} \visible<4->{now the functions seem to be equal, the only difference between them is that tha rational function is undefined at $x=1$, so} $$\visible<3->{\frac{x^{2}-1}{x-1}=x+1 \quad} \visible<5->{for \quad x\neq 1}$$    }}
\end{frame}
\begin{frame}
\visible<2->{\begin{example}
How does the function $$f(x)=\frac{x^{2}-1}{x-1} $$ behave near $x=1$
\end{example}}
{\textcolor{blue}{We have seen that the function $f$ equals $x+1$ except at $x=1$, so the graph of $f$ is thus the line $x+1$ with the point $(1,2)$ removed.}}
\begin{center}
			\includegraphics[scale=0.2]{Figures/lec27.pdf}
		\end{center}
\end{frame}
\begin{frame}
\begin{center}
			\includegraphics[scale=0.3]{Figures/lec29.pdf}
		\end{center}
		\visible<2->{$$\lim_{x \to 1} f(x)=\lim_{x \to 1} \frac{x^{2}-1}{x-1}=2$$}
\end{frame}
\begin{frame}
\begin{center}
			\includegraphics[scale=0.4]{Figures/lec30.pdf}
		\end{center}
\end{frame}
\begin{frame}{Finding the Limits}
\visible<3->{Sometimes $\lim_{x \to a}f(x)$ can be evaluated by calculating $f(a)$. This holds, for example,
whenever $f(x)$ is an algebraic combination of polynomials and trigonometric functions
for which $f(a)$ is defined.}
\begin{itemize}
\visible<4->{\item $\lim_{x \to 3} x=3$ 
\item $\lim_{x \to 3} 5=5$} 
\visible<2->{\item $\lim_{x \to 3} (5x-2)=13$} 
\end{itemize}
\visible<5->{{\textbf {\textcolor{red}{Note:}}} The Identity and Constant Functions Have Limits at Every Point.}
\end{frame}
\begin{frame}{The Limit Laws}
 If $L, M, a $ and $k$ are real numbers and $$\lim_{x \to a} f(x)=L \quad and \quad  \lim_{x \to a} g(x)=M$$
then:
\begin{itemize}
\item \textit{Sum Rule}: The limit of the sum of two functions is the sum of their limits.{\textcolor{blue}{$$\lim_{x \to a} [f(x)+g(x)]=\lim_{x \to a} f(x)+\lim_{x \to a} g(x)=L+M$$}}
\item \textit{Difference Rule:} The limit of the difference of two functions is the difference of their limits. {\textcolor{blue}{$$\lim_{x \to a} [f(x)-g(x)]=\lim_{x \to a} f(x)-\lim_{x \to a} g(x)=L-M$$}}
\end{itemize}
\end{frame}
\begin{frame}
\begin{itemize}
\item \textit{Product Rule:} The limit of a product of two functions is the product of their limits. {\textcolor{blue}{$$\lim_{x \to a} [f(x) \cdot g(x)]=(\lim_{x \to a} f(x))\cdot (\lim_{x \to a} g(x))=L\cdot M$$}}
\item \textit{Constant Multiple Rule:} The limit of a constant times a function is the constant times the limit of the function. {\textcolor{blue}{$$\lim_{x \to a} (k\cdot f(x)) =k\cdot (\lim_{x \to a} f(x)=k\cdot L$$}}
\item \textit{Quotient Rule:} The limit of a quotient of two functions is the quotient of their limits, provided the limit of the denominator is not zero.{\textcolor{blue}{$$\lim_{x \to a} \frac{f(x)}{g(x)}=\frac{\lim_{x \to a} f(x)}{\lim_{x \to a} g(x)}=\frac{L}{M}, \quad M\neq 0$$}}
\end{itemize}

\end{frame}
\begin{frame}
\begin{itemize}
\item \textit{Power Rule:} If $r$ and $s$ are integers with no common factor and $s\neq 0,$ then {\textcolor{blue}{$$\lim_{x \to a} (f(x))^{r/s}=(\lim_{x \to a} f(x))^{r/s}=L^{r/s}$$}} 
\end{itemize}
\visible<2->{\begin{example}
\begin{itemize}
\item $\lim_{x \to 1} (x^{3}+4x^{2}-3)=\lim_{x \to 1}x^{3}+\lim_{x \to 1} 4x^{2}-\lim_{x \to 1}3=1+4-3=2$
\end{itemize}
\end{example}}
\visible<3->{\begin{example}
\begin{itemize}
\item $\displaystyle{\lim_{x \to 1} \frac{x^{4}+x^{2}-1}{x^{2}+5}=\frac{\lim_{x \to 1} (x^{4}+x^{2}-1) }{\lim_{x \to 1} (x^{2}+5)}=\frac{1}{6}}$
\end{itemize}
\end{example}}
\visible<4->{\begin{example}
\begin{itemize}
\item $\lim_{x \to 1} \sqrt{4x^{2}-3}=\sqrt{\lim_{x \to 1} (4x^{2}-3)}=1$
\end{itemize}
\end{example}}

\end{frame}
\begin{frame}
\begin{example}
Evaluate: $$\lim_{x \to 1} \frac{x^{2}+x-2}{x^{2}-x}$$
\end{example}
\visible<2->{ {\textcolor{blue}{$$\lim_{x \to 1} \frac{x^{2}+x-2}{x^{2}-x}=\lim_{x \to 1} \frac{(x-1)(x+2)}{x(x-1)}=\lim_{x \to 1} \frac{x+2}{x}=3$$}} }
 \visible<3->{{\textbf {\textcolor{red}{Note:}}} If the denominator is zero, canceling common factors in the numerator and denominator may reduce the fraction to one whose denominator is no longer zero}
\end{frame}
\begin{frame}
\begin{example}
$$\lim_{x \to 2} (\frac{1}{2}-\frac{1}{x})\frac{1}{x-2}$$
\end{example}
$$\lim_{x \to 2} (\frac{1}{2}-\frac{1}{x})\frac{1}{x-2}=\lim_{x \to 2} \frac{x-2}{2x} \cdot \frac{1}{x-2}$$
$$\hspace{3.5cm} =\lim_{x \to 2} \frac{1}{2x}=\frac{1}{2(2)}=\frac{1}{4}$$
\end{frame}
\begin{frame}
\begin{example}
Evaluate $$\lim_{x\to 0} \frac{\sqrt{1+x^{2}}-1}{x^{2}}$$
\end{example}
{\textcolor{blue}{\visible<2->{$$\lim_{x\to 0} \frac{\sqrt{1+x^{2}}-1}{x^{2}}=\lim_{x\to 0} \frac{(\sqrt{1+x^{2}}-1)(\sqrt{1+x^{2}}+1)}{x^{2}(\sqrt{1+x^{2}}+1)}$$}\\
\visible<3->{$\hspace{1cm} \displaystyle{ \lim_{x\to 0} \frac{(1+x^{2}-1)}{x^{2}(\sqrt{1+x^{2}}+1)}=\lim_{x\to 0} \frac{(x^{2})}{x^{2}(\sqrt{1+x^{2}}+1)}}$}
\visible<4->{$$\lim_{x\to 0} \frac{1}{\sqrt{1+x^{2}}+1}=\frac{1}{\sqrt{1}+1}=1/2$$}}}
\end{frame}
\begin{frame}

\begin{theorem}{Sandwich Theorem}
Suppose that $g(x)\leq f(x) \leq h(x)$ for all $x$ in some open interval containing $c$, except possibly at $c$ itself. Suppose also that $$\lim_{x \to c} g(x)=\lim_{x \to c} h(x)=L$$
Then $\lim_{x \to c} f(x)=L$
\end{theorem}
\visible<2->{\begin{center}
			\includegraphics[scale=0.2]{Figures/lec32.pdf}
		\end{center}}
		\end{frame}
		\begin{frame}
\begin{example}
Given $$1-\frac{x^{2}}{4}\leq u(x) \leq 1+\frac{x^{2}}{2} \quad for all \quad x\neq 0$$
Find the $\lim_{x \to 0} u(x)$, no matter how complicated $u$ is.
\end{example}
\visible<2->{Since $$\lim_{x \to 0} (1-\frac{x^{2}}{4})=1 \quad and \quad \lim_{x \to 0} (1+\frac{x^{2}}{2})=1$$ the Sandwich theorem implies that $$\lim_{x \to 0} u(x)=1$$}
\end{frame}
\begin{frame}
\begin{center}
			\includegraphics[scale=0.5]{Figures/lec31.png}
		\end{center}
\end{frame}
\begin{frame}
\begin{example}
An important limit: $$\lim_{x\to 0} \frac{\sin x}{x}=1$$
\end{example}

\begin{center}
			\includegraphics[scale=0.25]{Figures/lec23.pdf}
		\end{center}
\end{frame}
\begin{frame}
Area of $\triangle OAP < $ Area of the sector $OAP < $ Area of $\triangle OAT$\\ 
Area of $\triangle OAP=\frac{1}{2} \sin \theta $\\
Area of the sector $OAP=\frac{1}{2}r^{2}\theta=\frac{\theta}{2}$\\
Area of $\triangle OAT=\frac{1}{2} \tan \theta $ 
\visible<2->{$$\frac{1}{2}\sin \theta < \frac{1}{2} \theta < \frac{1}{2} \tan \theta$$}
\visible<3->{$$1 < \frac{\theta}{\sin \theta} < \frac{1}{\cos \theta} $$}
\visible<4->{Taking the reciprocals reverses the inequalities so:
$$1 > \frac{\sin \theta}{\theta} > \cos \theta $$}
\visible<5->{Since $\lim_{\theta \to 0}\cos \theta=\lim_{\theta \to 0} 1=1$, The Sandwich theorem gives:
$$\lim_{\theta \to 0} \frac{\sin \theta}{\theta}=1$$}


\end{frame}



\begin{frame}
\begin{example}
$$\lim_{x \to 0} \frac{\tan 3x}{\sin 2x}$$
\end{example}
\visible<2->{$$\hspace{-3cm} \lim_{x \to 0} \frac{\tan 3x}{\sin 2x}=\lim_{x \to 0} \frac{\sin 3x}{\cos 3x} \cdot \frac{1}{\sin 2x}$$}
\visible<3->{$$=\lim_{x \to 0} \sin 3x \cdot \frac{1}{\cos 3x} \cdot \frac{1}{\sin 2x}$$}
\visible<4->{$$\hspace{1cm} =\lim_{x \to 0} \frac{\sin 3x}{3x} \cdot \frac{1}{\cos 3x} \cdot \frac{2x}{\sin 2x} \cdot \frac{3x}{2x}$$}
\visible<5->{$$=(\lim_{x \to 0} \frac{\sin 3x}{3x})(\lim_{x \to 0} \frac{1}{\cos 3x})(\lim_{x \to 0} \frac{2x}{\sin 2x})(\lim_{x \to 0} \frac{3x}{2x})$$
$$=(1)(1)(1)(3/2)=3/2$$}
\end{frame}

\begin{frame}
\begin{example}
$$\lim_{x \to 0} \frac{1-\cos x}{x^{2}}$$
\end{example}
\visible<2->{Note: $\cos (2A)=1-2\sin^{2}(A)$\\}
\visible<3->{Let: $A=x/2$, then 
$\Rightarrow \quad \cos x=1-2\sin^{2} x/2,$} \visible<4->{so $$\hspace{-3cm} \lim_{x \to 0} \frac{1-\cos x}{x^{2}}
=\lim_{x \to 0} \frac{1-[1-2\sin^{2}(x/2)]}{x^{2}}$$}
\visible<5->{$$\hspace{2cm} =\lim_{x \to 0} \frac{2\sin^{2}(x/2)}{x^{2}}=\lim_{x \to 0} 2\frac{\sin x/2}{x/2} \cdot \frac{\sin x/2}{x/2} \cdot (1/2)(1/2)$$}
\visible<6->{$$=\lim_{x \to 0} 2\frac{\sin x/2}{x/2} \cdot \frac{\sin x/2}{x/2} \cdot (1/2)(1/2) $$}
\visible<7->{$$=\lim_{x \to 0} \frac{\sin x/2}{x/2} \cdot \lim_{x \to 0} \frac{\sin x/2}{x/2} \cdot 1/2$$
$\hspace{3cm} =(1)(1)(1/2)=1/2$}
\end{frame}

\begin{frame}

{\textbf {\textcolor{red}{Useful approximation:}}}\\
$1.$ when $x \to 0$ then $\cos x \quad \approx \quad 1-\frac{x^{2}}{2}$\\
$2.$ when $x \to 0$ then $\sin x \quad \approx \quad x-\frac{x^{3}}{6}$\\
\visible<2->{\begin{example}
$$\lim_{x \to 0} \frac{\sin x-x}{x^{3}}$$
\end{example}}
\visible<3->{$$\lim_{x \to 0} \frac{\sin x-x}{x^{3}}=\lim_{x \to 0} \frac{[x-\frac{x^{3}}{6}]-x}{x^{3}}$$}
\visible<4->{$$\hspace{2cm} =\lim_{x \to 0} \frac{-\frac{x^{3}}{6}}{x^{3}}=-1/6$$}
\end{frame}
\begin{frame}
\visible<2->{a lot of limit analysis ends with $\infty$, in these cases we say that the limit does not exist.}  \visible<5->{$$\frac{infinity}{constant\neq 0} \quad or \quad \frac{constant\neq 0}{0} \Rightarrow \infty$$}
\visible<3->{\begin{example}
$\lim_{x \to 0} 1/x=1/0=\infty$
\visible<4->{\begin{center}
			\includegraphics[scale=0.5]{Figures/lec33.png}
		\end{center}}
\end{example}}
\end{frame}
\begin{frame}
\begin{example}
If $f(x)=\frac{x+1}{x^{3}}$, find $\lim_{x \to 0} f(x)$
\end{example}
$f(x)$ tends to $\frac{constant \approx 1}{\approx 0}$\\
so $\lim_{x \to 0} f(x)=\infty$, it does not exist. \\
\visible<2->{{\textbf {\textcolor{red}{Note:}}}\\
$$\frac{constant \neq 0}{infinity} \quad or \quad \frac{0}{constant\neq 0} \quad \Rightarrow 0$$}
\end{frame}
\begin{frame}

one can think of sequences as values of continuous functions at $x=1,2,3,\cdots$\\
for example $f(x)=x^{2}+1$, $a_{n}=n^{2}+1$\\
$\{a_{n}\}=\{2,5,10,17,\cdots\}$\\
we can use our limit theory on continuous functions to decide if a sequence has a limit.
\end{frame}
\begin{frame}
\begin{example}
Does $\{a_{n}\}$ with $a_{n}=\frac{n^{2}+1}{n+1}$ have a limit.\\
$\lim_{n \to \infty} \frac{n^{2}+1}{n+1}=\lim_{n \to \infty} \frac{n+\frac{1}{n}}{1+\frac{1}{n}}=\infty$
\end{example}
$\{a_{n}\}$ has no limit if diverges to infinity\\

\end{frame}

\begin{frame}
\begin{center}
			\includegraphics[scale=0.5]{Figures/lec22.pdf}
		\end{center}
		\begin{itemize}
		%\item $x$ is a variable
		%\item $f(x)$ is a function
		\item $a$ is a fixed number which $x$ can take i.a. $x=a$
		\item $\delta$ and $\epsilon$ are small positive numbers i.e. $\delta > 0$
		%\item $\epsilon$ is a small positive number
		\item $|x-a| < \delta$ the distance from $x$ to $a$ is less than $\delta$
		\item $f(x)$ approaches a number $l$ as $x$ approaches $a$
		\end{itemize}
\end{frame}

\begin{frame}
So if I am able to find a $\delta$ given an $\epsilon$ then (in an informal way) this means:\\
that we can make the value of $f(x)$ as close as we like to $L$ by taking $x$ sufficiently close to $a$.\\
\textbf{Formally}:\\
A function $f(x)$ is said to approach a limit $l$ as $x$ approaches the value $a$, if given any small positive number $\epsilon$, it is possible to find a positive number $\delta$, such that for any $x$:$$|x-a|<\delta \quad \Rightarrow \quad |f(x)-l|<\epsilon $$ 
we write $$\lim_{x\to a} f(x)=l$$  
\end{frame}
\begin{frame}
\begin{example}
Prove formally that: $$\lim_{x\to 3} (4x-5)=7$$
\end{example}
Given $\epsilon$, then $$|f(x)-l|<\epsilon \Leftrightarrow |(4x-5)-7|<\epsilon$$ \visible<2->{$$\Leftrightarrow |4x-5-7|<\epsilon$$}  \visible<3->{$$\Leftrightarrow |4x-12|<\epsilon$$}  \visible<4->{$$\Leftrightarrow 4|x-3|<\epsilon$$}  \visible<5->{$$\Leftrightarrow |x-3|<\epsilon/4$$}
\visible<6->{so if we pick $\delta=\epsilon/4$ then from above we see that  if $|x-3|<\delta=\epsilon/4$ implies  $\delta$ so $|(4x-5)-7|<\epsilon$.} 
\end{frame}
\begin{frame}
limits have practical uses.
\begin{example}
Using limits find the slope of the tangent to the curve $y=x^{3}$ at $x=4$
\end{example}
\begin{center}
			\includegraphics[scale=0.25]{Figures/lec25.png}
		\end{center}
		
\end{frame}
\begin{frame}
$(4,4^{3})$ is a point on $y=x^{3}$, $(4th,(4th)^{3})$ is a point on $y=x^{3}.$\\
The slope of a line through the points $(x_{1},y_{1})$ and $(x_{2},y_{2})$ is $$\frac{y_{2}-y_{1}}{x_{2}-x_{1}}$$ so the slope through the two points above is $\frac{(4+h)^{3}-4^{3}}{(4+h)-4}=\frac{4^{3}+3h4^{2}+3h^{2}4+h^{3}-4^{3}}{h}$ \\
$\frac{48h+12h^{2}+h^{3}}{h}=48+12h+h^{2}$\\ 
 to find the slope pf the tangent at $(4,4^{3})$, we find the limit as $h\rightarrow 0$ of the above i.e. $\lim_{h \to 0} (48+12h+h^{2})=48$		
\end{frame}
\begin{frame}
Another practical use of limits\\
\begin{example}
find the area between the x-axis and the curve $y=x^{3}$ between $x=0$ and $x=1$
\end{example}
\end{frame}
\begin{frame}{Exercises}
\begin{itemize}
\item[(1)] $$\lim_{x \to 2} \frac{x^{3}-8}{x^{2}-4}$$
\item[(2)] $$\lim_{x \to 1} \frac{x^{2}-1}{(\sqrt{x}-1)(x+2)}$$
\item[(3)] $$\lim_{x \to 0} \frac{\sin^{2}x}{\sin 2x \cdot \tan 4x}$$
\item[(4)] $$\lim_{x \to 0} x \cos \frac{1}{x^{2}}$$
\end{itemize}

\end{frame}

\begin{frame}
\begin{example}
Prove formally that $$\lim_{x \to 7} \frac{-x^{2}+9x-14}{x-7}=-5$$
\end{example}
\visible<2->{Given $\epsilon$, then $$|f(x)-l|<\epsilon \Leftrightarrow  |\frac{-x^{2}+9x-14}{x-7}-(-5)|<\epsilon$$
$$\Leftrightarrow |\frac{-(x-7)(x-2)}{x-7}+5|<\epsilon$$
$$\Leftrightarrow |-(x-2)+5|<\epsilon$$
$$\Leftrightarrow |-x+7|<\epsilon \Leftrightarrow |x-7|<\epsilon$$
so we should pick $\epsilon = \delta$}
\end{frame}
\begin{frame}
\begin{itemize}
\item $|x-a|<\delta$ is the same as $a-\delta < x < a+\delta$ or $-\delta < x-a < \delta  $
\begin{example}
solve $$|x-7|<3$$
\end{example}
$$-3 < x-7 < 3 \Leftrightarrow 7-3 < x < 7+3 \Leftrightarrow 4 < x < 10$$
\item For $x \in \mathbb{R}$: $$ |x|= \left\{
\begin{array}{ll}
      x, & x \geq 0 \\
      -x, & x<0 \\
      
\end{array} 
\right.$$
\item When multiplying an inequality by a negative number flip the inequality sign.
\end{itemize}
\end{frame}
\begin{frame}{One-sided limits}

\begin{example}
Let $$ f(x)= \left\{
\begin{array}{ll}
      3-x, & x<2 \\
      \frac{x}{2}+1, & x>2 \\
      
\end{array} 
\right.$$
\end{example}
\begin{center}
			\includegraphics[scale=0.25]{Figures/lec44.pdf}
		\end{center}
		\end{frame}
		\begin{frame}
		
{\textbf {\textcolor{red}{Note:}}} \begin{itemize}
\item The function approaches $1$ as $x$ approaches $2$ from the left.
\item The function approaches $2$ as $x$ approaches $2$ from the right. 
\end{itemize}
{\textcolor{red}{Notation:}}
$$\lim_{x \to 2^{-}} f(x)=1 \quad \lim_{x \to 2^{+}} f(x)=2$$
\end{frame}

\begin{frame}
These one-sided limits can be defined formally using the $\epsilon / \delta$ notation.\\
{\textcolor{red}{Clearly:}} $\lim_{x \to 2} f(x)$ above does not exist.
\begin{theorem}
A function $f(x)$ has a limit as $x$ approaches $a$ if and only if it has left-handed and right-handed limits there and these one-sided limits are equal.
$$\lim_{x \to a} f(x)=l \quad \Leftrightarrow  \quad \lim_{x \to a^{-}} f(x)=l \quad and \quad \lim_{x \to a^{+}} f(x)=l$$
\end{theorem}
\begin{example}
$$\lim_{x \to 0^{+}}\sqrt{x}=0$$
\end{example}
\end{frame}
\begin{frame}{Limits at Infinity }

\begin{example}
Find the limit of $y=\frac{1}{x}$ as $x \rightarrow \pm \infty$
\end{example}
\begin{center}
			\includegraphics[scale=0.25]{Figures/lec45.pdf}
		\end{center}  
\end{frame}

\begin{frame}{Asymptotes}

\begin{example}
$$\lim_{x \to \infty} \frac{x+3}{x+2}$$
\end{example}
\visible<2->{When dealing with limits at infinity of rational functions it can be useful to divide top and bottom by the highest power of the bottom. $$\lim_{x \to \infty} \frac{x+3}{x+2}=\lim_{x \to \infty} \frac{x(1+\frac{3}{x})}{x(1+\frac{2}{x})}=\lim_{x \to \infty} \frac{(1+\frac{3}{x})}{(1+\frac{2}{x})}=1$$
this exercise tells us that when $x$ get very big, the function tends to 1.\\}
 
\end{frame}
\begin{frame}
We say that the function $\displaystyle {\frac{x+3}{x+2}}$ has a \textit{horizontal asymptote} $y=1$
\begin{definition}
A line $y=b$ is a horizontal asymptote of the graph of a function $y=f(x)$ if either $$\lim_{x \to \infty} f(x)=b \quad or \quad \lim_{x \to -\infty} f(x)=b$$
\end{definition} 


\end{frame}
\begin{frame}
\begin{example}
Find the horizontal asymptote of $f(x)=\frac{5x^{2}+8x-3}{3x^{2}+2}$
\end{example}
\visible<2->{$$\lim_{x \to \infty} \frac{5x^{2}+8x-3}{3x^{2}+2} = \lim_{x \to \infty} \frac{5+(8/x)-(3/x^{2})}{3+(2/x^{2})}=\frac{5+0-0}{3+0}=\frac{5}{3}$$}
\visible<3->{\begin{center}
			\includegraphics[scale=0.25]{Figures/lec46.pdf}
		\end{center}}  
\end{frame}
\begin{frame}
Note that the denominator of $\displaystyle {\frac{x+3}{x+2}}$ is zero when $x=-2$.
$$\lim_{x \to -2^{-}} \frac{x+3}{x+2}=-\infty \quad \lim_{x \to -2^{+}} \frac{x+3}{x+2}=\infty$$
\visible<2->{We say that the function $\displaystyle {\frac{x+3}{x+2}}$ has a \textit{vertical asymptote} 
$x=-2$}
\visible<3->{\begin{definition}
A line $x=a$ is a vertical asymptote of the graph of a function $y=f(x)$ if either $$\lim_{x \to a^{+}} f(x)=\infty \quad or \quad \lim_{x \to a^{-}} f(x)=\infty$$
\end{definition}}

\end{frame}
\begin{frame}
\begin{center}
			\includegraphics[scale=0.25]{Figures/lec40.pdf}
		\end{center}  
\end{frame}
\begin{frame}
\begin{example}
Find all asymptotes of $f(x)$ and plot $$f(x)=\frac{x^{2}-3}{2x-4}$$ \visible<2->{writing this as a strictly proper rational function $$f(x)=\frac{x}{2}+1+\frac{1}{2x-4}$$} \visible<3->{ so, when $x$ gets very big $f(x)$ tends to $\frac{x}{2}+1$.\\
Also when $x$ gets very negative, $f(x)$ tends to $\frac{x}{2}+1$.\\}
\visible<4->{when $2x-4=0$ or $x=2$, we have a vertical asymptote.\\
the zeros of the function are: $$x^{2}-3=0 \Rightarrow x=\pm 3$$}
\end{example}
\end{frame}
\begin{frame}
\begin{center}
			\includegraphics[scale=0.3]{Figures/lec41.pdf}
		\end{center}  
\end{frame}
\begin{frame}
\begin{example}
Find the horizontal and vertical asymptotes of the graph of $$f(x)=-\frac{8}{x^{2}-4}$$
\end{example}
\visible<2->{First, since $\lim_{x \to \infty} f(x)=0$, the line $y=0$ is a horizontal asymptote.}
\visible<3->{Also, since $$\lim_{x \to 2^{+}} f(x)=-\infty \quad and \quad \lim_{x \to 2^{-}} f(x)=\infty$$ 
the line $x=2$ is a vertical asymptote both from the right and from the left.}
\end{frame}
\begin{frame}
\begin{center}
			\includegraphics[scale=0.3]{Figures/lec47.pdf}
		\end{center}
\end{frame}
\begin{frame}{Exercises}
\begin{itemize}
\item $$\lim_{x \to 2^{-}}\frac{x-3}{x^{2}-4}$$
\item $$\lim_{x \to 2^{-}} \frac{x-3}{x^{2}-4}$$
\item $$\lim_{x \to 2} \frac{2-x}{(x-2)^{3}}$$

\end{itemize}
\end{frame}
\begin{frame}
A continuous function is one with an "unbroken" graph
\visible<2->{\begin{definition}
A function $f$ is continuous at $x=a$ if:
\begin{itemize}
\item the point $a$ is in the domain of $f$
\item $f(x)$ has a limit as $x \to a$
\item $\lim_{x \to a} f(x)=f(a)$
\end{itemize}
\end{definition}
If $f$ is continuous at every point in its domain, we say $f$ is continuous.\\
{\textbf {\textcolor{red}{Note:}}}
Lots of functions are continuous e.g. polynomials, trigonometric (not $\tan$), $|x|$ and so on.}  
\end{frame}
\begin{frame}
Here are some examples of discontinuity.
\begin{center}
			\includegraphics[scale=0.4]{Figures/lec48.pdf}
		\end{center}
\end{frame}
\begin{frame}
\begin{example}
Consider the function $$f(x)= \left\{
\begin{array}{ll}
      x+1, & x<2 \\
      bx^{2}, & x\geqslant 2 \\
      
\end{array} 
\right.$$
For what values of $b$ is $f$ continuous at $x=2.$
\end{example}
\visible<2->{We have $$\lim_{x \to 2^{-}} f(x)=2+1=3$$
and $$\lim_{x \to 2^{+}} f(x)=b(2)^{2}=4b$$}
\visible<3->{Also note $$f(2)=b(2)^{2}=4b$$}
\visible<4->{First, for the function to have a limit at $x=2$, $$\lim_{x \to 2^{-}} f(x)=\lim_{x \to 2^{+}} f(x)$$}
\end{frame}
\begin{frame}

\visible<1->{so $3=4b$, then $b=3/4$, so $$\lim_{x \to 2} f(x)=3$$}
\visible<2->{Second, we will check that this value of $b$ ensures $$\lim_{x \to 2} f(x)=f(2)$$
 $3=4b$ or $3=4(3/4)$. So when $b=3/4,$ $f(x)$ is continuous at $x=2$.} 

\end{frame}

\begin{frame}{(The Intermediate Value Theorem)}
\begin{theorem}
A function $y=f(x)$ that is continuous on an interval $[a,b]$ takes on every value between $f(a)$ and $f(b)$. In other words, if $y_{0}$ is any value between $f(a)$ and $f(b)$, then $y_{0}=f(c)$ for some $c$ in $[a,b]$ 
\end{theorem}

\begin{center}
			\includegraphics[scale=0.25]{Figures/lec49.pdf}
		\end{center}

\end{frame}
\begin{frame}
\begin{example}
Sketch a discontinuous graph for which the above theorem does not hold 
\end{example}
\visible<2->{The function $$f(x)= \left\{
\begin{array}{ll}
      2x-2, & 1\leqslant x<2 \\
      3, & 2 \leqslant x \leqslant 4 \\
      
\end{array} 
\right.$$ 
This function does not take on all values between $f(1)=0$ and $f(4)=3$, it misses all the values between $2$ and $3$.

\begin{center}
			\includegraphics[scale=0.2]{Figures/lec50.pdf}
		\end{center}}
\end{frame}
\begin{frame}
\begin{example}
Show that there is a root of the equation $$4x^{3}-6x^{2}+3x-2=0$$
between $1$ and $2$.
\end{example}
\visible<2->{Let $f(x)=4x^{3}-6x^{2}+3x-2$, we will use the above theorem with $a=1, b=2, c=0$, so }
\visible<3->{\begin{itemize}
\item $f(x)$ is a polynomial so it is continuous 
\item $f(1)=4-6+3-2=-1<0$\\
$f(2)=32-24+6-2=12>0$
\item and $f(a)<c<f(b)$

\end{itemize}
All conditions hold so, there exists a $y$, $1<y<2$ such that $f(y)=0$ \\
So there is a root between $1$ and $2$}
\end{frame}
\begin{frame}
\begin{example}
How many roots does $x^{3}+1=3x^{2}$ have?
\end{example}
\visible<2->{So, $$x^{3}-3x^{2}+1=0$$
We define $$f(x)=x^{3}-3x^{2}+1$$
$f(x)$ is a polynomial and hence continuous.} 
\visible<3->{\begin{itemize}
\item $f(-1)=-1-3+1<0$ negative
\item $f(0)=1>0$ positive
\item $f(2)=8-3(4)+1<0$ negative
\item $f(3)=1>0$ positive
\end{itemize} 
So using The Intermediate Value Theorem, we see that $f(x)=0$ has $3$ roots. }
\end{frame}
\begin{frame}
\visible<2->{\begin{example}
Find the number of asymptotes and discontinuities of $$f(x)=\frac{(x-1)(x-2)}{(x+1)(x-3)}$$ Then find the $x-$intercept and $y-$intercept and plot $f$ 
\end{example}}
\visible<2->{\begin{example}
How many discontinuities has $$f(x)= \left\{
\begin{array}{ll}
      \frac{(x-1)(x-2)}{(x+1)(x-3)}, & x \neq 1 \\
      1, & x=1 \\
      
\end{array} 
\right.$$ 
\end{example}}
\end{frame}

\begin{frame}
\visible<2->{The change in distance $=f(x_{0}+h)-f(x_{0})$\\}
\visible<3->{The change in time $=(x_{0}+h)-x_{0}=h$\\}
\visible<4->{The average speed between $P$ and $Q$ is $$\frac{f(x_{0}+h)-f(x_{0})}{h}$$}
\begin{center}
			\includegraphics[scale=0.25]{Figures/lec60.pdf}
		\end{center}
\end{frame}
\begin{frame}
The slope of the curve $y=f(x)$ at the point $P(x_{0},f(x_{0}))$ is the number $$\lim_{h \to 0} \frac{f(x_{0}+h)-f(x_{0})}{h}$$
We call this limit the derivative of $f$ at $x_{0}$.
\visible<2->{\begin{definition}
The derivative of the function $f(x)$ with respect to the variable $x$ is the function $f'$ or $\frac{df}{dx}$ whose value at $x$ is $$f'(x)=\lim_{h \to 0} \frac{f(x+h)-f(x)}{h}$$
\end{definition}}
\end{frame}
\begin{frame}
\begin{example}
Use the above definition to find the derivative of $f(x)=x^{2}$
\end{example}
\visible<2->{We know that $$f'(x)=\lim_{h \to 0} \frac{f(x+h)-f(x)}{h}$$} 
\visible<3->{Here $f(x+h)=(x+h)^{2}=x^{2}+h^{2}+2hx$ so $$f'(x)=\lim_{h \to 0} \frac{f(x+h)-f(x)}{h}=\lim_{h \to 0} \frac{(x^{2}+h^{2}+2hx)-x^{2}}{h}$$} 
\visible<4->{$$\hspace{-1cm} =\lim_{h \to 0} \frac{h(h+2x)}{h}=\lim_{h \to 0} (h+2x)=2x$$}
\end{frame}

\begin{frame}{Exercises}
Prove that 
\begin{itemize}
\item $\frac{d}{dx}(\cos x)=-\sin x$
\item $\frac{d}{dx}(e^{x})=e^{x}$
\end{itemize}
\end{frame}
\begin{frame}{Basic Rules of Differentiation }
\begin{itemize}
\visible<2->{\item[(1)] {\textcolor {red} {\textit{Derivative of a Constant Function:}}} If $f$ has the constant value $f(x)=c,$ then: $$\frac{df}{dx}=\frac{d}{dx}(c)=0$$}
\visible<3->{\item[(2)] {\textcolor {red} {\textit{Power Rule for Positive Integers:}}} If $n$ is a positive integer, then $$\frac{d}{dx}(x^{n})=nx^{n-1}$$}
\visible<4->{\item[(3)] {\textcolor {red} {\textit{Constant Multiple Rule:}}} If $u$ is a differentiable function of $x$, and $c$ is a constant, then $$\frac{d}{dx}(cu)=c\frac{du}{dx}$$ }
\end{itemize}

\end{frame}
\begin{frame}
\begin{itemize}
\visible<2->{\item[(4)] {\textcolor {red} {\textit{Derivative Sum Rule:}}} If $u$ and $v$ are differentiable functions of $x$, then their sum $u+v$ is differentiable at every point where $u$ and $v$ are both differentiable. At such points,$$\frac{d}{dx}(u+v)=\frac{du}{dx}+\frac{dv}{dx}$$ }
\visible<3->{\item[(5)] {\textcolor {red} {\textit{Derivative Product Rule:}}} If $u$ and $v$ are differentiable at $x$, then so is their product $uv$, and $$\frac{d}{dx}(uv)=u\frac{dv}{dx}+v\frac{du}{dx}$$}
\visible<4->{\item[(6)] {\textcolor {red} {\textit{Derivative Quotient Rule:}}} If $u$ and $v$ are differentiable at $x$ and if $v(x)\neq 0$, then the quotient $u/v$ is differentiable at $x$, and $$\frac{d}{dx}(\frac{u}{v})=\frac{v\frac{du}{dx}-u\frac{dv}{dx}}{v^{2}}$$}      
\end{itemize}
\end{frame}
\begin{frame}
\begin{example}
Suppose that $f(x)=-5x^{3}+3x^{2}-9x+7$, then find:
\begin{itemize}
\item[(a)] The derivative of $f(x)$
\item[(b)] The slope of the tangent line at $x=2$
\item[(c)] The equation of the tangent at $x=2$
\end{itemize}
\end{example}
\visible<2->{{\textcolor {red} {Note:}} The equation of a line with slope $m$ and a point $(x_{1},y_{1})$ on the line is: $$y-y_{1}=m(x-x_{1})$$}
\visible<3->{(a): $$f'(x)=-15x^{2}+6x-9$$}
\visible<4->{(b): The slope of the tangent line at $x=2$ is $f'(2)$} \visible<5->{$$f'(2)=-15(2)^{2}+6(2)-9=-15(4)+12-9=-60+12-9=-57$$}

\end{frame}
\begin{frame}
(c): The $y$ coordinate at $x=2$ is $$f(2)=-5(2)^{3}+3(2)^{2}-9(2)+7=-5(8)+3(4)-18+7$$ $$\hspace{-3.2cm} =-40+12-18+7=-39$$
\visible<2->{So $(2,-39)$ is a point on the tangent line and the slope of the line is $-57$ so the equation of the line is: $$y-y_{1}=m(x-x_{1})=y+39=-57(x-2)$$}

\end{frame}
\begin{frame}
\begin{example}
Use the rules to show that $$\frac{d}{dx}(\tan x)=\sec ^{2} x$$
\end{example}
\visible<2->{$$\frac{d}{dx}(\tan x)=\frac{d}{dx}(\frac{\sin x}{\cos x})$$}
\visible<3->{Using the quotient rule, we will get $$\frac{d}{dx}(\frac{\sin x}{\cos x})=\frac{(\cos x)[\frac{d}{dx}(\sin x)]-(\sin x)[\frac{d}{dx}(\cos x)]}{(\cos^{2} x)}$$} 
\end{frame}
\begin{frame}{Exercises}
Use the rules to show that:
\begin{itemize}
\item $$\frac{d}{dx}(\sec x)=\sec (x) \cdot \tan (x)$$
\item $$\frac{d}{dx}(\csc (x))=-\csc (x) \cdot \cot (x)$$
{\textcolor {red} {\textit{Hint:}}} $\csc (x)=1/\sin (x) \quad and \quad \cot (x)=1/\tan (x)$
\item $$\frac{d}{dx}(\cot (x))=-\csc ^{2}(x)$$
\end{itemize}
\end{frame}
\begin{frame}
\begin{definition}
If $f(u)$ is differentiable at the point $u=g(x)$ and $g(x)$ is differentiable at $x$, then the composite function $(f\circ g)(x)=f(g(x))$ is differentiable at $x$, and $$(f \circ g)'(x)=f'(g(x))\cdot g'(x)$$
In another notation, if $y=f(u)$ and $u=g(x)$, then $$\frac{dy}{dx}=\frac{dy}{du}\cdot \frac{du}{dx}$$   
\end{definition}

\end{frame}
\begin{frame}
\begin{example}
If $y=(x^{3}+4x^{4}+7)^{99}$, find $\frac{dy}{dx}$
\end{example}
\visible<2->{Let $u=x^{3}+4x^{4}+7$,} \visible<3->{we can write $y$ as $y=u^{99}$, then by chain rule we have:
$$\frac{dy}{dx}=\frac{dy}{du}\cdot \frac{du}{dx}=99u^{98}[3x^{2}+16x^{3}],$$ }
\visible<4->{so $$\frac{dy}{dx}=99(x^{3}+4x^{4}+7)^{98}(3x^{2}+16x^{3})$$}
\begin{example}
If $y=\displaystyle {\frac{1000}{(x^{4}+2x^{2}+8)^{40}}}$, find $\frac{dy}{dx}$
\end{example}
\end{frame}
\begin{frame}
\visible<2->{$y=1000(x^{4}+2x^{2}+8)^{-40}$.\\}
\visible<3->{Let $u=x^{4}+2x^{2}+8$, so we can write $y=1000u^{-40}$\\}
\visible<4->{The Chain rule is: $$\frac{dy}{dx}=\frac{dy}{du}\cdot \frac{du}{dx}$$}
\visible<5->{ Now: $$\frac{dy}{du}=(1000)(-40)u^{-41}$$}
\visible<6->{ $$\frac{du}{dx}=4x^{3}+4x$$}
 \visible<7->{so $$\frac{dy}{dx}=-40000u^{-41}[4x^{3}+4x]$$}
 \visible<8->{then $$\frac{dy}{dx}=\frac{-40000}{u^{41}}(4x^{3}+4x)$$}
\visible<9->{ or $$\frac{dy}{dx}=\frac{-40000(4x^{3}+4x)}{x^{4}+2x^{2}+8}$$ } 
\end{frame}
\begin{frame}

{\textcolor {red} {\textit{Note:}}} Sometimes it is useful to involve a second (or more) intermediate function $$\frac{dy}{dx}=\frac{dy}{du}\cdot \frac{du}{dv}\cdot \frac{dv}{dx}$$
\visible<2->{\begin{example}
Find $\frac{dy}{dx}$, when $$y=\sin ^{4}(x^{5}+7)$$
\end{example}}
\visible<3->{Let $u=\sin (x^{5}+7)$ and let $v=x^{5}+7$\\}
so the chain rule gives $$\frac{d \sin ^{4}(x^{5}+7)}{dx}=\frac{d \sin ^{4}(x^{5}+7)}{d \sin (x^{5}+7)}\cdot \frac{d \sin (x^{5}+7)}{d (x^{5}+7)}\cdot \frac{d(x^{5}+7)}{dx}$$ 
\visible<4->{$$\Big [4\sin ^{3}(x^{5}+7) \Big ]\cdot \Big [\cos (x^{5}+7) \Big ]\cdot \Big [ 5x^{4}\Big ]=20x^{4}\cdot \sin ^{3}(x^{5}+7)\cdot \cos (x^{5}+7) $$}

\end{frame}
\begin{frame}{Exercises}

Find $\frac{dy}{dx}$, if:
\begin{itemize}


\item $$y=x^{2}e^{\sin x}$$
\item $$y=\tan ^{3}[\sin ^{2}(x^{4})]$$
\end{itemize}
\end{frame}
\begin{frame}
\begin{example}
Find $dy/dx$ for $$y=\tan ^{3}[\sin ^{2}(x^{4})]$$ 
\end{example}
\visible<2->{$y=u^{3}$}\\
\visible<3->{$u=\tan [\sin ^{2}(x^{4})]$}  \visible<4->{$=\tan (v)$}\\
\visible<5->{$v=\sin ^{2}(x^{4})$}  \visible<6->{$=t^{2}$}\\
\visible<7->{$t=\sin (x^{4})$} \visible<8->{$=\sin (r)$}\\
\visible<9->{$r=x^{4}$}\\
\visible<10->{By the chain rule :\\
$\displaystyle{ \frac{dy}{dx}=\frac{dy}{du} \cdot \frac{du}{dv} \cdot \frac{dv}{dt} \cdot \frac{dt}{dr} \cdot \frac{dr}{dx}}$}\\
\visible<11->{$\displaystyle{\frac{dy}{dx}=(3u^{2})(sec^{2}(v))(2t)(\cos r)(4x)}$} \\
\visible<12->{$\displaystyle{\frac{dy}{dx}}=(3(\tan ^{2}[\sin ^{2}(x^{4})])) \cdot (\sec ^{2}(\sin ^{2}(x^{4}))) \cdot (2\sin (x^{4})) \cdot (\cos x^{4}) \cdot x^{4}$}
\end{frame}
\begin{frame}{Differentiation of Inverse functions}

It is often useful to be able to express the derivative of an inverse function in terms of the derivatives of $f$.
\begin{definition}
If $y=f^{-1}(x)$, then $x=f(y)$ and also $$\frac{dy}{dx}=\frac{1}{\frac{dx}{dy}}=\frac{1}{f'(y)}$$
\end{definition}


\end{frame}
\begin{frame}
\begin{example}
Let us use the inverse rule to find $\frac{dy}{dx}$, when $y=x^{1/3}$
\end{example}
\visible<2->{{\textcolor {red} {\textit{Note:}}} We know that the answer is $\frac{1}{3}x^{\frac{1}{3}-1}=\frac{1}{3}x^{\frac{-2}{3}}$, so we do not have to use the inverse rule but here we aim to use this rule to differentiate the function.} \\
\visible<3->{If $y=x^{\frac{1}{3}}$, then $y^{3}=x$, or $x=y^{3}$, so $$\frac{dx}{dy}=3y^{2}$$}
\visible<4->{By the inverse rule:$$\frac{dy}{dx}=\frac{1}{\frac{dx}{dy}}=\frac{1}{3y^{2}}$$}
\visible<5->{But $y=x^{\frac{1}{3}}$ so $$\frac{dy}{dx}=\frac{1}{3(x^{\frac{1}{3}})^{2}}=\frac{1}{3}x^{-\frac{2}{3}}$$ }
\end{frame}
\begin{frame}
\begin{example}
Find $dy/dx$ for  $$y=\sin ^{-1} x$$
\end{example}
\visible<2->{Let $y=\sin ^{-1} x$,} \visible<3->{then $  x=\sin y \enspace (\textcolor{red} {\star})$,}  \visible<4->{so $$\frac{dx}{dy}=\cos y \enspace (\textcolor{red} {\star \star})$$}
\visible<6->{As $\sin^{2} y + \cos^{2} y=1$, then $\cos y=\sqrt{1-\sin^{2} y}$, so by using $(\textcolor{red} {\star})$  $$\cos y=\sqrt{1-x^{2}}$$}
\visible<5->{Now using the inverse rule and from $(\textcolor{red} {\star \star})$, we have $$\frac{dy}{dx}=\frac{1}{\cos y} \quad or \quad \frac{dy}{dx}=\frac{1}{\sqrt{1-x^{2}}}$$}   
\end{frame}
\begin{frame}{Exercises}
\begin{itemize}
\item Show that: $$\frac{d}{dx}(\cos^{-1} x)=\frac{-1}{\sqrt{1-x^{2}}}$$
\item Using the identity $1+\tan^{2} A=\sec^{2} A$, show that: 
$$\frac{d}{dx} (\tan^{-1} x)=\frac{1}{1+x^{2}}$$
\item Find $$\frac{d}{dx}[\tan^{-1} (e^{x^{2}})]$$
\end{itemize}
\end{frame}
\begin{frame}
We had $$\frac{d}{dx} (e^{x})=e^{x}$$
\visible<2->{We will find $\frac{dy}{dx}$ when $y=\ln(x)$\\}
\visible<3->{If $y=\ln(x)$, then $x=e^{y}$, so $\frac{dx}{dy}=e^{y}$. \\}
\visible<4->{Using the inverse rule we get $$\frac{dy}{dx}=\frac{1}{\frac{dx}{dy}}=\frac{1}{e^{y}}=\frac{1}{x}$$} \visible<5->{Therefore $$\frac{d}{dx}(\ln(x))=\frac{1}{x}$$}
\end{frame}
\begin{frame}
A function $f(x)$ can be written in a unique way as the sum of one even function and one odd function. The decomposition is 
\begin{center}
			\includegraphics[scale=0.2]{Figures/lec80.pdf}
		\end{center} 
 
	\visible<2->{\begin{center}
			\includegraphics[scale=0.15]{Figures/lec81.pdf}
		\end{center} }	
\end{frame}
\begin{frame}{Hyperbolic Functions}
The hyperbolic functions are defined as follows 
\begin{itemize}
\item \textit{Hyperbolic sine of $x$} $$\sinh (x)=\frac{e^{x}-e^{-x}}{2}$$
\visible<2->{\begin{center}
			\includegraphics[scale=0.25]{Figures/lec83.pdf}
		\end{center} }
\end{itemize}

\end{frame}
\begin{frame}
\begin{itemize}
\item \textit{Hyperbolic cosine of $x$} $$\cosh (x)=\frac{e^{x}+e^{-x}}{2}$$
\visible<2->{\begin{center}
			\includegraphics[scale=0.25]{Figures/lec84.pdf}
		\end{center} }
\end{itemize}
\end{frame}
\begin{frame}
\begin{itemize}
\item \textit{Hyperbolic tangent} $$\tanh (x)=\frac{\sinh (x)}{\cosh (x)}=\frac{e^{x}-e^{-x}}{e^{x}+e^{-x}}$$
\item \textit{Hyperbolic cotangent} $$\coth (x)=\frac{\cosh (x)}{\sinh (x)}=\frac{e^{x}+e^{-x}}{e^{x}-e^{-x}}$$ 
\begin{center}
			\includegraphics[scale=0.25]{Figures/lec85.pdf}
		\end{center} 
\end{itemize}
\end{frame}
\begin{frame}
\begin{example}
Find $$\frac{d \sinh (x)}{dx}$$
\end{example}
\visible<2->{We know that $$\sinh (x)=\frac{e^{x}-e^{-x}}{2}$$}  \visible<3->{So $$\frac{d \sinh (x)}{dx}=\frac{d}{dx}(\frac{e^{x}-e^{-x}}{2})=\frac{1}{2}\frac{d(e^{x}-e^{-x})}{dx}=\frac{1}{2}[e^{x}+e^{-x}]=\cosh (x)$$}
\end{frame}
\begin{frame}
\begin{itemize}
\item \textit{Hyperbolic secant} $$\sech (x)=\frac{1}{\cosh (x)}=\frac{2}{e^{x}+e^{-x}}$$
\begin{center}
			\includegraphics[scale=0.25]{Figures/lec86.pdf}
		\end{center} 
\end{itemize}
\end{frame}
\begin{frame}
\begin{itemize}
\item \textit{Hyperbolic cosecant} $$\csch (x)=\frac{1}{\sinh (x)}=\frac{2}{e^{x}-e^{-x}}$$
\begin{center}
			\includegraphics[scale=0.25]{Figures/lec87.pdf}
		\end{center} 
\end{itemize}
\end{frame}
\begin{frame}{Exercises}
\begin{itemize}
\item Show that $$\frac{d}{dx}(\cosh (x))=\sinh (x)$$
\item Show that $$\frac{d}{dx}(\tanh (x))=\sech ^{2}(x)$$ 
\end{itemize}
\end{frame}
\begin{frame}{The second derivative}

The derivative of the derivative is called the second derivative. \\
For a function $y=f(x)$, we write the second derivative as $$\frac{d^{2}y}{dx^{2}} \quad or \quad f''(x) \quad or \quad f^{(2)}(x)$$ 

The basic idea is that the optimal value of a differentiable function $f(x)$ (its maximum and minimum value) generally occurs when $f'(x)=0$ 
\end{frame}
\begin{frame}
\begin{center}
			\includegraphics[scale=0.4]{Figures/lec90.pdf}
		\end{center} 
\end{frame}
\begin{frame}
\begin{definition}
An interior point of the domain of a function $f$ where $f'$ is zero or undefined is a \textit{critical point} of $f$.
\end{definition}
\visible<2->{{\textcolor {red} {\textit{Note:}}} One needs to check if points where the derivative does not exist is a maximum or minimum. For example $f(x)=x^{1/3}$ has a local minimum at $x=0$ although $f'(0)$ does not exist} 
\visible<3->{\begin{center}
			\includegraphics[scale=0.25]{Figures/lec91.pdf}
		\end{center} }
\end{frame}
\begin{frame}

{\textcolor {red} {\textit{Note:}}} Some values of $x$ satisfying $f'(x)=0$ are not maximum or minimum. \\
for example $x=0$ is a critical point of $f(x)=x^{3}$, because $$f'(x)=3x^{2}=0 \Rightarrow x=0$$ But $x=0$ is neither a maximum or minimum.    
 \begin{center}
			\includegraphics[scale=0.25]{Figures/lec92.pdf}
		\end{center} 
\end{frame}
\begin{frame}{The First Derivative Test}
We will show how to test the critical points of a function for the presence of local maximums and minimums.
\begin{definition}
Let $f$ be a function defined on an interval $I$ and let $x_{1}$ and $x_{2}$ be any two points in $I$.
\begin{itemize}
\item If $f(x_{1})<f(x_{2})$ whenever $x_{1}<x_{2}$, then $f$ is said to be \textit{increasing} on $I$.
\item If $f(x_{1})>f(x_{2})$ whenever $x_{1}<x_{2}$, then $f$ is said to be \textit{decreasing} on $I$.
\end{itemize}
\end{definition}
\visible<2->{\begin{example}
The function $f(x)=x^{2}$ decreases on $(-\infty , 0]$ and increases on $[0,\infty)$
\end{example}}
\end{frame}
\begin{frame}
\begin{theorem}
Suppose that $f$ is differentiable on $(a,b)$
\begin{itemize}
\item If $f'(x)>0$ at each point $x \in (a,b)$, then $f$ is increasing 
\item If $f'(x)<0$ at each point $x \in (a,b)$, then $f$ is decreasing   
\end{itemize}
\end{theorem}
 \begin{center}
			\includegraphics[scale=0.25]{Figures/lec93.pdf}
		\end{center} 
\end{frame}
\begin{frame}
\begin{example}
Find the critical points of $f(x)=x^{3}-12x-5$ and identify the intervals on which $f$ is increasing and decreasing 
\end{example}
\visible<2->{The function $f$ is everywhere continuous and differentiable. The first derivative 
$$f'(x)=3x^{2}-12=3(x^{2}-4)=3(x+2)(x-2)$$
is zero at $x=-2$ and $x=2$.} \visible<3->{These critical points subdivided the domain of $f$ into intervals $(-\infty , -2), (-2,2)$ and $(2,\infty)$ on which $f'$ is either positive or negative. We determine the sign of $f'$ by evaluating $f$ at a convenient point in each subinterval.}
\end{frame}
\begin{frame}
 \begin{center}
			\includegraphics[scale=0.2]{Figures/lec94.pdf}
		\end{center}
		\begin{center}
			\includegraphics[scale=0.2]{Figures/lec95.pdf}
		\end{center} 
\end{frame}
\begin{frame}

{\textcolor {red} {\textit{Note:}}} At the points where $f$ has a minimum value, $f'<0$ immediately to the left and $f'>0$ immediately to the right. Thus the function is decreasing on the left of the minimum value and it is increasing on its right. Similarly, at the points where $f$ has a maximum value, $f'>0$ immediately to the left and $f'<0$ immediately to the right. Thus the function is increasing on the left of the maximum value and decreasing on its right.
\begin{theorem}{\textcolor{red} {First Derivative test for local maximums and minimums:}}
Suppose that $c$ is a critical point of $f$,
\begin{itemize}
\item if $f'$ changes from negative to positive at $c$, then $f$ has a local minimum.
\item if $f'$ changes from positive to negative at $c$, then $f$ has a local maximum.
\item if $f'$ does not change sign at $c$ (that is, $f'$ is positive on both sides of $c$ or negative on both sides), then $f$ has no maximum or minimum at $c$.
\end{itemize}

\end{theorem}
\end{frame}
\begin{frame}
\begin{example}
Find the critical points of $$f(x)=x^{1/3}(x-4)$$
Identify the local maximums and minimums. 
\end{example}
We can write $f(x)=x^{1/3}(x-4)=x^{4/3}-4x^{1/3}$.\\
The first derivative $$f'(x)=\frac{d}{dx}(x^{4/3}-4x^{1/3})=\frac{4}{3}x^{1/3}-\frac{4}{3}x^{-2/3}=\frac{4}{3}x^{-2/3}(x-1)=\frac{4(x-1)}{3x^{2/3}}$$
is zero at $x=1$ and undefined at $x=0$. So these are the critical points.
\end{frame}
\begin{frame}
 \begin{center}
			\includegraphics[scale=0.2]{Figures/lec97.pdf}
		\end{center}
		\begin{center}
			\includegraphics[scale=0.2]{Figures/lec98.pdf}
		\end{center} 
\end{frame}
\begin{frame}
\begin{center}
			\includegraphics[scale=0.4]{Figures/lec90.pdf}
		\end{center} 

\end{frame}
\begin{frame}
\begin{definition}
An interior point of the domain of a function $f$ where $f'$ is zero or undefined is a \textit{critical point} of $f$.
\end{definition}
\end{frame}
\begin{frame}
\begin{theorem}
Suppose that $f$ is differentiable on $(a,b)$
\begin{itemize}
\item If $f'(x)>0$ at each point $x \in (a,b)$, then $f$ is increasing 
\item If $f'(x)<0$ at each point $x \in (a,b)$, then $f$ is decreasing   
\end{itemize}
\end{theorem}
 \begin{center}
			\includegraphics[scale=0.25]{Figures/lec93.pdf}
		\end{center} 
\end{frame}
\begin{frame}
\begin{theorem}{\textcolor{red} {First Derivative test for local maximums and minimums:}}
Suppose that $c$ is a critical point of $f$,
\begin{itemize}
\item if $f'$ changes from negative to positive at $c$, then $f$ has a local minimum.
\item if $f'$ changes from positive to negative at $c$, then $f$ has a local maximum.
\item if $f'$ does not change sign at $c$ (that is, $f'$ is positive on both sides of $c$ or negative on both sides), then $f$ has no maximum or minimum at $c$.
\end{itemize}

\end{theorem}
\end{frame}
\begin{frame}
\begin{definition}
The graph of a differentiable function $y=f(x)$ is:
\begin{itemize}
\item \textbf{concave up} on an open interval $I$ if $f'$ is increasing on $I$
\item \textbf{concave down} on an open interval $I$ if $f'$ is decreasing on $I$
\end{itemize}
\end{definition}
\visible<2->{\begin{theorem}
Let $y=f(x)$ be twice-differentiable on an open interval $I$.
\begin{itemize}
\item If $f''>0$ on $I$, the graph of $f$ over $I$ is concave up
\item If $f''<0$ on $I$, the graph of $f$ over $I$ is concave down. 
\end{itemize}
\end{theorem}}
\end{frame}
\begin{frame}
\begin{center}
			\includegraphics[scale=0.2]{Figures/lec99.pdf}
		\end{center}
		\visible<2->{\begin{center}
			\includegraphics[scale=0.18]{Figures/lec100.pdf}
		\end{center}}
\end{frame}
\begin{frame}
\begin{definition}
A point where the graph of a function has a tangent line and where the concavity changes is a \textbf{point of inflection}
\end{definition}
\visible<2->{{\textcolor {red} {\textit{Note:}}} To find the points of inflection, we need to find the zeros  of $f''$ and points where $f''$ is not defined. Then we need to check the concavity.}
\visible<3->{\begin{example}
The curve $y=x^{4}$ has no inflection point at $x=0$. Even though $y''=12x^{2}$ is zero there, it does not change sign
\end{example}}
\visible<4->{{\textcolor {red} {\textit{Note:}}} An inflection point may not exist where $y''=0$}
\end{frame}
\begin{frame}
\begin{center}
			\includegraphics[scale=0.2]{Figures/lec113.pdf}
		\end{center}
		\visible<2->{\begin{theorem}
		{\textcolor{red}{Second derivative test for local maximums and minimums:}} suppose that $f''$ is continuous on an open interval that contains $x=c$.
		\begin{itemize}
		\item If $f'(c)=0$ and $f''(c)<0$, then $f$ has a local maximum at $x=c$
		\item If $f'(c)=0$ and $f''(c)>0$, then $f$ has a local minimum at $x=c$
		\item If $f'(c)=0$ and $f''(c)=0$, then the test fails. The function $f$ may have a local maximum, a local minimum, or neither.
\end{itemize}		 
		\end{theorem}}
\end{frame}
\begin{frame}
\begin{example}
Find and classify the stationary points and the points of inflection of $$f(x)=4x^{3}-21x^{2}+18x+6$$
\end{example}
$f'(x)=12x^{2}-42x+18$\\
When $f'(x)=0$, we have: $$12x^{2}-42x+18=0 \Rightarrow 2x^{2}-7x+3=0 \Rightarrow (2x-1)(x-3)=0$$
So The stationary points are: $x=1/2$ and $x=3$\\
$f''(x)=24x-42$ so $$f''(1/2)=24(1/2)-42=12-42<0$$
which means $x=1/2$ is a local max. Also as $$f''(3)=24(3)-42=72-42>0$$
$x=3$ is a local min. 
\end{frame}
\begin{frame}
\begin{example}
sketch a graph of the function $f(x)=x^{4}-4x^{3}+10$ 
\end{example}
We use the following steps:\\
\begin{itemize}
\item[(1)] Find the critical (stationary) points
\item[(2)] Find the points of inflection
\item[(3)] Use the second derivative test 
\item[(4)] Find the y-value of these points to pair them
\item[(5)] Draw the table to find the intervals on which $f$ is increasing and the intervals on which $f$ is decreasing
\item[(6)] Add some extra rows to your table to see where the graph of $f$ is concave up and where it is concave down 
\item[(7)] Plot some specific points, such as local maximum and minimum points, points of inflection, and intercepts. 
\item[(8)] Sketch the general shape of the graph for $f$

\end{itemize}
\end{frame}
\begin{frame}

{\textcolor{red}{Step $(1)$}}:\\
$$f'(x)=4x^{3}-12x^{2}=4x^{2}(x-3)=0$$
So the stationary points are $x=0$ and $x=3$\\
\visible<2->{{\textcolor{red}{Step $(2)$}}:\\
$$f''(x)=12x^{2}-24x=12x(x-2)=0$$
So the points of inflection are $x=0$ and $x=2$\\}
\visible<3->{{\textcolor{red}{Step $(3)$}}:\\
At $x=0$, $f''(0)=0$ so the test fails in this point. But at $x=3$, $f''(3)=36>0$ so based on the test, $x=3$ is a local minimum\\}
\visible<4->{{\textcolor{red}{Step $4$}}:\\
$f(0)=10$, $f(2)=-6$ and $f(3)=-17$}
 
\end{frame}

\begin{frame}

{\textcolor{red}{Step $5$ and $6$}}:
\begin{center}
			\includegraphics[scale=0.3]{Figures/lec111.pdf}
		\end{center}
\end{frame}
\begin{frame}

{\textcolor{red}{Step $7$ and $8$}}:
\begin{center}
			\includegraphics[scale=0.3]{Figures/lec112.pdf}
		\end{center}
\end{frame}
\begin{frame}


\begin{example}
Sketch the graph of $$f(x)=\frac{(x+1)^{2}}{1+x^{2}}$$
\end{example}
{\textcolor{red}{Step $(1)$}}:\\
$\displaystyle{f(x)=\frac{(x+1)^{2}}{1+x^{2}}}$, so $$f'(x)=\frac{(1+x^{2})\cdot 2(x+1)-(x+1)^{2}\cdot 2x}{(1+x^{2})^{2}}=\frac{2(1-x^{2})}{(1+x^{2})^{2}}$$
So the critical points are $x=-1$ and $x=1$. \\
{\textcolor{red}{Step $(2)$}}:\\
$$f''(x)=\frac{(1+x^{2})^{2}\cdot 2(-2x)-2(1-x^{2})[2(1+x^{2})\cdot 2x]}{(1+x^{2})^{4}}=\frac{4x(x^{2}-3)}{(1+x^{2})^{3}}$$
\end{frame}
\begin{frame}
So inflection points are $x=\sqrt{3}$, $x=0$ and $x=-\sqrt{3}$\\
{\textcolor{red}{Step $(3)$}}:\\
since $f''(1)=-1<0$ so $x=1$ is a local max and since $f''(-1)=1>0$ so $x=-1$ is a local min\\
{\textcolor{red}{Step $(4)$}}:\\
$f(1)=2$, $f(-1)=0$, $f(\sqrt{3})=\frac{(\sqrt{3}+1)^{2}}{4}$, $f(-\sqrt{3})=\frac{(-\sqrt{3}+1)^{2}}{4}, f(0)=1$\\
We can also find the asymptotes of the function: $$\lim_{x\to \infty}f(x)=1$$
So $y=1$ is the horizontal asymptote.\\
\end{frame}
\begin{frame}

{\textcolor{red}{Step $5$ and $6$}}:
\begin{center}
			\includegraphics[scale=0.3]{Figures/lec130.pdf}
		\end{center}
\end{frame}
\begin{frame}

{\textcolor{red}{Step $7$ and $8$}}:
\begin{center}
			\includegraphics[scale=0.3]{Figures/lex131.pdf}
		\end{center}
\end{frame}
\begin{frame}{Exercise }
Use the steps of the graphing procedure to graph the following equations:
\begin{itemize}
\item $$y=x^{2}-4x+3$$
\item $$y=x^{3}-3x+3$$
\item $$y=\frac{x^{2}-3}{x-2}$$
\end{itemize}

\end{frame}
\begin{frame}
\begin{example}
Sketch the graph of the function $$f(x)=\frac{1}{1+e^{3x}}$$
\end{example}
\visible<2->{{\textcolor{red}{Step $(1)$}}:\\
Find the critical points, we can write $f(x)$ as, $f(x)=(1+e^{3x})^{-1}$, so 
$$f'(x)=-3(e^{3x})(1+e^{3x})^{-2}=\frac{-3e^{3x}}{(1+e^{3x})^{2}}$$ 
As for all $x\in \mathbb{R}$, $e^{3x}>0$, so $f'(x)$ has no root and it is always negative which means that the function is always decreasing. \\}
\visible<3->{{\textcolor{red}{Step $(2)$}}:\\
Find the points of inflection: $$f''(x)=\frac{(1+e^{3x})^{2}[-9e^{3x}]-[-3e^{3x}][6e^{3x}(1+e^{3x})]}{(1+e^{3x})^{4}}$$}
\end{frame}
\begin{frame}
Setting $f''(x)=0$, we have $$(1+e^{3x})^{2}(-9e^{3x})+[3e^{3x}][6e^{3x}(1+e^{3x})]=0$$
$$\Rightarrow (1+e^{3x})(-9)+18e^{3x}=0 \Rightarrow 1+e^{3x}=2e^{3x} \Rightarrow 1=e^{3x}$$ 
So $x=0$ could be the point of inflection, we need to check whether the second derivative changes sign around this point or not.\\
\visible<2->{{\textcolor{red}{Step $(3)$}}:\\
No need to use the second derivative test, as there is no critical point. \\}
\visible<3->{{\textcolor{red}{Step $(4)$}}:\\
$f(0)=1/2$, the function has no x-intercept as $f(x)$ is never zero.}
\end{frame}
\begin{frame}
As $f(x)$ is a rational function. we should also find the asymptotes
$$\lim_{x\to \infty}\frac{1}{1+e^{3x}}=0$$ also $$\lim_{x\to -\infty}\frac{1}{1+e^{3x}}=\frac{1}{1+0}=1$$
Is the denominator equal to zero? No, because there is no real $x$ when $1+e^{3x}=0$ \\
So the asymptotes are:\\
$y=0$ when $x \rightarrow \infty$\\
$y=1$ when $x \rightarrow -\infty$ 
\end{frame}
\begin{frame}

{\textcolor{red}{Step $5$ and $6$}}:
$f'(x)=\displaystyle{ \frac{-3e^{3x}}{(1+e^{3x})^{2}}}$ and $f''(x)=\displaystyle{ \frac{9(e^{3x}-1)}{(1+e^{3x})^{4}}}$
\visible<2->{\begin{center}
			\includegraphics[scale=0.3]{Figures/lec141.pdf}
		\end{center}}
\end{frame}

\begin{frame}
\begin{center}
			\includegraphics[scale=0.3]{Figures/lec140.pdf}
		\end{center}
\end{frame}
\begin{frame}{Logarithmic Differentiation}

One could use the product and quotient rule to differentiate the following type of function.
\begin{example}
$$f(x)=\frac{(x^{2}+5)(x+3)^{2}\sqrt{x+7}}{(x+4)^{5}}$$
\end{example}
\visible<2->{Alternatively, we could first take the log of both sides: 
$$\ln f(x)=\ln (x^{2}+5)+2\ln (x+3)+\frac{1}{2}\ln (x+7)-5\ln (x+4)$$
then differentiate\\}
\visible<3->{First note: $$\frac{d}{dx}(\ln f(x))=\frac{d \ln f(x)}{d f(x)}\cdot \frac{d f(x)}{dx}=\frac{1}{f(x)}\cdot \frac{d f(x)}{dx}=\frac{1}{f(x)}\cdot f'(x)$$}
 

\end{frame}
\begin{frame}
So differentiating the above: $$\frac{f'(x)}{f(x)}=\frac{2x}{x^{2}+5}+\frac{2}{x+3}+\frac{1}{2(x+7)}-\frac{5}{x+4}$$ \visible<2->{So $$f'(x)=\Big [ \frac{(x^{2}+5)(x+3)^{2}\sqrt{x+7}}{(x+4)^{5}} \Big ]\cdot \Big [ \frac{2x}{x^{2}+5}+\frac{2}{x+3}+\frac{1}{2(x+7)}-\frac{5}{x+4} \Big ]$$}
\end{frame}
\begin{frame}{Continuous and Differentiable Function}

\begin{example}
Determine values of $k$ and $m$ such that $h(x)$ is continuous and differentiable at all points. $$h(x)=\left\{
  \begin{array}{rcr}
    4x+k & if & x<3 \\
    mx^{3}-1 & if & x\geq 3 \\
  \end{array}
\right.$$
\end{example}
\visible<2->{To be continuous: $$\lim_{x \to 3^{-}} h(x)=\lim_{x \to 3^{+}} h(x)$$} \visible<3->{ So, 
$$4(3)+k=m(3)^{3}-1 \Rightarrow 12+k=27m-1 \Rightarrow k=27m-13$$}
\end{frame}

\begin{frame}
A function $h(x)$ is differentiable at $a$ if the following limit exists:
$$\lim_{x \to a} \frac{f(x)-f(a)}{x-a}$$
\visible<2->{this limit exists, if both of the one-sided limits exist and are equal:}
\visible<3->{$$\lim_{x \to 3^{-}} \frac{(4x+k)-(27m-1)}{x-3}=\lim_{x \to 3^{-}} \frac{4x-12}{x-3}=4$$}
\visible<4->{Also $$\lim_{x \to 3^{+}} \frac{(mx^{3}-1)-(27m-1)}{x-3}=\lim_{x \to 3^{+}} \frac{m(x^{3}-27)}{x-3}$$$$=\lim_{x \to 3^{+}} m(x^{2}+3x+9)=27m$$}
\end{frame}
\begin{frame}
so $$4=3m(3^{2}) \Rightarrow 4=27m \Rightarrow m=27/4$$
\visible<2->{As $k=27m-13$, $k=27(4/27)-13 \Rightarrow k=4-13=-9$ }
\end{frame}
\begin{frame}

{\textbf {\textcolor{red}{Solving Applied Optimization Problems:}}}
\begin{itemize}
\visible<2->{\item[(1)] \textit{Read the problem.} Read the problem until you understand it. What is given?
What is the unknown quantity to be optimized?}
\visible<3->{\item[(2)] \textit{Draw a picture.} Label any part that may be important to the problem.}
\visible<4->{\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.}
\visible<5->{\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}
\visible<2->{The perimeter equals $30m$, it means $2(x+y)=30$ or $x+y=15$, so $$y=15-x, (\textcolor{red} {\star})$$}
\visible<3->{$Area=A=x\cdot y$,} \visible<4->{Using $(\textcolor{red} {\star})$, we have  $$A=x(15-x)$$} \visible<5->{Now A is a function of $x$, in order to find the maximum value of A, we differentiate it:} \visible<6->{ $$\frac{dA}{dx}=15-2x$$
Let: $$\frac{dA}{dx}=0 \Rightarrow x=\frac{15}{2} (y=\frac{15}{2})$$}
\visible<7->{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$$ \visible<2->{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}
\visible<1->{The distance between the two points $(x,y)$ and $(1,4)$ equals:
$$d=\sqrt{(x-1)^{2}+(y-4)^{2}}$$}
\visible<2->{Instead of minimizing $d$ we can minimize distance squared. 
$$r=(x-1)^{2}+(y-4)^{2}$$}
\visible<3->{As the coordinates of the point satisfy $y^{2}=2x$ or $\frac{y^{2}}{2}=x$,}\visible<4->{ let $y=t$ then $x=\frac{t^{2}}{2}$.} \visible<5->{ 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}
\visible<1->{$$r(t)=\frac{t^{4}}{4}-t^{2}+1+t^{2}+16-8t=\frac{t^{4}}{4}-8t+17$$}
\visible<2->{$$r'(t)=t^{3}-8=0 \Rightarrow r'(t)=(t-2)(t^{2}+2t+4)=0$$}
\visible<3->{So $t=2$ is the only critical point as the other factor does not have any real roots
$$d''(t)=3t^{2} \Rightarrow d''(2)=12>0$$} 
\visible<4->{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)}$$
 \visible<2->{{\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}
\visible<2->{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}
\visible<2->{$\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}
\visible<2->{$\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}
\section{Integral}
\begin{frame}
\visible<2->{\begin{definition}
A function $F$ is an \textit{antiderivative} of $f$ on an interval $I$ if $F'(x)=f(x)$ for all $x$ in $I$.\\
$f$ is the derivative of $F$ $\longleftrightarrow$ $F$ is an antiderivative of $f$
\end{definition}}
\visible<3->{{\textcolor {red} {\textit{Note:}}} If $F$ is an antiderivative of $f$, then the most general antiderivative of $f$ is $$F(x)+c$$
Where $c$ is an arbitrary constant. \\}
\visible<4->{For example the antiderivative of $f(x)=2x$ equals $F(x)=x^{2}+c$\\}
\visible<5->{or \\
For example the antiderivative of $f(x)=3x^{2}$ equals $F(x)=x^{3}+c$}
\end{frame}
\begin{frame}
\begin{definition}
We call $$\int f(x) dx$$ an \textit{indefinite integral} if $$\int f(x) dx=F(x)+c$$ where $F(x)$ is an antiderivative of $f(x)$.
\end{definition}
\visible<2->{\begin{example}
\begin{itemize}
\visible<3->{\item $\int 2x dx=x^{2}+c$}
\visible<4->{\item $\int 3x^{2} dx=x^{3}+c$}
\end{itemize}
\end{example}}
\end{frame}
\begin{frame}
\begin{example}
\begin{itemize}
\visible<2->{\item $$\int x dx=\frac{1}{2}x^{2}+c$$}
\visible<3->{Because the derivative of $\frac{1}{2} x^{2}+c$ is equal to $x$}
\visible<4->{\item $$\int x^{2} dx=\frac{1}{3} x^{3}+c$$}
\end{itemize}
\end{example}
\visible<5->{In general when $x\neq -1$: $$\int x^{n} dx=\frac{x^{n+1}}{n+1}+c$$ }

\end{frame}
\begin{frame}
\begin{example}
\begin{itemize}
\visible<1->{\item $$\int \sin (x) dx=-\cos (x)+c$$}
\visible<2->{\item $$\int \cos (x) dx=\sin (x)+c$$}
\visible<3->{\item $$\int \sec^{2} (x) dx=\tan(x)+c$$}
\visible<4->{\item $$\int \csc^{2} (x) dx=-\cot (x)+c$$}
\visible<5->{\item $$\int \sec (x)\tan (x) dx=\sec (x)+c$$}
\visible<6->{\item $$\int \csc (x)\cot (x) dx=-\csc(x)+c$$}
\end{itemize}
\end{example}
\end{frame}
\begin{frame}

{\textcolor {red} {\textit{Some useful integral properties:}}}
\begin{itemize}
\visible<2->{\item[(1)] $$\int cf(x) dx=c\int f(x) dx$$}
\visible<3->{\item[(2)] $$\int [f(x)\pm g(x)] dx=\int f(x) dx\pm \int g(x) dx$$}
\end{itemize}
\visible<4->{\begin{example}
evaluate the following integral: $$\int (2x^{2}+9x^{7}) dx$$
\end{example}}
\visible<5->{$$\int (2x^{2}+9x^{7}) dx=\int 2x^{2} dx+\int 9x^{7} dx=2\int x^{2} dx+9\int x^{7} dx$$}
\end{frame}
\begin{frame}
$$=[2(\frac{x^{3}}{3})+c_{1}]+[9(\frac{x^{8}}{8})+c_{2}]=2(\frac{x^{3}}{3})+9(\frac{x^{8}}{8})+(c_{1}+c_{2})$$ 
$$\int (2x^{2}+9x^{7}) dx=2(\frac{x^{3}}{3})+9(\frac{x^{8}}{8})+c$$

\visible<2->{\begin{theorem}
If $u=g(x)$ is a differentiable function, then: $$\int f(g(x))g'(x) dx=\int f(u)du$$
\end{theorem}}
\end{frame}
\begin{frame}
\begin{example}
evaluate the following integral: $$\int 3x^{2} \sin (x^{3}) dx$$
\end{example}
\visible<2->{We see that $3x^{2}$ is the derivative of $x^{3}$.} \visible<3->{So if we make the substitution $u=x^{3}$, then $\displaystyle {\frac{du}{dx}}=3x^{2}$} \visible<4->{ or in the differential form $du=3x^{2} dx$,} \visible<5->{so 
$$\int 3x^{2} \sin (x^{3}) dx=\int \sin (u) du $$}
\visible<6->{Now we integrate with respect to $u$:
$$\int \sin (u) du=-\cos (u)+c$$}
\visible<7->{Replace $u$ by $x^{3}$, we get:
$$\int 3x^{2} \sin (x^{3}) dx=\int \sin (u) du=\int \sin (u) du=-\cos (u)+c=-\cos (x^{3})+c$$}
\end{frame}
\begin{frame}
\begin{example}
Find: $$\int 2x \sqrt{1+x^{2}} dx$$
\end{example}
\visible<2->{We define a function of $x$, called $u$.\\
Let $u=1+x^{2}$,} \visible<3->{so $\displaystyle {\frac{du}{dx}=2x}$ or $du=2x dx$}
\visible<4->{So the above integral becomes: $$\int \sqrt{u} du=\int u^{\frac{1}{2}} du=\frac{u^{\frac{3}{2}}}{\frac{3}{2}}+c=\frac{2}{3}u^{\frac{3}{2}}+c=\frac{2}{3}(1+x^{2})^{\frac{3}{2}}+c$$}
\end{frame}
\begin{frame}
\begin{example}
Find: $$\int \cos(4x-7) dx$$
\end{example}
\visible<2->{Let $u=4x-7$.}\visible<3->{ then $\displaystyle{\frac{du}{dx}}=4$ or $du=4dx$.\\}
\visible<4->{We can rewrite the original integral as: $$\frac{1}{4}\int 4 \cos(4x-7) dx$$} \visible<5->{ then the above integral equals: $$\frac{1}{4} \int \cos(u) du=\frac{1}{4} \sin(u)+c=\frac{1}{4} \sin(4x-7)+c$$}  
\end{frame}
\begin{frame}
\begin{example}
Find: $$\int e^{-5x} dx$$
\end{example}
\visible<2->{Let $u=-5x$,} \visible<3->{ then $\displaystyle{\frac{du}{dx}}=-5$ or $du=-5dx$.\\}
\visible<4->{We can rewrite the original integral as: $$\frac{-1}{5}\int -5e^{-5x} dx$$  then the above integral equals: $$\frac{-1}{5}\int e^{u} du=\frac{-1}{5}e^{u}+c=\frac{-1}{5}e^{-5x}+c $$}
\end{frame}
\begin{frame}
\begin{example}
Find: $$\int \sin^{3}x \cos x dx$$
\end{example}
\end{frame}
\begin{frame}
\begin{definition}
Rational functions have the general form $$f(x)=\frac{p(x)}{q(x)}$$
where $p(x)$ and $q(x)$ are polynomials.
\end{definition}
\begin{itemize}
\item \textbf{IF} degree of $p(x) <$ degree of $q(x)$, then $f(x)$ is a strictly proper rational function. 
\item \textbf{IF} degree of $p(x) =$ degree of $q(x)$, then $f(x)$ is a proper rational function. 
\item \textbf{IF} degree of $p(x) >$ degree of $q(x)$, then $f(x)$ is an improper rational function. 
\end{itemize}

\end{frame}
\begin{frame}
An improper or proper rational function can be expressed in terms of a strictly proper rational function
\begin{example}
Express $f(x)=\displaystyle{\frac{3x^{4}+2x^{3}-5x^{2}+6x-7}{x^{2}-2x+3}}$ in terms of a strictly proper rational function
\end{example}
{\textcolor{blue}{$f(x)=3x^{2}+8x+2-\displaystyle{\frac{14x+13}{x^{2}-2x+3}}$}}
\end{frame}
\begin{frame}
\begin{itemize}
\item[(1)] {\textcolor{red}{Linear factor to the power of $1$:}}\\
A linear factor $(x-a)$ gives rise to the partial fraction of the form $$\frac{A}{x-a}$$
\item[(2)] {\textcolor{red}{Linear factor to the power of greater than $1$:}}\\
If $(x-\alpha)^{k}$ appears in the denominator, it will give rise to the following terms:$$\frac{A_{1}}{x-\alpha}+\frac{A_{2}}{(x-\alpha)^{2}}+\cdots+\frac{A_{k}}{(x-\alpha)^{k}}$$
\end{itemize}
\end{frame}
\begin{frame}
\begin{itemize}
\item[(3)] {\textcolor{red}{Irreducible quadratic factors:}}\\
An irreducible quadratic $ax^{2}+bx+c$ gives rise to partial fractions of the form $$\frac{Ax+B}{ax^{2}+bx+c}$$
\item[(4)] {\textcolor{red}{Irreducible quadratic factors to the power of greater than $1$:}}\\
If $(ax^{2}+bx+c)^{k}$ appears in the denominator, it will give rise to the following terms:
$$\frac{A_{1}x+B_{1}}{ax^{2}+bx+c}+\frac{A_{2}x+B_{2}}{(ax^{2}+bx+c)^{2}}+\cdots+\frac{A_{k}x+B_{k}}{(ax^{2}+bx+c)^{k}}$$
\end{itemize}
\end{frame}
\begin{frame}
\begin{example}
Evaluate $$\int \frac{3x+4}{x^{2}+7x+12} dx$$

\end{example}
\visible<2->{$x^{2}+7x+12=(x+4)(x+3)$,} \visible<3->{so the partial fraction decomposition has the form:
$$ \frac{3x+4}{x^{2}+7x+12}=\frac{A}{x+4}+\frac{B}{x+3}$$ }
\visible<4->{To find the values of the undetermined coefficients $A$ and $B$, we add the new fractions:
$$\frac{3x+4}{x^{2}+7x+12}=\frac{A}{x+4}+\frac{B}{x+3}=\frac{A(x+3)+B(x+4)}{(x+4)(x+3)}$$}
\end{frame}
\begin{frame}
The denominators on both sides of the above equation are identical, so the numerators must be equal: \visible<2->{$$3x+4=A(x+3)+B(x+4)=Ax+3A+Bx+4B=(A+B)x+(3A+4B)$$} \visible<3->{ which means:
$$\left\{
  \begin{array}{rcr}
    A+B & = & 3 \\
    3A+4B & = & 4 \\
  \end{array}
\right.$$ }
\visible<4->{So $A=3-B$} \visible<5->{ so inserting this into the second equation, we get:$$3(3-B)+4B=4 \Rightarrow 9-9B+4B=4 \Rightarrow 9-5B=4 \Rightarrow 5B=5 \Rightarrow B=1$$}
\visible<6->{Therefore $A=3-B=3-1=2$. \\}
\visible<7->{So $$\frac{3x+4}{x^{2}+7x+12}=\frac{2}{x+4}+\frac{1}{x+3}$$}
\end{frame}
\begin{frame}
Now we can express the integral as: $$\int \frac{3x+4}{x^{2}+7x+12} dx=\int \Big ( \frac{2}{x+4}+\frac{1}{x+3} \Big ) dx$$
\visible<2->{Using the sum rule, we have: $$\int \frac{3x+4}{x^{2}+7x+12} dx=\int \Big ( \frac{2}{x+4}+\frac{1}{x+3} \Big ) dx=\underbrace{\int \frac{2}{x+4} dx}_{I_{1}} +\underbrace{\int \frac{1}{x+3} dx}_{I_{2}} $$}
\end{frame}
\begin{frame}
First we find $I_{1}$: $$I_{1}=\int \frac{2}{x+4} dx=2\int \frac{1}{x+4} dx$$
\visible<2->{Let $u=x+4$,} \visible<3->{ then $du=dx$,} \visible<4->{ so: $$I_{1}=\int \frac{2}{x+4} dx=2\int \frac{1}{x+4} dx=2\int \frac{du}{u}=2\ln (u)+c_{1}=2\ln (x+4)+c_{1}$$ }
\visible<5->{Therefore $I_{1}=2\ln (x+4)+c_{1}$}
\end{frame}
\begin{frame}
  $$I_{2}=\int \frac{1}{x+3} dx$$
Let $u=x+3$, then $du=dx$, so: $$I_{2}=\int \frac{1}{x+3} dx=\int \frac{du}{u}=\ln (u)+c_{2}=\ln (x+3)+c_{2}$$ 
Therefore $I_{2}=\ln (x+3)+c_{2}$\\
\visible<2->{So finally $$\int \frac{3x+4}{x^{2}+7x+12} dx=\int \Big ( \frac{2}{x+4}+\frac{1}{x+3} \Big ) dx=\underbrace{\int \frac{2}{x+4} dx}_{I_{1}} +\underbrace{\int \frac{1}{x+3} dx}_{I_{2}}$$$$=2\ln (x+4)+c_{1} + I_{2}=\ln (x+3)+c_{2}=2\ln (x+4)+\ln (x+3)+c $$}
\end{frame}
\begin{frame}
\begin{example}
Evaluate:
$$\int \frac{dx}{x(x^{2}+1)^{2}}$$
\end{example}
The form of the partial fraction decomposition is $$\frac{1}{x(x^{2}+1)^{2}}=\frac{A}{x}+\frac{Bx+C}{x^{2}+1}+\frac{Dx+E}{(x^{2}+1)^{2}}$$
Add up the fractions:  $$\frac{1}{x(x^{2}+1)^{2}}=\frac{A}{x}+\frac{Bx+C}{x^{2}+1}+\frac{Dx+E}{(x^{2}+1)^{2}}$$ $$=\frac{A(x^{2}+1)^{2}+(Bx+C)x(x^{2}+1)+(Dx+E)x}{x(x^{2}+1)^{2}}$$
\end{frame}
\begin{frame}
So: $$1=A(x^{2}+1)^{2}+(Bx+C)x(x^{2}+1)+(Dx+E)x $$ $$\Rightarrow 1=A(x^{4}+2x^{2}+1)+B(x^{4}+x^{2})+C(x^{3}+x)+Dx^{2}+Ex $$ $$\Rightarrow 1=(A+B)x^{4}+Cx^{3}+(2A+B+D)x^{2}+(C+E)x+A$$ 
If we equate coefficients, we get the system
$$\left\{
  \begin{array}{rcr}
    A+B & = & 0 \\
    C & = & 0 \\
    2A+B+D & = & 0\\
    C+E & = & 0\\
    A & = & 1
  \end{array}
\right.$$ 

\end{frame}
\begin{frame}
Solving this system gives: $A=1, B=-1, C=0, D=-1, E=0$\\
Thus  $$\int \frac{dx}{x(x^{2}+1)^{2}}=\int \Big ( \frac{A}{x}+\frac{Bx+C}{x^{2}+1}+\frac{Dx+E}{(x^{2}+1)^{2}} \Big ) dx$$ $$=\int \Big ( \frac{1}{x}+\frac{-x+0}{x^{2}+1}+\frac{-x+0}{(x^{2}+1)^{2}} \Big ) dx$$ $$=\int \Big ( \frac{1}{x}+\frac{-x}{x^{2}+1}+\frac{-x}{(x^{2}+1)^{2}} \Big ) dx$$ $$=\underbrace{\int \frac{1}{x} dx }_{I_{1}}+ \underbrace{\int  \frac{-x}{x^{2}+1} dx }_{I_{2}}+\underbrace{ \int \frac{-x}{(x^{2}+1)^{2}} dx}_{I_{3}}$$
\end{frame}
\begin{frame}
$$I_{1}=\int \frac{1}{x} dx$$ Therefore $$I_{1}=\ln (x)+c_{1} $$
Also $$I_{2}=\int  \frac{-x}{x^{2}+1} dx $$
Let $u=x^{2}+1$ then $du=2x dx$, so $-\frac{du}{2}=-x dx$ $$\int  \frac{-x}{x^{2}+1} dx=\int \frac{-du}{2u}=\frac{-1}{2} \int \frac{du}{u}=\frac{-1}{2} \ln u+c_{2}=\frac{-1}{2}\ln (x^{2}+1)+c_{2}$$
\end{frame}
\begin{frame}
$$I_{3}=\int \frac{-x}{(x^{2}+1)^{2}} dx$$
Let $u=x^{2}+1$, then $du=2x dx$, so $\frac{-du}{2}=-x dx$, Therefore: 
$$I_{3}=\int \frac{-x}{(x^{2}+1)^{2}} dx=\int \frac{-du}{2(u)^{2}}=\frac{-1}{2}\int \frac{du}{u^{2}}=\frac{-1}{2}\int u^{-2} du$$ $$= \frac{-1}{2} \Big ( \frac{u^{-2+1}}{-2+1}\Big ) +c_{3}=\frac{-1}{2} \Big ( \frac{(x^{2}+1)^{-2+1}}{-2+1}\Big ) +c_{3}=\frac{-1}{2} \Big ( \frac{(x^{2}+1)^{-1}}{-1}\Big ) +c_{3} $$
\end{frame}
\begin{frame}
\begin{center}
			\includegraphics[scale=0.33]{Figures/lec501.pdf}
		\end{center}
\end{frame}
\begin{frame}
To do so, we choose $n-1$ points $\{ x_{1}, x_{2}, \cdots, x_{n-1} \}$ between $a$ and $b$ and satisfying $$a < x_{1} < x_{2} < \cdots < x_{n-1} < b$$
To make the notation consistent, we denote $a$ by $x_{0}$ and $b$ by $x_{n}$, so that : 
$$a=x_{0} < x_{1} < x_{2} < \cdots < x_{n-1} < x_{n}=b$$
The set $$P=\{x_{0}, x_{1}, x_{2}, \cdots, x_{n-1},x_{n} \}$$ is called a partition of $[a,b]$
\begin{center}
			\includegraphics[scale=0.33]{Figures/lec500.pdf}
		\end{center}
\end{frame}
\begin{frame}
In each subinterval we select some point $c_{k}$. Then on each subinterval we stand a vertical rectangle that stretches
from the x-axis to touch the curve at $(c_{k},f(c_{k}))$:
\begin{center}
			\includegraphics[scale=0.36]{Figures/lec502.pdf}
		\end{center}
\end{frame}
\begin{frame}
We can also let all the the subintervals to have equal widths, $\Delta x_{k}=\frac{1}{n}$ Then the area of each rectangle is $$\Delta x_{k} \cdot f(c_{k})=\frac{1}{n} \cdot f(c_{k})$$
\begin{center}
			\includegraphics[scale=0.3]{Figures/lec503.pdf}
		\end{center}
\end{frame}
\begin{frame}
Finally we sum all these products to get $$S_{P}=\sum_{k=1}^{n} \frac{1}{n} \cdot f(c_{k}) $$ $S_{P}$ is called a Riemann sum for $f$ on the interval $[a, b]$.
\end{frame}
\begin{frame}
We can also make the width of the subintervals smaller.
\begin{center}
			\includegraphics[scale=0.3]{Figures/lec504.pdf}
		\end{center}
\end{frame}
\begin{frame}
If we make $n$ larger (or make $\frac{1}{n}$ smaller), then $$\lim_{n \to \infty} \sum_{k=1}^{n} \frac{1}{n} \cdot f(c_{k})$$ will give us an accurate answer.\\
We say that the definite integral of $f$ from $a$ to $b$ is: $$\int_{a}^{b} f(x) dx=\lim_{n \to \infty} \sum_{k=1}^{n} \frac{1}{n} \cdot f(c_{k})$$   
\end{frame}
\begin{frame}
\begin{center}
			\includegraphics[scale=0.4]{Figures/lec505.pdf}
		\end{center}
\end{frame}
\begin{frame}
\begin{theorem}
 {\textcolor{red}{The Fundamental Theorem of Calculus (1):}}\\
 Suppose that $f$ is a continuous function on $[a,b]$, and $F$ is a anti-derivative of $f$. Then: $$\int_{a}^{b} f(x) dx=F(x)\Big ]_{a}^{b}=F(b)-F(a)$$
\end{theorem}
\end{frame}
\begin{frame}
\begin{example}
Evaluate $$\int_{0}^{1} x^{3} dx$$
\end{example}
An anti-derivative can be obtained by evaluating the following integral:$$\int x^{3} dx = x^{4}/4$$ So $F(x)=x^{4}/4$, therefore: $$\int_{0}^{1} x^{3} dx=x^{4}/4 \Big ]_{0}^{1}=(1^{4}/4) - (0^{4}/4)=1/4 $$
\end{frame}
\begin{frame}
\begin{theorem}
\begin{itemize}
\item Order of integration: $$\int_{a}^{b} f(x) dx=-\int_{b}^{a} f(x) dx$$
\item Zero width interval $$\int_{a}^{a} f(x) dx=0$$
\item if $a<c<b$, then $$\int_{a}^{b} f(x) dx=\int_{a}^{c} f(x) dx+\int_{c}^{b} f(x) dx$$
\end{itemize}
\end{theorem}
\end{frame}
\begin{frame}
\begin{example}
Suppose that $\int_{-1}^{1} f(x) dx=5$ , $\int_{1}^{4} f(x) dx=-2$ and $\int_{-1}^{1} h(x) dx=7$. Then find
\begin{itemize}
\item  $$\int_{4}^{1} f(x) dx$$
\item  $$\int_{-1}^{1} [2f(x)+3h(x)] dx$$ 
\item $$\int_{-1}^{4} f(x) dx$$ 


 \end{itemize}
\end{example}
\end{frame}
\begin{frame}
\begin{theorem}
 {\textcolor{red}{The Fundamental Theorem of Calculus (2):}}\\
 Suppose that $f$ is a continuous function on $[a,b]$, $$\frac{d}{dx} \int_{a}^{x} f(t) dt=f(x)$$
\end{theorem}
\begin{example}
Find $$\frac{d}{dx} \int_{0}^{x} \sqrt{1+2t} dt$$
\end{example}
Recall that $$\frac{d}{dx} \int_{a}^{x} f(t) dt=f(x)$$ so: $$\frac{d}{dx} \int_{0}^{x} \sqrt{1+2t} dt=\sqrt{1+2x}$$
\end{frame}
\begin{frame}
\begin{example}
Find $\frac{dy}{dx}$, if $$y=\int_{a}^{x} \cos (t) dt$$
\end{example}
By The fundamental theorem of calculus, we know that: $$\frac{d}{dx} \int_{a}^{x} f(t) dt=f(x)$$ So: $$\frac{d}{dx} \int_{a}^{x} \cos (t) dt=\cos (x)$$
\end{frame}
\begin{frame}
\begin{example}
Find $\frac{dy}{dx}$, if $$y=\int_{1}^{x^{2}} \cos (t) dt$$
\end{example}
The upper limit of integration is not $x$ but $x^{2}$. This makes $y$ a composite of the two functions, $$y=\int_{1}^{u} \cos(t) dt \quad and \quad u=x^{2}$$
We must therefore apply the chain rule when finding $\frac{dy}{dx}$.
$$\frac{dy}{dx}=\frac{dy}{du}\cdot \frac{du}{dx}=\Big ( \frac{d}{du}\int_{1}^{u} \cos (t) dt \Big )\cdot \frac{du}{dx}$$ $$=\cos (u)\cdot \frac{du}{dx}=\cos (x^{2})\cdot 2x=2x\cdot \cos(x^{2})$$
\end{frame}
\begin{frame}
\begin{example}
Find $\frac{dy}{dx}$, if $$y=\int_{3}^{\sqrt{x}} \frac{\cos (t)}{t} dt$$
\end{example}
By the chain rule: $$\frac{dy}{dx}=\frac{dy}{du}\cdot \frac{du}{dx}=\Big ( \frac{d}{du}\int_{3}^{u} \frac{\cos (t)}{t} dt \Big )\cdot \frac{du}{dx}$$ $$=\frac{\cos (u)}{u}\cdot \frac{du}{dx}=\frac{\cos (\sqrt{x})}{\sqrt{x}}\cdot \frac{1}{2\sqrt{x}}$$
\end{frame}
\begin{frame}
Integration by parts is a technique for simplifying integrals of the form:
$$\int f(x)\cdot g(x) dx$$
It is useful when $f$ can be differentiated repeatedly and $g$ can be integrated repeatedly
without difficulty. The integral $$\int xe^{x} dx$$
is such an integral because $f(x)=x$ can be differentiated twice to become zero and $g(x)=e^{x} $ can be integrated repeatedly without difficulty.  
\end{frame}
\begin{frame}
\begin{theorem}
{\textcolor{red}{Integration by Parts Formula:}}
$$\int u dv=uv-\int v du$$
\end{theorem}
\visible<2->{\begin{example}
Find $$\int x\cos (x) dx$$
\end{example}}
\visible<3->{We use the formula $\int u dv=uv-\int v du$ with $$u=x, \quad dv=\cos(x)dx, $$
$$du=dx, \quad v=\sin(x)$$
Then $$\int x\cos(x) dx=x\sin(x)-\int \sin(x) dx=x\sin(x)+\cos(x)+c$$}
\end{frame}
\begin{frame}
\begin{example}
Find $$\int \ln(x) dx$$
\end{example}
Since $$\int \ln(x) dx$$ can be written as $$\int \ln(x)\cdot 1 dx$$, we use integration by parts: $$u=\ln(x) \quad dv=dx$$
$$du=\frac{1}{x} dx, \quad v=x$$
Then: $$\int \ln(x) dx=x\ln(x)-\int dx=x\ln(x)-x+c$$ 
\end{frame}
\begin{frame}
\begin{example}
Evaluate $$\int x^{2}e^{x} dx$$
\end{example}
With $$u=x^{2}, \quad dv=e^{x}dx$$
$$du=2xdx, \quad v=e^{x}$$
Using integration by parts,
$$\int u dv=uv-\int v du$$
We get: $$\int x^{2}e^{x} dx=x^{2}e^{x}-2\int xe^{x} dx$$
\end{frame}
\begin{frame}
$$\int xe^{x} dx=?$$
we have to use integration by parts more than once. We integrate by parts again with
$$u=x, \quad dv=e^{x}dx$$
$$du=dx, \quad v=e^{x}$$
So $$\int xe^{x} dx=xe^{x}-\int e^{x} dx=xe^{x}-e^{x}+c$$
Hence: 
$$\int x^{2}e^{x} dx=x^{2}e^{x}-2\int xe^{x} dx=x^{2}e^{x}-2xe^{x}+2e^{x}+c$$


\end{frame}
\begin{frame}
\begin{example}
Evaluate: $$\int e^{x} \cos(x) dx$$
\end{example}
Let $$u=e^{x}, \quad dv=\cos(x) dx$$
Then: $$du=e^{x}dx, \quad v=\sin(x) $$
Using integration by parts,
$$\int u dv=uv-\int v du$$
We get: $$\int e^{x}\cos(x) dx=e^{x}\sin(x)-\int e^{x}\sin(x)dx$$

\end{frame}
\begin{frame}
The second integral is like the first except that it has $\sin x$ in place of $\cos x$. To evaluate it, we use integration by parts with:$$u=e^{x}, \quad dv=\sin (x)dx$$
$$v=-\cos (x), \quad du=e^{x}dx$$
Then: $$\int e^{x}\cos(x) dx=e^{x}\sin(x)-\Big ( -e^{x}\cos (x)-\int (-\cos(x))(e^{x}dx) \Big )$$
$$=e^{x}\sin(x)+e^{x}\cos (x)-\int e^{x}\cos (x)dx$$
\end{frame}
\begin{frame}
The unknown integral now appears on both sides of the equation. Adding the integral to
both sides and adding the constant of integration gives:
$$2\int e^{x}\cos(x) dx=e^{x}\sin(x)+e^{x}\cos (x)+c$$
Dividing by $2$ and renaming the constant of integration gives: 
$$\int e^{x}\cos(x) dx=\frac{e^{x}\sin(x)+e^{x}\cos (x)}{2}+c$$ 
\end{frame}
\begin{frame}

{\textcolor{red}{Infinite Limits of Integration:}}
\begin{example}
Evaluate: $$\int_{0}^{\infty} \frac{1}{e^{\frac{x}{2}}} dx$$
\end{example}
\visible<2->{\begin{center}
			\includegraphics[scale=0.28]{Figures/lec607.pdf}
		\end{center}}
\end{frame}
\begin{frame}
First find the area $A(b)$ of the portion of the region that is bounded on the right by $x=b$.
$$A(b)=\int_{0}^{b} \frac{1}{e^{\frac{x}{2}}} dx=\int_{0}^{b} e^{-x/2} dx=-2e^{-x/2} \Big ]_{0}^{b}=-2e^{-b/2}+2 $$
Then find the limit of $A(b)$ as $b\to \infty$: 
$$\lim_{b\to \infty} A(b)=\lim_{b\to \infty} (-2e^{-b/2}+2)=2$$
\end{frame}
\begin{frame}

{\textcolor{red}{Inverse Trigonometric Functions:}}
\visible<2->{\begin{itemize}
\visible<3->{\item $$\int \frac{dx}{\sqrt{1-x^{2}}}=\sin^{-1} (x)+c$$}
\visible<4->{\item $$\int \frac{dx}{1+x^{2}}=\tan^{-1} (x)+c$$}
\visible<5->{\item $$\int \frac{dx}{\sqrt{x^{2}-1}}=\sec^{-1} (x)+c$$}
\end{itemize}}
\end{frame}
\begin{frame}
\begin{example}
Evaluate $$I=\int \frac{2}{3+4x^{2}} dx$$
\end{example}
\visible<2->{Recall that $$\int \frac{dx}{1+x^{2}} =\tan^{-1} (x)+c$$}
\visible<3->{$$I=\int \frac{2}{3(1+\frac{4}{3} x^{2})} dx=\frac{2}{3} \int \frac{1}{1+\frac{4}{3} x^{2}} dx=\frac{2}{3} \int \frac{1}{1+(\frac{2x}{\sqrt{3}})^{2} } dx$$}
\visible<4->{Let $u=\frac{2}{\sqrt{3}}x$,} \visible<2->{then $du=\frac{2}{\sqrt{3}} dx$,} \visible<5->{so $\frac{\sqrt{3}}{2}du = dx $.}
\visible<6->{$$I=\frac{2}{3} \int \frac{1}{1+u^{2}} (\frac{\sqrt{3}}{2}du )$$}
\end{frame}
\begin{frame}
$$I=\frac{2}{3} \frac{\sqrt{3}}{2} \int \frac{1}{1+u^{2}} du $$ So 
$$I=\frac{1}{\sqrt{3}} \tan^{-1} u+c=\frac{1}{\sqrt{3}} \tan^{-1} (\frac{2}{\sqrt{3}}x)+c$$
\end{frame}
\begin{frame}
To compute the area of the region bounded by the graph of a function $y=f(x)$ and the $x-$axis requires more care when the function takes on both positive and negative values.
We must be careful to break up the interval $[a,b]$ into subintervals on which the function
doesn’t change sign. Otherwise we might get cancellation between positive and negative
signed areas, leading to an incorrect total.
\begin{definition}
To find the area between the graph of $y=f(x)$ and the $x-$axis over the interval $[a,b]$, do the following: 
\begin{itemize}
\item[(1)] Subdivide $[a,b]$ at the zeros of $f$
\item[(2)] Integrate $f$ over each subinterval.
\item[(3)] Add the absolute values of the integrals. 
\end{itemize}  
\end{definition} 
\end{frame}
\begin{frame}
\begin{example}
Suppose that $f(x)=\sin (x)$, find:
\begin{itemize}
\item $$\int_{0}^{2\pi} \sin (x) dx$$
\item  The area between the graph of $f(x)$ and the $x-$axis over $[0,2\pi]$ 
\end{itemize}
\end{example}
\end{frame}
\begin{frame}
The definite integral for $f(x)=\sin (x)$ is given by $$\int_{0}^{2\pi} \sin (x) dx=-\cos (x) \Big ]_{0}^{2\pi}=-[\cos (2\pi)-\cos (0)]=-[1-1]=0$$
The definite integral is zero because the portions of the graph above and below the x-axis
make canceling contributions.
\end{frame}
\begin{frame}
\begin{center}
			\includegraphics[scale=0.4]{Figures/lec600.pdf}
		\end{center}
\end{frame}
\begin{frame}
The area between the graph of $f(x)$ and the $x-$axis over $[0,2\pi]$ is calculated by breaking up the domain of $\sin (x)$ into two pieces: the interval $[0,\pi]$ over which it is nonnegative and the interval $[\pi , 2\pi]$ over which it is nonpositive.
$$\int_{0}^{\pi} \sin (x) dx=-\cos (x) \Big ]_{0}^{\pi}=-[\cos (\pi)-\cos (0)]=-[-1-1]=2$$
$$\int_{\pi}^{2\pi} \sin (x) dx=-\cos (x) \Big ]_{\pi}^{2\pi}=-[\cos (2\pi)-\cos (\pi)]=-[1-(-1)]=-2$$
The second integral gives a negative value. The area between the graph and the axis is obtained
by adding the absolute values $$area=|2|+|-2|=4$$
\end{frame}
\begin{frame}
\begin{definition}
If $f$ and $g$ are continuous with $f(x)\geq g(x)$ throughout $[a,b]$, then the area of the region between the curves $y=f(x)$ and $y=g(x)$ from $a$ to $b$ is the integral of $(f-g)$ from $a$ to $b$: $$A=\int_{a}^{b} [f(x)-g(x)] dx$$
\end{definition}
\begin{center}
			\includegraphics[scale=0.25]{Figures/lec601.pdf}
		\end{center}
\end{frame}
\begin{frame}
\begin{example}
Find the area of the region enclosed by the parabola $y=2-x^{2}$ and the line $y=-x$
\end{example}
First we sketch the two curves
\visible<2->{\begin{center}
			\includegraphics[scale=0.28]{Figures/lec602.pdf}
		\end{center}}
\end{frame}
\begin{frame}
The limits of integration are found
by solving $y=2-x^{2}$ and $y=-x$ simultaneously for $x$. $$2-x^{2}=-x \Rightarrow x^{2}-x-2=0 \Rightarrow (x+1)(x-2)=0 \Rightarrow x=-1, x=2$$ 
The region runs from $x=-1$ to $x=2$. The limits of integration are $a=-1$, $b=2$. The area between the curve is $$A=\int_{a}^{b} [f(x)-g(x)] dx=\int_{-1}^{2} [(2-x^{2})-(-x)] dx$$
$$=\int_{-1}^{2} (2+x-x^{2}) dx=\Big [ 2x+\frac{x^{2}}{2}-\frac{x^{3}}{3}\Big ]_{-1}^{2}$$
$$=\Big ( 4+\frac{4}{2}-\frac{8}{3}\Big )-\Big ( -2+\frac{1}{2}+\frac{1}{3} \Big )=\frac{9}{2}$$
\end{frame}
\begin{frame}
\begin{example}
Find the area enclosed between the two curves $f(x)=6-2x^{2}$ and $g(x)=4x$.
\end{example}
\end{frame}
\begin{frame}

{\textcolor{red}{Find the volume of solids:}}
\visible<2->{\begin{center}
			\includegraphics[scale=0.35]{Figures/1111.jpg}
		\end{center}}
		\visible<3->{\begin{center}
			\includegraphics[scale=0.35]{Figures/2222.jpg}
		\end{center}}
\end{frame}
%\begin{frame}
%\begin{definition}
%The volume of a solid of known integrable cross-sectional area $A(x)$ from $x=a$ to $x=b$ is the integral of $A$ from $a$ to $b$, $$V=\int_{a}^{b} A(x) dx$$
%\end{definition}
%\begin{theorem}
%{\textcolor{red}{Calculating the volume of solids:}}
%\begin{itemize}
%\item[(1)] Sketch the solid and a typical cross-section.
%\item[(2)] Find a formula for $A(x)$, the area of a typical cross-section.
%\item[(3)] Find the limits of integration.
%\item[(4)] Integrate $A(x)$ using the Fundamental Theorem.  
%\end{itemize}
%\end{theorem}
%\end{frame}
%\begin{frame}
%\begin{example}
%A pyramid $3$ m high has a square base that is $3$ m on a side. Find
%the volume of the pyramid.
%\end{example}
%We draw the pyramid: 
%\begin{center}
%			\includegraphics[scale=0.28]{Figures/lec603.pdf}
%		\end{center}
%\end{frame}
%\begin{frame}
%The cross-section at $x$ is a square $x$ meters on a side, so its area is: $$A(x)=x^{2}$$ 
%The squares lie on the planes from $x=0$ to $x=b$. So the volume is $$V=\int_{0}^{3} A(x) dx=\int_{0}^{3} x^{2} dx=\frac{x^{3}}{3} \Big ]_{0}^{3}=9$$ 
%\end{frame}
\begin{frame}
The solid generated by rotating a plane region about an axis in its plane is called a solid of
revolution. To find the volume of a solid we need only
observe that the cross-sectional area $A(x)$ is the area of a disk of radius $R(x)$, the distance
of the planar region’s boundary from the axis of revolution. The area is then $$A(x)=\pi (radius)^{2}=\pi [R(x)]^{2}$$ 
So the definition of volume gives: $$V=\int_{a}^{b} A(x) dx=\int_{a}^{b} \pi [R(x)]^{2} dx$$
\end{frame}
\begin{frame}
\begin{example}
The region between the curve $y=\sqrt{x}$, $0\leq x\leq 4$, and the $x-$axis is revolved about the $x-$axis to generate a solid. Find its volume.
\end{example}
We draw figures showing the region, a typical radius, and the generated solid.
\begin{center}
			\includegraphics[scale=0.28]{Figures/lec604.pdf}
		\end{center}
\end{frame}
\begin{frame}
\begin{center}
			\includegraphics[scale=0.38]{Figures/lec605.pdf}
		\end{center}
\end{frame}
\begin{frame}
The volume is: $$V=\int_{a}^{b} \pi [R(x)]^{2} dx==\int_{0}^{4} \pi [\sqrt{x}]^{2} dx$$ 
$$=\pi\int_{0}^{4} x dx=\pi \frac{x^{2}}{2} \Big ]_{0}^{4}=\pi \frac{(4)^{2}}{2}=8\pi$$
\end{frame}
\begin{frame}
\begin{example}
The circle $$x^{2}+y^{2}=a^{2}$$
is rotated about the $x-$axis to generate a sphere. find its volume
\end{example}
We imagine the sphere cut into thin slices, \begin{center}
			\includegraphics[scale=0.26]{Figures/lec606.pdf}
		\end{center}
\end{frame}
\begin{frame}
the cross-sectional area at a typical point $x$ between $-a$ and $a$ is: $$A(x)=\pi y^{2}=\pi (a^{2}-x^{2})$$
Therefore, the volume is $$V=\int_{-a}^{a} A(x) dx=\int_{-a}^{a} \pi (a^{2}-x^{2}) dx$$
$$=\pi \Big [ a^{2}x-\frac{x^{3}}{3} \Big ]_{-a}^{a}=\frac{4}{3} \pi a^{3}$$  
\end{frame}
\begin{frame}
\begin{example}
Sketch the area between $x=2$ and $x=3$, under the curve $$y=\frac{1}{x-1}$$
Also find the volume of the solid if this area is rotated around the $x-$axis.
\end{example}
\end{frame}
\begin{frame}

{\textcolor{red}{Arc Length:}}
\visible<2->{Let C be a curve given by the equation $y=f(x)$. It may be helpful to imagine the curve as
the path of a particle moving from point $A$ to pint $B$. We subdivide the path (or arc) $AB$ into $n$ pieces at points $A=P_{0}, P_{1}, P_{2}, \cdots , P_{n}=B $. Join successive points of this subdivision by straight line segments 
\begin{center}
			\includegraphics[scale=0.25]{Figures/lec700.pdf}
		\end{center}}
\end{frame}
\begin{frame}
A representative line segment: 
\begin{center}
			\includegraphics[scale=0.25]{Figures/lec701.pdf}
		\end{center}
		has length: $$L_{k}=\sqrt{(\Delta x_{k})^{2}+(\Delta y_{k})^{2}}$$
\end{frame}
\begin{frame}
An intuitive approximation to the length of the curve $AB$, $S$,  is the sum of all the lengths $L_{k}:$ 

$$S\cong \sum_{k=1}^{n} L_{k}=\sum_{k=1}^{n} \sqrt{(\Delta x_{k})^{2}+(\Delta y_{k})^{2}} $$ 
So $$S\cong \sum_{k=1}^{n} \sqrt{(\Delta x_{k})^{2}(1+(\frac{\Delta y_{k}^{2}}{\Delta x_{k}^{2}})) }$$ 
\end{frame}
\begin{frame}
So: $$S\cong \sum_{k=1}^{n} \sqrt{(1+(\frac{\Delta y_{k}^{2}}{\Delta x_{k}^{2}})) } (\Delta x_{k})$$
Using a Riemann sum approach.\\
Let $\Delta x\to 0$ or $n\to \infty$, we get: $$S=\lim_{n\to \infty} \sum_{k=1}^{n} \sqrt{(1+(\frac{\Delta y_{k}^{2}}{\Delta x_{k}^{2}})) } (\Delta x_{k})$$
So: $$S=\int_{a}^{b} \sqrt{1+(\frac{dy}{dx})^{2}} dx$$
\end{frame}
\begin{frame}
\begin{theorem}
If $f$ is continuously differentiable on the closed interval $[a,b]$, the length of the curve (graph) $y=f(x)$ from $x=a$ to $x=b$ is: $$S=\int_{a}^{b} \sqrt{1+(\frac{dy}{dx})^{2}} dx=\int_{a}^{b} \sqrt{1+(f'(x))^{2}} dx$$
\end{theorem}
\end{frame}
\begin{frame}
\begin{example}
Find the length of the curve $$y=\frac{4\sqrt{2}}{3}x^{3/2}-1, \quad 0\leq x \leq 1$$
\end{example}
We use the theorem with $a=0$, $b=1$, and 
$$y=\frac{4\sqrt{2}}{3}x^{3/2}-1$$ 
First we take the derivative of $y$: $$\frac{dy}{dx}=\frac{4\sqrt{2}}{3}\cdot \frac{3}{2}x^{1/2}=2\sqrt{2}x^{1/2}$$
So $$(\frac{dy}{dx})^{2}=(2\sqrt{2} x^{1/2})^{2}=8x$$
\end{frame}
\begin{frame}
The length of the curve from $x=0$ to $x=1$ is:
$$S=\int_{0}^{1} \sqrt{1+(\frac{dy}{dx})^{2}} dx=\int_{0}^{1} \sqrt{1+8x} dx$$
$$=\frac{2}{3}\cdot \frac{1}{8} (1+8x)^{3/2} \Big ]^{1}_{0}=\frac{13}{6}$$
\end{frame}
\begin{frame}
\begin{example}
The cable of a suspension bridge takes the shape of the curve:
$$y=\frac{h}{l^{2}}x^{2}-\frac{2h}{l}x+h$$
Where $0\leq x\leq 2l$, $h>0$. Find the length of the cable.
\end{example}

\end{frame}
\begin{frame}
$$\frac{dy}{dx}=\frac{2h}{l^{2}}x-\frac{2h}{l}=\frac{2h}{l}(\frac{x}{l}-1)$$
So: $$(\frac{dy}{dx})^{2}=\Big [ \frac{2h}{l}(\frac{x}{l}-1) \Big ]^{2}$$
The length of the curve equals: $$S=\int_{a}^{b} \sqrt{1+(\frac{dy}{dx})^{2}} dx=\int_{0}^{2l} \sqrt{1+\Big [ \frac{2h}{l}(\frac{x}{l}-1) \Big ]^{2}} dx$$
First we find the following indefinite integral:
$$\int \sqrt{1+\Big [ \frac{2h}{l}(\frac{x}{l}-1) \Big ]^{2}} dx, \quad (\textcolor{red} {\star})$$ 
\end{frame}
\begin{frame}
Let $u=\frac{2h}{l}(\frac{x}{l}-1)$, then $du=\frac{2h}{l^{2}}dx$ or $\frac{l^{2}}{2h}du=dx$\\
So: $$(\textcolor{red} {\star})=\frac{l^{2}}{2h}\int \sqrt{1+u^{2}} du$$
{\textcolor{red}{quick reminder:}}\\
\begin{itemize}
\item $\sinh (x)=\frac{e^{x}-e^{-x}}{2}$
\item $\cosh (x)=\frac{e^{x}+e^{-x}}{2}$
\item $\frac{d}{dx} \sinh (x)=\cosh (x)$
\item $\frac{d}{dx} \cosh (x)=\sinh (x)$
\item $\cosh^{2} (x)-\sinh^{2} (x)=1$
\end{itemize}

\end{frame}
\begin{frame}
Now let $u=\sinh (v)$, so $du=\cosh (v) dv$, so:
$$(\textcolor{red} {\star})=\frac{l^{2}}{2h} \int \sqrt{1+u^{2}} du=\frac{l^{2}}{2h} \int \sqrt{1+\sinh ^{2} (v)} \cosh (v) dv$$ $$=\frac{l^{2}}{2h} \int \cosh (v) \cosh (v) dv=\frac{l^{2}}{2h} \int \cosh^{2} (v) dv$$
We have: $$\cosh^{2} (v)=\frac{[e^{2v}+e^{-2v}+2]}{4}=\frac{1}{2} [\frac{e^{2v}+e^{-2v}+2}{2}]$$ $$=\frac{1}{2}[\frac{e^{2v}+e^{-2v}}{2}+1]=\frac{1}{2}[\cosh(2v)+1]$$
So the above integral is:
$$(\textcolor{red} {\star})=\frac{l^{2}}{2h} \int \frac{1}{2}[\cosh(2v)+1] dv=\frac{l^{2}}{4h} \Big [ \frac{1}{2} \sinh (2v)+v \Big ]+c$$
\end{frame}
\begin{frame}
So:
$$(\textcolor{red} {\star})=\frac{l^{2}}{4h}\Big [ \sinh(v)\sqrt{1+\sinh^{2} (v)}+v \Big ]+c=\frac{l^{2}}{4h}\Big [ u\sqrt{1+u^{2}}+\sinh^{-1} (u) \Big ]+c$$ $$=\frac{l^{2}}{4h}\Big [ \frac{2h}{l}(\frac{x}{l}-1)\sqrt{1+(\frac{2h}{l}(\frac{x}{l}-1))^{2}}+\sinh^{-1} (\frac{2h}{l}(\frac{x}{l}-1)) \Big ]+c$$
So the length of the cable is:
$$\frac{l^{2}}{4h}\Big [ \frac{2h}{l}(\frac{x}{l}-1)\sqrt{1+(\frac{2h}{l}(\frac{x}{l}-1))^{2}}+\sinh^{-1} (\frac{2h}{l}(\frac{x}{l}-1)) \Big ]+c \Big ]^{2l}_{0}$$
$$=\Big ( \frac{l^{2}}{4h} (\frac{2h}{l} \sqrt{1+(\frac{2h}{l})^{2}}+\sinh^{-1} (\frac{2h}{l})\Big )$$$$-\Big ( \frac{l^{2}}{4h} (\frac{-2h}{l} \sqrt{1+(\frac{2h}{l})^{2}}+\sinh^{-1} (\frac{-2h}{l})\Big )$$
\end{frame}
\begin{frame}
Using the fact that $\sinh^{-1}(-x)=-\sinh^{-1}(x)$, we can simplify the above answer:
$$=\sqrt{l^{2}+4h^{2}}+\frac{l^{2}}{2h}\sinh^{-1}(\frac{2h}{l}) $$
\end{frame}
\begin{frame}
We begin by rotating the line segment $y=r$, from $x=A$ to $x=B$.\\
If we rotate this line segment $AB$ having length $\Delta x$ about the $x-$axis, we generate a cylinder with surface area $$2\pi y\Delta x=2\pi r\Delta x$$ This area is the same as that of a rectangle with side lengths $\Delta x$ and $2\pi y$ 
\begin{center}
			\includegraphics[scale=0.25]{Figures/lec2004.pdf}
		\end{center}
\end{frame}
\begin{frame}

{\textcolor{red}{Surface area:}}
\visible<2->{We are interested in the surface generated by rotating the curve about the x-axis.}
\visible<3->{\begin{center}
			\includegraphics[scale=0.25]{Figures/lec2000.pdf}
		\end{center}}
\end{frame}
\begin{frame}
Suppose that the arc length from $p$ to $Q$ is $\Delta S_{k}$, so the surface area of the typical band above is: 
$$\Delta S_{k} 2\pi f(x_{k})$$
So the surface area can be approximated by the following sum:
$$S\cong \sum ^{n}_{k=1} \Delta S_{k} 2\pi f(x_{k})$$
From the last lecture, we know that $$\Delta S_{k}=\Delta x_{k} \sqrt{1+(\frac{\Delta y_{k}}{\Delta x_{k}})^{2}}$$
So: 
$$S \cong \sum ^{n}_{k=1} (\Delta x_{k} \sqrt{1+(\frac{\Delta y_{k}}{\Delta x_{k}})^{2}}) 2\pi f(x_{k})$$

\end{frame}
\begin{frame}
Let $n \to \infty $ or $\Delta x_{k} \to 0$, then:
$$S=\lim_{n\to \infty} \sum ^{n}_{k=1} (\Delta x_{k} \sqrt{1+(\frac{\Delta y_{k}}{\Delta x_{k}})^{2}}) 2\pi f(x_{k})$$
As this is a Riemann sum: 
$$S=2\pi \int_{a}^{b} f(x)\sqrt{1+(\frac{dy}{dx})^{2}}dx$$
\end{frame}
\begin{frame}
\begin{example}
Find the area of the surface generated by revolving the curve $y=2\sqrt{x}$, $1\leq x\leq 2$, about the $x-$axis
\end{example}
\begin{center}
			\includegraphics[scale=0.25]{Figures/lec2001.pdf}
		\end{center}
\end{frame}
\begin{frame}
We evaluate the formula $$S=\int_{a}^{b} 2\pi y\sqrt{1+(\frac{dy}{dx})^{2}}$$
with: $$a=1, b=2, y=2\sqrt{x}, \quad \frac{dy}{dx}=\frac{1}{\sqrt{x}}$$ 
So: $$\sqrt{1+(\frac{dy}{dx})^{2}}=\sqrt{1+(\frac{1}{\sqrt{x}})^{2}}$$ $$=\sqrt{1+\frac{1}{x}}=\sqrt{\frac{x+1}{x}}=\frac{\sqrt{x+1}}{\sqrt{x}}$$
\end{frame}
\begin{frame}
So: $$S=\int_{1}^{2} 2\pi \cdot 2\sqrt{x} \cdot \frac{\sqrt{x+1}}{\sqrt{x}} dx=4\pi \int_{1}^{2} \sqrt{x+1} dx$$
$$=4\pi \cdot \frac{2}{3}(x+1)^{3/2}\Big ]^{2}_{1}=\frac{8\pi }{3}(3\sqrt{3}-2\sqrt{2})$$
\end{frame}
\begin{frame}
\begin{example}
A reflector is formed by rotating $y=\sqrt{x}$ between $x=0$ and $x=1$ about the $x-$axis. What is the surface area.
\end{example}
\begin{example}
Find the area of the surface generated by revolving the curve $y=\frac{x^{3}}{9}$ between $x=0$ and $x=2$  
\end{example}
\end{frame}
\begin{frame}

{\textcolor{red}{Centers of Mass:}}\\
\visible<2->{{\textcolor{red}{Masses Along a Line:}}\\
\begin{center}
			\includegraphics[scale=0.3]{Figures/lec7001.pdf}
		\end{center}}
\end{frame}
\begin{frame}
Each mass $m_{k}$ exerts a downward force $m_{k}g$.\\
Each of these forces has a tendency to turn the axis about the origin This turning effect is called a
torque.\\
The torque of each mass is: $$m_{k}gx_{k}$$
$$System \quad torque=m_{1}gx_{1}+m_{2}gx_{2}+m_{3}gx_{3}$$
$$=g\cdot (m_{1}x_{1}+m_{2}x_{2}+m_{3}x_{3})$$
The number $m_{1}x_{1}+m_{2}x_{2}+m_{3}x_{3}$ is called the moment of the system about the
origin.
 		
		
\end{frame}
\begin{frame}
We usually want to know where to place the fulcrum to make the system balance, that
is, at what point $\bar{x}$ to place it to make the torques add to zero.
\begin{center}
			\includegraphics[scale=0.3]{Figures/lec7002.pdf}
		\end{center}
		
\end{frame}
\begin{frame}
The torque of each mass about the fulcrum in this special location is: $$(x_{k}-\bar{x})m_{k}g$$
So the torque of the new system is $$\sum_{k=1}^{3}(x_{k}-\bar{x})m_{k}g$$
Then: $$\sum_{k=1}^{3}(x_{k}-\bar{x})m_{k}g=0 \Rightarrow g\sum_{k=1}^{3}(x_{k}-\bar{x})m_{k}=0$$

$$\Rightarrow \sum_{k=1}^{3}(m_{k}x_{k}-m_{k}\bar{x})=0 \Rightarrow \sum_{k=1}^{3} m_{k}x_{k}-\sum_{k=1}^{3} m_{k}\bar{x}=0$$

$$\Rightarrow \sum_{k=1}^{3} m_{k}x_{k}=\bar{x}\sum_{k=1}^{3} m_{k}\Rightarrow  \bar{x}=\frac{\sum_{k=1}^{3} m_{k}x_{k}}{\sum_{k=1}^{3} m_{k}}$$

\end{frame}
\begin{frame}
This last equation tells us to find $\bar{x}$ by dividing the system's moment about the origin by
the system's total mass:
$$\Rightarrow  \bar{x}=\frac{\sum_{k=1}^{3} m_{k}x_{k}}{\sum_{k=1}^{3} m_{k}}=\frac{system\enspace moment \enspace about \enspace origin }{system \enspace mass} $$
\end{frame}
\begin{frame}

{\textcolor{red}{Wires and Thin strips:}}\\
\begin{center}
			\includegraphics[scale=0.35]{Figures/lec7003.pdf}
		\end{center}
\end{frame}
\begin{frame}
$$\bar{x}\cong \frac{system \enspace moment}{system \enspace mass}$$
The system mass is $$\sum_{k=1}^{n} \Delta m_{k}$$
the moment of each piece $x_{k}\Delta m_{k}$, so $$ System \enspace moment \cong \sum_{k=1}^{n} x_{k}\Delta m_{k}$$
if the density of the strip at $x_{k}$ is $\delta(x_{k})$, expressed in terms of mass per unit
length and if $\delta$ is continuous, then $\Delta m_{k}$ is approximately equal to $\delta(x_{k}) \Delta x_{k}$:
$$\Delta m_{k} \cong \delta(x_{k}) \Delta x$$  
\end{frame}
\begin{frame}
Therefore:
$$\bar{x}\cong \frac{system \enspace moment}{system \enspace mass}\cong \frac{\sum_{k=1}^{n} x_{k} \Delta m_{k}}{\sum_{k=1}^{n} \Delta m_{k}}\cong \frac{\sum_{k=1}^{n} x_{k} \delta(x_{k}) \Delta x}{\sum_{k=1}^{n} \delta(x_{k})  \Delta x}$$
The sums is a Riemann sum so when $\Delta x\to 0$ or $n\to \infty$, then $$\bar{x}=\frac{\int_{a}^{b} x\delta(x)dx}{\int_{a}^{b} \delta(x)dx}$$
\end{frame}
\begin{frame}
\begin{example}
Show that the center of mass of a straight, thin strip or rod of constant density lies halfway
between its two ends.
\end{example}
\begin{center}
			\includegraphics[scale=0.35]{Figures/lec7004.pdf}
		\end{center}
\end{frame}
\begin{frame}
We model the strip as a portion of the x-axis from $x=a$ to $x=b$.
We know that $$\bar{x}=\frac{\int_{a}^{b} x\delta(x)dx}{\int_{a}^{b} \delta(x)dx}$$
the density is constant so $\delta(x)=\delta$. The numerator is: $$\int_{a}^{b} x\delta dx=\delta \int_{a}^{b} xdx=\delta \frac{1}{2}x^{2} \Big ]_{a}^{b}=\frac{\delta}{2} (b^{2}-a^{2})$$
The denominator is: $$\int_{a}^{b} \delta dx=\delta \int_{a}^{b} dx=\delta x \Big ]_{a}^{b}=\delta (b-a)$$
So: $$\bar{x}=\frac{\int_{a}^{b} x\delta(x)dx}{\int_{a}^{b} \delta(x)dx}=\frac{a+b}{2}$$
\end{frame}
\begin{frame}
When the density is constant, we call the center of mass the centroid of the object. To find the centroid we set $\delta=1$\\
 {\textcolor{red}{Centroid of a plane area:}}\\
 \begin{center}
			\includegraphics[scale=1.0]{Figures/lec7000.pdf}
		\end{center}

\end{frame}
\begin{frame}
Suppose the centroid of a typical strip is at $(x_{k},y_{k})$
Then: $$System \enspace mass\cong \sum_{k=1}^{n} \Delta m_{k}$$
The moments of the entire system about the two axes are: $$Moment \enspace about \enspace x-axis\cong \sum_{k=1}^{n} y_{k} \Delta m_{k}$$
$$Moment \enspace about \enspace y-axis\cong \sum_{k=1}^{n} x_{k} \Delta m_{k}$$


\end{frame}
\begin{frame}
The $x$-coordinate of the system's center of mass is defined to be:
$$\bar{x}=\frac{Moment \enspace about \enspace y-axis}{System \enspace mass}\cong \frac{\sum_{k=1}^{n} x_{k} \Delta m_{k}}{\sum_{k=1}^{n} \Delta m_{k}}$$
As $\delta=1$, $\Delta m_{k}=\Delta A_{k}=(f_{2}(x_{k})-f_{1}(x_{k}))\Delta x$. So:
$$\bar{x}\cong \frac{\sum_{k=1}^{n} x_{k} (f_{2}(x_{k})-f_{1}(x_{k}))\Delta x}{\sum_{k=1}^{n} (f_{2}(x_{k})-f_{1}(x_{k}))\Delta x}$$
The sums is a Riemann sum so when $\Delta x\to 0$ or $n\to \infty$, then $$\bar{x}= \frac{\int_{a}^{b} x (f_{2}(x)-f_{1}(x)) dx}{\int_{a}^{b} (f_{2}(x))-f_{1}(x)) dx}=\frac{\int_{a}^{b} x (f_{2}(x)-f_{1}(x)) dx}{A}$$
\end{frame}
\begin{frame}
The $y$-coordinate of the system's center of mass is defined to be:
$$\bar{y}=\frac{1}{2A}\int_{a}^{b}  \Big [(f_{2}(x))^{2}-(f_{1}(x))^{2}\Big ] dx$$
\begin{example}
Find the centroid of the area under the curve $y=\sqrt{x-2}$ between the lines $x=2$ and $x=5$
\end{example}
\end{frame}
\begin{frame}
$$Area=\int_{2}^{5} \sqrt{x-2} dx=\int_{2}^{5} (x-2)^{1/2} dx=\frac{(x-2)^{3/2}}{3/2}\Big ]_{2}^{5}$$ 
$$=\frac{2}{3}[(5-2)^{3/2}-(2-2)^{3/2}]=\frac{2}{3}3\sqrt{3}=2\sqrt{3}$$
the $x$ coordinate of the centroid is: $$\bar{x}=\frac{1}{A}\int_{2}^{5} x\sqrt{x-2} dx$$
Let $u=x-2$, so $x=u+2$ and $du=dx$ then: 
$$\int x\sqrt{x-2} dx=\int (u+2)\sqrt{u} du=\int u^{3/2}+2u^{1/2} du=\frac{u^{5/2}}{5/2}+2\frac{u^{3/2}}{3/2}+c$$ 
$$=\frac{2}{5}(x-2)^{5/2}+\frac{4}{3}(x-2)^{3/2}+c$$
\end{frame}
\begin{frame}
$$\bar{x}=\frac{1}{A}\int_{2}^{5} x\sqrt{x-2} dx=\frac{1}{2\sqrt{3}}\Big( \frac{2}{5}(x-2)^{5/2}+\frac{4}{3}(x-2)^{3/2}\Big ]_{2}^{5}\Big )=\frac{19}{5}$$
Also: 
$$\bar{y}=\frac{1}{2A}\int_{2}^{5} [f(x)]^{2} dx=\frac{1}{2A}\int_{2}^{5} (x-2) dx=\frac{1}{2A} (\frac{x^{2}}{2}-2x\Big ]_{2}^{5})$$ So $$\bar{y}=\frac{3\sqrt{3}}{8}$$
\end{frame}
\begin{frame}

{\textcolor{red}{Average value of a function over a range:}}\\
The average of $n$ numbers is:
$$\frac{1}{n} \sum_{i=1}^{n}x_{i}$$
\visible<2->{\begin{center}
			\includegraphics[scale=0.33]{Figures/lec8001.pdf}
		\end{center}}
\end{frame}
\begin{frame}
We divide $[a,b]$ into $n$ subintervals of equal width $\Delta x=(b-a)/n$.\\
The average of the $n$ sampled values is: $$\frac{f(c_{1})+f(c_{2})+\cdots +f(c_{n})}{n}=\frac{1}{n}\sum_{k=1}^{n} f(c_{k})$$ $$=\frac{\Delta x}{b-a}\sum_{k=1}^{n}f(c_{k})=\frac{1}{b-a}\sum_{k=1}^{n} f(c_{k})\Delta x$$
The average is obtained by dividing a Riemann sum for $f$ on $[a,b]$ by $(b-a)$, so $n\to \infty$ or $\Delta x\to 0$, we get: $$av(f)=\frac{1}{b-a}\int_{a}^{b} f(x) dx$$
\end{frame}
\begin{frame}


\begin{example}
Find the average value of $f(x)=\sqrt{4-x^{2}}$ on $[-2,2]$
\end{example}
\begin{center}
			\includegraphics[scale=0.33]{Figures/lec8002.pdf}
		\end{center}
		\end{frame}
\begin{frame}
The average of the function is: $$av(f)=\frac{1}{b-a}\int_{a}^{b} f(x) dx=\frac{Area}{b-a}$$
The area between the semicircle and the $x-$axis from $-2$ to $2$ can be computed using the geometry formula:
$$Area=\frac{1}{2}\cdot \pi r^{2}=\frac{1}{2}\cdot \pi (2)^{2}=2\pi$$
So the average value of $f$ is $$av(f)=\frac{1}{4}(2\pi)=\frac{\pi}{2}$$		
\end{frame}
\begin{frame}
It is sometimes convenient to use an alternative kind of average for the values of a function, $f(x)$, between $x=a$ and $x=b$. \\
The Root Mean Square Value provides a measure of central tendency for the numerical values of $f(x)$ and is defined to be the square root of the Mean Value of $f^{2}(x)$ from $x=a$ to $x=b$. Hence:
$$R.M.S=\sqrt{\frac{1}{b-a} \int_{a}^{b} [f(x)]^{2} dx}$$
\end{frame}
\begin{frame}
\begin{example}
An electric current $i(\theta)$ is given by $i(\theta)=I\sin (\theta)$ where $I$ is a constant. Find R.M.S of $i(\theta)$ over $0\leq \theta \leq 2\pi$
\end{example}
\visible<2->{$$R.M.S=\sqrt{\frac{1}{b-a} \int_{a}^{b} [f(x)]^{2} dx}$$ So 
$$R.M.S=\sqrt{\frac{1}{2\pi -0} \int_{0}^{2\pi } [I\sin \theta]^{2} d\theta}$$ Then:
$$[R.M.S]^{2}=\frac{1}{2\pi-0} \int_{0}^{2\pi} [I\sin \theta]^{2} d\theta=\frac{I^{2}}{2\pi} \int_{0}^{2\pi} \sin^{2} \theta d\theta$$}
\end{frame}
\begin{frame}
Recall $\sin^{2} \theta=\frac{1}{2} (1-\cos 2\theta)$, so $$[R.M.S]^{2}=\frac{I^{2}}{2\pi} \int_{0}^{2\pi} \frac{1}{2} (1-\cos 2\theta)  d\theta$$ So: $$[R.M.S]^{2}=\frac{I^{2}}{2\pi}  \frac{1}{2} (\theta-\frac{1}{2}\sin 2\theta)\Big ]_{0}^{2\pi}$$ Therefore $$[R.M.S]^{2}=\frac{I^{2}}{4\pi}\Big [(2\pi-\frac{1}{2}\sin (4\pi))-(0-\frac{1}{2}\sin (0))\Big ]$$ Then:$$[R.M.S]^{2}=\frac{I^{2}}{4\pi}(2\pi)=\frac{I^{2}}{2}\Rightarrow R.M.S=\frac{I}{\sqrt{2}}$$
\end{frame}
\begin{frame}
\begin{example}
Find the centroid of the area under the curve $y=2x$ between the lines $x=0$ and $x=1$
\end{example}
\end{frame}
\begin{frame}

{\textcolor{red}{Differential Equations:}}\\
\visible<2->{\begin{definition}
An equation involving a derivative is a differential equation. For example $$\frac{dy}{dt}=ky \enspace (\textcolor{red} {\star})$$
where $k$ is some constant and $y$ some function of $t$.
\end{definition}}
\visible<3->{{\textcolor{red}{Are there any solutions to the above equation?}}\\}
\visible<4->{Consider for instance $$y=e^{kt}$$
Then: $$\frac{dy}{dt}=ke^{kt}=ky$$ So $y=e^{kt}$ is a solution of $(\textcolor{red} {\star})$,} \visible<5->{ also $y=5e^{kt}$ satisfies the equation} \visible<6->{ so we see that $$y=Ae^{kt}$$ is a solution to $(\textcolor{red} {\star})$ for any constant $A$  }
\end{frame}
\begin{frame}

{\textcolor{red}{World Population:}}\\
\begin{example}
Suppose that the world population in $1960$ was $3.06$ billion, also suppose during this period the world population increased by $2\%$ per year. Calculate today's population.
\end{example}
\visible<2->{Strategy: Start with a simple model and modify it if necessary\\
Let $y(t)=$ world population at time $t$, measured in years.\\}
\visible<3->{ {\textcolor{red}{Malthusian Law:}}\\
 In $1798$ English economist Thomas Malthus suggested that the rate of change of a population is proportional to the size of the population. }
\visible<4->{\begin{definition}
 Malthusian Law: $$\frac{dy}{dt}=ky$$
 \end{definition} }
\end{frame}
\begin{frame}
This means that at time $t$ the world population is $$y=Ae^{kt}$$
for some constants $A,k$\\
Let's start time $t=0$ in $1960$, so $$y(0)=3.06 \enspace billion=Ae^{0k}=A \Rightarrow A=3.06 \enspace billion$$
$$y(1)=1.02 y(0)$$
$$y(2)=1.02 y(1)=(1.02)^{2} y(0)$$
$$y(3)=1.02 y(2)=(1.02)^{3} y(0)$$
So in general: $$y(t)=(1.02)^{t} y(0)\Rightarrow \frac{y(t)}{y(0)}=(1.02)^{t}=\frac{Ae^{kt}}{A}=e^{kt}$$
So $e^{k}=1.02$, therefore:$$\ln(e^{k})=\ln(1.02) \Rightarrow k\ln(e)=\ln(1.02)\Rightarrow k=\ln(1.02)=0.0198$$
So roughly $$k=0.02$$
\end{frame}
\begin{frame}
Therefore: $$y(t)=3.06e^{0.02t}$$
Now let's calculate today's population using our model. $$t=2017-1960=57$$
So: $$y=3.06e^{0.02 \times 57}=9.38 \enspace billion$$ 
\end{frame}
\begin{frame}
\begin{definition}
A {\bf differential equation} is an equation containing derivatives (we often write {\bf D.E.} for differential equation). For example: 
\begin{itemize}
\item $\frac{dy}{dx} = 2xy$
\item $\frac{d^2y}{dx^2}+5\frac{dy}{dx}-4y = e^x$
\end{itemize}
\end{definition}
\visible<2->{\begin{definition}
The {\bf order of a D.E.} is the order of the highest derivative in the D.E. For example:
\begin{itemize}
\item $\frac{dy}{dx} = 2xy$ is a first order differential equation
\item $\frac{d^2y}{dx^2}+5\frac{dy}{dx}-4y = e^x$ is a second order differential equation
\end{itemize} 
\end{definition}}
\end{frame}
\begin{frame}

{\textcolor{red}{Separable Differential Equations:}}
\begin{definition}
A first order D.E. of the form $$\frac{dy}{dx} = g(x)h(y)$$ is called a {\bf separable D.E.}\\
(where $g(x)$ is a function of $x$ and $h(y)$ is a function of $y$).
\end{definition}
\visible<2->{This D.E. can be solved as follows:\\
$$\frac{1}{h(y)} \frac{dy}{dx} = g(x) \Rightarrow \int \frac{1}{h(y)} dy = \int g(x) dx$$
Then integrate and solve for $y$ if possible.}
\end{frame}
\begin{frame}
\begin{example}
Solve the separable D.E. $$\frac{dy}{dx} = \frac{3x^2}{\sin y}$$
\end{example}
\visible<2->{$$\sin y dy = 3x^2 dx \Rightarrow \int \sin y dy = 3\int x^2 dx $$
$$\Rightarrow -\cos y = x^3 +C \Rightarrow \cos y = -x^3-C$$
$$\Rightarrow \cos ^{-1}(\cos y) = \cos ^{-1} (-x^3-C) \Rightarrow y=\cos^{-1}(-x^3-C)$$}
\end{frame}
\begin{frame}
\begin{example}
Solve the separable D.E. $$\frac{dy}{dx} = 1+y^{2}$$
Given that when $x=0$ then $y=0$
\end{example}
\visible<2->{$$\frac{1}{1+y^{2}}\frac{dy}{dx}=1\Rightarrow \int \frac{1}{1+y^{2}} dy=\int 1 dx$$
Let $y=\tan \theta$ so $dy=\sec^{2} \theta d\theta$. Therefore: 
$$\int \frac{1}{1+\tan^{2} \theta} \sec^{2} \theta d\theta=\int dx$$
$$\Rightarrow \int d\theta=\int dx$$ So: $$\theta=x+c$$}

\end{frame}
\begin{frame}
Now $x=0, y=0 \Rightarrow 0=\tan \theta \Rightarrow \theta=0$, thus $$0=0+c\Rightarrow c=0$$
Therefore $\theta=x$ and $y=\tan x$ is our solution.
\end{frame}
\begin{frame}

{\textcolor{red}{First Order Linear Differential Equations (The Integrating Factor Method):}}
\begin{definition}
A D.E. of the form $$\frac{dy}{dx} + P(x)y = Q(x)$$ is called a {\bf first order linear D.E.}, where $P(x)$ and $Q(x)$ are functions of $x$.
\end{definition}
We can find the general solution of this D.E. as follows:\\
1.) Find the {\bf integrating factor} $$e^{\int P(x)dx}$$
2.) Multiply the D.E. by the integrating factor (I.F.) to get:
$$e^{\int P(x)dx} \left( \frac{dy}{dx} + P(x)y \right) = e^{\int P(x) dx}Q(x) \enspace (\textcolor{red} {\star})$$

\end{frame}
\begin{frame}
3.) Note that the L.H.S. of $(\textcolor{red} {\star})$ equals:
$$\frac{d}{dx} (y e^{\int P(x)dx} )$$ So $(\textcolor{red} {\star})$ becomes:
$$d(ye^{\int P(x)dx}) = e^{\int P(x)dx} Q(x)dx$$
4.) Integrate both sides and solve for $y$.\\

This algorithm is called the {\bf integrating factor method}.
\end{frame}
\begin{frame}
\begin{example}
Solve the first order linear differential equation $$\frac{dy}{dx}-3y=0$$ using the integrating factor method.

\end{example}
\visible<2->{1.) $$I.F. = e^{\int P(x)dx} = e^{\int -3dx} = e^{-3x}$$
(note that we do not include the arbitrary constant $C$).\\
2.) Multiply the D.E. by the I.F. to get 
$$e^{-3x}(\frac{dy}{dx}-3y) = 0e^{-3x}\enspace (\textcolor{red} {\star})$$
3.) Recall that the L.H.S. of $(\textcolor{red} {\star})$ equals $$\frac{d}{dx}(ye^{-3x})$$}

\end{frame}
\begin{frame}
therefore $$\frac{d}{dx}(ye^{-3x}) = 0 \Rightarrow d(ye^{-3x}) = 0dx$$
4.) Integrate and solve for $y$:
$$\int d(ye^{-3x}) = \int 0dx
\Rightarrow ye^{-3x} = 0+C
\Rightarrow y=Ce^{3x}$$
\end{frame}
\begin{frame}

{\textcolor{red}{Last year exam Solutions:}}\\
{\textcolor{blue}{Question $1.(a). i$:}}\\
$$\lim_{x \to 1} \frac{x-1}{(\sqrt{x}-1)(x+2)}=\lim_{x \to 1} \frac{(\sqrt{x}-1)(\sqrt{x}+1)}{(\sqrt{x}-1)(x+2)}$$
$$=\lim_{x \to 1} \frac{\sqrt{x}+1}{x+2}=\frac{2}{3}$$ 
{\textcolor{blue}{Question $1.(a). ii$:}}\\
we apply L'H\^opital's Rule: 
$$\lim_{\theta \to 0}\frac{6\sin \theta}{\theta + 2\tan \theta}\overset{\mathrm{H}}=\lim_{\theta \to 0}\frac{6\cos \theta}{1 + 2\sec^{2} \theta}=\frac{6}{3}=2$$
\end{frame}
\begin{frame}

{\textcolor{blue}{Question $2.(a). i$:}}\\
The derivative of the function $f(x)$ with respect to the variable $x$ is the function $f'$ or $\frac{df}{dx}$ whose value at $x$ is $$f'(x)=\lim_{h \to 0} \frac{f(x+h)-f(x)}{h}$$
{\textcolor{blue}{Question $2.(a). ii$:}}\\
$$f'(x)=\lim_{h \to 0} \frac{f(x+h)-f(x)}{h}=\lim_{h \to 0} \frac{(x+h)^{2}+(x+h)-(x^{2}+x)}{h}$$
$$=\lim_{h \to 0} \frac{x^{2}+h^{2}+2xh+x+h-x^{2}-x}{h}=\lim_{h \to 0} \frac{h^{2}+2xh+h}{h}$$
$$=\lim_{h \to 0} (h+2x+1)=2x+1$$
\end{frame}
\begin{frame}

{\textcolor{blue}{Question $2.(b). i$:}}\\
$$f(x)=e^{\cos x^{2}} \sin x$$
$$\Rightarrow f'(x)=(e^{\cos x^{2}} \sin x)'=(e^{\cos x^{2}})' \sin x + e^{\cos x^{2}} (\sin x)' \enspace (\textcolor{red} {\star})$$
To differentiate $e^{\cos x^{2}}$ we use the chain rule: \\
Let $y=e^{\cos x^{2}}=e^{u}$, where $u=\cos x^{2}$, then by chain rule we have:  
$$y'=\frac{dy}{dx}=\frac{dy}{du}\cdot \frac{du}{dx}=e^{u} \cdot (\cos x^{2})'$$ 
To differentiate $\cos x^{2}$ we use the chain rule again:\\
 $u=\cos x^{2}=\cos v$, where $v=x^{2}$, then by chain rule we have:
 $$u'=\frac{du}{dx}=\frac{du}{dv}\cdot \frac{dv}{dx}=(-\sin v)(2x)=(-\sin x^{2})(2x)$$ 
\end{frame}
\begin{frame}
So $$(e^{\cos x^{2}})'=y'=e^{u} \cdot (-\sin x^{2})(2x)=(e^{\cos x^{2}})\cdot (-\sin x^{2})(2x)$$ Therefore
$$(\textcolor{red} {\star})=f'(x)=(e^{\cos x^{2}})\cdot (-\sin x^{2})(2x)\sin x + e^{\cos x^{2}} (\cos x)$$
\end{frame}
\begin{frame}

{\textcolor{blue}{Question $2.(b). iii$:}}\\
$$y=(\cos x)^{x}$$
$$\Rightarrow \ln y=\ln (\cos x)^{x} \Rightarrow \ln y= x \ln \cos x$$
$$\Rightarrow (\ln y)'= (x \ln \cos x)' \Rightarrow \frac{y'}{y}=1 \cdot \ln \cos x + x \cdot \frac{(\cos x)'}{\cos x}$$
$$\Rightarrow \frac{y'}{y}=\ln \cos x - \frac{x\sin x}{\cos x}$$
$$\Rightarrow y'=y\Big [ \ln \cos x - \frac{x\sin x}{\cos x}\Big ]=(\cos x)^{x}\Big [ \ln \cos x - \frac{x\sin x}{\cos x}\Big ]$$
\end{frame}
\end{document}