A game with two dice Imagine a game with two dice, played by two people and a referee.
The referee rolls the first die and the number will determine the number of times that the second die will be rolled.
The two players never know the result of the first die and they must place bets on the total outcome (the sum of the numbers rolled with the second die). They can review the bet each time after the second die is rolled.
With two regular (1:6) dice, and before any die is rolled, there are 55986 different combinations (6^6+6^5+...6^1), that will sum up in 36 total (from 1 to 36).
My question is: how can I calculate the probability of each sum (from 1 to 36) without brute force?
I attach a simple example with two dice of (1:3) instead of (1:6); in this case we have 3^3+3^2+3^1=39 combinations and it is easy to use brute force.
The probabilities of the dice outcomes are:



You could use probability generating functions (PGFs) to model the situation. The PGF for rolling the first die is $\frac{1}{6}(z^{1}+\dots+z^{6})$ . The exponents label the pips of the die, the coefficients give the number of occurrences of an event, weighted with the probability $\frac{1}{6}$ for each occurrence. To model the roll(s) of the second die $z$ is substituted by $z\mapsto\frac{1}{6}(x^{1}+\ldots+x^{6})$, since for each pip the second die will be rolled once. So, the PGF for the rolls of the second die is
$$A(x)\mathrel{\mathop:}=\frac{1}{6}\sum_{k=1}^{6}\frac{1}{6^{k}}\left(x^{1}+\dots+x^{6}\right)^{k}$$
To calculate the wanted probabilities for the resulting sums $1,\ldots,36$, we have to determine the coefficients $[x^{t}]$ of $x^{t}$ in $A(x)$ for each $t\in{1,\ldots,36}$. So,
\begin{eqnarray}
[x^{t}]A(x)
&=&[x^{t}]\sum_{k=1}^{6}\frac{1}{6^{k+1}}x^{k}\left(\sum_{j=0}^{5}x^{j}\right)^{k}\\
&=&\sum_{k=1}^{6}\frac{1}{6^{k+1}}[x^{t-k}]\left(\frac{1-x^{6}}{1-x}\right)^{k}\\
&=&\sum_{k=1}^{6}\frac{1}{6^{k+1}}[x^{t-k}]\sum_{j=0}^{k}(-1)^{j}\binom{k}{j}x^{6j}\frac{1}{(1-x)^{k}}\\
&=&\sum_{k=1}^{6}\frac{1}{6^{k+1}}\sum_{j=0}^{k}(-1)^{j}\binom{k}{j}[x^{t-k-6j}]\sum_{l\geq0}\binom{-k}{l}(-x)^{l}\\
&=&\sum_{k=1}^{6}\frac{1}{6^{k+1}}\sum_{j=0}^{k}(-1)^{j}\binom{k}{j}[x^{t-k-6j}]\sum_{l\geq0}\binom{k+l-1}{l}x^{l}\\
&=&\sum_{k=1}^{6}\frac{1}{6^{k+1}}\sum_{{j=0}\atop{t-6j-1\ge0}}^{k}(-1)^{j}\binom{k}{j}\binom{t-6j-1}{t-6j-k}
\end{eqnarray}
Finally,
$$
[x^{t}]A(x)=\sum_{k=1}^{6}\frac{1}{6^{k+1}}\sum_{{j=0}\atop{t-6j\ge1}}^{k}(-1)^{j}\binom{k}{j}\binom{t-6j-1}{k-1}\qquad\qquad t=1,\ldots,36
$$
Which $t$ would you choose for a bet? :-)
Note: The polynomial in $z$ encodes the probability distribution of rolling the first die. E.g. $z^4$ encodes the event: rolling a $4$. So,  $z^1+\dots+z^6$ encodes all possible events, namely rolling $1,\dots,6$. These events are weighted with the probability of occurrence, giving a total of $1/6\cdot(1+\dots+1)=(1/6)\cdot 6=1$. How is $4$ encoded when rolling the second die? Since, we have to roll the second die four times, the contribution is $(x^1+\dots+x^6)^4$. Expansion of this expression shows that all $6^4$ quadruples from $(1,1,1,1) \mapsto x^1x^1x^1x^1$ up to $(6,6,6,6) \mapsto x^6x^6x^6x^6$ are encoded. This is weighted with the probability ${(1/6)}^4$ according to the number of possible 4-tuples. But, rolling a $4$ (first die) occurs only in $1$ out of $6$ cases, so we have to multiply with an additional factor $1/6$ resulting in ${(1/6)}^5$.
