Solution: Expected Exit Time from a Bounded Interval
Part 1
Yn+1=Sn+12−(n+1)=(Sn+Xn+1)2−n−1=Sn2+2SnXn+1+Xn+12−n−1.
Taking conditional expectation, using independence and E[Xn+1]=0, E[Xn+12]=1:
E[Yn+1∣Fn]=Sn2+0+1−n−1=Sn2−n=Yn.
Martingale. ✓
Part 2
Increments: ∣Yn+1−Yn∣=∣2SnXn+1+Xn+12−1∣. On {τ>n}, Sn∈[0,N], so ∣Yn+1−Yn∣≤2N+2 — bounded.
For E[τ]<∞: in any block of N consecutive +1 increments the walk would be forced out. The probability of such a block is 2−N, and the blocks are disjoint, so:
P(τ>kN)≤(1−2−N)k,
which is summable, so E[τ]<∞ by a standard expectation-via-tail-sum argument. OST condition (3) is satisfied.
Part 3
OST: E[Yτ]=Y0=k2.
Also, E[Yτ]=E[Sτ2]−E[τ]. On {Sτ=0}: Sτ2=0. On {Sτ=N}: Sτ2=N2. So:
E[Sτ2]=N2⋅P(Sτ=N)=N2⋅k/N=kN.
Substituting: k2=kN−E[τ], so E[τ]=kN−k2=k(N−k). ✓
Part 4
(k,N)=(50,100) gives
E[τ]=50⋅50=2500 steps, i.e.
2500 seconds ≈ 42 minutes on average.
import numpy as np
import matplotlib.pyplot as plt
k_vals = np.arange(1, 100)
E_tau = k_vals * (100 - k_vals)
plt.plot(k_vals, E_tau)
plt.xlabel('starting position k')
plt.ylabel('E[tau]')
plt.title('E[tau] = k(N-k), N=100')
# Parabola peaking at k=50 with E[tau]=2500 and zero at k=0, 100 (instant exit).
The parabola peaks at the midpoint — farthest from both barriers, longest expected time — and drops to zero at each boundary (instant exit).
Takeaways
- Two-martingale OST identity. Apply OST to Sn to get the exit probabilities; apply OST to Sn2−n to get the exit time. Both are one-line computations once the right martingale is chosen.
- E[τ]=k(N−k) — the canonical quadratic exit-time formula. Memorise it; it appears in every trading-rule mean-holding-time argument.
- Continuous-time analogue. For Brownian motion started at x∈(a,b), the expected exit time from (a,b) is (x−a)(b−x)/σ2 — exact same formula, scaled by diffusion variance. Same martingale (Wt2−t) drives the derivation.
- Yn=Sn2−n is the discrete quadratic-variation martingale. It is to the discrete walk what Wt2−t is to Brownian motion — the foundational L2-martingale of the process.