How do you use generating functions in this problem?

452 Views Asked by At

Let's say that I would like to find all the ways I could make a dollar using pennies, nickels, dimes, quarters, half-dollars, and dollar coins, assuming that all coins of a type are indistinguishable. I would only need to use $100$ pennies or $20$ nickels or $10$ dimes or $4$ quarters or $2$ half-dollars or $1$ dollar coin. I can represent each possible choice of the number of pennies as $(x^0+x^1+x^2...+x^{100})$ from $0$ to $100$ pennies. Likewise, I can represent choices for each possible choice for the number of the other coins as $(x^0+x^5+x^{20}...+x^{100})$ for nickels $(x^0+x^{10}+x^{20}...+x^{100})$ for dimes $(x^0+x^{25}+x^{50}+x^{100})$ for quarters $(x^0+x^{50}+x^{100})$ for half dollars and $(x^0+x^{100})$. As you can see, the exponents represent how much value that each number of coins has. For example, the $2$nd term in the expression that represents quarters represents that $1$ quarter had $25$ value $x^{25}$. Let's see what happens when I multiply all of these factors together.

$(x^0+x^1+x^2...+x^{100})(x^0+x^5+x^{20}...+x^{100})(x^0+x^{10}+x^{20}...+x^{100})(x^0+x^{25}+x^{50}+x^{100})(x^0+x^{50}+x^{100})(x^0+x^{100})$. When I multiply the factors together, the exponents add, and I will eventually end up with a term with $x^{100}$, which represents a value of $100$, or one dollar, which is what we are looking for. However, note that each term in our factors represent the possible values for a different number of coins. So, the coefficient of $x^{100}$ represents all the ways to make a dollar by differing the number of each coin you use. Now, I just need to find the coefficient of $x^{100}$. I can simplify the formula I found by using the formula for geometric series to get $\frac{x^{101}-1}{x-1}*\frac{x^{105}-1}{x^5-1}*\frac{x^{110}-1}{x^{10}-1}*\frac{x^{125}-1}{x^{25}-1}*\frac{x^{150}-1}{x^{50}-1}*\frac{x^{200}-1}{x^{100}-1}$. Now, this is where I am stuck, even though I simplified it, it still looks complicated. This isn't some random thing I came up with, the expressions I used are called "generating fucntions", so I know that this method would be useful in solving problems like these. However, I do not see how to effectively use these generating functions to solve this problem. Could somebody show me the way?

2

There are 2 best solutions below

7
On

This is maybe not what you're looking for as an answer, but generating functions are cool in part because they're so computable. In particular, computers are very very good at computing taylor series (that is, at getting the terms from a generating function).

In practice, we are usually interested in proving theorems, and here we can use facts about rational functions, complex analysis, etc. to say something about how (often combinatorial) series behave. In this case we will frequently do manipulations with the series by hand.

If we are ever interested in a concrete example, though, there is no reason to work by hand. Once you've computed the generating function (as you have) then every subsequent question (except theoretical ones) can and should be bashed out by a computer.

Your function does look gross if your measure of "gross" involves differentiating it by hand. However, if you modify your definition of "gross" to take into account "something I can type into a computer", then this function isn't gross at all!

So, with that in mind, say you want the $x^{100}$ term from this series:

Open up sage or something similar.

You'll use code like

sage: f(x) = (x^101 - 1)/(x-1) * (x^105 - 1)/(x^5 - 1) * (x^110 - 1)/(x^10 - 1) * (x^125 - 1)/(x^25 - 1) * (x^150 - 1)/(x^50 - 1) * (x^200 - 1)/(x^100 - 1)

sage: f.series(x,101)

Then you can simply look at the 100th coefficient. Sage will tell you the answer is $293$ in a matter of microseconds!

compute the series


Edit:

You can see how to compute this by hand in Grahm, Knuth, and Patashnik's "Concrete Mathematics". There's an example computation on pages $327$ to $330$ of my edition, and a closed form is computed on pages $344$ - $346$.


I hope this helps ^_^

0
On

The key idea is that obtaining the count outright might be hard, but we might be able to more easily write down a function $f(x)$ such that in the Taylor expansion of $f(x)$, the coefficient of $x^{n}$ provides the count when our object is of size $n$.

For the making change problem, computing the number of ways to make change for a fixed $n$ might be hard, but we can write down an (ordinary) generating function where the coefficient of $x^{n}$ is our desired count. This is the next best thing.

As was mentioned above, a computer algebra system is useful in ascertaining specific coefficients. In some cases, it may be feasible to compute the coefficient outright by hand (e.g., Computing problems and generating functions).