I know that the expected number of rolls to roll a number x is 6, and from that I'm guessing that the expected number of rolls to roll an x n times is 6n. But I don't know the expected value if we're not looking for a specific x, but rather any number that gets rolled n times first.
What is the expected number of dice rolls to roll any number n times?
478 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 3 best solutions below
On
Let $E(x_1,\ldots,x_6,n)$ be the expected number of rolls where $x_i$ means face $i$ has been rolled $x_i$ times. We want to compute $E(0,\ldots,0, n)$ for some $n$.
We have $E(x_1,\ldots,x_6,n) = 0$ if $\max(x_1, \ldots, x_6) = n$, but otherwise:
$$E(x_1,\ldots, x_6, n) = 1 + \dfrac{1}{6} \left(E(x_1+1,x_2,\ldots,x_6, n) + \ldots + E(x_1,\ldots,x_5,x_6+1, n)\right) $$
Cobbling together a quick Python script, I get this for the first ten values of $n$ (decimals rounded off to second position):
1 1 or 1.00
2 1223/324 or 3.77
3 4084571/559872 or 7.30
4 247150321423/22039921152 or 11.21
5 56252877655712005/3656158440062976 or 15.39
6 2597868106693535971/131621703842267136 or 19.74
7 1004137746946400066467061/41451359947637504606208 or 24.22
8 1511870922130873413914611/52461877433728716767232 or 28.82
9 796097507230553992646636993684021/23764434735722193898380170625024 or 33.50
10 17392183399770252095858075799290840376365/454658218573929784111766025256801665024 or 38.25
On
The Exponential Generating Function
The exponential generating function for the number of ways to get exactly $d$ faces appearing $n-1$ times and the other faces less than $n-1$ times on a given number of rolls is $$ \overbrace{\vphantom{{\sum_1^2}^6}\quad\binom{6}{d}\quad}^{\substack{\text{choose the $d$}\\[2pt]\text{of $6$ faces}}}\overbrace{\vphantom{{\sum_1^2}^6}\left(\frac{x^{n-1}}{(n-1)!}\right)^d}^{\substack{\text{$d$ faces appear}\\\text{$n-1$ times}}}\overbrace{\left(\sum_{j=0}^{n-2}\frac{x^j}{j!}\right)^{6-d}}^{\substack{\text{$6-d$ faces appear}\\\text{$\lt n-1$ times}}}\tag1 $$ That is, the probability that after $r$ rolls, we have exactly $d$ faces appearing $n-1$ times and the other faces less than $n-1$ times is $$ \frac{r!}{6^r}\left[x^r\right]\binom{6}{d}\left(\frac{x^{n-1}}{(n-1)!}\right)^d\left(\sum_{j=0}^{n-2}\frac{x^j}{j!}\right)^{6-d}\tag2 $$ Given that $d$ faces have appeared $n-1$ times after $r$ rolls, there is a $\frac{d}6$ probability that on the next roll, one face will have appeared $n$ times. Thus, the probability of having the first face appearing $n$ times after $r+1$ rolls is $$ \begin{align} &\frac{r!}{6^r}\left[x^r\right]\sum_{d=1}^6\frac{d}6\binom{6}{d}\left(\frac{x^{n-1}}{(n-1)!}\right)^d\left(\sum_{j=0}^{n-2}\frac{x^j}{j!}\right)^{6-d}\\ &=\frac{r!}{6^r}\left[x^r\right]\sum_{d=1}^6\binom{5}{d-1}\left(\frac{x^{n-1}}{(n-1)!}\right)^d\left(\sum_{j=0}^{n-2}\frac{x^j}{j!}\right)^{6-d}\\ &=\frac{r!}{6^r}\left[x^r\right]\sum_{d=0}^5\binom{5}{d}\left(\frac{x^{n-1}}{(n-1)!}\right)^{d+1}\left(\sum_{j=0}^{n-2}\frac{x^j}{j!}\right)^{5-d}\\ &=\frac{r!}{6^r}\left[x^r\right]\frac{x^{n-1}}{(n-1)!}\left(\sum_{j=0}^{n-1}\frac{x^j}{j!}\right)^5\tag3 \end{align} $$
The Expectation
Therefore, if we define the degree $6n-6$ polynomial $$ P_n(x)=\frac{x^{n-1}}{(n-1)!}\left(\sum_{j=0}^{n-1}\frac{x^j}{j!}\right)^5\tag4 $$ The expected number of rolls for the first face to appear $n$ times is $$ E_n(\color{#C00}{r+1})=\sum_{r=0}^{6n-6}(\color{#C00}{r+1})\frac{r!}{6^r}\left[x^r\right]P_n(x)\tag5 $$ The first $10$ expectations match those computed by Marcus Andrews: $$ \begin{array}{r|r|l} n&\text{approx}&\text{expected number of rolls}\\\hline 1&1.0000&1\\ 2&3.7747&\frac{1223}{324}\\ 3&7.2955&\frac{4084571}{559872}\\ 4&11.2138&\frac{247150321423}{22039921152}\\ 5&15.3858&\frac{56252877655712005}{3656158440062976}\\ 6&19.7374&\frac{2597868106693535971}{131621703842267136}\\ 7&24.2245&\frac{1004137746946400066467061}{41451359947637504606208}\\ 8&28.8185&\frac{1511870922130873413914611}{52461877433728716767232}\\ 9&33.4995&\frac{796097507230553992646636993684021}{23764434735722193898380170625024}\\ 10&38.2533&\frac{17392183399770252095858075799290840376365}{454658218573929784111766025256801665024}\\ 11&43.0690&\frac{101511378167172386781645248411365620974025241}{2356948205087252000835395074931259831484416}\\ 12&47.9382&\frac{6101342241457232211864797021754203037755744243}{127275203074711608045111334046288030900158464} \end{array} $$
The Variance
The variance of the number of rolls for the first face to appear $n$ times is $$ E_n\!\left((r+1)^2\right)-\left(E_n(r+1)\right)^2\tag6 $$ where $E_n(r+1)$ is computed above and $$ E_n\!\left(\color{#C00}{(r+1)^2}\right)=\sum_{r=0}^{6n-6}\color{#C00}{(r+1)^2}\frac{r!}{6^r}\left[x^r\right]P_n(x)\tag7 $$ $$ \begin{array}{r|r|l} n&\text{approx}&\text{variance of the number of rolls}\\\hline 1&0.0000&0\\ 2&1.5264&\frac{160235}{104976}\\ 3&4.4200&\frac{1385467181735}{313456656384}\\ 4&8.1741&\frac{3970639068398634029855}{485758124386377007104}\\ 5&12.5141&\frac{167282417942596577487510903436775}{13367494538843734067838845976576}\\ 6&17.2823&\frac{299403979134389260700419343170913975}{17324272922341479351919144385642496}\\ 7&22.3801&\frac{38453757121975432232112509661376820420488859015}{1718215241508606708609003009624888417152139264}\\ 8&27.7411&\frac{76350278475830518207232272700236909606258581335}{2752248583871574368941325377477757056868941824}\\ 9&33.3185&\frac{18816569501958632926522985216785742414806774312249329667113541895}{564748358308399579753663138099951559832606887511235138815000576}\\ 10&39.0779&\frac{8077952785250811719054966016778836135365746066999551557114097296532094462513175}{206714095716819310132155904842979232279330627141833377324175114359098704920576} \end{array} $$
I'm not sure how to do this analytically, but I wrote a simulation in $\texttt R$:
Here's the rough mean values for $n=2,3,\ldots,10$: \begin{array}{l|l} n & \text{Expected number of rolls}\\\hline 2 & 3.75\\ 3 & 7.28\\ 4 & 11.18\\ 5 & 15.37\\ 6 & 19.74\\ 7 & 24.20\\ 8 & 28.84\\ 9 & 33.48\\ 10 & 38.36 \end{array}
There's definitely a linear trend, but that's about all that can be said from this data.