every experiment has anNow, we when perform an expriment, or something random happens, sometimes, the result (ie, the outcome) can beoutcome. We write an outcome section when we write a lab manual/lab record for a given experiment.

`event: outcome -> bool`

.
This is the same as being a subset of outcomes (the event is identified
with the set of outcomes it considers eventful), so we have `event ~= 2^outcomes`

.
- the box with the prize.
- the box chosen by the contestant.
- the box that was revealed.

- the prize is in box 2
- the player first picks box 1
- the assistant, Carol, reveals box 3.
- The contestant wins, because we're assuming the player switches. Hnce, theywill switch from their initial choice of (1) to (2).

- $(1, 2, 1)$ is not a sample point, because we can't reveal the box with the prize.
- $(2, 1, 1)$ is not a sample point, because we can't reveal the box the player chose.
- $(1, 1, 2), (1, 1, 3)$ is OK. The player chooses the correct box, carol reveals some box,and then the player switches.

```
(prize 1)
(prize 2)
(prize 3)
```

```
(prize 1
(choice 1)
(choice 2)
(choice 3))
(prize 2
(choice 1)
(choice 2)
(choice 3))
(prize 3
(choice 1)
(choice 2)
(choice 3))
```

```
(prize 1
(choice 1
(reveal 2)
(reveal 3))
(choice 2
(reveal 3))
(choice 3)
(reveal 2))
(prize 2
(choice 1
(reveal 3)
(choice 2
(reveal 1)
(reveal 3))
(choice 3)
(reveal 1))
(prize 3
(choice 1
(reveal 2))
(choice 2
(reveal 1))
(choice 3)
(reveal 1)
(reveal 2))
```

```
(prize 1
(choice 1
loss (reveal 2)
loss (reveal 3))
(choice 2
win (reveal 3))
(choice 3)
win (reveal 2))
(prize 2
(choice 1
win (reveal 3)
(choice 2
loss (reveal 1)
loss (reveal 3))
(choice 3)
win (reveal 1))
(prize 3
(choice 1
win (reveal 2))
(choice 2
win (reveal 1))
(choice 3)
loss (reveal 1)
loss (reveal 2))
```

This seems like it's 50/50! But what we're missing is the - For every outcome, the probability is between zero and one.
- The sum of all the probabilities is one.

- Carol put the prize uniformly randomly. Probability 1/3.
- No matter where the prize is, the player picks each box with probability 1/3.
- No matter where the prize is, the box that carol reveals will be picked uniformly randomly. Probability 1/2.

```
(prize 1 [1/3]
(choice 1 [1/3]
l (reveal 2) [1/2]
l (reveal 3)) [1/2]
(choice 2 [1/3]
w (reveal 3)) [1]
(choice 3) [1/3]
w (reveal 2)) [1]
(prize 2 [1/3]
(choice 1
w (reveal 3)
(choice 2
l (reveal 1)
l (reveal 3))
(choice 3)
w (reveal 1))
(prize 3 [1/3]
(choice 1
w (reveal 2))
(choice 2
w (reveal 1))
(choice 3)
l (reveal 1)
l (reveal 2))
```

- Probability for a sample point is the product of probabilities leadingto the outcome

```
(prize 1 [1/3]
(choice 1 [1/3]
l (reveal 2) [1/2]: 1/18
l (reveal 3)) [1/2]: 1/18
(choice 2 [1/3]
w (reveal 3)) [1]: 1/9
(choice 3) [1/3]
w (reveal 2)) [1]: 1/9
...
```

So the probability of winning is going to be $6 \times 1/9 = \frac{2}{3}$.
- For example, $E_l$ is the event that the person loses in Monty Hall.

- $P(\texttt{win with switch}) = P(\texttt{lose with stick})$.

- Dice $A$: $\{2, 6, 7\}$.

```
\ 2 /
\ /
6 \/ 7
||
```

it's the same on the reverse side. It's a fair dice. So the probability of
getting $2$ is a third. Similarly for $6, 7$.
- Dice $B$: $\{1, 5, 9 \}$.
- Dice $C$: $\{3, 4, 8 \}$.

- We both dice. The higher dice wins. Loser pays the winner a dollar.

- Dice $A$ followed by dice $C$:

```
(2
(3
4
8))
(6
(3
4
8))
(7
(3
4
8))
```

- Assign winning

```
(2
(3 C
4 C
8)) C
(6
(3 A
4 A
8)) C
(7
(3 A
4 A
8)) C
```

Each of the outcomes has a probability $1/9$, so dice $C$ wins.
`P(A|B)`

where both `A`

and `B`

are events, read as probability of `A`

given `B`

.
$P(A|B) \equiv \frac{P(A \cap B)}{P(B)}$

We know $B$ happens so we normalize by $B$. We then intersect $A$ with $B$
because we want both $A$ and $B$ to have happened, so we consider all outcomes
that both $A$ and $B$ consider eventful, and then reweigh the probability such
that our definition of "all possible outcomes" is simply "outcomes in $B$".
- A quick calculation shows us that $P(B|B) = P(B \cap B)/Pr(B) =1$.

$P(A \cap B) = P(B) P(A|B)$

follows from the definition by rearranging.
$P(A_1 \cap A_2 \dots A_n) = P(A_1) P(A_2 | A_1) P(A_3 | A_2 \cap A_1) P(A_4 | A_3 \cap A_2 \cap A_1) \dots P(A_n | A_1 \cap \dots \cap A_{n-1})$

```
(W1
(W2)
(L2
(W3
L3)))
(L1
(W2)
(L2
(W3
L3)))
(L1)
```

The product rule sneakily uses conditional probability! $P(W_1W_2) = P(W_1) P(W_2|W_1)$.
Etc, solve the problem.
$\begin{aligned}
P(A) = P(A|B) \text{(given)} \\
P(A) = P(A \cap B) / P(B) \text{(defn of computing $P(A|B)$)} \\
P(A) P(B) = P(A \cap B) \text{(rearrange)} \\
\end{aligned}$

- A = event coins match
- B = event that the first coin is heads.

$\forall x_1, x_2 \in \mathbb R, P(R_1 = x_1 | R_2 = x_2) = P(R_1 = x_1)$

Slogan: No value of $R_2$ can influence any value of $R_1$.

$P(R_1 = x_1 \land R_2 = x_2) = P(R_1 = x_1) P(R_2 = x_2)$