Waiting Time for a Random Walk to Hit One

notes
Author

Stephen J. Mildenhall

Published

2024-05-02

Let \(X_n\) be a symmetric random walk moving up or down by one at each step with equal probability. Let \(T\) be the waiting time until \(X_n=1\). Then \[ \def\E{\mathsf E} \def\P{\mathsf P} \begin{align} \E[z^T] &= \E[z \mid X_1=1]/2 + \E[z^{1+T' + T''} \mid X_1=-1]/2 \\ &= \frac{z + z\, \E[z^T]^2}{2} \end{align} \] where \(T'\) and \(T''\) are two independent copies of \(T\) that model the time to go from \(-1\) to \(0\) and then from \(0\) to \(1\). Solving the quadratic equation for \(\E[z^T]\) gives \[ \E[z^T] = \frac{1-\sqrt{1-z^2}}{z}. \] Select the minus sign because the MGF must be \(<1\) when \(0<z<1\). This function is not differentiable at \(z=1\) and therefore \(T\) is not integrable (does not have a mean).

We can use the binomial formula to show that \[ \P(T=2n-1) = (-1)^{n-1}\binom{1/2}{n} = \frac{1}{2^{2n-1}(2n-1)}\binom{2n-1}{n}. \]


Here is an illustration of these values.

import numpy as np
from scipy.special import comb
import pandas as pd

df = pd.DataFrame({'n': np.arange(1, 100, 2, dtype=int)})
df['p'] = 2.**-(2*df.n-1) / (2*df.n-1) * comb(2*df.n-1, df.n)
df['np'] = df.n * df.p
df['cumsum n*p'] = df.np.cumsum()
df = df.set_index('n')
df
p np cumsum n*p
n
1 0.500000 0.500000 0.500000
3 0.062500 0.187500 0.687500
5 0.027344 0.136719 0.824219
7 0.016113 0.112793 0.937012
9 0.010910 0.098190 1.035202
11 0.008009 0.088099 1.123301
13 0.006199 0.080590 1.203891
15 0.004982 0.074723 1.278614
17 0.004116 0.069975 1.348589
19 0.003475 0.066030 1.414619
21 0.002985 0.062685 1.477304
23 0.002600 0.059802 1.537106
25 0.002291 0.057283 1.594390
27 0.002039 0.055058 1.649448
29 0.001830 0.053073 1.702521
31 0.001654 0.051289 1.753810
33 0.001505 0.049673 1.803484
35 0.001377 0.048201 1.851685
37 0.001266 0.046853 1.898538
39 0.001170 0.045612 1.944149
41 0.001084 0.044464 1.988613
43 0.001009 0.043399 2.032012
45 0.000942 0.042407 2.074419
47 0.000883 0.041480 2.115899
49 0.000829 0.040611 2.156509
51 0.000780 0.039795 2.196304
53 0.000736 0.039026 2.235330
55 0.000696 0.038299 2.273629
57 0.000660 0.037612 2.311242
59 0.000626 0.036961 2.348203
61 0.000596 0.036342 2.384545
63 0.000568 0.035754 2.420299
65 0.000541 0.035193 2.455492
67 0.000517 0.034658 2.490150
69 0.000495 0.034146 2.524296
71 0.000474 0.033657 2.557953
73 0.000455 0.033188 2.591140
75 0.000437 0.032738 2.623878
77 0.000420 0.032305 2.656183
79 0.000404 0.031890 2.688073
81 0.000389 0.031490 2.719563
83 0.000375 0.031105 2.750668
85 0.000362 0.030733 2.781401
87 0.000349 0.030375 2.811776
89 0.000337 0.030029 2.841804
91 0.000326 0.029694 2.871499
93 0.000316 0.029370 2.900869
95 0.000306 0.029057 2.929926
97 0.000296 0.028754 2.958680
99 0.000287 0.028460 2.987140