Random Variables and Expectation
Videos
- Introducing Random Variables (9:50)
- Distributions of Random Variables (14:52)
- Expectation of Random Variables (18:40)
Reading
- Connecting Discrete Mathematics and Computer Science by David Liben-Nowell, Chapter 10, pages 54-71
Warmup
Problem 1
Note: This problem is based on Problems 10.119 and 10.120 from Connecting Discrete Mathematics and Computer Science by David Liben-Nowell.
Suppose that we have the following six-sided die with unusual faces:
- Blue die: 3, 3, 3, 3, 3, 6
- Red die: 2, 2, 2, 5, 5, 5
- Green die: 1, 4, 4, 4, 4, 4
Each of these die are fair in the sense that each face is equally likely to come up when the die is rolled.
Let \(B\) be a random variable describing the outcome of rolling the blue die, \(R\) be a random variable describing the outcome of rolling the red die, and \(G\) be a random variable describing the outcome of rolling the green die.
Part A
Show that \(\mathbb{E}[B] = \mathbb{E}[R] = \mathbb{E}[G]\).
Part B
Show that \(\mathbb{P}(B>R) \geq \frac{1}{2}\), \(\mathbb{P}(R>G) \geq \frac{1}{2}\), and \(\mathbb{P}(G>B) \geq \frac{1}{2}\).
Hint: For the first item, consider the two scenarios \(B = 3\) and \(B = 6\) separately, and combine them using the law of total probability.
Part C
Write a few sentences describing what is surprising about your result from Part B. You may find it interesting to make an analogy to the “game” of rock-paper-scissors.
Problem 2
Suppose that I have a coin with probability of heads equal to \(p\). I flip the coin until I see the first \(H\) (each flip is independent). Let random variable \(X\) be the number of tails I see before the first \(H\).
Part A
Write a formula for \(\mathbb{P}(X = k)\) for \(k = 0, 1, 2, \ldots\) in terms of \(k\) and \(p\).
Part B
Write a formula for \(\mathbb{P}(X \geq k)\) for \(k = 0, 1, 2, \ldots\) in terms of \(k\) and \(p\).
Part C
Compute the value of \(\mathbb{E}(X)\) in terms of \(p\).
- Hint: Use Theorem 10.18 in Liben-Nowell.
- Hint: The geometric series identity states that \[ \begin{aligned} \sum_{k = 0}^\infty r^k = \frac{1}{1 - r} \quad \text{for any} |r| < 1. \end{aligned} \]
Part D
Write a function that simulates the coin-flipping process and returns the value of \(X\). Your function should accept \(p\) as an argument. Choose \(p = 0.3\). Call your function \(1,000\) times; compute the average of the results; and then compare to \(p\).
© Phil Chodrow, 2024