diff --git a/source/notes/week01.ptx b/source/notes/week01.ptx index 6f7e5f3..20a03ea 100644 --- a/source/notes/week01.ptx +++ b/source/notes/week01.ptx @@ -16,286 +16,507 @@ Tuesday 1/13 -

- In calculus, you mostly asked deterministic questions about functions. - In science experiments, you need to take randomness into account. -

+ + Sec 1.1: Sets - - -

- A toxin molecule in a cell has a certain chance each minute to leave the cell. -

-
-
+

+ In prior math courses, you mostly asked deterministic questions. + Now, we need new tools to model randomness. +

- - -

- A patient takes a diagnostic test for a disease and wants to know the chance that they have the disease based on the test result. -

-
-
- - - -

- Based on historical year-over-year population growth rate data for a particular species, what is a reasonable range for next year's population? -

-
-
- - - -

- The sample space, often denoted \Omega, is the set of all possible results of an experiment. - A single result is called an outcome, while a collection of results is called an event. -

-
-
- - - -

- Let A be a set. - The symbol \in means "is an element of", as in a \in A. - Given another set B, we say A is a subset of B, written A\subset B, to mean that every element of the set A is also an element of the set B. -

-
-
- - - -

- An experiment consists of rolling a standard 6-sided die. - The sample space is \Omega = \{1, 2, 3, 4, 5, 6\}. - One possible event is A = \{2, 4, 6\}, i.e., the event that the result of the roll is even. -

-
-
- - - -

- Consider sets A and B, each contained inside \Omega. - We can combine sets in a variety of ways:

