This simulation provides the answers to a variety of questions of the type, In how many ways can r balls be placed into n boxes? You can vary the number of balls and the number of boxes. Options include distinguishable or indistinguishable balls, distinguishable or indistinguishable boxes, and whether or not empty boxes are permitted.
Notation follows Martin's text [1]. In particular, \(\Pi(r,n)\) stands for the number of integer partitions of \(r\) into exactly \(n\) parts.
For \(r\) balls placed into \(n\) boxes, the count depends on which of the eight combinations of options is selected:
Distinguishable balls, distinguishable boxes, empty boxes allowed
\[ n^r \]Distinguishable balls, distinguishable boxes, empty boxes not allowed
\[ \sum_{k=0}^{n} (-1)^k \binom{n}{k}(n-k)^r \]Distinguishable balls, indistinguishable boxes, empty boxes not allowed
\[ S(r,n) = \frac{1}{n!}\sum_{k=0}^{n} (-1)^k \binom{n}{k}(n-k)^r \]Distinguishable balls, indistinguishable boxes, empty boxes allowed
\[ \sum_{k=1}^{n} S(r,k) \]Indistinguishable balls, distinguishable boxes, empty boxes allowed
\[ \left(\!\!\binom{n}{r}\!\!\right) = \binom{n+r-1}{r} \]Indistinguishable balls, distinguishable boxes, empty boxes not allowed
\[ \left(\!\!\binom{n}{r-n}\!\!\right) = \binom{r-1}{n-1} \]Indistinguishable balls, indistinguishable boxes, empty boxes not allowed
\[ \Pi(r,n) \]Indistinguishable balls, indistinguishable boxes, empty boxes allowed
\[ \sum_{k=1}^{n} \Pi(r,k) \][1] G. E. Martin, Counting: The Art of Enumerative Combinatorics, New York: Springer-Verlag, 2001.
This simulation was created in the Department of Chemical and Biological Engineering at University of Colorado Boulder for LearnChemE.com by John L. Falconer using Claude AI. It is a JavaScript/HTML5 implementation of a Mathematica simulation by Marc Brodie. It was prepared with financial support from the National Science Foundation (DUE 2336987 and 2336988). Address any questions or comments to LearnChemE@gmail.com.