If I have a fair die and throw it until I get a run of 1,2,3,4,5,6 in order, how many times on average must I throw the dice?
What is the expected number of dice one needs to roll to get 1,2,3,4,5,6 in order?
3k Views Asked by user8283 https://math.techqa.club/user/user8283/detail AtThere are 2 best solutions below
On
For each $k\geqslant6$, call $x_k$ the six last positions occupied at time $k$. Introduce $t_0=0$ and, for each $n\geqslant1$, $t_n$ the $n$th time when the word 123456 got completed, that is, $t_n$ denotes the $n$th visit to 123456 of the process $(x_k)_{k\geqslant6}$. The question asks for $\mathrm E(t_1)$.
Note that the sequence $(t_{n+1}-t_{n})_{n\geqslant0}$ is i.i.d. and distributed like $t_1$. This step uses the fact that after a completion of 123456 one must start to build a new occurrence entirely anew, that is, that no nontrivial suffix of 123456 is also a prefix of 123456. (Otherwise, $(t_{n+1}-t_{n})_{n\geqslant1}$ would be i.i.d. but with a different distribution than $t_1$, more precisely, the distribution of $t_{n+1}-t_n$ for every $n\geqslant1$ would be strictly dominated by the distribution of $t_1$, in particular, for every $n\geqslant1$, one would have $\mathrm E(t_1)\gt\mathrm E(t_{n+1}-t_n)$. In the present case, $\mathrm E(t_1)=\mathrm E(t_{n+1}-t_n)$.)
The process $(x_k)_k$ performs a random walk on the regular directed graph with $N=6^6$ vertices where every vertex 1u is linked to the six vertices u1, u2, ..., to u6, for every given 5-letters word u. The out-degree and the in-degree of every vertex being all equal to 6, the stationary distribution of the Markov chain is uniform, in particular the weight of 123456 is $w=1/N$.
By the law of large numbers for ergodic Markov chains, the asymptotic proportion of time spent at 123456 is almost surely $w$, that is, $t_n=(n/w)+o(n)$ almost surely. By the law of large numbers for i.i.d. sequences, $t_n=n\mathrm E(t_1)+o(n)$ almost surely.
Comparing these two expressions, one gets $\mathrm E(t_1)=1/w=N=6^6=46656$.
Let's write
then
so
i.e.
So the answer is $46656$.
This is $6^6$ so the "obvious solution" turns out to be correct and there is probably a quicker way.