# Confusions regarding the concept of a stopping time for a martingale

I am studying martingales and I have a few conceptual questions regarding why we need stopping times. My book (Probability and Computing by Mitzenmacher and Upfal) defines a martingale as follows:

A sequence of random variables $Z_0,Z_1,\ldots$ is a martingale with respect to the sequence $X_0,X_1,\ldots$ if $\forall n\geq 0$, the following condition holds:

1. $Z_n$ is a function of $X_0,X_1,\ldots, X_n$
2. $\mathbb{E}(|Z_n|) < \infty$
3. $\mathbb{E}(Z_{n+1}\mid X_0,\ldots, X_n) = Z_n$

Here is what I don't get: It seems to me, you could just pick any random variable and symbolically assert the following:

$\forall n \geq 0, \mathbb{E}(Z_n)=\mathbb{E}(Z_0)$ using the tower of expectations property recursively, so how do I symbolically verify the need to worry about the stopping time and develop the martingale stopping theorem?

PS: Is the following guess as to why we need the stopping theorem correct? We need it because the original theorem might be defined for a countably infinite number of random variables and stopping it at a random time might break the conditions under which it holds?

-
A crucial point is that condition (1) asks that $Z_n$ be a function of $X_0$, $X_1$, ..., $X_n$ only (using no $X_k$ for $k\ge n+1$). –  Did Apr 21 '11 at 23:30
Good point. I have edited the post. –  EVK Apr 22 '11 at 4:38
I guess a more crisper variant of the question could be (in case someone was not clear on what I was mumbling about): Why do we need to care about Stopping Times, when given any time $T$, I can easily find $\mathbb{E}(Z_T)$ recursively ? –  EVK Apr 22 '11 at 4:40
Given any deterministic time $T$ you can find $E(Z_T)$ easily. But a stopping time is a random time. –  GWu Apr 22 '11 at 4:59
Well, I guess I don't understand clearly why the fact that the stopping time is random prevents you from finding $\mathbb{E}(Z_T)$ easily? I mean even though the time is random, doesn't the fact that this behavior is true for all times ensure that $\mathbb{E}(Z_T)$ is available to us ? For example, suppose I toss a coin and irrespective of whether I get a head or tail, I roll a die, doesn't it mean that the die roll is invariant of the coin toss? –  EVK Apr 22 '11 at 5:15

When $T$ is not a stopping time, $\mathrm E(Z_T)$ can be well defined but very different from $\mathrm E(Z_0)$. Consider for instance the symmetric random walk $(Z_n)_{n\geqslant0}$ on the integer line which starts from $Z_0=0$ and whose steps are $\pm1$. Let $R$ denote the time of the first return to $0$, and $T$ the last time before $R$ such that $Z$ is maximal on the time span $[0,R]$, that is, such that $Z_T\geqslant Z_n$ for every $0\leqslant n\leqslant R$.
Then $Z_R=0$ almost surely hence $\mathrm E(Z_R)=0$. On the other hand, $Z_T\geqslant0$ almost surely and $Z_T\geqslant1$ with positive probability hence $\mathrm E(Z_T)\gt0$. One sees that $\mathrm E(Z_R)=\mathrm E(Z_0)$ and $\mathrm E(Z_T)\ne\mathrm E(Z_0)$. Of course, $R$ is a stopping time while $T$ is not.
Edit In the case described above, one can even show that $Z_T$ is not integrable. To see this, note that $Z_T=0$ on $[Z_{-1}=-1]$, which happens with probability $\frac12$, and that, for each integer $z\geqslant1$, $Z_T\geqslant z$ if and only if $Z_1=1$ and, starting from $1$, one hits the level $z$ before the level $0$. This last event has probability $\frac1z$ hence, for every $z\geqslant1$, $\mathrm P(Z_T\geqslant z)=\frac1{2z}$. In particular $\mathrm E(Z_T^-)=0$ and $\mathrm E(Z_T^+)=+\infty$ hence $\mathrm E(Z_T)=+\infty$.