Stopped second-moment identity for a simple symmetric random walk (source code)

= Stopped second-moment identity for a simple symmetric random walk

Let $S_n$ be a <simple symmetric random walk> started at a deterministic value $S_0=s$, and let $T$ be a nonnegative integer-valued <stopping time> with $\mathbb ET<\infty$. The stopped second-moment identity is
$$
\mathbb E[(S_T-s)^2]=\mathbb ET,\qquad \mathbb ES_T=s,
\qquad \mathbb E[S_T^2]=s^2+\mathbb ET.
$$
In particular, $\mathbb E S_T^2=\mathbb ET$ requires the zero start $s=0$.

For a direct argument, write $S_{T\wedge n}-s=\sum_{k=1}^n\xi_k\mathbf1_{\{T\geq k\}}$. The indicators depend only on the past. Centered <independent> increments therefore give zero cross terms and
$$
\mathbb E[(S_{T\wedge n}-s)^2]=\sum_{k=1}^n\mathbb P(T\geq k)=\mathbb E(T\wedge n).
$$
For $m>n$, the same calculation gives the squared <L2 norm> of the difference as $\mathbb E[(T\wedge m)-(T\wedge n)]$, which tends to zero. Thus the stopped positions converge in <L2 space>, as well as eventually pointwise to $S_T$, and both their first and second <moments> pass to the limit. This supplies the required justification for an unbounded <stopping time>; almost-sure convergence alone would not pass the second <moment>.