# What are the odds of never losing in a loaded coin game?

Let's consider this simple dice game: A coin is faked so it has `p` chance to land on heads, and `1-p` chance to land on tails. Every round costs `$1`, and gives you `$2` if you win (for a total of `+$1`).

Assume you're starting with `$n`. What are your odds to "go infinite" - be able to play the game forever? This sounds like Markov Chains 101, it's just been ages since I read anything about Markov Chains.

Also - given any constant `m`, what are the odds of ever reaching `$m` in this game?

-

I can answer the second question: if $m < n$ then the probability is between $0$ and $1$, if $m \geq n$ then the probability is $1$. – Yuval Filmus Feb 4 '11 at 7:26
@Yuval: The probability is most certainly not 1.  Imagine you start out with \$1 and lose the first round... – BlueRaja - Danny Pflughoeft Jun 24 '11 at 23:23

## 1 Answer

Define $f(n)$ as the probability of playing forever when starting out with n coins. Also, assume that the probability p of winning a round is bigger than $\frac{1}{2}$ (otherwise, the probability of playing forever is 0). Then, we get the recurrence relation $$f(n) = p f(n + 1) + (1-p) f(n-1)$$ with the boundary conditions $f(0) = 0$ and $\lim_{n \to \infty} f(n) = 1$.

The general solution of the recurrence relation is $$f(n) = a + b \left( \frac{1-p}{p} \right)^n$$ and from the boundary conditions we get $a = -b = 1$. So, the probability to play infinitely is $$f(n) = 1 - \left( \frac{1-p}{p} \right)^n .$$

The second question can be answered just as the first one, but with different boundary conditions: $f(0) = 0$ and $f(m) = 1$. This leads to the probability of reaching m as $$\frac{1 - \left( \frac{1-p}{p} \right)^n}{1 - \left( \frac{1-p}{p} \right)^m} .$$

By the way, the keyword for this kind of problems is 'Random Walk'.

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 12, "mathjax_display_tex": 4, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9509855508804321, "perplexity_flag": "middle"}