How many ways can you make a dollar out of change? (explanation)

174 Views Asked by At

I know this question has been asked many times, but I'm not looking for the answer here. I'm looking for the explanation. In other words, I want to know WHY is the number of combinations equal to the coefficient of $X^{100}$ in the expansion series.

I cannot grasp the mathematics behind the generalized problem of how many ways can you make a sum of $N$ given $X, Y, Z$, etc. units.

2

There are 2 best solutions below

0
On BEST ANSWER

How do you work out $$Q=(x^{a_1}+x^{a_2}+\cdots)(x^{b_1}+x^{b_2}+\cdots)\cdots(x^{r_1}+x^{r_2}+\cdots)?$$ Well, you use the distributive law. You get the sum of a bunch of terms, each of which is a product of terms, taking one from each bracket. So it's a sum of terms of the form $$x^{a_{s_1}}x^{b_{s_2}}\cdots x^{r_{s_{\rm whatever}}}$$ By the laws of exponents, this is $$x^{a_{s_1}+b_{s_2}+\cdots+r_{s_{\rm whatever}}}$$ So the coefficient of $x^n$ when $Q$ is all multiplied out is the number of ways of writing $n$ as a sum of numbers, taking one number from each of the sets $\{a_1,a_2,\dots\},\{b_1,b_2,\dots\},\dots,\{\,r_1,r_2,\dots\}$.

For example: the number of solutions of $c+d+e=10$ where $c$ is taken from $\{\,1,3,6,8\}$, $d$ from $\{\,2,4,7,9\,\}$ and $e$ from $\{\,1,4,5\,\}$ will be the coefficient of $x^{10}$ in $$(x+x^3+x^6+x^8)(x^2+x^4+x^7+x^9)(x^1+x^4+x^5)$$ because when you use the distributive law to multiply that out you get terms each of which is of the form $x^{c+d+e}$ with $c$ taken from $\{\,1,3,6,8\}$, $d$ from $\{\,2,4,7,9\,\}$ and $e$ from $\{\,1,4,5\,\}$.

0
On

Taking a cue from lulu above, let's work through a smaller example: making 10 cents out of change.

You can either include a dime (10 cent coin), or not. If you use a dime, that's it, you're done. If you don't use a dime, you can use 0, 1 or 2 nickels (5 cent coins). Whichever option you choose, you are forced to fill up the remainder with single cent coins. That's a total of 4 ways.

Now let's look at the generating function: (I've chosen to use $X^0$ rather than $1$ here, for illustrative purposes) $$ \overbrace{(X^0+X^{10})}^{\text{dime}}\cdot \overbrace{(X^0+X^5+X^{10})}^{\text{nickel}} \cdot \overbrace{(X^0+X+X^2+\cdots+X^{10})}^{\text{cents}} $$ which, at the moment, might just look like some mysterious mumbo-jumbo. And, for some reason, we are interested in the coefficient of the $X^{10}$ term of this expression.

Let's see if we can't make sense of this. We expand the first bracket (dime), and get $$ X^0\cdot \overbrace{(X^0+X^5+X^{10})}^{\text{nickel}} \cdot \overbrace{(X^0+\cdots+X^{10})}^{\text{cents}} + X^{10}\cdot \overbrace{(X^0+X^5+X^{10})}^{\text{nickel}} \cdot \overbrace{(X^0+\cdots+X^{10})}^{\text{cents}} $$ Looking at the right-hand term, we see that the only contribution to the $X^{10}$ coefficient of the final expression comes from $X^{10}\cdot X^0\cdot X^0$. In other words, if the dime contributes a value of $10$ to the exponent of $X$, then the nickel and cent each have to contribute $0$. This corresponds exactly to the choice of using one dime, no nickels and no cents from above.

We shift our focus to the left-hand term. This time, expand the nickel bracket: $$ X^0\cdot X^0\cdot \overbrace{(X^0+\cdots+X^{10})}^{\text{cents}} + X^0\cdot X^5\cdot \overbrace{(X^0+\cdots+X^{10})}^{\text{cents}} + X^0\cdot X^{10}\cdot \overbrace{(X^0+\cdots+X^{10})}^{\text{cents}}$$ Each of these three terms correspond to a choice for the number of nickels to use. The first term corresponds to no dime, no nickel. Its only contribution to $X^{10}$ comes from $X^0\cdot X^0\cdot X^{10}$, which is to say we use 10 cents.

The second term, with $X^0\cdot X^5$, corresponds to using no dime, one nickel. Its contribution to the $X^{10}$ coefficient comes in the form of $X^0\cdot X^5\cdot X^5$, which is to say no dime, one nickel, five cents.

Finally, we get one contrubution to the $X^{10}$ coefficient from the right term, by way of $X^0\cdot X^{10}\cdot X^0$, symbolising no dime, two nickels and no cents.

So all in all, the coefficient of $X^{10}$ when expanding the generating function is $4$, and each contribution to that coefficient, each $X^{10}$ that appears when expanding the brackets, corresponds naturally to one way of making 10 cents from change.

The idea behind the solution to your dollar problem is entirely analoguous, there are just more terms to handle.