Expected value when die is rolled $N$ times

Solution 1:

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_{a\in \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$.