Expected value with recursive probability

probabilityrecursion

First of all, I'm aware of an existing question with a similar title, but my problem is fundamentally different.

I'm trying to solve this: in the first try, there is a 5% probability of obtaining a success. In the second try, if the first one was a success, the probability resets to 5%, but if the first one was a failure, now there is 5% more probability (10%). This goes on an on for an arbitrary number of trials, what I'm trying to calculate is the expected number of trials to obtain a single success.

What I got is the probability of obtaining a success in try number $n$, which obviously depends on the probability of the previous try:
$$p(n) = p(n-1)\times 0.05 + (1-p(n-1))\times(p(n-1)+0.05),$$
with $p(1)=0.05$. Is it possible to calculate what I want?

In a more general way, what I'm asking is how to calculate the expected number of trials when the probability of success in a single trial depends on the probability of the previous trial, $p(n)=f(p(n-1))$.

Best Answer

Let $p(n)$ be the probability of having a success within the first $n$ trials, and let $q(n)$ be the probability of having the FIRST success in trial $n$. Then it holds that $p(1)=q(1)=0.05$, $$q(n)=0.05n[1-p(n-1)],$$ and $$p(n)=p(n-1)+q(n).$$ Generate the sequences $p(n)$ and $q(n)$ for as long as they satisfy $0\leq p(n)\leq1$ and $0\leq q(n)\leq1$. It turns out that $p(21)=1$ and this is where you can stop. Then calculate $$\sum_{n=1}^{21}q(n)n.$$