\documentclass[notes=show,10pt]{beamer}
\usepackage{mathpazo}			%% Beamer stuff
\usepackage{amsmath}			%% AMS math packages
\usepackage{amsfonts}			%%	-	special fonts
\usepackage{amssymb}			%%	-	special symbols
\usepackage{graphicx}			%% graphics
\usepackage{tcolorbox}			%% color boxes

\usepackage{hyperref}			%% for web links
\hypersetup{
%    bookmarks=true,         		% show bookmarks bar?
    unicode=false,          		% non-Latin characters in Acrobat’s bookmarks
    pdftoolbar=true,        		% show Acrobat’s toolbar?
    pdfmenubar=true,        	% show Acrobat’s menu?
    pdffitwindow=false,     		% window fit to page when opened
    pdfstartview={FitH},    		% fits the width of the page to the window
    pdfnewwindow=true,      	% links in new PDF window
    colorlinks=true,       			% false: boxed links; true: colored links
    linkcolor=blue,          		% color of internal links (change box color with linkbordercolor)
    citecolor=PineGreen,    		% color of links to bibliography
    filecolor=magenta,      		% color of file links
    urlcolor=cyan           		% color of external links
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		TiKZ Ploting Stuff
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{tikz}				%% TikZ -graphics

\usetikzlibrary{arrows, positioning, calc, intersections}
\usetikzlibrary{decorations.pathreplacing, decorations.markings}

\usepackage{pgfplots}			%% fancy plotting

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%	For 3d plotting, using the tikz-3dplot package so
%	that (x,y,z) coordinates are specified in normal order
%	and one can change the perspective for 3-d plots
%
%	To invoke, use
%
%	\begin{tikzpicture}[tdplot_main_coords,{other options}]
%		...
%	\end{tikzpicture}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{tikz-3dplot}		%% Enhanced 3d plotting

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		Package forest to draw tree diagrams for chain rule
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{forest}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%	adjustbox package to force minipage alignment
%
%	Two-column structure is
%
%	\adjustbox{valign=t}
%		{
%			\begin{minipage}{0.45\textwidth}
%			...
%			\end{minipage}
%		}
%	\adjustbox{valign=t}
%		{
%		
%			\begin{minipage}{0.45\textwidth}
%			...
%			\end{minipage}
%		}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{adjustbox}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		Set Beamer theme
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usetheme{Dresden}
\usecolortheme{dolphin}

%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		Hack to remove subsection bar from our
%		friends at Tex.StackExchange.Com
%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\beamer@theme@subsectionfalse

\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%
%		
%		Hack to make the nice little circles appear
%		from Tex.stackexchange.com
%
%		Reference: 
%
%		https://tex.stackexchange.com/questions/2072/beamer-navigation-circles-without-subsections
%
%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{remreset}
\makeatletter
\@removefromreset{subsection}{section}
\makeatother
\setcounter{subsection}{1}

%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		Get rid of triangles, put in circles for 
%		itemize items
%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{items}[circle]

%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		Clean up fonts
%
%%%%%%%%%%%%%%%%%%%%%%%%%%

\usefonttheme{professionalfonts}
\usefonttheme{serif}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		tikz plotting options
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\pgfplotsset{my style/.append style={axis x line=middle, axis y line=
           middle, xlabel={}, ylabel={}, axis equal }}
           
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		Math Operators
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\DeclareMathOperator{\comp}{comp}
\DeclareMathOperator{\proj}{proj}
\DeclareMathOperator{\Hess}{Hess}

\DeclareMathOperator{\curl}{curl}
\DeclareMathOperator{\diver}{div}
\DeclareMathOperator{\grad}{grad}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%	Document begins here...
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
           
\begin{document}

\input{213-Lecture-Macros}		%% 	macros, settings, et.c


\title{Math 213 - Double Integrals in Polar Coordinates}			%%	title page
\author{Peter A. Perry}
\institute{University of Kentucky}
\date{October 18, 2019}
\maketitle

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	
%	Due Date Reminders
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Reminders}

\begin{itemize}
\item	Homework B8 on Sections 15.1-15.2 is due tonight
\item	Happy Fall Break!
\end{itemize}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%	Unit Outline
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Unit III: Multiple Integrals, Vector Fields}
\begin{itemize}

