# Drunkard's Walk (along a line)

I'm trying to solve the following variation of the Drunkard Walk:

From where he stands, one step toward the cliff would send the drunken man over the edge. He takes random steps, either toward or away from the cliff. At any step his probability of taking a step away is $$\frac{2}{3}$$, of a step toward the cliff $$\frac{1}{3}$$. What is his chance of escaping the cliff?

My initial idea was to draw a tree and come up with an infinite sum that looked like this:

$$\sum_{n=0}^{\infty} \left(\frac{2}{3}\right)^n\left(\frac{1}{3}\right)^{n+1}$$

But this doesn't take into consideration the scenario where the man walks back and forth from, say, position 2 to 1 for a couple turns, and then walks off. So I corrected with this sum:

$$\sum_{n=0}^{\infty} \binom{2n+1}{n} \left(\frac{2}{3}\right)^n\left(\frac{1}{3}\right)^{n+1}$$

Which is intuitive, at least to me, because it sums up all scenarios where the man takes exactly n steps backwards, and then that $$+1$$ $$(n+1)$$ steps forward and walks off the cliff. But this sum converges to $$1.5$$ $$(>1)$$ and is not a valid probability.

Could someone please explain where I'm going wrong? Also, how would I solve this problem using a Markov Chain/transition matrix (I'm not very familiar with either)

EDIT: If anyone else is interested, I found another really neat solution:https://medium.com/i-math/the-drunkards-walk-explained-48a0205d304

• In your second approach, $\binom{2n+1}{n}$ counts all the ways of arranging $(n+1)$ $\rightarrow$'s and $n$ $\leftarrow$'s, some of which are invalid because they go beyond the cliff. You need only count the paths that goes beyond the cliff precisely at the $(2n+1)$th step, and this can be done by employing Dyck paths. The resulting formula for the poor man to fall off involves the Catalan numbers and is given by $$p=\sum_{n=0}^{\infty}\frac{1}{n+1}\binom{2n}{n}\left(\frac{2}{3}\right)^n\left(\frac{1}{3}\right)^{n+1}=\frac{1}{2}.$$ Commented Apr 10, 2023 at 4:19
• @SangchulLee Hi, this makes sense! Thank you so much. Do you know of any better ways to solve a random walk problem like this one for a real value? Coming up with such a nuanced summation seems overly difficult. I can use recursion, but how would I solve such a problem mathematically, perhaps by using a Markov Chain? Commented Apr 10, 2023 at 18:30
• @MatthewKaplan In many solutions, there will be one step which isn't well-argued (because doing so is complicated). For instance, in your link the solution assumes that $P_1 = (1-p)/p$ whenever this expression is less than $1$. If you look through the article, it never actually justifies this (except at $p=1$). Commented Apr 10, 2023 at 19:00
• Here's how I did it. Suppose the ground is $(-\infty,0]$, you take steps of length $1,$ and you initially start at $x=0$ (i.e. the edge of the cliff). Let $p(n)$ be the probability of eventual doom when you're at position $n\in \{...-3,-2,-1,0,1\}$. Then $p(1)=1,p(n)\rightarrow 0$ as $n\rightarrow -\infty$ and $$p(n)=\frac{2}{3}p(n-1)+\frac{1}{3}p(n+1)$$ Can you finish?
– user801306
Commented Apr 10, 2023 at 20:36
• IIRC this is the "clfifhanger" problem in Mosteller's "50 Challenging Problems in Probability" and his solution uses the lesser of $1$ and $\frac{1-p}{p}$ based on a continuity assertion (the proof of which is too difficult he says)... "how would I solve this problem using a Markov Chain" -- if you know basic real analysis you should be able to follow my solution here: math.stackexchange.com/questions/4674446/… . Commented Apr 10, 2023 at 21:54

In order to compute the probability $$p$$ of falling down the cliff we just have to sum up the probabilities of doing so in $$2n+1$$ steps for $$n=0,1,2,\dots$$. The Catalan number $$C_n$$ counts the ways of taking $$2n$$ steps starting and ending at the initial point before falling down in the $$(2n+1)$$-th and final step. The probability of each of those paths (inluding the last step) is clearly $$(2/3)^n$$ times $$(1/3)^{n+1}$$, so $$p=\sum_{n=0}^\infty C_n\,\frac{2^n}{3^{2n+1}} = \frac 1 3\,\sum_{n=0}^\infty C_n\,\big(\,\frac 2 9\,\big)^n = \frac 1 3\,f(\,2/9\,)\,,$$ where $$f$$ is the well-known generating function given by $$f(x)=\sum_{n=0}^\infty C_n\,x^n = \frac{1-\sqrt{1-4x}}{2x}\,.$$ Since $$f(\,2/9\,)=3/2$$ we conclude that $$p=1/2$$, and then the probability of escaping is $$1/2$$ as well.