# What is the expected number of full holes out of $b$ holes if I randomly throw $f$ balls

The question in the title is answered in two different places that give out different results and I if someone could explain why the results differ it would be great. The first approach is from here: Solution conflict: Expected number of distinct birthdays for $100$ people Basically answering how many distinct holes will be chosen. For f and b its: $$E = b*\left(1-\frac{b-1}{b}^{f}\right)$$

For the first approach with 8 people and 8 holes I get: $$E = 8*\left(1-\frac{7}{8}^{8}\right)=5.25$$

The other approach is here: Put 13 identical balls in 8 different holes. What is the probability that there's one empty hole? This is the probability of having k empty holes out of b which is given by: $$P_{\text{empty}}(i) =\binom{m}{i}\binom{k-1}{m-i-1}$$ now the expectation of full holes is: $$\sum_{i=0}^{m}(m-i)\binom{m}{i}(P_{\text{empty}}(i))$$ where we have $$k$$ balls and $$m$$ holes

For the second approach for 8 people and 8 holes I get:$$\sum_{i=0}^{8}(8-i)\binom{8}{i}(P_{\text{empty}}(i)) = 4.267$$

Both try to answer the same thing, what is the average of full holes but the result is different. Is it because of underlying assumptions made? Or something else? Clarification would be appreciated.

• The second version is talking about "identical balls" so may either be impractical in reality or count events with different probabilities. That is why the second half of the accepted solution uses notation like ${\left\{ \matrix{ n \hfill \cr j \hfill \cr} \right\}m^{\;\underline {\,j\,} } }$ combining Stirling numbers of the second kind and falling factorials. Jan 19 at 14:31
• I am not clear how your second calculation works: Your $P_{\text{empty}}(i)$ looks like an integer rather than a probability and there seems to be some confusion about $i$ and $k$ Jan 19 at 14:49
• Can you add to your answer. What are the practical difference assuming what I am interested in calculating the expected number of full holes. Jan 19 at 17:28
• I am adding presently. Jan 19 at 18:40

The first computes the weighted average (weighted accoording to probability of occurrence), whereas the second is a simple average of all possible arrangements of full holes.

Consider a simple case, $$4$$ balls put in $$3$$ boxes

(I): Akin to a $$3$$ faced die thrown $$4$$ times, $$3^4 = 81$$ cases

$$4-0-0:\; \Large\binom{4}{4,0,0}\frac{3!}{1!2!}=3$$

$$3-1-0:\; \Large\binom{4}{3,1,0}\frac{3!}{1!1!1!} = 24$$

$$2-2-0:\; \Large\binom{4}{2,2,0}\frac{3!}{2!1!} = 18$$

$$2-1-1:\; \Large\binom{4}{2,1,1}\frac{3!}{1!2!}= 36$$

Average number of boxes filled $$= \Large\frac{3\cdot1+24\cdot 2 + 18\cdot2 +36\cdot3}{81} = \frac{195}{81}$$

$$[II]: Using\, stars\, and\, bars,\, \Large\binom{4+3-1}{3-1}=15\;$$cases

Average boxes filled $$= \Large\frac{3\cdot1+ 6\cdot2+ 3\cdot2+3\cdot3}{15} = \frac{30}{15}=2$$

• Can you add to your answer. What are the practical difference assuming what I am interested in calculating the expected number of full holes. Jan 19 at 17:28
• I understand the results are different but what does it mean? I want to calculate the expected number of full holes. Assuming there are no two answers, why choose one over the other. Jan 19 at 20:07
• The first solution is the one to use as it uses probabilities reflecting physical reality. To see why, consider the actual probability all the balls end up in a single hole: this is clearly $\frac{3}{3}\times \frac13\times \frac13\times \frac13= \frac{3}{81}$ not $\frac3{15}$. Jan 20 at 1:37
• So the issue is not that the balls are identical like you said earlier? I still can't explain it to myself as I am not sure what "reflecting physical reality" means Jan 20 at 8:38
• @Igor_dp: Expectation is inextricably bound with probability, the most basic formula is $\Sigma p_1 x_i$. Only the first method proceeds thus, eg for a $4-0-0$ configuration, the $p_i$ is $(1/3)^4$ and $x_i$ is $3$, so it contributes $(1/81)\times 3$ towards the expectation. The second method implies $(1/15)\times 3$ which is incorrect because $1/15$ is not the correct probability as the sample space of $15$ using stars and bars is not an equiprobable sample space. Jan 20 at 10:52

The expected number of full holes out of b holes when throwing f balls is given by the formula:

E(X) = f * (1 - (b-1)/b)^f

Where X is the number of full holes, f is the number of balls thrown, and b is the number of holes.

This formula assumes that the probability of a ball landing in a hole is independent of the other balls, and that all holes are equally likely to be filled.

It can also be understood as the probability of all other holes except one to be empty after throwing f balls.

If you want to calculate the expected number of full holes for a specific number of balls and holes, you can substitute the values into the formula.

For example, if you throw 10 balls at a target with 20 holes, the expected number of full holes would be:

E(X) = 10 * (1 - (20-1)/20)^10 = 7.34

So, you can expect around 7 full holes out of 20 if you randomly throw 10 balls.