Tuesday, 20 August 2019

probability - How many tries on average before I see the same value N times in a row?



If I repeatedly roll a fair, X-sided die, on average how many rolls should I expect to make before I happen to roll the same value N times in a row?




I've found questions on here with answers when X=2, or where N=2, or where you're looking for a specific result N times in a row; I'm interested in the situation where I don't care what the specific value is, I just want it to be N times in a row. The closest I can find is Suppose we roll a fair 6 sided die repeatedly. Find the expected number of rolls required to see 3 of the same number in succession., but I can't quite figure out how to generalize it beyond N=3.


Answer



Let Ek denote the expected number of rolls that are still needed if k rolls have passed with equal result. We write recurrence relations for Ek,0kN1 and calculate the wanted expectation E=E0 from them.




We obtain
E0=E1+1E1=1X(E2+1)+X1X(E1+1)E2=1X(E3+1)+X1X(E1+1)E3=1X(E4+1)+X1X(E1+1)   EN3=1X(EN2+1)+X1X(E1+1)EN2=1X(EN1+1)+X1X(E1+1)EN1=1X+X1X(E1+1)




Comment:





  • In (1) we note that any roll of the X-sided die will do.


  • In (2) we are in the situation that a run of length 3 is given. With probability 1X we get a run of length 4 and with probability XX1 we get a different result and start with a run of length 1.


  • In (3) we get a run of length n with probability 1X and can stop or we are back at the beginning and start again with a run of length 1.





This system can be easily solved. We iteratively obtain be respecting all equations from above besides the last one (tagged with (3)).
E1=E01E2=E0(1+X)E3=E0(1+X+X2)E4=E0(1+X+X2+X3)   EN1=E0(1+X+X2++XN2)=E0XN11X1



From equation (4) and (3) we finally conclude
EN1=E0XN11X1(1X)E0+XEN1=1
from which
E=E0=XN1X1
follows.





Note: This approach is a generalisation of @lulu's answer of this MSE question. In fact we get as small plausibility check with N=3 and X=6 the result
E=63161=2155=43.
in accordance with @lulu's result.




[Add-on] The strongly related problem: Rolling a fair X-sided die until we get a run of length N of a specific value can be solved by the system above with the first equation (1) replaced with
E0=1X(E1+1)+X1X(E0+1)
which gives the result
E=E0=X(XN1)X1
This is also plausible compared with the result above, since the probability to roll a specific value is 1X.



No comments:

Post a Comment

real analysis - How to find limhrightarrow0fracsin(ha)h

How to find lim without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...