# Probability between 2 values that change over time. Average value per second?

Lets say I make 20 dollars per second and there is a certain starting probability that instead of 20 I make 50 dollars. let's say that this starting probability is 5%.

Every second that passes and I haven't made 50 dollars, the probability raises by 3%. When I make 50 dollars then the probability for that resets back to 5%.

So my question is, how can I calculate the average value per second of this process?

Thank you.

-
For simplicity, I would suggest you look at a translation of the whole problem by $-20$ dollars per second; so you make $0$ dollars per second, and you have a certain probability of making $30$ dollars per second. – TMM Nov 1 '12 at 11:06
yes but that certain probability is time dependable.. how i calculate the average profit per second with the probability change over time and when it gives money it resets back to the basic value of 5% – Excadrix Nov 1 '12 at 11:59
@Excadrix - If you like an answer, you can upvote as well as accepting it. – nbubis Nov 1 '12 at 12:42

At each step, one makes either $\$a$or$\$b$ with $a=20$ and $b=50$. The $b$-steps are separated by i.i.d. numbers of steps distributed as the following positive integer random variable $N$.
For every $k\geqslant1$, conditionally on $[N\geqslant k]$, the probability of the event $[N\geqslant k+1]$ is $1-p(k)$, where it seems that $p(k)=2\%+k3\%$ (but what happens at step $33$ is not very clear since $2\%+32\cdot3\%\lt1$ but $2\%+33\cdot3\%\gt1$.) Thus, for every $k\geqslant1$, $$\mathbb P(N\geqslant k)=\prod_{i=1}^{k-1}(1-p(i)).$$ The number of steps $S_n$ needed to achieve $n$ $b$-steps is $S_n=\sum\limits_{k=1}^nN_k$, during which one collected $\$M_n$, where$M_n=a\sum\limits_{k=1}^nN_k+(b-a)n$. When$n\to\infty$,$S_n\approx n\mathbb E(N)$and$M_n\approx n(a\mathbb E(N)+b-a)$hence$\$A$ the average amount collected by step is such that $$A=\frac{a\mathbb E(N)+b-a}{\mathbb E(N)}=a+\frac{b-a}{\mathbb E(N)}.$$ One has $$\mathbb E(N)=\sum_{k\geqslant1}\mathbb P(N\geqslant k)=\sum_{k\geqslant0}\prod_{i=1}^{k}(1-p(i)),$$ that is, in the present case, $$\mathbb E(N)=\sum_{k=0}^{32}\prod_{i=1}^{k}\frac{98-3i}{100}.$$ Numerically, $\mathbb E(N)=6.358^-$ and $A=24.72^-$.