\begingroup
\color{red}
\item[{}]			Double Integrals in Polar Coordinates
\endgroup
\item[{}]			Triple Integrals (Part I)
\item[{}]			Triple Integrals (Part II)
\item[{}]			Triple Integrals in Cylindrical Coordinates
\item[{}]			Triple Integrals in Spherical Coordinates
\item[{}]			Change of Variables, Part I
\item[{}]			Change of Variables, Part II

\medskip

\item[{}]			Vector Fields
\item[{}]			Line Integrals (Scalar functions)
\item[{}]			Line Integrals (Vector functions)

\medskip

\item[{}]			Exam III Review
\end{itemize}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%	Learning Goals
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Learning Goals}

\begin{frame}
\frametitle{Goals of the Day}
\begin{itemize}
\item		Review Polar Coordinates, introduce Polar Rectangles
\item		Learn how to compute double integrals over polar rectangles
\item		Learn how to compute double integrals over polar regions
\item		Learn to compute volumes using polar integrals
\end{itemize}
\end{frame}

\begin{frame}
\frametitle{Reality Check}
\footnotesize
\medskip

\begin{center}
{
\renewcommand{\arraystretch}{3}
\begin{tabular}{|l|l|l|}
\hline
	&	\textbf{Calculus I}	&	\textbf{Calculus III}	\\
\hline
Riemann sum		&	$\dsum_{i=1}^n f(x_i^*) \Delta x$	&	$\dsum_{i,j=1}^n f(x_i^*,y_j^*) \Delta A$\\
\hline
Riemann Integral	&	$\dint_a^b f(x) \, dx $	&	$\diint_D f(x,y) \, dA$	\\
\hline
Way of computing	&	$F(b) - F(a)$				&	Iterated Integral	\\
\hline
Interpretation			&	Area under a curve		&	Volume under a surface\\
\hline
\end{tabular}
}
\end{center}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		New material begins here...
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Learning Goals}

\begin{frame}
\frametitle{Goals of the Day}
\begin{itemize}
\item		Review Polar Coordinates, introduce Polar Rectangles
\item		Learn how to compute double integrals over polar rectangles
\item		Learn how to compute double integrals over polar regions
\item		Learn to compute volumes using polar integrals
\end{itemize}
\end{frame}

\begin{frame}
\frametitle{Reality Check}
\footnotesize
\medskip

\begin{center}
{
\renewcommand{\arraystretch}{3}
\begin{tabular}{|l|l|l|}
\hline
	&	\textbf{Calculus I}	&	\textbf{Calculus III}	\\
\hline
Riemann sum		&	$\dsum_{i=1}^n f(x_i^*) \Delta x$	&	$\dsum_{i,j=1}^n f(x_i^*,y_j^*) \Delta A$\\
\hline
Riemann Integral	&	$\dint_a^b f(x) \, dx $	&	$\diint_D f(x,y) \, dA$	\\
\hline
Way of computing	&	$F(b) - F(a)$				&	Iterated Integral	\\
\hline
Interpretation			&	Area under a curve		&	Volume under a surface\\
\hline
\end{tabular}
}
\end{center}
\end{frame}

\section{Polar Rectangles}

\begin{frame}
\frametitle{Review of Polar Coordinates}
\begin{minipage}{0.45\textwidth}
\begin{tikzpicture}[scale=0.75]
\draw[orange,thick,fill=orange!30]
	(0,0) circle(1cm);
\drawxy{2}
\node[above] at (1.5,1)	{\tiny{$x^2+y^2=1$}};
\end{tikzpicture}

\bigskip

\begin{tikzpicture}[scale=0.75]
\draw[orange,thick,fill=orange!30]
	(1.5,0)	arc(0:180:1.5)	
	--	(-0.75,0)
	--	(-0.75,0) arc(180:0:0.75)
	--	(1.5,0);
\drawxy{2}
\node[above] at (1.75,1)	{\tiny{$x^2+y^2=4$}};
\node[below]  at	(1,-0.5)	{\tiny{$x^2+y^2=1$}};
\draw[->,>=stealth]	(0.75,-0.5) -- (0.75,-0.1);
\end{tikzpicture}
\end{minipage}
\quad
\begin{minipage}{0.45\textwidth}
\footnotesize

