% vim: tw=50
% 01/02/2022 11AM

\subsubsection*{Properties}

\begin{itemize}
    \item $\PP(A \mid B) \ge 0$
    \item $\PP(B \mid B) = \PP(\Omega \mid B) =
        1$.
    \item $(A_n)$ disjoint events $\in
        \mathcal{F}$.
        \begin{claim*}
            $\PP \left( \bigcup_{n \ge 1} A_n \mid B
            \right) = \sum_{n \ge 1} \PP(A_n \mid
            B)$.
        \end{claim*}
        \begin{proof}
            \begin{align*}
                \PP \left( \bigcup_{n \ge 1} A_n
                \mid B \right)
                &= \frac{\PP \left( \left(
                \bigcup_{n \ge 1} A_n \right) \cap
                B \right)}{\PP(B)} \\
                &= \frac{\PP \left( \bigcup_{n \ge
                1} \left( A_n \cap B \right)
                \right)}{\PP(B)} \\
                &= \frac{\sum_{n \ge 1} \PP (A_n
                \cap B)}{\PP(B)} \\
                &= \sum_{n \ge 1} \PP(A \mid B)
            \end{align*}
        \end{proof}
\end{itemize}

\myskip
$\PP( \bullet \mid B)$ is a function from
$\mathcal{F} \to [0, 1]$ that satisfies the rules
to be a probability measure $\Omega$. Consider
$\Omega' = B$ (especially in finite / countable
setting), $\mathcal{F}' = \mathcal{P}(B)$. Then
$(\Omega', \mathcal{F}', \PP(\bullet \mid B))$
also satisfies the rules to be a probability
measure on $\Omega'$.
\[ \PP (A \cap B) = \PP(A) \PP(B \mid A) \]
\[ \PP(A_1 \cap A_2 \cap \cdots \cap A_n) =
\PP(A_1) \PP(A_2 \mid A_1) \PP(A_3 \mid A_1 \cap
A_2) \cdots \PP(A_n \mid A_1 \cap \cdots \cap A_{n
- 1}) .\]

\begin{example*}
    Uniform permutation $(\sigma(1), \sigma(2),
    \dots, \sigma(n)) \in \sum_n$.
    \begin{claim*}
        \[ \PP(\sigma(k) = i_k \mid \sigma(i) = i,
        \dots, \sigma(k - 1) = i_{k - 1}) = \begin{cases}
            0 & \text{if $i_k \in \{i_1, \dots,
            i_{k - 1}\}$} \\
            \frac{1}{n - k + 1} & \text{if
            $i_k \not\in \{i_1, \dots,
            i_{k - 1}\}$}
    \end{cases} \]
    \end{claim*}
    \begin{proof}
        \begin{align*}
            \PP (\sigma(k) = i_k \mid \sigma(i) =
            i, \dots, \sigma(k - 1) = i_{k - 1})
            &= \frac{\PP(\sigma(i) = i, \dots,
            \sigma(k) = i_k)}{\PP(\sigma(i) = i_1,
            \dots, \sigma(k - 1) = i_{k - 1})} \\
            &= \frac{0 \text{ or } \frac{(n -
            k)!}{n!}}{\frac{(n - k + 1)!}{n!}} \\
            &= \frac{(n - k)!}{(n - k + 1)!} \\
            &= \frac{1}{n - k + 1}
        \end{align*}
    \end{proof}
\end{example*}

\subsubsection*{Law of Total Probability and Bayes' Formula}

\begin{definition*}
    $(B_1, B_2, \dots) \subset \Omega$ is a
    \emph{partition} of $\Omega$ if:
    \begin{itemize}
        \item $\Omega = \bigcup_{n \ge 1} B_n$
        \item $(B_n)$ are disjoint
    \end{itemize}
\end{definition*}

\begin{theorem*}
    $(B_n)$ a finite countable partition of
    $\Omega$ with $B_n \in \mathcal{F}$ and for
    all $n$ $\PP(B_n) > 0$, then for all $A \in
    \mathcal{F}$:
    \[ \PP(A) = \sum_{n \ge 1} \PP(A \mid B_n)
    \PP(B_n) .\]
    (Sometimes known as ``Partition Theorem'').
\end{theorem*}

\begin{proof}
    Note that $\bigcup_{n \ge 1} (A \cap B_n) =
    A$.
    \[ \PP(A) = \sum_{n \ge 1} \PP(A \cap B_n) =
    \sum_{n \ge 1} \PP(A \mid B_n) \PP(B_n) .\]
\end{proof}

\begin{theorem*}[Bayes' Formula]
    \[ \PP(B_n \mid A) = \frac{\PP(A \cap
    B_n)}{\PP(A)} = \frac{\PP(A \mid B_n)
    \PP(B_n)}{\sum_{m \ge 1} \PP(A \mid B_m)
    \PP(B_m)} .\]
    Rephrasing for $n = 2$:
    \[ \PP(B \mid A) \PP(A) = \PP(A \mid B) \PP(B)
    = \PP(A \cap B) .\]
\end{theorem*}

\noindent
This allows us for example to calculate $\PP(B
\mid A)$ given $\PP(A)$, $\PP(A \mid B)$ and
$\PP(B)$.

\setcounter{customexample}{0}
\begin{example}
    Lecture course: $\frac{2}{3}$ probability that
    it is a weekday, and $\frac{1}{3}$ probability
    that it is a weekend.
    \[ \PP(\text{forget notes} \mid
    \text{weekday}) = \frac{1}{8} \]
    \[ \PP(\text{forget notes} \mid
    \text{weekend}) = \frac{1}{2} .\]
    What is $\PP(\text{weekend} \mid \text{forget
    notes})$?
    \[ B_1 = \{\text{weekend}\}, \qquad B_2 =
    \{\text{weekend}\}, \qquad A - \{\text{forget
    notes}\} .\]
    Law of Total Probability:
    \[ \PP( = \frac{2}{3} \times \frac{1}{8} +
    \frac{1}{3} \times \frac{1}{2} = \frac{1}{12}
    + \frac{1}{6} = \frac{1}{4} .\]
    Bayes':
    \[ \PP(B_2 \mid A) = \frac{\frac{1}{3} \times
    \frac{1}{2}}{\frac{1}{4}} = \frac{2}{3} .\]
\end{example}

\begin{example}
    Disease testing: probability $p$ that you are
    infected, probability $1 - p$ that you are
    not.
    \[ \PP(\text{tests positive} \mid
    \text{infected}) = 1 - \alpha \]
    \[ \PP(\text{test positive} \mid \text{not
    infected}) = \beta \]
    Ideally both $\alpha$, $\beta$ are small (and
    ideally $p$ is small).
    \[ \PP(\text{infected} \mid \text{test
    positive}) .\]
    Law of Total Probability:
    \[ \PP(\text{test positive}) = p(1 - \alpha) +
    (1 - p)\beta .\]
    Bayes':
    \[ \PP(\text{infected} \mid \text{positive}) =
    \frac{p(1 - \alpha)}{p(1 - \alpha) + (1 -
    p)\beta} .\]
    Suppose $p \ll \beta$. Then
    \[ p(1 - \alpha) \ll (1 - p) \beta \]
    Then
    \[ \PP(\text{infected} \mid \text{positive})
    \sim \frac{p(1 - \alpha)}{(1 - p)\beta} \]
\end{example}
