Randomly assigning balls to boxes Suppose I have $n$ boxes, and $n^2$ balls, of which $b$ are colored blue. Each box has a capacity of holding $n$ balls. If I randomly assign balls to boxes until all the balls are placed, what is the probability that each box has at least one blue ball?
I've been working on this for small cases. Suppose $n = b = 3$. There should be ${9}\choose{3}$ ways to place the blue balls, and $3^3$ of these will result in one in each box, so the probability is $\frac{27}{84}$. If I add a fourth blue ball I see 6 places it could go, but if there are 2 blue balls in the same box, that would give me some overcounting, so I end up with $3^4$ ways to get at least one blue in each box. For 5 balls I brute-forced it, and ended up with $\frac{3^3\cdot 4}{{9}\choose{5}}$ for the probability. I haven't been able to come up with a good counting scheme to explain why this is true, and am unable to generalize.
 A: Number the boxes and for $i=1,\dots, n$ let $E_i$ be the event that box $i$ does not contain a blue ball.
Then with inclusion/exclusion and symmetry we find:
$$1-P\left(\bigcup_{i=1}^{n}E_{i}\right)=\sum_{k=0}^{n}\binom{n}{k}\left(-1\right)^{k}P\left(\bigcap_{i=1}^{k}E_{i}\right)=\binom{n^{2}}{b}^{-1}\sum_{k=0}^{n}\binom{n}{k}\left(-1\right)^{k}\binom{n\left(n-k\right)}{b}$$
This under the conventions that $\binom{r}{s}=0$ if $s\notin\{0,1,\dots,r\}$ and $\cap\varnothing=\Omega$ (so that $P(\cap\varnothing)=1$).
A: You can consider the "non-blue" balls as "voids": that means that the problem
boils down to how to place $b$ balls into $n$ boxes of capacity $n$, such that there is at least
one (blue) ball in each box.
So you are looking for
$$
\eqalign{
  & N_b (b - n,n - 1,n) =   \cr 
  &  = {\rm No}{\rm .}\,{\rm of}\,{\rm solutions}\,{\rm to}\;\left\{ \matrix{
  {\rm 1} \le {\rm integer}\;x_{\,j}  \le n \hfill \cr 
  x_{\,1}  + x_{\,2}  + \; \cdots \; + x_{\,n}  = b \hfill \cr}  \right. =   \cr 
  &  = {\rm No}{\rm .}\,{\rm of}\,{\rm solutions}\,{\rm to}\;\left\{ \matrix{
  0 \le {\rm integer}\;y_{\,j}  \le n - 1 \hfill \cr 
  y_{\,1}  + y_{\,2}  + \; \cdots \; + y_{\,n}  = b - n \hfill \cr}  \right. \cr} 
$$
which, as explained in this related post is given by
$$
\eqalign{
  & N_b (b - n,n - 1,n)\quad \left| \matrix{
  \;{\rm integers  }b,n \hfill \cr 
  \;1 \le n \le b \hfill \cr}  \right.\quad  =   \cr 
  &  = \sum\limits_{\left( {0\, \le } \right)\,\,k\,\,\left( { \le \,{{b - n} \over n}\, \le \,n} \right)} {\left( { - 1} \right)^k \left( \matrix{
  n \cr 
  k \cr}  \right)\left( \matrix{
  b - 1 - k\,n \cr 
  b - n - k\,n \cr}  \right)}  \cr} 
$$
