Showing that the square of Brownian motion, minus time, is a martingale

A martingale $(M_t)_{t\geq 0}$ is an $\mathcal{F}_t$-adapted stochastic process that satisfies $\mathbb{E}(M_t\mid \mathcal{F}_s) = M_s$ for all $s,t$ with $0\leq s \leq t$. Intuitively, this means that a Martingale does not on average change over time (with respect to a particular probability measure; in this case the one corresponding to $\mathbb{E}$).

Note that we can write the equation mentioned above as $\mathbb{E}(M_t - M_s \mid \mathcal{F_s})=0$, which is exactly what you have in your question.

Technically, some conditions concerning integrability are required, but those are not important to grasp the intuition. A formal definition is given here.

The third-last line uses the facts that $\mathbb{E}(W_t - W_s\mid\mathcal{F}_s)=0$ (a Wiener process is a Martingale) and $\mathbb{E}((W_t - W_s)^2\mid\mathcal{F}_s)=t-s$ (a Wiener process accrues variance at rate one per unit time). These properties are detailed here.


For a Wiener process you have that

$$(W_t - W_s) \sim N(0, t-s)$$

Therefore the first term in the third to last line becomes $0$.

and the second term becomes $t-s$.