# Expected value when die is rolled $N$ times

Suppose we have a die with $K$ faces with numbers from 1 to $K$ written on it, and integers $L$ and $F$ ($0 < L \leq K$). We roll it $N$ times. Let $a_i$ be the number of times (out of the $N$ rolls) that a face with number $i$ written on it came up as the top face of the die.

I need to find the expectation of the value $a_1^F \times a_2^F \times \cdots a_L^F$

For example, let $N=2, K=6, L=2$ and $F=1$

Then, we roll the $6$-face die $2$ times, and we are interested in the value $a_1 \times a_2$.

The only two possible scenarios when this value is not zero are $(1, 2)$ and $(2, 1)$.

Both of them have $a_1 \times a_2 = 1$ and happen with probability $1 / 36$ each. So $P / Q = (1 + 1) / 36 = 1 / 18$

Let $A_i$ denote the number of times number $i$ appears (each number is equally likely to appear) and $\mathcal{A}$ be the set of all possible combinations of $a\equiv(a_1,\dots,a_K)$ s.t. $\sum_{k=1}^Ka_k=N$ and each $a_k\ge 0$. Then for $a\in \mathcal{A}$

$$P\{A_1=a_1,\dots,A_K=a_K\}=\frac{N!}{\prod_{k=1}^Ka_k!}K^{-\sum_{k=1}^Na_k}=\frac{K^{-N}N!}{\prod_{k=1}^Ka_k!}$$

and

$$\mathbb{E}\left[\prod_{k=1}^LA_k^F\right]=K^{-N}N!\times\sum_{\mathcal{A}}\frac{\prod_{k=1}^La_k^F}{\prod_{k=1}^Ka_k!}$$

Edit: The above formula can be simplified. Assume that $F=1$, $N\ge L$, and the relevant probabilities are $(p_1,\dots,p_K)$. Then

$$\prod_{k=1}^Lp_k \times\frac{\partial^L}{\partial p_1\cdots \partial p_L} \left(\prod_{k=1}^Lp_k^{a_k} \right)=\prod_{k=1}^L a_k p_k^{a_k}$$

Since

$$(p_1+\cdots+p_K)^N=\sum_{\mathcal{A}}\binom{N}{a_1,\dots,a_K}\prod_{k=1}^Kp^{a_k}$$

differentiating the LHS and noticing that $\sum_{k=1}^Kp_k=1$ yields

$$\prod_{k=1}^Lp_k \times\frac{\partial^L}{\partial p_1\cdots \partial p_L}(p_1+\cdots+p_K)^N=\prod_{k=1}^Lp_k\times \prod_{n=0}^{L-1}(N-n)$$

Consequently, since $p_k=K^{-1}$, $k=1,\dots,K$,

$$\mathbb{E}\left[\prod_{k=1}^LA_k\right]=K^{-L}\prod_{n=0}^{L-1}(N-n)$$

For $N<L$ this expectation is $0$ because $a_k=0$ for some $k=1,\dots,L$.

• Can you provide some example to show your approach – mat7 Jul 6 '15 at 7:30
• You can apply your own example... – d.k.o. Jul 6 '15 at 7:37
• Can't we make use of the fact that faces are numbered from 1 to K. So we can make use of it to find combinations that sum up to N – mat7 Jul 6 '15 at 7:38
• Its pretty simple example to show this formula correctness. So perhaps it will be great if you quote some good one – mat7 Jul 6 '15 at 7:38
• It doesn't matter how faces are labeled. Still, it's easy to write a simple program (in your favourite language) to calculate the expectation... – d.k.o. Jul 6 '15 at 7:42