CONTENTS

Solution: Expected Exit Time from a Bounded Interval

Part 1

Yn+1=Sn+12(n+1)=(Sn+Xn+1)2n1=Sn2+2SnXn+1+Xn+12n1Y_{n+1} = S_{n+1}^2 - (n+1) = (S_n + X_{n+1})^2 - n - 1 = S_n^2 + 2S_n X_{n+1} + X_{n+1}^2 - n - 1.

Taking conditional expectation, using independence and E[Xn+1]=0\mathbb{E}[X_{n+1}] = 0, E[Xn+12]=1\mathbb{E}[X_{n+1}^2] = 1:

E[Yn+1Fn]=Sn2+0+1n1=Sn2n=Yn.\mathbb{E}[Y_{n+1} \mid \mathcal{F}_n] = S_n^2 + 0 + 1 - n - 1 = S_n^2 - n = Y_n.

Martingale. ✓

Part 2

Increments: Yn+1Yn=2SnXn+1+Xn+121|Y_{n+1} - Y_n| = |2S_n X_{n+1} + X_{n+1}^2 - 1|. On {τ>n}\{\tau > n\}, Sn[0,N]S_n \in [0, N], so Yn+1Yn2N+2|Y_{n+1} - Y_n| \le 2N + 2 — bounded.

For E[τ]<\mathbb{E}[\tau] < \infty: in any block of NN consecutive +1+1 increments the walk would be forced out. The probability of such a block is 2N2^{-N}, and the blocks are disjoint, so:

P(τ>kN)(12N)k,\mathbb{P}(\tau > kN) \le (1 - 2^{-N})^k,

which is summable, so E[τ]<\mathbb{E}[\tau] < \infty by a standard expectation-via-tail-sum argument. OST condition (3) is satisfied.

Part 3

OST: E[Yτ]=Y0=k2\mathbb{E}[Y_\tau] = Y_0 = k^2.

Also, E[Yτ]=E[Sτ2]E[τ]\mathbb{E}[Y_\tau] = \mathbb{E}[S_\tau^2] - \mathbb{E}[\tau]. On {Sτ=0}\{S_\tau = 0\}: Sτ2=0S_\tau^2 = 0. On {Sτ=N}\{S_\tau = N\}: Sτ2=N2S_\tau^2 = N^2. So:

E[Sτ2]=N2P(Sτ=N)=N2k/N=kN.\mathbb{E}[S_\tau^2] = N^2\cdot \mathbb{P}(S_\tau = N) = N^2\cdot k/N = kN.

Substituting: k2=kNE[τ]k^2 = kN - \mathbb{E}[\tau], so E[τ]=kNk2=k(Nk)\mathbb{E}[\tau] = kN - k^2 = k(N - k). ✓

Part 4

(k,N)=(50,100)(k, N) = (50, 100) gives E[τ]=5050=2500\mathbb{E}[\tau] = 50\cdot 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 SnS_n to get the exit probabilities; apply OST to Sn2nS_n^2 - n to get the exit time. Both are one-line computations once the right martingale is chosen.
  • E[τ]=k(Nk)\mathbb{E}[\tau] = 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)x \in (a, b), the expected exit time from (a,b)(a, b) is (xa)(bx)/σ2(x - a)(b - x)/\sigma^2 — exact same formula, scaled by diffusion variance. Same martingale (Wt2tW_t^2 - t) drives the derivation.
  • Yn=Sn2nY_n = S_n^2 - n is the discrete quadratic-variation martingale. It is to the discrete walk what Wt2tW_t^2 - t is to Brownian motion — the foundational L2L^2-martingale of the process.