%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Beamer Presentation
% LaTeX Template
% Version 1.0 (10/11/12)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------------------------------
%	PACKAGES AND THEMES
%----------------------------------------------------------------------------------------

\documentclass[9pt]{beamer}
%\setbeamerfont{frametitle}{size=\normalsize}
\usepackage{tikz}
\usepackage{color, xcolor}
\usetikzlibrary{shapes, patterns}
%colorblind-friendly palette
\definecolor{dblue}{RGB}{51,34,136}
\definecolor{lblue}{RGB}{136,204,238}
\definecolor{green}{RGB}{17,119,51}
\definecolor{tan}{RGB}{221,204,119}
\definecolor{mauve}{RGB}{204,102,119}

\newcommand{\ds}{\displaystyle}
\newcommand{\dbox}[1]{\colorbox{tan}{\textbf{#1}}}
\usepackage{amsthm}
\theoremstyle{definition}
\newtheorem*{defn}{Definition}
\newtheorem*{convention}{Convention}
\newtheorem*{recall}{Recall}
\newtheorem*{thm}{Theorem}
\tikzstyle{vertex}=[shape=circle, minimum size=2mm, inner sep=0, fill]
\tikzstyle{opendot}=[shape=circle, minimum size=2mm, inner sep=0, fill=white, draw]
\newcommand{\axis}[2]{\draw[help lines, <->] (-#1,0)--(#1,0) node[right]{$x$};
\draw[help lines, <->] (0,-#2)--(0,#2) node[above]{$y$};}
\newcommand{\aaxis}[4]{\draw[help lines, <->] (-#1,0)--(#2,0) 
node[right]{$x$};
\draw[help lines, <->] (0,-#3)--(0,#4) node[above]{$y$};}

\usepackage{multicol}
\setlength{\columnsep}{1cm}

%\usepackage{enumitem, tablists, amsmath,vwcol}
\usepackage{amsmath,vwcol}


\mode<presentation> {

% The Beamer class comes with a number of default slide themes
% which change the colors and layouts of slides. Below this is a list
% of all the themes, uncomment each in turn to see what they look like.

%\usetheme{default}
%\usetheme{AnnArbor}
%\usetheme{Antibes}
%\usetheme{Bergen}
\usetheme{Berkeley}
%\usetheme{Berlin}
%\usetheme{Boadilla}
%\usetheme{CambridgeUS}
%\usetheme{Copenhagen}
%\usetheme{Darmstadt}
%\usetheme{Dresden}
%\usetheme{Frankfurt}
%\usetheme{Goettingen}
%\usetheme{Hannover}
%\usetheme{Ilmenau}
%\usetheme{JuanLesPins}
%\usetheme{Luebeck}
%\usetheme{Madrid}
%\usetheme{Malmoe}
%\usetheme{Marburg}
%\usetheme{Montpellier}
%\usetheme{PaloAlto}
%\usetheme{Pittsburgh}
%\usetheme{Rochester}
%\usetheme{Singapore}
%\usetheme{Szeged}
%\usetheme{Warsaw}

% As well as themes, the Beamer class has a number of color themes
% for any slide theme. Uncomment each of these in turn to see how it
% changes the colors of your current slide theme.

%\usecolortheme{albatross}
%\usecolortheme{beaver}
%\usecolortheme{beetle}
%\usecolortheme{crane}
%\usecolortheme{dolphin}
%\usecolortheme{dove}
%\usecolortheme{fly}
%\usecolortheme{lily}
%\usecolortheme{orchid}
%\usecolortheme{rose}
\usecolortheme{seagull}
%\usecolortheme{seahorse}
%\usecolortheme{whale}
%\usecolortheme{wolverine}
\setbeamercolor{alerted text}{fg=mauve}

\setbeamertemplate{footline} % To remove the footer line in all slides uncomment this line
%\setbeamertemplate{footline}[page number] % To replace the footer line in all slides with a simple slide count uncomment this line

\setbeamertemplate{navigation symbols}{} % To remove the navigation symbols from the bottom of all slides uncomment this line
}

\usepackage{graphicx} % Allows including images
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
\begin{document}

\section{1. Sets}
%----------------------------------------------------------------------------------------
\begin{frame}
For Sections 1.1-1.4, see the \href{http://www.math.ubc.ca/~elyse/220/2016/1Sets.pdf}{previous set of slides}.
\end{frame}
\subsection{1.1 Introduction to Sets}
\subsection{1.2 The Cartesian Product}
\subsection{1.3 Subsets}
\subsection{1.4 Power Sets}
\subsection{1.5 Union, Intersection, Difference}
\begin{frame}{Union, Intersection, a Difference}
We are familiar with unions, intersections, and differences of sets. Let's write them using set-builder notation.
\vfill

Suppose $A$ and $B$ are sets.
\begin{itemize}
\item $A \cup B = \{\onslide<2->{x:x \in A \mbox{ or } x \in B}\}$
\item $A \cap B = \{\onslide<3->{x: x \in A \mbox{ and } x \in B}\}$
\item $A - B = \{\onslide<4->{x:x\in A \mbox{ and } x \not\in B}\}$
\end{itemize}\vfill\color{mauve}

\onslide<5->{Suppose $|A|=5$ and $|B|=7$.
\begin{itemize}\color{mauve}
\item True or False: $|A \cup B|=12$\\
\onslide<6->{\textcolor{lblue}{False: depends on $A$ and $B$}}
\item True or False: $|B-A|=2$\\
\onslide<7->{\textcolor{lblue}{False: depends on $A$ and $B$}}
\item Suppose $|A \cap B|=0$. What is $|A \cup B|$?\\
\onslide<8->{\textcolor{lblue}{$|A \cup B|=12$}}
\end{itemize}}
\color{black}
\end{frame}
%-------------------------------------
\begin{frame}
Suppose $A = \{0,1,5\}$ and $B=\{1,3,5\}$.
\color{mauve}
\vfill
 What is $\mathcal P(A) \cap \mathcal P(B)$?\\
 
 \onslide<2->{\color{lblue} $\mathcal P(A) \cap \mathcal P(B) = \{\emptyset, \{1\},\{5\},\{1,5\}\}$}\onslide<3->{$=\mathcal P(A \cap B)$}
\vfill\color{mauve}
What is $(A \times B) \cap (B \times A)$?
\onslide<4->{\color{lblue}
$(A \times B) \cap (B \times A) = \{(1,5),(5,1),(1,1),(5,5)\}\onslide<5->{=(A \cap B) \times (A \cap B)}$\onslide<6->{$=(A \cap B)^2$}}
\color{black}
\end{frame}
\subsection{1.6 Complement}
\begin{frame}{Complement and Universal Set}
Suppose $F = \{5n:n \in \mathbb Z\}$. Name some stuff that is \emph{not} in $F$.\pause

We think of $F$ as a subset of $\mathbb Z$, or possibly of $\mathbb R$ or $\mathbb Q$.
\begin{defn} If we choose a \dbox{universal set} $U$ that $F$ lives in (that is, we choose any $U$ such that $F \subseteq U$), then the \dbox{complement} of $F$ is
\[\overline{F}=U - F\]
\end{defn}\pause
If we take our universal set to be $\mathbb Z$, then
\[\overline{F}=\mathbb Z - F=\pause\left\{n \in \mathbb Z : \frac{n}{5}\not\in \mathbb Z\right\}\]
\end{frame}
\subsection{1.7 Venn Diagrams}
\begin{frame}{Venn Diagram}
\begin{center}
$A = \{0,1,2\} \quad B  =\{1,2,3,4,5\}\quad
\onslide<8->{U=\mathbb N}$
\vfill
\begin{tikzpicture}
\onslide<9->{\draw[fill=green!20] (-4.75,-3.5) rectangle (5.5,3.25);
\draw (5,2.75)node{$\mathbb N$};}
\draw (2,0) node[shape=circle, inner sep=0, minimum size=6cm,fill=white]{};
\draw (-1.5,0) node[shape=circle, inner sep=0, minimum size=6cm, draw, fill=white, label=below:{$A$}]{};
\draw (2,0) node[shape=circle, inner sep=0, minimum size=6cm, draw, label=below:{$B$}]{};
\onslide<2>{
\draw (-1.5,0) node[shape=circle, inner sep=0, minimum size=6cm,label=below:{$A$}, fill,color=tan!15, opacity=0.5]{};
}
\onslide<3>{
\draw (2,0) node[shape=circle, inner sep=0, minimum size=6cm, label=below:{$B$}, fill,color=dblue!15, opacity=0.5]{};
}
\onslide<4>{\draw (.25,0) node{$A \cap B$};
\begin{scope}
\clip (-1.5,0) circle (3cm);
\draw (2,0) node[shape=circle, inner sep=0, minimum size=6cm, label=below:{$B$}, fill,color=dblue!50!tan, opacity=0.25]{};
\end{scope}}
\onslide<5->{
\draw (-2.25,0) node{0};}
\onslide<6->{
\draw (.25,-1) node{1};
\draw (.25,1) node{2};}
\onslide<7->{
\draw (2.5,-1.5) node{3};
\draw (2.5,0) node{4};
\draw (2.5,1.5) node{5};
}
\end{tikzpicture}
\end{center}
\vfill
\end{frame}
%-----------------------------------------
\begin{frame}{Using Venn Diagrams}
\centering
\begin{tikzpicture}
\draw (-1.5,0) node[shape=circle, inner sep=0, minimum size=4cm, draw,  label=below:{$A$}]{};
\draw (1.5,0) node[shape=circle, inner sep=0, minimum size=4cm, draw, label=below:{$B$}]{};
\onslide<2->{
\foreach \y in {-.75,0,.75}{
\draw[mauve] (-1,\y) node{a};
\draw[mauve] (-2,\y) node{a};}
\draw[mauve] (0,-.5) node{a};
\draw[mauve] (0,.5) node{a};
}
\onslide<3->{
\foreach \y in {-.5,0,.5}{
\draw[green] (1,\y) node{b};
\draw[green] (1.75,\y) node{b};
\draw[green] (2.5,\y) node{b};}}
\onslide<3,5->{
\draw[green] (0,-.65) node{b};
\draw[green] (0,.35) node{b};
}
\end{tikzpicture}
\vfill
\color{mauve}
Fact: $|A|+|B|=|A \cup B|+|A \cap B|$
\color{black}
\end{frame}
%-----------------------------------------
\begin{frame}
Which expressions are equivalent?
\begin{itemize}
\item $(A \cup B) \cap C$
\item $(A \cap B) \cup C$
\item $(A \cap B) - C$
\item $(A-C) \cap B$
\item $(B-C) \cap A$
\item $(A \cap C) \cup (B \cap C)$
\end{itemize}
\end{frame}
%-----------------------------------------

\begin{frame}
\begin{multicols}{2}
Which expressions are equivalent?
\begin{itemize}
\item $(A \cup B) \cap C$
\item $(A \cap B) \cup C$
\item \textcolor{mauve}{$(A \cap B) - C$}
\item \textcolor{mauve}{$(A-C) \cap B$}
\item \textcolor{mauve}{$(B-C) \cap A$}
\item $(A \cap C) \cup (B \cap C)$
\end{itemize}
\columnbreak
\begin{tikzpicture}
\foreach \x/\n in {0/A,1/B,2/C}{
	\draw (0,0)+(-120*\x+150:1cm) node(c\x){};}
%---finished picture
\onslide<2,6,8>{
\begin{scope}
\clip (c0) circle (1.25cm);
\draw[fill=mauve] (c1) circle(1.25cm);
\draw[fill=white] (c2) circle(1.25cm);
\end{scope}
}
%first one------
\onslide<3-4>{
\draw[mauve] (0,2.5) node{$A \cap B$};
\onslide<4>{
\draw[mauve] (.6,2.5) node{$-C$};}
\begin{scope}
\clip (c0) circle (1.25cm);
\draw[fill=mauve] (c1) circle(1.25cm);
\onslide<4->{
\draw[fill=white] (c2) circle(1.25cm);}
\end{scope}

}
%second one----
\onslide<5-6>{
\draw[mauve] (0,2.5) node{$(A -C)$};}
\onslide<6>{
\draw[mauve] (.7,2.5) node{$\cap B$};}
\onslide<5>{\draw[fill=mauve] (c0) circle (1.25cm);
\draw[fill=white] (c2) circle (1.25cm);
}
%third one----
\onslide<7-8>{
\draw[mauve] (0,2.5) node{$(B -C)$};}
\onslide<8>{
\draw[mauve] (.7,2.5) node{$\cap A$};}
\onslide<7>{
\draw[fill=mauve] (c1) circle (1.25cm);
\draw[fill=white] (c2) circle (1.25cm);

}
%labels------
\foreach \x/\n in {0/A,1/B,2/C}{
	\draw (0,0)+(-120*\x+150:2.5cm) node(n\x){$\n$};
	\draw (c\x) node[shape=circle, draw, inner sep=0, minimum size=2.5cm]{};}
\end{tikzpicture}
\end{multicols}

\end{frame}
%-----------------------------------------
\begin{frame}
\begin{multicols}{2}
Which expressions are equivalent?
\begin{itemize}
\item \textcolor{green}{$(A \cup B) \cap C$}
\item $(A \cap B) \cup C$
\item \textcolor{mauve}{$(A \cap B) - C$}
\item \textcolor{mauve}{$(A-C) \cap B$}
\item \textcolor{mauve}{$(B-C) \cap A$}
\item \textcolor{green}{$(A \cap C) \cup (B \cap C)$}
\end{itemize}
\columnbreak
\begin{tikzpicture}
\foreach \x/\n in {0/A,1/B,2/C}{
	\draw (0,0)+(-120*\x+150:1cm) node(c\x){};}
%---finished picture
\onslide<2,4,6>{
\begin{scope}
\clip (c2) circle (1.25cm);
\draw[fill=green] (c1) circle(1.25cm);
\draw[fill=green] (c0) circle(1.25cm);
\end{scope}
}
%first one------
\onslide<3-4>{
\draw[green] (0,2.5) node{$(A \cup B)$};}
\onslide<4>{
\draw[green] (.7,2.5) node{$\cap C$};}
\onslide<3>{
\begin{scope}
\draw[fill=green] (c0) circle (1.25cm);
\draw[fill=green] (c1) circle(1.25cm);
\end{scope}
}
%second one----
\onslide<5-6>{
\draw[green] (0,2.5) node{$(A\cap C)$};}
\onslide<6>{
\draw[green] (1.25,2.5) node{$\cup (B\cap C)$};}
\onslide<5>{
\begin{scope}
\clip (c0) circle (1.25cm);
\draw[fill=green] (c2) circle (1.25cm);
\end{scope}
}

%labels------
\foreach \x/\n in {0/A,1/B,2/C}{
	\draw (0,0)+(-120*\x+150:2.5cm) node(n\x){$\n$};
	\draw (c\x) node[shape=circle, draw, inner sep=0, minimum size=2.5cm]{};}
\end{tikzpicture}
\end{multicols}

\end{frame}%-----------------------------------------
\begin{frame}
\begin{multicols}{2}
Which expressions are equivalent?
\begin{itemize}
\item \textcolor{green}{$(A \cup B) \cap C$}
\item \textcolor{dblue}{$(A \cap B) \cup C$}
\item \textcolor{mauve}{$(A \cap B) - C$}
\item \textcolor{mauve}{$(A-C) \cap B$}
\item \textcolor{mauve}{$(B-C) \cap A$}
\item \textcolor{green}{$(A \cap C) \cup (B \cap C)$}
\end{itemize}
\columnbreak
\begin{tikzpicture}
\foreach \x/\n in {0/A,1/B,2/C}{
	\draw (0,0)+(-120*\x+150:1cm) node(c\x){};}
%---finished picture
{
\begin{scope}
\clip (c0) circle (1.25cm);
\draw[fill=dblue] (c1) circle(1.25cm);
\end{scope}
\draw[fill=dblue] (c2) circle(1.25cm);
}
%labels------
\foreach \x/\n in {0/A,1/B,2/C}{
	\draw (0,0)+(-120*\x+150:2.5cm) node(n\x){$\n$};
	\draw (c\x) node[shape=circle, draw, inner sep=0, minimum size=2.5cm]{};}
\end{tikzpicture}
\end{multicols}
\end{frame}
%-----------------------------------------
\begin{frame}
Group into collections of equivalent expressions:
\begin{itemize}
\item $\overline{A} \cup \overline B \cup \overline C$
\item $\overline{A \cup B \cup C}$
\item $\overline{A} \cap \overline{B} \cap \overline{C}$
\item $\overline{A \cap B \cap C}$
\end{itemize}
\begin{itemize}
\item $\overline{A \cup B} \cup \overline{C}$
\item $\overline A \cup \overline{B \cup C}$
\item $\overline{A \cup C}\cup \overline B$
\end{itemize}
\begin{itemize}
\item $\overline{A \cap B} \cap \overline C$
\item $\overline A \cap \overline{B \cap C}$
\item $\overline {A \cap C} \cap \overline B$
\end{itemize}
\end{frame}

%-----------------------------------------
\subsection{1.8 Indexed Sets}
%-----------------------------------------
\begin{frame}{Indexed Sets}
\begin{defn}
Let $\{A_1,\ldots,A_n\}$ be a collection of sets.
\[\ds\bigcup_{i=1}^n A_i = A_1 \cup \cdots \cup A_n = \{x: x \in A_i \mbox{ for some }i \in \{1,\ldots,n\}\}\]
\[\ds\bigcap_{i=1}^n A_i = A_1 \cap \cdots \cap A_n = \{x: x \in A_i \mbox{ for EVERY }i \in \{1,\ldots,n\}\}\]
Similar to sigma notation for sums, $\ds\sum_{i=1}^n a_i$
\end{defn}\pause
\begin{defn}
Let $I$ be a set, and for every $i \in I$, let $A_i$ be a set.
\[\ds\bigcup_{i \in I} A_i =  \{x: x \in A_i \mbox{ for some }i \in I\}\]
\[\ds\bigcap_{i\in I} A_i =  \{x: x \in A_i \mbox{ for EVERY }i \in I\}\]
\end{defn}
\end{frame}
%-----------------------------------------
\begin{frame}
Example: Let $\mathcal C$ be the set of all countries. For every $c \in \mathcal C$, let $A_c$ be the set of citizens of country $c$.\pause\vfill

Then $\ds\bigcup_{c \in \mathcal C}A_c$ is
\onslide<3->{the set of all people who are citizens of at least one country \onslide<4->{\\(so, all non-stateless people)}}\vfill

and $\ds\bigcap_{c \in \mathcal C}A_c$ is 
\onslide<5->{the set of all people who are citizens of \emph{every} country
\onslide<6->{\\(probably empty!)}}\vfill
\end{frame}
%-----------------------------------------
\begin{frame}{Let's Have some Fun}
\begin{itemize}
\color{mauve}
\item For every nonzero integer $i$, let 
$F_i=\left\{\dfrac{n}{i}:n \in \mathbb N\right\}$

$\ds\bigcup_{i \in \mathbb Z} F_i=$
\onslide<2->{\textcolor{lblue}{ $\mathbb Q - \{0\}$}}

\item For every real number $r$, let $P_r = \{(x,y):y< r\}$.

$\ds\bigcap_{r>0} P_r=$ 
\onslide<3->{\textcolor{lblue}{$\{(x,y):y \le 0\}$\\ (the half plane below and including the $x$-axis)}}

\item For every nonnegative $x$, let 
$S_x = [x,1]\times[0,x^2]$.\\
$\ds\bigcap_{x \in [0,1]}S_x=$ 
\onslide<4->{\textcolor{lblue}{$\{(1,0)\}$}}

\item For every nonnegative integer $i$, let $D_i$
be the collection of all numbers that can be written as a decimal (base 10) with $i$ digits after the decimal point.

$\ds\bigcup_{i \in \mathbb N \cup \{0\}}D_i$ 
\onslide<5->{\textcolor{lblue}{is all numbers that can be written as a finite decimal.\\
\onslide<6->{ This is a subset of the rationals, but does not include numbers like $\frac{1}{3}$.}}}\\
\onslide<7->{$\ds\bigcap_{i=a}^b D_i=\onslide<8->{D_a}$}
\end{itemize}
\color{black}
\end{frame}
%-----------------------------------------
\end{document} 