Let and be integers. A simple symmetric random walk started at exits the integer interval at . Its expected occupation of before exit, including its initial state, is
A block of consecutive positive steps forces exit, so the geometric tail bound from a uniform escape probability proves almost surely. Optional stopping at the bounded stopping time , followed by the bounded convergence theorem for , gives the gambler's ruin probabilities
Translate the absolute value martingale of a simple symmetric random walk from zero to . Bounded-time optional stopping yields
Use monotone convergence on the increasing visit count and the bounded convergence theorem on the right. Substituting the exit probabilities gives
which simplifies to the displayed expression by considering and . In particular, when .
The proof establishes finite expected value of the visit count. Therefore each translated stopped absolute-value martingale is dominated in absolute value by a constant plus that total count, an integrable random variable; its family of values is uniformly integrable. This supplies the limit justification without assuming uniform integrability in advance.
The filtration is generated by the successive independent random variables . Each is adapted, and makes it an integrable random variable. Since independence gives ,
Thus is a martingale.
Write the accumulated number of visits to zero as
It is adapted, and . Thus is also adapted and an integrable random variable. For every integer ,
Conditioning on and using independence of the next step therefore gives
The drift of the absolute value is cancelled exactly by the visit count, so . Hence both and are martingales. The latter is the absolute value martingale of a simple symmetric random walk, a discrete Tanaka formula in which visits to zero supply the correction at the corner of the absolute-value function.