0

If I'm in a restaurant and can choose 3 scoops of 3 different ice-creams then it's easy to see that I have 10 different choices.

If we extend to the general case of $n$ scoops of $n$ different ice-creams then per the link below this is:

the number of ways to get $n$ non-negative integers to add up to $n$

which I follow. However this is then linked to a coefficient in a binomial expansion for the general formula.

My question is for a bit of intuition/explanation about this answer came from as it seems to be linked to the Binomial Theorem but I'm missing the bit about why it's the expansion of $(1 - x)^{-n}$ and the $x^n$ coefficient.

Reference question: here

2 Answers2

2

In order to assemble your dish of ice cream we take some number of scoops from the tub containing the first flavor, then some number of scoops of the next flavor, then some number of scoops of the third flavor, and so forth.

When we're finished, the total number of scoops must be $n.$

By analogy, we consider a product of polynomial series $$ (1+x+x^2+\cdots)(1+x+x^2+\cdots)\cdots(1+x+x^2+\cdots) $$ where there are $n$ copies of the series $1+x+x^2+\cdots$ each copy of the series corresponds to one of the tubs of ice cream. And we consider different terms of powers of $x$ that we can get by applying the distributive rule to this product until we have reduced it to a single polynomial series $$ a_0 + a_1 x + a_2 x^2 + \cdots.$$

It should be clear that there's only one way to get the term $1,$ namely, we have to multiply the $1$ in the first term by the $1$ in the second term, and so forth. So the constant coefficient in the product is $a_0 = 1.$ The analogy to a dish of ice cream is that the dish is empty, and there's only one way to do this.

To get the term $x,$ we can multiply the $x$ in any of the terms with the $1$ in every other term. There are $n$ ways to choose which copy of the series to take the $x$ from, and there's no other way to get $x,$ so the coefficient of $x$ in the product is $a_ 1 = n.$ The analogy to a dish of ice cream is that we take one scoop from one of the tubs and none from the others.

For $x^2,$ we can take $x^2$ from one copy of the series and $1$ from all the others, or we can take $x$ from each of two copies and $1$ from all the others, and that's all we can do. The analogy to a dish of ice cream is that we take two scoops--maybe the same flavor, maybe two different flavors.

The idea is that a power of $x$ corresponds to a number of scoops of ice cream: $x^k$ corresponds to $k$ scoops.

We can keep going like this for any number of scoops. For $k$ scoops we look at how many ways $x^k$ can occur from the application of the distributive rule, and it turns out to be the number of ways we can take some number of scoops from the the first tub (some power of $x$ from the first copy of the series), some number of scoops from the second, and so forth, and in the end the number of scoops adds up to $k$ (that is, when we multiply the chosen powers of $x$ we get $x^k$).

That's why we say the number of ways to make a dish of $n$ scoops of ice cream is the coefficient of $x^n$ in the expansion of $$ (1+x+x^2+\cdots)(1+x+x^2+\cdots)\cdots(1+x+x^2+\cdots).$$

But in order to simplify the answer, we count the number of tubs, and for $n$ tubs we find that $$ (1+x+x^2+\cdots)(1+x+x^2+\cdots)\cdots(1+x+x^2+\cdots) = (1+x+x^2+\cdots)^n.$$

And then we use the fact that $$1+x+x^2+\cdots = \frac{1}{1 - x} = (1 - x)^{-1},$$ so $$(1+x+x^2+\cdots)^n = (1 - x)^{-n},$$ and use the binomial theorem to write out the expansion of this power of the binomial $1 - x.$


Generalizing the problem slightly, if we wanted to count the number of ways to select $p$ scoops from a choice of $q$ different flavors, where $p$ and $q$ could be different, we would be looking for the coefficient of $x^p$ (power = number of scoops) in the binomial expansion of $(1−x)^{−q}$ (power = negative number of flavors).

David K
  • 98,388
  • Brilliant, thank you David. So just to clarify the exponent of $x^n$ is for the number of scoops and the number of times we multiply the expansions is due to the number of tubs, here $n$? – User123456789 Mar 12 '18 at 16:18
  • Splendid, though I think you mean $(1 - x)^{-q}$... – User123456789 Mar 12 '18 at 20:33
  • Yes, I did. It was too late to edit the comment, so I tacked that case onto the end of the answer. – David K Mar 13 '18 at 00:31
0

the number of non-negative integer solutions to $$ x_1+x_2+\cdots +x_n=n\quad\; |0\le x_k \le n$$ is well explained in this Wikipedia article about Compositions, specially in the part where it deals with weak compositions.

If you are interested to generalize a bit further, when the scoops for each taste are limited to max $r < n$ then you may refer to this post where it is explained that $$N_{\,b} (s,r,m) = \text{No}\text{. of solutions to}\;\left\{ \begin{gathered} 0 \leqslant \text{integer }x_{\,j} \leqslant r \hfill \\ x_{\,1} + x_{\,2} + \cdots + x_{\,m} = s \hfill \\ \end{gathered} \right.$$ is given by $$ N_b (s,r,m)\quad \left| {\;0 \leqslant \text{integers }s,m,r} \right.\quad = \sum\limits_{\left( {0\, \leqslant } \right)\,\,k\,\,\left( { \leqslant \,\frac{s} {r}\, \leqslant \,m} \right)} {\left( { - 1} \right)^k \left( \begin{gathered} m \hfill \\ k \hfill \\ \end{gathered} \right)\left( \begin{gathered} s + m - 1 - k\left( {r + 1} \right) \\ s - k\left( {r + 1} \right) \\ \end{gathered} \right)} $$

Concerning the generating function, for an intuitive explanation of that, consider this multiplication $$ \eqalign{ & \left( {x^0 + x^1 + x^2 + x^3 + \cdots + x^{\,r} } \right)\left( {x^0 + x^1 + x^2 + x^3 + \cdots + x^{\,r} } \right) = \cr & = \left( {x^0 x^0 } \right) + \left( {x^0 x^1 + x^1 x^0 } \right) + \left( {x^0 x^2 + x^1 x^1 + x^2 x^0 } \right) + \cdots +\left( {x^r x^r } \right) \cr} $$ you can clearly see that the coefficient of $x^n$ is given by all the weak compositions of two digits which sum to $n$ and are each less then $r$.
It is also clear what happens when you multiply three and more blocks.

Taking your case, you can put $r=n$, or also $n<r$, or $r \to \infty$, which leads to consider $1/{(1-x)^n}$ and then the coefficient of $x^n$ in it.
That is
$$ \left( { - 1} \right)^n \left( \matrix{ - n \cr n \cr} \right) = \left( \matrix{ 2n - 1 \cr n \cr} \right) = \left( \matrix{ 2n - 1 \cr n - 1 \cr} \right) $$
by applying the "upper negation", and which corresponds in fact to the number of weak compositions of $n$ into $n$ parts.

G Cab
  • 35,272