Why is $(S_n)^2 - n(q-p)$ a martingale for a random walk

159 Views Asked by At

If we have a random walk such that $$P(S_{n+1} = S_n + 1|S_n)=p$$ and $$P(S_{n+1} = S_n - 1|S_n)= 1-p=q$$ then why is $$(S_n)^2 - n(q-p)$$ a martingale.

I understand that $(S_n)^2$ is a sub-martingale but why do we take away $n(q-p)$ to get a martingale?

In the symmetric random walk case I understand this would be $(S_n)^2 - n$, but again I can't understand this inutition behind this.