\begin{center}
\begin{tikzpicture}[scale=0.5]
\draw		(0,0)	--	(4,0)	--	(4,3)	--	(0,0);
\node[below] 	at (2,0)		{\scriptsize{$x$}};
\node[right]  	at (4,1.5)	{\scriptsize{$y$}};
\node[left] 		at	(2,1.7)	{\scriptsize{$r$}};
\node 			at	(1,0.375)	{\scriptsize{$\theta$}};
\end{tikzpicture}
\end{center}

\bigskip

Recall that
$$ r^2 = x^2 + y^2, \quad \tan \theta = \frac{y}{x} $$
and
$$ x = r\cos\theta,\quad y  =r\sin \theta. $$

\bigskip

How would you describe the regions at left in polar coordinates?
\end{minipage}
\end{frame}

\begin{frame}
\frametitle{Polar Rectangles}
\begin{minipage}{0.35\textwidth}
\begin{tikzpicture}
\draw[thick,->,>=stealth]	(-0.5,0)	--(3,0);
\draw[thick,->,>=stealth]	(0,-0.5)	--(0,3);
\draw[dashed]	(0,0)	--	(30:1);
\draw[dashed]	(0,0)	--	(75:1);
\draw[orange,thick,fill=orange!30]
	(30:1)	--	(30:3) --
	(30:3) arc(30:75:3)	--	(75:1)	--
	(75:1) arc(75:30:1) -- cycle;
\uncover<2-3>
{
	\node at (52.5:0.75)	{\tiny{$r=a$}};
	\node at (52.5:3.3)	{\tiny{$r=b$}};
}
\only<2>
{
\draw[red,very thick]
	(30:1)	arc(30:75:1);
\draw[red,very thick]
	(30:3)	arc(30:75:3);
}
\only<3>
{
	\node at (22:2.5)		{\tiny{$\theta=\alpha$}};
	\node at (83:2.5)		{\tiny{$\theta=\beta$}};
}
\only<3>
{
\draw[red,very thick]	
	(30:1)	--	(30:3);
\draw[red,very thick]
	(75:1)	--	(75:3);
}
\uncover<4->
{
\foreach \theta in {30,37.5,45,52.5,60,67.5}
	\foreach \r in {1,1.25,1.5,1.75,2,2.25,2.5,2.75}
		{
			\draw[orange]
				(\theta:\r)	--	(\theta:{\r+0.25})	--
				(\theta:{\r+0.25}) arc (\theta:{\theta+7.5}:{\r+0.25})	--
				({\theta+7.5}:\r) --
				({\theta+7.5}:\r) arc ({\theta+7.5}:\theta:\r);
		}
}
\end{tikzpicture}
\end{minipage}
\quad
\begin{minipage}{0.55\textwidth}
\footnotesize
A \emph{polar rectangle} is a region 
$$ R = \{ (r,\theta): a \leq r \leq b, \quad \alpha \leq \theta \leq \beta\}.$$

\bigskip
\uncover<4->
{
Like an ordinary rectangle a polar rectangle can be divided into 
\emph{subrectangles}
}

\bigskip

\uncover<5->
{
A small polar rectangle has area
$$ \Delta A \simeq r \, \Delta r \, \Delta \theta $$

\bigskip
\begin{center}
\begin{tikzpicture}[scale=1.5]
\draw[orange,thick]		(45:2)	--	(45:3) arc (45:60:3)		--	(60:2)
	--	(60:2) arc(60:45:2);
\node[left] at (60:2.5)	{\tiny{$\Delta r$}};
\node	at	(53:2.2)	{\tiny{$r \Delta \theta$}};
\end{tikzpicture}
\end{center}
}
\end{minipage}
\end{frame}

\section{Integrals over Polar Rectangles}

\begin{frame}
\frametitle{Integrals Over Polar Rectangles}
\begin{minipage}{0.40\textwidth}
\begin{tikzpicture}[scale=0.95]
\draw[thick,->,>=stealth]	(-0.5,0)	--(3,0);
\draw[thick,->,>=stealth]	(0,-0.5)	--(0,3);

