7

With each step, we move either clockwise or counterclockwise each with probability $\frac{1}{2}$ independent of the previous steps. Starting at 6 o’clock, what is the probability that we visit all the hours from 1 o’clock to 11 o’clock before visiting 12 o’clock?

Solving this numerically I arrive at an approximation of $\approx 0.04$. My code is provided below.

import random 

clock = [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
N = 100000
success = 0

for _ in range(N):
  index = 6
  touches = []

  while True:
    U = random.uniform(0,1)

    if U < 0.5:
      index -= 1
    else:
      index += 1

    if clock[index] == 1 and 1 not in touches:
      touches.append(1)
    elif clock[index] == 11 and 11 not in touches:
      touches.append(11)
    elif 1 in touches and 11 in touches:  
      success += 1
      break
    elif clock[index] == 12:
      break
    else:
      pass

print(round(success/N,4))

However, I was unsure as to how to verify this output provided the study of random walks. I have that given a simple symmetric random walk, the probability of reaching some $\ b$ before $\ 0$ is defined as: $$\ P[W(a) \ hit \ 0 \ before \ b] = 1 - \frac{a}{b}$$ This, however, does not produce 0.04 when substituting $\ a, b$ in the argument. Any help in guiding the probabilistic set up is much appreciated.

Will_E
  • 125

1 Answers1

5

Note that your code has a logic error: When you touch $1$ and $11$ in your code, you don't check whether you've passed. Instead, you wait until the next round to do this check, and half the time you'll fail on this next round even though you actually succeeded. Due to this, your estimate will be about half of the correct value, so we're expecting a probability $\approx 2 \cdot 0.04 = 0.08.$

If you are interested in fixing this error, the smallest fix would be changing

elif clock[index] != 12 and 1 in touches and 11 in touches:

to

elif 1 in touches and 11 in touches:

as then even though you still wait til the next round to check whether you've passed, it doesn't mistakenly mark it as a failure if you jump to $12$ on the next step.


Instead of being on the clock, my notation will be more clear if we label the positions $$0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12$$ where $0$ is simply the name we give to the "lower" $12$ to use the standard results.

Further, I'll adopt the usual notation of $S_n = a + \sum_{k=1}^n X_k$ for the simple symmetric random walk starting at $a,$ and $T_b = \inf\{n > 0 : S_n = b\}$ for the hitting times.


Now, start at position $6.$

In order to touch all the positions $1$ through $11$ before touching $0=12$, we have the following two disjoint cases:

  1. Touch $1$ before touching $11,$ and then touch $11$ before touching $0$.
  2. Touch $11$ before touching $1,$ and then touch $1$ before touching $12$.

Since these are disjoint, the probability we want is the sum of the two probabilities, and by symmetry, these two probabilities are equal. Further, by the Markov property of the symmetric random walk, the probability of the first case can be written as $$P(T_1< T_{11} < T_0 | a = 6) = P(T_1 < T_{11} | a = 6) \cdot P(T_{11} < T_0 | a = 1) = \frac{1}{2} \cdot \frac{1}{11}$$

This gives a result of $$\dfrac{1}{2}\cdot\dfrac{1}{11} + \dfrac{1}{2}\cdot\dfrac{1}{11} = \dfrac{1}{11}.$$

  • Much appreciated, when observing the probability of each occurrence I assume that $\ P(\ T_1<\ T_11)=\frac{1}{2}$, due to the symmetry of the starting point and for $\ P(\ T_11<\ T_0)=\frac{1}{11}$ by observing all available points starting at 1 to 0-11 – Will_E Nov 16 '19 at 03:11