# Number of ways a sum of r can occur if a die is rolled a number of times.

Show that $(1 - x - x^2 - x^3 - x^4 - x^5 -x^6)^{-1}$ is the generating function for the umber of ways a sum of r can occur if a die is rolled a number of times.

-
This seems similar to this question. –  robjohn Nov 6 '13 at 9:15

Consider the product $$\left(x+x^2+x^3+x^4+x^5+x^6\right)^n\tag{1}$$ The choice of a term in each factor of $(1)$ corresponds to the choice of a face on each of $n$ dice. The coefficient of $x^k$ in $(1)$ is the number of ways for the faces of $n$ dice to sum to $k$.
The coefficient of $x^k$ in the sum of $(1)$ over all $n$ gives the number of ways to roll a $k$ on the faces of any number of dice.
Using the formula for the sum of a geometric series, we get $$\sum_{n=0}^\infty\left(x+x^2+x^3+x^4+x^5+x^6\right)^n=\frac1{1-\left(x+x^2+x^3+x^4+x^5+x^6\right)}\tag{2}$$