$n$ number of balls are thrown randomly to $m$ number of bins, standing in a row. The balls are labeled as $1,2,3,....n$ and bins are also labeled as $1,2,3,...,m$. The probability of $i\_{th}$ ball enters in the $j\_{th}$ bin is $p\_{ij}$ where $\sum\_{j=1}^{m}p\_{ij}=1$ for all $i$. What is the expected number of balls per occupied bin when all $n$ balls are thrown simultaneously? 



Generalized expression for balls and bins problem
The odds of having all the balls in bins $j\_1, \cdots, j\_d$ is $\Pi\_{i\leq n}(p\_{ij\_1} + \cdots + p\_{ij\_d})$; call this number $q\_{j\_1, \cdots, j\_d}$


By inclusion/exclusion we get that the odds the that set of nonempty bins is exactly $J = \{j\_1, \cdots, j\_d\}$ are $\sum\_{S \subset J} (-1)^{d - |S|} q\_S$; call this number $p\_J$.


So, the expected number $E$ of balls per nonempty bin is given by $E = \sum\_{J} {n \over |J|} p\_J$ where the sum is taken over all subsets of $\{1,\dotsc,m\}$.


Were you looking for something nicer?


