Shreve I.2.5 Discrete versions of Ito’s lemma

Øksendal (sixth edition) example 3.1.9: almost surely,
\[
B_t^2 - t = \int_0^t 2B_s dB_s
\]

This has a discrete version which holds everywhere: let \(X_n=\pm 1\) and \(S_n=\sum_{i=1}^n X_i\), then
\[
S^2_n-n = 2\sum_{i=0}^{n-1} S_i X_{i+1}
\]
To verify just note that both sides increase by \(2S_{n-1}X_n\) when going from $n-1$ to $n$.

Øksendal’s exercise 4.2:
\[
B_t^3 = \int_0^t 3B_s ds + \int_0^t 3B_s^2 dB_s
\]

Here the discrete version is not a perfect analogue:
\[
S_n^3 - S_n = 3\sum_{i=0}^{n-1} (S_i + S_i^2 X_{i+1})
\]
The extra term $S_n$ seems related to the fact that $(dB_t)^3 = 0$.