General recipe
From Ito formula,
$$ f(B_t)-f(B_0)
\int_0^t f’(B_s),dB_s + \frac12\int_0^t f’’(B_s),ds. $$
Move the drift term to the left:
$$ f(B_t)-f(B_0)-\frac12\int_0^t f’’(B_s),ds
\int_0^t f’(B_s),dB_s. $$
Consequence
The right-hand side is an Ito integral, so it is a martingale. Therefore
$$ f(B_t)-f(B_0)-\frac12\int_0^t f''(B_s)\,ds $$is a martingale.
Examples
- If $f(x)=x$, then $B_t$ is a martingale.
- If $f(x)=x^2$, then $B_t^2-t$ is a martingale.