Sampling with and without replacement

heathend0

New member
Joined
Apr 5, 2020
Messages
8
We have a cooler containing 2 cider bottles and n−2 beer bottles. We can sample from this cooler in two different ways:
  • with replacement: We take a uniformly-random bottle from the cooler, look at it and put it back.
  • without replacement: We take a uniformly-random bottle from the cooler, drink it, and throw the empty bottle into the recycling bin.
Suppose we repeatedly sample from the cooler and let X be the number of samples up to and including the first cider bottle.
  1. What is E(X) if we use sampling with replacement?
  2. What is E(X) if we use sampling without replacement?
(This question highlights a fact that beer, whisky, and wine connoisseurs know intuitively: sampling without replacement is more fun, but makes things harder to compute!)


OK so here is what I did for parts 1 and 2.

1. For each test, the probability of getting a cider is 2/n (and the probability of NOT getting a cider is (n - 2)/n).
E(X) = 1/(2/n) = n/2

2. For the first test, the probability of getting a cider is 2/n
The probability of getting a cider on the second try is (n - 2)/n × (2)/(n - 1)
The probability of getting a cider on the third try is (n - 2)/n × (n - 3)/(n - 1) × (2)/(n - 2).
And so on...

I admit here that I couldn't find a nice formula for this one, but I worked some figures on a spreadsheet and theorize that the expected number of trials is
E(X) = (n + 1)/3.

is my computation O.K? thanks
 
Your working with replacement is correct.

Without replacement we have

[MATH]P[\text{cider on $k$th bottle}] = \dfrac{\dbinom{n-2}{k-1}}{\dbinom{n}{k-1}} \dfrac{2}{n-k+1},~k\in 1,2,\dots, n[/MATH]
Mathematica wouldn't produce a closed formula for the expectation but looking at the graph

[MATH]E[X] = \dfrac{n+1}{3}[/MATH]
as you computed. Well done.
 
Your working with replacement is correct.

Without replacement we have

[MATH]P[\text{cider on $k$th bottle}] = \dfrac{\dbinom{n-2}{k-1}}{\dbinom{n}{k-1}} \dfrac{2}{n-k+1},~k\in 1,2,\dots, n[/MATH]
Mathematica wouldn't produce a closed formula for the expectation but looking at the graph

[MATH]E[X] = \dfrac{n+1}{3}[/MATH]
as you computed. Well done.

Perfect thank you!
 
Top