-
  • - Union - -

    - The union of A and B is the set A \cup B = \{x \mid x \in A \text{ or } x \in B\}. -

    -
  • - -
  • - Intersection - -

    - The intersection of A and B is the set A \cap B = \{x \mid x \in A \text{ and } x \in B\}. -

    -
  • - -
  • - Difference - -

    - The set difference A-B is the set A - B = \{x \mid x \in A \text{ and } x \notin B\}. -

    -
  • - -
  • - Complement - -

    - The complement of A is the set A^c = \{x \in \Omega \mid x \notin A\}. -

    -
  • - -
  • - Empty Set - -

    - The empty set, usually written \emptyset or \{\}, is the set which contains no elements. -

    -
  • -
    -

    -
    -
    - -

    - It's useful sometimes to draw pictures called Venn diagrams representing sets: -

    - -
    - Example Venn Diagram - - + +

    - Venn diagram showing sets A, B, C with the region representing (A\cup B\cup C) - (A \cap C) shaded. + A toxin molecule in a cell has a certain chance each minute to leave the cell.

    -
    - + + + + + +

    + A patient takes a diagnostic test for a disease and wants to know the chance that they have the disease based on the test result. +

    +
    +
    + + + +

    + The sample space, often denoted \Omega, is the set of all possible results of an experiment. + A single result is called an outcome, while a collection of results is called an event. +

    +
    +
    + + + +

    + An experiment consists of rolling a standard 6-sided die (D6). + The sample space is \Omega = \{1, 2, 3, 4, 5, 6\}. + One possible event is A = \{2, 4, 6\}, i.e., the event that the result of the roll is even. +

    +
    +
    + +

    + Note: we'll use notation like D6 to indicate a 6-sided die with faces 1, 2, 3, 4, 5, 6. + Similarly, for example, D4 will indicate a 4-sided die with faces 1, 2, 3, 4. +

    + + + +

    + The symbol \in means "is an element of", as in 4 \in A. +

    + +

    + The symbol \subset means "is a subset of", as in A \subset \Omega. + This means that every element of the set A is also an element of the set \Omega. +

    +
    +
    + + + +

    + Consider sets A and B, each contained inside \Omega. + We can combine sets in a variety of ways:

    +
  • + Union + +

    + The union of A and B is the set A \cup B = \{x \mid x \in A \text{ or } x \in B\}. +

    +
  • + +
  • + Intersection + +

    + The intersection of A and B is the set A \cap B = \{x \mid x \in A \text{ and } x \in B\}. +

    +
  • + +
  • + Difference + +

    + The set difference A-B is the set A - B = \{x \mid x \in A \text{ and } x \notin B\}. +

    +
  • + +
  • + Complement + +

    + The complement of A is the set A^c = \{x \in \Omega \mid x \notin A\}. +

    +
  • + +
  • + Empty Set + +

    + The empty set, usually written \emptyset or \{\}, is the set which contains no elements. +

    +
  • +
    +

    +
    +
    + +

    + It's useful sometimes to draw pictures called Venn diagrams representing set interactions. +

    + + + +
    + Union + + +

    + Venn diagram showing sets A, B with the region representing A \cup B shaded. +

    +
    + \begin{tikzpicture} - \def\firstcircle{(90:1.75cm) circle (2.5cm)} - \def\secondcircle{(210:1.75cm) circle (2.5cm)} - \def\thirdcircle{(330:1.75cm) circle (2.5cm)} + \def\firstcircle{(180:1.75cm) circle (2.5cm)} + \def\secondcircle{(0:1.75cm) circle (2.5cm)} \fill[gray!30] \firstcircle; \fill[gray!30] \secondcircle; - \fill[gray!30] \thirdcircle; + \draw \firstcircle node[text=black,left] {$A$}; + \draw \secondcircle node [text=black,right] {$B$}; + \end{tikzpicture} + + +
    + +
    + Intersection + + +

    + Venn diagram showing sets A, B with the region representing A \cap B shaded. +

    +
    + + \begin{tikzpicture} + \def\firstcircle{(180:1.75cm) circle (2.5cm)} + \def\secondcircle{(0:1.75cm) circle (2.5cm)} + \fill[white] \firstcircle; + \fill[white] \secondcircle; \begin{scope} \clip \firstcircle; - \clip \thirdcircle; - \fill[white] \firstcircle; + \clip \secondcircle; + \fill[gray!30] \firstcircle; \end{scope} - \draw \firstcircle node[text=black,above] {$A$}; - \draw \secondcircle node [text=black,below left] {$B$}; - \draw \thirdcircle node [text=black,below right] {$C$}; - \node at (0, -4.5) {$(A\cup B\cup C) - (A \cap C)$}; + \draw \firstcircle node[text=black,left] {$A$}; + \draw \secondcircle node [text=black,right] {$B$}; \end{tikzpicture} - - -
    +
    + +
    + -

    - Next, we want to start assigning probabilities to each individual outcome so we can then find the probabilities of events. -

    + +
    + Difference + + +

    + Venn diagram showing sets A, B with the region representing A - B shaded. +

    +
    + + \begin{tikzpicture} + \def\firstcircle{(180:1.75cm) circle (2.5cm)} + \def\secondcircle{(0:1.75cm) circle (2.5cm)} + \fill[gray!30] \firstcircle; + \fill[white] \secondcircle; + \draw \firstcircle node[text=black,left] {$A$}; + \draw \secondcircle node [text=black,right] {$B$}; + \end{tikzpicture} + + +
    - - -

    - An experiment consists of rolling a standard 6-sided die. - The sample space is \Omega = \{1, 2, 3, 4, 5, 6\}. - We might assign probabilities as follows: -

    +
    + Complement + + +

    + Venn diagram showing set A \subset \Omega with the region representing A^c shaded. +

    +
    + + \begin{tikzpicture} + \def\firstcircle{(0, 0) circle (2.5cm)} + \fill [gray!30] (-4, -3) rectangle (5, 3); + \fill[white] \firstcircle; + \draw \firstcircle node[text=black] {$A$}; + \draw (-4, -3) rectangle (5, 3) node [text=black,right] {$\Omega$}; + \end{tikzpicture} + + +
    +
    + +
    - - Distribution for a fair die + + Sec 1.2: Probability - - - x - \Pr(x) - +

    + Next, we want to start assigning probabilities to each individual outcome so we can then find the probabilities of events. +

    - - 1 - 1/6 - + + +

    + An experiment consists of rolling a D6. + The sample space is \Omega = \{1, 2, 3, 4, 5, 6\}. + We might assign probabilities as follows: +

    - - 2 - 1/6 - +
    + Distribution for a fair die - - 3 - 1/6 - + + + x + \Pr(x) + - - 4 - 1/6 - + + 1 + 1/6 + - - 5 - 1/6 - + + 2 + 1/6 + - - 6 - 1/6 - - -
    + + 3 + 1/6 + -

    - Note that we don't have to assign the same probability to each outcome. - If we do, we call this distribution uniform. - If we have some event, such as A = \{2, 4, 6\}, then we calculate the probability of the event by adding together the probabilities of the outcomes that make up the event: - - \Pr(A) = \Pr(2) + \Pr(4) + \Pr(6) = \frac{1}{6} + \frac{1}{6} + \frac{1}{6} = \frac{3}{6} = \frac{1}{2} - - Note that this is the same result that we would get if we counted the total number of outcomes in A and divided by the total number of outcomes in \Omega. -

    - - + + 4 + 1/6 + - - -

    - Given a finite set A, the cardinality of A, written |A|, is the number of elements in A. -

    -
    -
    + + 5 + 1/6 + - - -

    - If \Omega is a finite probability space with the uniform distribution and A \subset \Omega is an event, then: - - \Pr(A) = \frac{|A|}{|\Omega|} - -

    -
    -
    + + 6 + 1/6 + + + - - -

    - Suppose we have a weighted die that's much more likely to come up 6 than any other outcome. -

    +

    + Note that we don't have to assign the same probability to each outcome. + If we do, we call this distribution uniform. + If we have some event, such as A = \{2, 4, 6\}, then we calculate the probability of the event by adding together the probabilities of the outcomes that make up the event: + + \Pr(A) = \Pr(2) + \Pr(4) + \Pr(6) = \frac{1}{6} + \frac{1}{6} + \frac{1}{6} = \frac{3}{6} = \frac{1}{2} + + Note that this is the same result that we would get if we counted the total number of outcomes in A and divided by the total number of outcomes in \Omega. +

    +
    +
    - - Distribution for a fair die + + +

    + Given a finite set A, the cardinality of A, written |A|, is the number of elements in A. +

    +
    +
    - - - x - \Pr(x) - + + +

    + If \Omega is a finite probability space with the uniform distribution and A \subset \Omega is an event, then: + + \Pr(A) = \frac{|A|}{|\Omega|} + +

    +
    +
    - - 1 - 0.1 - + + +

    + Suppose we have a weighted die that's much more likely to come up 6 than any other outcome. +

    - - 2 - 0.1 - +
    + Distribution for a fair die - - 3 - 0.1 - + + + x + \Pr(x) + - - 4 - 0.2 - + + 1 + 0.1 + - - 5 - 0.1 - + + 2 + 0.1 + - - 6 - 0.4 - - -
    + + 3 + 0.1 + -

    - With this distribution, if A = \{2, 4, 6\}, then: - - \Pr(A) = 0.1 + 0.2 + 0.4 = 0.7 \neq \frac{3}{6}. - -

    - - + + 4 + 0.2 + + + + 5 + 0.1 + + + + 6 + 0.4 + + + + +

    + With this distribution, if A = \{2, 4, 6\}, then: + + \Pr(A) = 0.1 + 0.2 + 0.4 = 0.7 \neq \frac{3}{6}. + +

    + + + + + +

    + Pick a number from 1 to 10. + What is the probability of picking 3? +

    + +

    + Some considerations: +

      +
    1. +

      + Are we using the uniform distribution? +

      +
    2. + +
    3. +

      + What even is the sample space here? Do we need to pick only integers, or is \pi an outcome here? +

      +
    4. + +
    5. +

      + What would "uniform" mean if the sample space was infinite? +

      +
    6. +
    +

    +
    +
    + + + +

    + A probability distribution on a sample space \Omega assigns probabilities to every event, satisfying the following conditions: +

      +
    1. +

      + \Pr(\Omega) = 1. +

      +
    2. + +
    3. +

      + 0 \leq \Pr(A) \leq 1 for any event A. +

      +
    4. + +
    5. +

      + If A \cap B = \emptyset, then \Pr(A\cup B) = \Pr(A) + \Pr(B). +

      +
    6. +
    +

    +
    +
    + + + +

    + Suppose we flip a coin until we see heads. + The sample space is \Omega = \{H, TH, TTH, TTTH, \dotsc\}. + What would "uniform" mean here? Is there any way we could assign the same probability to each individual outcome here? +

    + +

    + Instead of "uniform", what if we want to treat the coin as a fair coin? Then what would the distribution be? +

    + + + Distribution assuming a fair coin + + + + x + # flips + \Pr(x) + + + + H + 1 + 1/2 + + + + TH + 2 + 1/4 + + + + TTH + 3 + 1/8 + + + + TTTH + 4 + 1/16 + + + + \vdots + + \vdots + + + + T\dotsm TH + n + 1/2^n + + + + \vdots + + \vdots + + +
    +
    +
    + + + +

    + One last (very useful!) observation. + Recall: If A\cap B = \emptyset, then \Pr(A\cup B) = \Pr(A) + \Pr(B). +

    + +

    + For any event A, A\cap A^c = \emptyset and A \cup A^c = \Omega. + So: + + 1 = \Pr(\underbrace{A \cup A^c}_{\Omega}) = \Pr(A) + \Pr(A^c). + + We can rewrite this in two useful ways: + + \Pr(A) \amp = 1 - \Pr(A^c) + \Pr(A^c) \amp = 1 - \Pr(A) + +

    +
    +
    +