layer_one other_layer
1 V V
2 V C
3 C C
OI, Ch. 3
2026-02-27
Suppose you have three two-layer cakes:



You cut the top layer and peek inside. It’s vanilla!
Q. What is the probability that when you cut through the bottom layer, that layer will also be vanilla?
library(tidyverse)
n <- 1000000
sim <- menu |>
sample_n(size = n, replace = TRUE) |>
mutate(
cake_order = sample(c("layer_one_top", "other_layer_top"),
size = n,
replace = TRUE),
peek = ifelse(cake_order == "layer_one_top",
as.character(layer_one),
as.character(other_layer)),
full_cut = ifelse(cake_order == "layer_one_top",
as.character(other_layer),
as.character(layer_one))
) layer_one other_layer cake_order peek full_cut
1 V V other_layer_top V V
2 V V other_layer_top V V
3 C C layer_one_top C C
4 V C other_layer_top C V
5 C C other_layer_top C C
6 V V other_layer_top V V
7 V V other_layer_top V V
8 C C layer_one_top C C
9 C C other_layer_top C C
10 V C other_layer_top C V
Let \(A, B\) be two events. Then:
\(A\) and \(B\) are independent if and only if:
Note that this implies \(\mathrm{P}(A \text{ and } B) = \mathrm{P}(A) \times \mathrm{P}(B)\)
\[ \mathrm{P}(A|B) = \frac{\mathrm{P}(B|A) \times \mathrm{P}(A)}{\mathrm{P}(B)} \]
When my daughter was a baby I noticed her hair whorl swirled counterclockwise (CCW). It turns out that CCW whorls are less common than clockwise (CW) whorls. Further, whorl direction and handedness have been found to be associated (Klar, 2003)! I wondered, given that my baby had a CCW whorl, what was the chance she’d be left-handed?
So, given that my baby had a CCW whorl, what was the chance she’d be left-handed? We need \(\mathrm{P}(A|B)\)
\[ \mathrm{P}(A|B) = \frac{\mathrm{P}(B|A) \times \mathrm{P}(A)}{\mathrm{P}(B)} = \frac{.45 \times .12}{.23} = .235 \]