WOLFRAM|DEMONSTRATIONS PROJECT

Using Generating Functions to Solve Enumeration Problems

​
number of colors available
2
3
4
5
6
total number of balls selected
100
unrestricted
⋯
unrestricted
⋯
unrestricted
⋯
The number of ways to select 100 balls, each of 3 possiblecolors, with no restrictions is the coefficient of
100
z
in thegenerating function
g(z) =
1
3
(1-z)
, giving 
3
100
 = 
3
+
100
-1
100
 = 5,151.
Many enumeration problems can be solved using generating functions. This Demonstration illustrates the method in the context of problems concerning the number of ways to select
r
balls, each of which is one of
n
colors, where balls of a given color are indistinguishable. In addition to choosing the values of
r
and
n
, restrictions on the number of balls of a given color can be imposed, giving a large variety of problems that can be solved.