Generating Functions Dice

699 Views Asked by At

In how many ways can we roll a red die, a yellow die, and a black die, and get a sum of $9$?

(The dice are colored so that a red $2$, a yellow $3$, and a black $4$ is distinguished from a red $3$, a yellow $4$, and a black $2$, for example.)


Should I use generating functions somehow?

1

There are 1 best solutions below

0
On BEST ANSWER

Yes. Multiply out:

$$(x+x^2+x^3+x^4+x^5+x^6)^3$$

and find the coefficient of $x^9$. Do you see why this works?

EDIT: I'll elaborate more for the sake of completeness. It is because when you multiply:

$$\color{red}{(x+x^2+x^3+x^4+x^5+x^6)}\color{yellow}{(x+x^2+x^3+x^4+x^5+x^6)}(x+x^2+x^3+x^4+x^5+x^6)$$

Sorry for the yellow color, but treat each of these factors as one of the dice. Now to get a sum of $9$ on the dice, you are effectively picking powers of $x$ from each of the factors such that their exponents sum to $9$. The number of times you can pick powers of $x$ from each of the factors like that (which is the number of ways we can get a sum of $9$ on the dice) is exactly the coefficient of $x^9$ when the product is multiplied out.