2

Problem:

Suppose a lottery exists in which your luck increases as you play. The probability of winning a prize starts at 1%. After every unsuccessful attempt, the probability of winning increases by 1% from your previous odds (so 1% becomes 2%). When a prize is won, the chance of winning is reset to 1%. What is the expected number of prizes that you will receive after 100 uses?

What we know so far:

So far we have tried recurrence formulas but failed to get a closed form answer.

Through a python script and brute forcing we have calculated the answer to be 7.8608…

We have also tried by viewing 1% as 1/100, we added up the fractions: 1/100 + 2/100 + 3/100... + 14/100, which yielded a sum of 105/100. Based on this calculation, the probability of winning appears to exceed 100%. To determine the number of times this outcome would occur within 100 attempts, we divided 100 by 14. But we again found a problem as we ended up with a sum of 105/100.

All of our answers lie closely to each-other but we have yet to find a concrete answer

We would appreciate any help that we can get!

RobPratt
  • 45,619
  • Expected # of prizes $~= \dfrac{100}{A},~$ where $~A = ~$ the expected (i.e. average) # of tries per win. Then, $$A = \sum_{n=1}^{100} n \times p(n),$$ where $~p(n)~$ equals the probability of winning on the $~n$-th turn. Then $$p(1) = 0.01, ~p(2) = 0.99 \times 0.02, ~p(3) = 0.99 \times 0.98 \times 0.03,~$$ and so forth. – user2661923 Jul 09 '23 at 16:14
  • @NumberBasher No, my formula is only supposed to be applied to computing the first win. The formula gets re-set after each win. This is the foundation for computing $~A~$ which represents the average number of tries before the first win. – user2661923 Jul 09 '23 at 16:21
  • You can also solve numerically with a spreadsheet: https://docs.google.com/spreadsheets/d/1tfVDS32huSkNKL3_vUp0pQw1BNKWKEhm8eQYBX8RICc/edit?usp=sharing I doubt that there is some simple closed form formula – leonbloy Jul 09 '23 at 21:41
  • For what's worth: The distribution of each "run" (number of tries for each prize) is known as Naor's distribution https://math.stackexchange.com/questions/276013/px-n-fracxn-1nxn-x-what-is-the-name-of-this-probability/276067 – leonbloy Jul 11 '23 at 01:51

2 Answers2

2

$\def\eqd{\stackrel{\text{def}}{=}}$ Let $\ \frac{X_t}{100}\ $ be the probability of your winning on the $\ t$-th try. Then you will have won on the $\ t$-th try if and only if $\ X_{t+1}=1\ $. Your expected number of wins after $100$ tries is therefore $$ \sum_{t=1}^{100}\Bbb{P}\big(\text{You win on the $\ t$-th try}\big)=\sum_{t=1}^{100}\Bbb{P}\big(X_{t+1}=1\big)\ . $$ Now $\ X_t\ $ is a discrete, homogeneous, $100$-state Markov chain, the entries of whose transition matrix are given by \begin{align} P_{pq}&=\Bbb{P}\big(X_{t+1}=q\,\big|\,X_t=p\big)\\ &=\cases{1-\frac{p}{100}&if $\ q=p+1$\\ \frac{p}{100}&if $\ q=1$\\ 0&otherwise.} \end{align} If $\ \pi_t\ $ is the (column ) vector of probabilities of $\ X_t\ $ being in any given state: $$ (\pi_t\big)_q\eqd\Bbb{P}\big(X_t=q\big)\ , $$ then $$ (\pi_1)_q=\cases{1&if $\ q=1$\\ 0&otherwise,} $$ and \begin{align} \pi_{t+1}^T&=\pi_t^TP\tag{1}\label{1}\\ &=\pi_1P^t\ . \end{align} Your expected number of wins after $100$ tries is therefore given by \begin{align} \sum_{t=1}^{100}\Bbb{P}\big(X_{t+1}=1\big)&=\sum_{t=1}^{100}\big(\pi_{t+1}\big)_1\\ &=\sum_{t=1}^{100}\pi_{t+1}^T\pi_1\\ &=\sum_{t=1}^{100}\pi_1^TP^t\pi_1\ . \end{align} Because the matrix $\ P\ $ is sparse, with only two non-zero entries in every row, the recursion \eqref{1} can be used to calculate the vectors $\ \pi_{t+1}\ $ for $\ t=1,2,\dots,100\ $ quite quickly: \begin{align} (\pi_{t+1}^TP)_q&=\sum_{p=1}^{100}\big(\pi_t\big)_pP_{pq}\\ &=\cases{\sum_\limits{p=1}^{100}\frac{p\big(\pi_t\big)_p}{100}&if $\ q=1$\\ \frac{\pi_{q-1}(101-q)}{100}&if $\ 2\le q\le100$}\ . \end{align}

The Magma script given below performs the calculations described above, and obtains exactly the same answer as Number Basher does with the Python script he gives in his answer. To run the script, copy and paste it into the online Magma calculator and click on the "submit" button.

nt:=100;
n:=100;
oldpi:= ZeroMatrix(Rationals(),1,nt);
newpi:= ZeroMatrix(Rationals(),1,nt);
oldpi[1,1]:=1;

expw:=0; for t in [1..nt] do for p in [1..n] do newpi[1,1]:=newpi[1,1]+poldpi[1,p]/n; end for; for q in [2..n] do newpi[1,q]:=oldpi[1,q-1](101-q)/n; end for; expw:=expw+newpi[1,1]; oldpi:=newpi; newpi:= ZeroMatrix(Rationals(),1,nt); end for;

print expw;

lonza leggiera
  • 28,646
  • 2
  • 12
  • 33
0

Using the following python script:

def cache(function):
    cache = {}
    def f(*args):
        if args in cache: return cache[args]
        result = function(*args)
        cache[args] = result
        return result
    return f

@cache def wins_average(turns_completed=0, probability=1): if turns_completed == 100: return 0 return probability * (100*(100-turns_completed) +
wins_average(turns_completed+1)) +
(100-probability)
wins_average(turns_completed+1, probability+1)

print(wins_average())

we get that the exact answer is 7.86080126403229668198182908097394362384354574898764667238115242755521947164335122692038436352382356040222738777625219891364911130702970910977870565447613758476042568092806020045109899810694869084004791. However, we have yet to get insight as to why this is.

  • 1
    Off-topic but just pointing something out in case it's useful: you don't have to write your own cache decorator. You can use @functools.lru_cache(maxsize=None) – parsiad Jul 09 '23 at 16:22
  • oh ok thank you, it doesnt matter in this case since time efficiency is not really important here. i just dont use libs much ig – Number Basher Jul 09 '23 at 16:25