Finding combination using generating function Q. Find the no of ways of inserting r dolllars using 1 dollar, 2 dollar and 5 dollar tokens,when order doesn't matter and when order doesn't matter.
Ans.
When order doesn't matter..
$(1+x+x^2+x^3+..)(1+x^2+x^4+..)(1+x^5+x^{10}+..)$ 
Coefficient of $x^r$ in above generating function.
I clearly understand this. But I don't understand the process when order matters. Please somebody explain how (and why) to approach when order matters.

When order does matter, the contents of the $k$-th bracket will be the possibilities for the $k$-th token to be inserted, which are $1,2$ or $5$ dollars regardless of $k$.
So a first guess for the generating function that respects order is
$$g(x)=(x+x^2+x^5)\times(x+x^2+x^5)\times(x+x^2+x^5)\times\cdots$$
but this has the problem that the degree of any term in the product is infinite.
But we know that at least $4$ and at most $19$ tokens can be used to make up the amount.
So
$$\begin{align}
g(x)&=\sum_{k=4}^{19}{(x+x^2+x^5)^k} \\
    &=(x+x^2+x^5)^4\cdot\sum_{k=0}^{15}{(x+x^2+x^5)^k} \\[2ex]
    &=(x+x^2+x^5)^4\cdot\frac{(x+x^2+x^5)^{16}-1}{x+x^2+x^5-1}
\end{align}$$
