1

Came across this interesting question:

We are given $j$ balls. We put them into bins labelled $1$, $2$, and $3$ at random. We want to calculate P(all bins have at least a ball).

The approach I'm using is as follows:

Given $k$ balls, the probability that all bins are empty is: $\frac{^{K-1}C_2}{3^k}$.

In expectation, I'll get heads on the 2nd flip $(\frac{1}{\frac{1}{2}}) = 2$. Therefore, for the final answer, I can just plug in $k=2$.

  • Just so you know your last edit makes this question very confusing. Mainly because you suddenly start talking about heads in the last line which is mentioned nowhere before so its not at all clear why you are starting to talk about coin flips. Likewise the answers talk about this making it very confusing. Also there is a bit of confusion around j and k... – Chris Dec 29 '23 at 10:22
  • @Chris At the time of the answers, the problem was: $~~~~~$ We flip a fair coin until we obtain our first heads. If the first heads occurs on the kth flip, we are given k balls. We put them into 3 bins labelled 1, 2, and 3 at random. Find the probability that none of the three bins are empty. – user2661923 Dec 29 '23 at 17:12
  • To the OP (i.e. original poster): You have made a meaningful change to the posted question after receiving answers. This is discourteous, since it imposes the shooting gallery blues on the MathSE reviewers, asking them to hit a moving target. I request that you use my previous comment to re-edit your posted question, to restore the original question. Then, if you wish to ask a new question, make a brand new posting. – user2661923 Dec 29 '23 at 17:16
  • To the OP (i.e. original poster): I noticed that you posted a question following the answer of joriki, but you did not post a question following my answer. Does this mean that you are convinced that my answer is valid? If not, what question(s) do you have for me? Alternatively if you accept the answer as valid, this means that you accept that $~(1/10)~$ is the correct answer. This implies that you can sanity check your own work. If your work does not result in the answer of $~(1/10),~$ then it can not be correct. – user2661923 Dec 29 '23 at 17:22
  • To the OP The comment of @Chris bring up another subtle point. I agree with him that besides your altering the posted question, your analysis is confusing. Normally, it would be reasonable for you, as the OP to ask: where did I go wrong. However, in order for a MathSE reviewer to give an educational response to such a question, you must present your work in as crystal clear a fashion as is possible. This helps the reviewer diagnose your work line by line. – user2661923 Dec 29 '23 at 17:24

2 Answers2

6

We certainly get at least one ball and put it into one of the bins, leaving two empty bins.

Now there are three possible outcomes on each flip. With probability $\frac12$ we obtain heads and fail. With probability $\frac12\cdot\frac13=\frac16$ we get another ball and put it in the same bin, leaving the situation unchanged. With probability $\frac12\cdot\frac23=\frac13$ we get another ball and put it in one of the empty bins, leaving one empty bin. The probability that the third outcome occurs before the first outcome occurs is

$$ \frac{\frac13}{\frac13+\frac12}=\frac25\;. $$

So with probability $\frac25$ we reach the stage where only one bin is empty. The analysis for this stage is the same as for the stage with two empty bins, except now the probability for leaving the situation unchanged is $\frac12\cdot\frac23=\frac13$ and the probability for filling the empty bin is $\frac12\cdot\frac13=\frac16$. Thus, the probability (given we’ve reached this stage) of filling the empty bin before obtaining heads is

$$ \frac{\frac16}{\frac16+\frac12}=\frac14\;. $$

So the overall probability of completing both stages before we obtain heads is

$$ \frac25\cdot\frac14=\frac1{10}\;. $$

joriki
  • 238,052
  • Could you explain the formula where you get $\frac{2}{5}$ from? Why are we saying that $\frac{1}{3} + \frac{1}{2}$ is the probability for either outcome, since we could get a tails and land in the same bin, and then tails and in a different bin, which would lead to a high probability since it's more than one situation I think? – Robert Murray Dec 28 '23 at 21:27
  • 2
    @RobertMurray: There are three outcomes: fail, repeat, or succeed. We can ignore repeat, since it just leads back to the same situation, so we want the conditional probability for success given either success or failure. This is

    $$ \mathsf P(\text{success}\mid\text{success or failure})=\frac{\mathsf P(\text{success})}{\mathsf P(\text{success or failure})}=\frac{\mathsf P(\text{success})}{\mathsf P(\text{success})+\mathsf P(\text{failure})};. $$

    – joriki Dec 28 '23 at 23:21
  • 1
    +1 : Much more elegant than my answer. – user2661923 Dec 28 '23 at 23:25
2

Alternative approach

For $~n \in \Bbb{Z_{\geq 3}},~$ let:

  • $f(n)~$ denote the probability that the 1st head is on coin flip $~n.~$
    Then $~f(n) = 2^{-n}.$

  • $g(n)~$ denote the probability that none of the bins are empty, given that the 1st head occurred on coin flip $~n.$
    Then, by Inclusion Exclusion, which is also discussed here, you have that
    $\displaystyle g(n) = 1 - 3\left[ ~\frac{2^n}{3^n} ~\right] + 3\left[ ~\frac{1^n}{3^n} ~\right] = 1 - 3\left( ~\frac{2}{3} ~\right)^n + 3\left( ~\frac{1}{3} ~\right)^n.$

So, the overall computation is

$$\sum_{n=3}^\infty [ ~f(n) \times g(n) ~] $$

$$= \sum_{n=3}^\infty \left\{ ~2^{-n} \times \left[ ~1 - 3\left( ~\frac{2}{3} ~\right)^n + 3\left( ~\frac{1}{3} ~\right)^n ~\right] ~\right\} $$

$$= \sum_{n=3}^\infty \left[ \left( ~\frac{1}{2} ~\right)^n - 3\left( ~\frac{1}{3} ~\right)^n + 3\left( ~\frac{1}{6} ~\right)^n ~\right]. \tag1 $$

Note that for $~|x| < 1,~$ you have that

$$\sum_{n=3}^\infty x^n = x^3 \sum_{n=0}^\infty x^n = x^3 \times \left[ ~\frac{1}{1 - x} ~\right]. \tag2 $$

So, (1) above can be evaluated by using the formula in (2) above. Therefore, the probability is

$$\left[ ~\frac{1}{8} \times 2 ~\right] - 3 \left[ ~\frac{1}{27} \times \frac{3}{2} ~\right] + 3 \left[ ~\frac{1}{216} \times \frac{6}{5} ~\right]$$

$$= \left[ ~\frac{1}{4} ~\right] - \left[ ~\frac{1}{6} ~\right] + \left[ ~\frac{1}{60} ~\right]$$

$$= \frac{15 - 10 + 1}{60} = \frac{6}{60} = \frac{1}{10}.$$

user2661923
  • 35,619
  • 3
  • 17
  • 39