Problem similar to Gambler's Ruin I am working on a problem that is similar to the gambler's ruin problem.

We start with a bet of $\$1$.

*

*With probability $p$ the game is won and we win the amount of the bet, i.e., if we bet $\$1$, we win $\$2$.


*With probability $1-p =: q$ the game is lost.
If we win the game,  we take our earnings and stop playing. If we lose we double our bet and keep on playing until we lose.
What is the expected amount we bet in total?

I would argue that the formula for the total bet looks like this, but I'm not sure if I made a mistake somewhere, as it would give negative bet values for a small $p$.
$$\sum \limits_{k=1}^{\infty}(2^k-1)p(1-p)^{(k-1)}=\frac{2p}{2p-1}-1$$
Many thanks for your time and help!

You can split your sum into two separate sums:
$$E(p)=\sum \limits_{k=1}^{\infty}(2^k-1)p(1-p)^{(k-1)}=p\sum \limits_{k=1}^{\infty}2^k(1-p)^{k-1} - p\sum \limits_{k=1}^{\infty}(1-p)^{k-1}  \\ = 2p\sum \limits_{k=0}^{\infty}2^{k}(1-p)^{k} - p \sum \limits_{k=0}^{\infty}(1-p)^{k}$$
The sum $\sum\limits_{k=0}^{\infty}2^{k}(1-p)^{k} $ is convergent only, if $p>\frac{1}{2}$. For $p \leq 2$ we have $\sum\limits_{k=0}^{\infty}2^{k}(1-p)^{k} =\infty $
The second sum is equal $\frac{1}{p}$ for any $p\neq 0$
Therefore we have:
$$E(p)=\begin{cases}\frac{1}{2p-1}, & p>\frac{1}{2}\\
\infty,& p\leq \frac{1}{2}\end{cases}$$