\draw[orange,thick,fill=orange!30]
	(30:1)	--	(30:3) --
	(30:3) arc(30:75:3)	--	(75:1)	--
	(75:1) arc(75:30:1) -- cycle;
\foreach \theta in {30,37.5,45,52.5,60,67.5}
	\foreach \r in {1,1.25,1.5,1.75,2,2.25,2.5,2.75}
		{
			\draw[orange]
				(\theta:\r)	--	(\theta:{\r+0.25})	--
				(\theta:{\r+0.25}) arc (\theta:{\theta+7.5}:{\r+0.25})	--
				({\theta+7.5}:\r) --
				({\theta+7.5}:\r) arc ({\theta+7.5}:\theta:\r);
		}
%%
\node at (52.5:0.75)	{\tiny{$r=a$}};
\node at (52.5:3.3)		{\tiny{$r=b$}};
%%
\node at (22:2.5)		{\tiny{$\theta=\alpha$}};
\node at (83:2.5)		{\tiny{$\theta=\beta$}};
%%
\draw[black,fill=black]	(41.25:2.375)	circle(0.03cm);
\draw[->,>=stealth]		(41.25:3.5)	--	(41.25:2.45);
\node[right]	at	(41.25:3.5)		{\scriptsize{$(r_i^*, \theta_j^*)$}};
\end{tikzpicture}
\end{minipage}
\quad
\begin{minipage}{0.50\textwidth}
\footnotesize
The double integral $\diint_R f(x,y) \, dA$ is a limit of Riemann sums: 
$$ \sum_{i,j=1}^n  f(r_i^* \cos \theta_j^*,  r_i^* \sin \theta_j^*) {\color{red}r_j} \, \Delta r \, \Delta \theta$$
Rectangle $R_{ij}$ is given by
$$ R_{ij} = \{(r,\theta): r_{i-1} \leq r \leq r_i, \theta_{j-1} \leq \theta \leq \theta_j \}$$
$$r_i = a + i \Delta r \quad, \theta_j = \alpha + j \Delta \theta$$
where
$$ \Delta r = \frac{b-a}{n}, \quad \Delta \theta = \frac{\beta-\alpha}{n}$$

In the limit this leads to an iterated integral 
$$ \int_\alpha^\beta \, \int_a^b f(r\cos\theta, r\sin\theta) \, {\color{red}r} \, dr \, d\theta $$
\end{minipage}
\end{frame}

\begin{frame}
\frametitle{Integrals Over Polar Rectangles}
\footnotesize
\begin{center}
\fcolorbox{cyan}{white}
{
\begin{minipage}{0.85\textwidth}
{\textbf{\color{cyan} Double Integral In Polar Coordinates}}
The integral of a continuous function $f(x,y)$ over a polar rectangle $R$ 
given by $a \leq r \leq b$, $\alpha \leq r \leq \beta$, is
$$ \iint_R f(x,y) \, dA = \int_\alpha^\beta \, \int_a^b f(r\cos\theta,r\sin\theta) \, {\color{red} r} \, dr \, d\theta$$
\end{minipage}
}
\end{center}

\medskip

\hrulefill

\medskip

\begin{enumerate}
\item	Find $\diint_R (2x-y) \, dA$ if $R$ is the region in the first quadrant bounded by the circle $x^2+y^2=4$ and the lines $x=0$ and $y=x$.

\medskip

\item	Find $\diint_R e^{-x^2-y^2} \, dA$ if $D$ is the region bounded by the semicircle $x=\sqrt{4-y^2}$ and the $y$-axis.


\end{enumerate}

\end{frame}

\section{Integrals Over Polar Regions}

\begin{frame}
\frametitle{Integrals over Polar Regions}
\begin{minipage}{0.35\textwidth}
\begin{tikzpicture}[scale=0.8]
\draw[thick,->,>=stealth]	(-0.5,0)	--(3,0);
\draw[thick,->,>=stealth]	(0,-0.5)	--(0,3);
\draw[orange,thick]
	plot[domain=20:65,variable=\theta,samples=20,smooth]
		(	
			{(1+0.15*sin(4*(\theta-20)))*cos(\theta)},
			{(1+0.15*sin(4*\theta-20)))*sin(\theta)}		
		)	
	--	(65:2.5)
	--	plot[domain=65:20,variable=\theta,samples=20,smooth]
		(
			{(2.5 + 0.50*sin(4*(\theta-65)))*cos(\theta)},
			{(2.5 + 0.50*sin(4*(\theta-65)))*sin(\theta)}
		)
	--	(20:1);
