# generating function for counting number of ways to distribute balls to 5 people

Question: find a generating function for the number of ways to distribute n identical juggling balls to five different jugglers if each juggler receives at most seven balls. And then compute how many ways 25 balls can be distributes with the generating function.

This what I think the generating function is: (1 + Z^1 + Z^2 ..... + z^7)^5

And then for the numbers of ways 25 balls can be distributed in the manner as stated in the question would be: 14Cr10

Are my answers correct?

• You have the correct GF, but for the second part you need to find the coefficient of z^25 when the GF is expanded. Mar 17 '19 at 17:58
• Is that not 14 choose 10? Mar 17 '19 at 20:59
• I don't think so. Mar 17 '19 at 23:40

## 1 Answer

We use the coefficient of operator $$[z^n]$$ to denote the coefficient of $$z^n$$.

We obtain \begin{align*} \color{blue}{[z^{25]}}&\color{blue}{(1+z+z^2++z^7)^5}\\ &=[z^{25}]\left(\frac{1-z^8}{1-z}\right)^5\tag{1}\\ &=[z^{25}]\left(1-\binom{5}{1}z^8+\binom{5}{2}z^{16}-\binom{5}{3}z^{24}\right)\sum_{j=0}^\infty \binom{-5}{j}(-z)^j\tag{2}\\ &=\left([z^{25}]-5[z^{17}]+10[z^9]-10[z]\right)\sum_{j=0}^\infty \binom{j+4}{4}z^j\tag{3}\\ &=\binom{29}{4}-5\binom{21}{4}+10\binom{13}{4}-10\binom{5}{4}\tag{4}\\ &\,\,\color{blue}{=926} \end{align*}

Comment:

• In (1) we use the final geometric series formula.

• In (2) we expand $$(1-z^8)^5$$ up to powers of $$z^{24}$$, since higher powers do not contribute. We also apply the binomial series expansion.

• In (3) we use the rule $$[z^{p-q}]A(z)=[z^p]z^qA(z)$$. We also apply the binomial identity $$\binom{-p}{q}=\binom{p+q-1}{p-1}(-1)^q$$.

• In (4) we select the coefficients accordingly.