Use a generating function to find all postage amounts using a subset of stamps and the number of ways each amount can be formed. You have the following set of stamps:


*

*2 three-cent stamps

*3 five-cent stamps

*2 seven-cent stamps


Use a generating function to:
a) Find all postage amounts that can be formed using a subset of these stamps.
b) Find the number of ways each amount can be formed.
I'm not quite sure where to begin.
I assume the problem can be set up like this:
$3x_1+5x_2+7x_3=n$
where n is the amount of money and $x_1$ is the number of three-cent stamps, and so on.
Then, we also have that $0 \le x_1 \le 2, 0 \le x_2 \le 3$, and $0 \le x_3 \le 2$.
I've learned the following method for similar problems, but I'm clearly not understanding something because it doesn't seem to work...
If $x_1$ were not limited to between 0 and 2, it would create the function $1+x^3+x^6+x^9...$
However, since it is limited, I don't see how this could work. The same applies for $x_2$ and $x_3$. Could someone please explain to me in the simplest possible terms what it is that I am not understanding?
 A: As you said, if $x_1$ were not limited by $0\le x_1\le 2$, then you would use the function $1+x^3+x^6+x^9+\dots$ . In order to account for $0\le x_1\le 2$, simply only use the first three terms of this series, $1+x^3+x^6$. Same for the other two variables. 
The generating function is then
$$
(1+x^3+x^6)(1+x^5+x^{10}+x^{15})(1+x^7+x^{14})
$$

In general, if you are counting solutions to the equation $x_1+\dots+x_k=n$, and each variable $x_i$ is restricted to some set $S$, the generating function for that variable is $\sum_{s\in S}x^s$. In your case, you have $3x_1+5x_2+7x_3=n$, and $0\le x_1\le 2$, so that $3x_1$ must be in the set $\{0,3,6\}$, leading to $x^0+x^3+x^6$.
A: Consider the way in which you expand this product
$$
\left( {1 + x^{\,3} } \right)\left( {1 + x^{\,5} } \right) = 1x^{\,0}  + 1x^{\,3}  + 1x^{\,5}  + 1x^{\,8} 
$$
and then this
$$
\begin{gathered}
  \left( {1 + x^{\,3} } \right)\left( {1 + x^{\,3} } \right)\left( {1 + x^{\,5} } \right) = \left( {1 + x^{\,3} } \right)^{\,2} \left( {1 + x^{\,5} } \right) =  \hfill \\
   = 1 + 2x^{\,3}  + 1x^{\,5}  + 1x^{\,6}  + 2x^{\,8}  + 1x^{\,11}  \hfill \\ 
\end{gathered} 
$$
You will easily recognize that 
$$
\left( {1 + x^{\,3} } \right)^{\,2} \left( {1 + x^{\,5} } \right)^{\,3} \left( {1 + x^{\,7} } \right)^{\,2} 
$$
is the answer to your question, when in the number of ways to compose a given amount
you do not make distinction as for the order in which the stamp are placed, but you make distinction
as for the ways in which you can choose a stamp to be part of the amount.
For example you have $2x^3$ and $1x^6$.