\node[right] at (17:1.5)	{\tiny{$\theta=\alpha$}};
\node[left]	at	(65:2.1)	{\tiny{$\theta=\beta$}};
\node at (42.5:0.5)		{\tiny{$h_1(\theta)$}};
\node at (42.5:2.5)		{\tiny{$h_2(\theta)$}};
\end{tikzpicture}

\bigskip

\uncover<2->
{
\begin{tikzpicture}[scale=1.4]
\draw[densely dashed,gray]
	plot[domain=0:360,variable=\theta,samples=50,smooth]
		({cos(3*\theta)*cos(\theta)},{cos(3*\theta)*sin(\theta)});
\draw[orange,thick,fill=orange!20]
	plot[domain=-30:30,variable=\theta]
		({cos(3*\theta)*cos(\theta)},{cos(3*\theta)*sin(\theta)});
\drawxy{1.2}
\end{tikzpicture}
}
\end{minipage}
\quad
\begin{minipage}{0.55\textwidth}
\footnotesize
If $f$ is continuous over a polar region of the form
$$ D = \{ (r,\theta): \alpha \leq \theta \leq \beta, \, h_1(\theta) \leq r \leq h_2(\theta) \} $$
then
\begin{multline*} \iint_D f(x,y) \, dA = \\ \int_\alpha^\beta \, \int_{h_1(\theta)}^{h_2(\theta)}	
	f(r\cos \theta, r\sin\theta) \, {\color{red} r} \, dr \, d\theta
\end{multline*}

\bigskip

\hrulefill

\medskip


\uncover<2->
{
Find the area of one loop of the rose $$r=\cos3\theta$$
}
\end{minipage}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		Finish with examples eg. 15.3.19, 15.3.25, 15.3.29, 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Volumes}

\begin{frame}
\frametitle{Volumes of Solids}
\begin{minipage}{0.4\textwidth}
\begin{tikzpicture}[scale=0.5]
\begin{axis}[colormap/cool]
	\addplot3[surf,domain=-6:6]{x^2+y^2};
	\addplot3+[blue,thick,no markers,samples=50,samples y=0,domain=0:360,variable=\theta]
	({5*cos(\theta)},{5*sin(\theta)},0);
	\addplot3[surf,domain=-6:6]{x^2+y^2};
	\addplot3+[blue,opacity=0.8,dashed,no markers,samples=50,samples y=0,domain=0:360,variable=\theta]
	({5*cos(\theta)},{5*sin(\theta)},25);
\end{axis}
\end{tikzpicture}
\end{minipage}
\quad
\begin{minipage}{0.5\textwidth}
\footnotesize
Find the volume under the paraboloid $$z=x^2+y^2$$
and above the disc $$x^2+y^2 < 25$$

\bigskip

\begin{enumerate}
\item	Describe the disc in polar coordinates
\item	Transform $f(x,y)$ to polar coordinates
\end{enumerate}

\end{minipage}
\end{frame}

\begin{frame}
\frametitle{Volumes of Solids}
\begin{minipage}{0.4\textwidth}
\begin{tikzpicture}[scale=0.5]
\begin{axis}[colormap/cool]
	\addplot3[surf,z buffer=sort,domain=2:4,y domain=0:360,samples=30]
		({x*cos(y)},{x*sin(y)},{sqrt(16-x^2)});
	\addplot3[surf,z buffer=sort,domain=0:3.464,y domain=0:360]
		({2*cos(y)},{2*sin(y)},{x});
\end{axis}
\end{tikzpicture}
\end{minipage}
\quad
\begin{minipage}{0.5\textwidth}
\footnotesize
Find the volume inside the sphere $$x^2 + y^2 + z^2 = 16$$ and outside
the cylinder $$x^2+y^2 = 4$$
\end{minipage}
\end{frame}

\end{document}
