# Distributing 5 distinct balls into 3 distinct boxes

Suppose $$5$$ distinct balls are distributed into $$3$$ distinct boxes such that each of the $$5$$ balls can get into any of the $$3$$ boxes. What is the Probability that exactly one box is empty. Also What is the best Probability that all the boxes are occupied.

For the first part my answer comes out to be $$\frac{3\cdot2^5}{3^5}$$
Logic: $$3$$ choices for each ball $$= 3^5$$.

And $$3$$ ways of choosing the box that will be empty ; Each balls has then $$2$$ choices of going in remaining of the $$2$$ boxes.

Is it correct?

For the Second Part, I think Collectors Problem will be used. Can anyone please confirm it?

P. S I am new here so any feedback regarding the way of putting questions is welcome :).

• The substance of your post is fine. It's a courtesy to other contributors to learn and use MathJax to format your question. – Robert Shore Feb 16 '19 at 6:15
• This tutorial explains how to use MathJax to typeset mathematics on this site. – N. F. Taussig Feb 16 '19 at 10:30

Your solution is not quite correct because you are counting some possibilities where two of the boxes are empty. Your denominator is indeed $$3^5 = 243$$. If Box $$1$$ is to be empty, then there are $$2^5=32$$ ways to distribute the $$5$$ balls among the other two boxes. But two of those combinations (all balls in Box $$2$$ and all balls in Box $$3$$) are forbidden, so there are only $$30$$ ways for Box $$1$$ to be the only empty box. Multiply this by $$3$$ to get $$90$$ "winning" combinations and we end up with $$10/27 = 0.\overline{370}$$ as your probability.

To determine the probability that there are no empty boxes, I'd just figure out the number of combinations that leave at least one empty box. We already know that $$90$$ possible combinations leave exactly one box empty, and there are exactly $$3$$ ways to leave two boxes empty. So that leaves $$243-93=150$$ combinations with no empty boxes, and the probability that no boxes are empty is $$50/81 \approx 0.617$$.

Not a solution but a sanity check on Robert's answer using R statistical software to simulate this:

urn<-c(1,2,3)
u<-replicate(10^6,length(unique(sample(urn,5,repl=T))))
mean(u==2)

> 0.370469

mean(u==3)

> 0.617385


Both agree up to $$3$$ decimal places.