We have a cooler containing 2 cider bottles and n−2 beer bottles. We can sample from this cooler in two different ways:
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
- 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.
- What is E(X) if we use sampling with replacement?
- What is E(X) if we use sampling without replacement?
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