Stats 100A Hw1
Stats 100A Hw1
Problem 1 Suppose a population has N people. Among them, N1 are males, and N0 are females.
Among the males, T1 are taller than 6 feet. Among the females, T0 are taller than 6 feet. Suppose
we randomly sample a person from the population. Let A be the event that the person is male.
Let B be the event that the person is taller than 6 feet.
Using the numbers N , N1 , N0 , T1 , T0 , calculate or prove the following:
(1) Calculate P (A), P (B), P (A|B), P (B|A), P (A ∩ B).
A: P (A) = |A|/|Ω| = N1 /N . P (B) = |B|/|Ω| = T /N , where T = T1 + T0 . P (A|B) =
|A ∩ B|/|B| = T1 /T . P (B|A) = |A ∩ B|/|A| = T1 /N1 . P (A ∩ B) = |A ∩ B|/|Ω| = T1 /N .
(2) Show that P (A ∩ B) = P (A)P (B|A) = P (B)P (A|B). This is called chain rule.
A: P (A∩B) = T1 /N . P (A)P (B|A) = (N1 /N )(T1 /N1 ) = T1 /N . P (B)P (A|B) = (T /N )(T1 /T ) =
T1 /N .
(3) Show that P (B) = P (A)P (B|A) + P (Ac )P (B|Ac ). This is called rule of total probability.
A: P (B) = T /N . P (A) = N1 /N . P (B|A) = T1 /N1 . P (Ac ) = N0 /N . P (B|Ac ) = T0 /N0 .
P (A)P (B|A) + P (Ac )P (B|Ac ) = N1 /N × T1 /N1 + N0 /N × T0 /N0 = (T1 + T0 )/N = T /N = P (B).
(4) Show that
P (A ∩ B) P (A)P (B|A)
P (A|B) = = .
P (B) P (A)P (B|A) + P (Ac )P (B|Ac )
This is called the Bayes rule.
A: P (A|B) = T1 /T . P (A ∩ B) = T1 /N . P (B) = T /N . P (A ∩ B)/P (B) = T1 /T . The last
equation comes from (2) and (3).
Problem 2 Suppose we generate X and Y from the uniform distribution over [0, 1] independently,
i.e., (X, Y ) is a random point within the unit square [0, 1]2 .
(1) Calculate P (X 2 + Y 2 ≤ 1) by measuring the area.
A: Let A = {(x, y) : x2 + y 2 ≤ 1}.
|A| π/4 π
P (X 2 + Y 2 ≤ 1) = = =
|Ω| 1 4
(2) Suppose we repeat the experiment n times. For large n, how often X 2 + Y 2 ≤ 1? Suppose
it happens m times. Can you approximate π based on m and n?
A:
m π 4m
≈ =⇒ π ≈
n 4 n
(3) Calculate P (X ≥ 1/2) and P (X ≥ 1/2|X + Y ≥ 1).
A: Let A = {(x, y) : x ≥ 1/2}, and B = {(x, y) : x + y ≥ 1}.
|A| 1
P (X ≥ 1/2) = =
|Ω| 2
|A ∩ B| 1/2 − 1/2 · 1/2 · 1/2 3
P (X ≥ 1/2|X + Y ≥ 1) = = =
|B| 1/2 4
(4) Let A be the event that X ∈ [.2, .6], and let B be the event that Y ∈ [.3, .5]. Show that
P (A ∩ B) = P (A)P (B).
1
A: P (A) = .4. P (B) = .2. P (A ∩ B) = .4 × .2 = .8.
Problem 3 (Optional) Read the following webpages on Buffon’s needle:
https://mste.illinois.edu/activity/buffon/
https://yihui.org/animation/example/buffon-needle/
Write a brief memo on (1) how to calculate the probability in the simplest case, (2) how to
estimate π using Monte Carlo.