%\documentclass[c]{beamer}

%\usecolortheme{whale}


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

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


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

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

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


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



\setbeamertemplate{theorems}[numbered]



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



\usepackage{ifthen}

% This is the file main.tex


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

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

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

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

\input{def}

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



 




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


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


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

\begin{frame}

{\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}
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}
\begin{example}
Solve the first order linear differential equation $$\frac{dy}{dx}-y=e^{x}$$ using the integrating factor method.

\end{example}
1.) $$I.F. = e^{\int P(x)dx} = e^{\int -1dx} = e^{-x}$$
(note that we do not include the arbitrary constant $C$).\\
2.) Multiply the D.E. by the I.F. to get 
$$e^{-x}(\frac{dy}{dx}-y) = e^{x}\cdot e^{-x}\enspace (\textcolor{red} {\star})$$
3.) Recall that the L.H.S. of $(\textcolor{red} {\star})$ equals $$\frac{d}{dx}(ye^{-x})$$
\end{frame}
\begin{frame}
therefore $$\frac{d}{dx}(ye^{-x}) = 1 \Rightarrow d(ye^{-x}) = 1dx$$
4.) Integrate and solve for $y$:
$$\int d(ye^{-x}) = \int 1dx
\Rightarrow ye^{-x} = x+C
\Rightarrow y=xe^{x}+c$$
\end{frame}
\begin{frame}
\begin{example}
Solve the first order linear differential equation $$\frac{dy}{dx}+2xy=x$$ using the integrating factor method.

\end{example}
\begin{enumerate}
\item Note that $P(x) = 2x$ while $Q(x) = x$.
\item $$I.F. = e^{\int P(x)dx} = e^{\int 2x dx} = e^{x^2}$$
(note that we do not include the arbitrary constant $C$).\\
\item Multiply the D.E. by the I.F. to get 
\begin{equation*}
\begin{split}
%$$
e^{x^2}(\frac{dy}{dx}+2xy) = e^{x^2}x = 
\frac{d}{dx}\left(ye^{x^2}\right) 
%$$
%$$
\end{split}
\end{equation*}
\end{enumerate}
\end{frame}
\begin{frame}
\begin{equation*}
\begin{split}
&\implies ye^{x^2} = \int e^{x^2}x dx = e^{x^2}/2 + C\\
&\implies y = \frac{e^{x^2}/2 + C}{e^{x^2}} = \frac{e^{x^2} + C}{2e^{x^2}}
\end{split}
\end{equation*}
\begin{example}
Solve the first order linear differential equation
 $$\frac{dy}{dx}+\frac{2y}{x}=\frac{\sin x}{x^2}$$
\end{example}
$P(x) = 2/x$; $Q(x) = (\sin x)/ x^2$, so we have 
\begin{equation*}
\begin{split}
& \int P(x) dx = \int \left(\frac{2}{x}\right)dx = 
2\int \left(\frac{1}{x}\right)dx
=2\log x = \log (x^2)
\end{split}
\end{equation*}
\end{frame}
\begin{frame}
\begin{equation*}
\begin{split}
& \mbox{Integrating Factor } = e^{\int P(x) dx} = e^{\log (x^2)} = x^2\\
&\implies x^2\left[\frac{dy}{dx}+\frac{2y}{x}\right] 
=
x^2\left[\frac{\sin x}{x^2}\right]\\
&\implies \frac{d}{dx}\left(yx^2\right) = \sin x\\
&\implies yx^2 = \int \sin x dx = -\cos x + C\\
&\implies y = \frac{-\cos x + C}{x^2}\\
\end{split}
\end{equation*}
\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}