%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Lecture 8: Conditional Probability and Independence }
{\footnotesize Copyright, Michael Monagan and Jamie Mulholland, 2020.}

\vspace{3cm}

Grimaldi 3.6

\vspace{3cm}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
Example 1.  Let $S$ be the set of binary sequences of length 8. \\
Let $A \subset S$ be the sequences starting with 111. \\
Let $B$ be the sequences in $S$ with five 1's. \\
Suppose we pick $x$ from $A$ at random.  What is $Pr(B)$?

\vspace{10cm}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\begin{definition}[ Conditional Probability ]
Let $S$ be a sample space and $A$ and $B$ two subsets of $S$.
The {\bf conditional probability} of $B$ given/knowing $A$, denoted by $$Pr(B|A)$$
is the probability that a random outcome from $A$ also belongs to $B$.
It can be obtained by the formula $$Pr(B|A) = \frac{Pr(B \cap A)}{Pr(A)}.$$
\end{definition}

Example 2.  Assume two dice are rolled. What is the probability that, 
if they sum up to at least $9$ (event $A$) that both dice have the
same value (event $B$).

\vspace{8cm}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
Four consequences of $Pr(B|A) = Pr(B \cap A) / Pr(A)$.

\bigskip
1. Switching $A$ and $B$.

\vspace{1cm}

2. Multiplicative rule.
\vspace{1cm}

3. Law of total probability.

\vspace{2cm}

4. Bayes' Theorem.
\vspace{4cm}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
Example 3. \ Suppose 10\% of olympic cyclists use steroid $Z$
and the IOC develops a test for $Z$ with the following properties.

\bigskip

1. If a cyclist is taking $Z$ the probability they test positive is 0.99. \\
2. If they are not taking $Z$ the probability they test positive is 0.05.

\bigskip
{\bf Question:} If a randomly chosen cyclist tests positive for $Z$,
what is the probability they are taking steroid $Z$.

\vspace{8cm}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\begin{frame}
%Bayes' Theorem:  $\color{blue} \ds Pr(B|A) = \frac{Pr(A|B) Pr(B)}{ Pr(A) }.$
%
%\medskip
%Example 3 
%
%Suppose box 1 has 2 black balls and 3 white balls and box 2
%has 1 black ball and 1 white ball.  An box is chosen at random
%and a ball is drawn at random from it.  If the ball chosen
%is black, what is the probability that box 1 was chosen?
%
%\vspace{8cm}
%\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\begin{definition}[ Independent Events ]
Two events $A$ and $B$ are \textbf{independent} if either one of them has 
probability $0$ or both have positive probabily and
$$Pr(B|A) = Pr(B) ~~{\rm and}~~ Pr(A|B) = Pr(A).$$
\end{definition}

For example, if we toss a coin twice, the first toss is independent of the second.

\begin{theorem} Two events $A$ and $B$ are independent if and only if
$$Pr(A \cap B) = Pr(A)Pr(B).$$
\end{theorem}

\noindent
\textbf{Proof:}


\vspace{4cm}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}

Example 4. \  Suppose Alex tosses a fair coin 3 times.  Here the sample space
$S = \{ HHH, HHT, HTH, HTT, THH, THT, TTH, TTT \}$.  Consider the events

\bigskip
$A$: The first toss is a $H$: $A = \{HHH, HHT, HTH, HTT \}$. \\
$B$: The second toss is a $H$: $B = \{HHH, HHT, THH, THT \}$. \\
$C$: There are 2 or 3 heads: $C = \{HHH, HHT, HTH, THH \}$.

\bigskip
Are $A$ and $B$ independent?
\vspace{1.25cm}

Are $A$ and $C$ independent?
\vspace{1.25cm}

Are $A$ and $\bar B$ independent?
\vspace{2cm}

\end{frame}

