Let $S_n$ be a symmetric simple random walk starting at $S_0=0$, how to prove $S_n^2-n$ is still a martingale?
It seems that checking the definition works but $$ E[S_n^2-n|\mathcal{F}_{n-1}]=? $$
Is there another approach? For $f(x)=x^2$, we can say $S^2_n$ is a sub-martingale since $S_n$ is a martingale.
Checking the definition directly is probably the best approach. I think it is useful to write $S_n=X_1+\dots+X_n$, where the $X_i$ are iid, with $\mathbb{P}(X_i=1)=\mathbb{P}(X_i=-1)=1/2$. This way, you can easily check that $$ S_n^2=(S_{n-1}+X_n)^2=S_{n-1}^2+2S_{n-1}X_n+X_n^2. $$ We can use this to compute the conditional expectation. As $S_{n-1}$ is $\mathcal{F}_n$-measurable, we get $$ \begin{align*} \mathbb{E}[S_n^2-n \mid \mathcal{F}_{n-1}] &= \mathbb{E}[S_{n-1}^2+2S_{n-1}X_n+X_n^2-n \mid \mathcal{F_{n-1}}] \\ &= S_{n-1}^2+2S_{n-1} \mathbb{E}[X_n \mid \mathcal{F}_{n-1}]+\mathbb{E}[X_n^2 \mid \mathcal{F}_{n-1}]-n \end{align*} $$ By independence, these conditional expectations agree with the expectation, and so $\mathbb{E}[X_n \mid \mathcal{F}_{n-1}]=0$, $\mathbb{E}[X_n^2 \mid \mathcal{F}_{n-1}]=1$. This yields $$ \mathbb{E}[S_n^2-n \mid \mathcal{F}_{n-1}] = S_{n-1}^2+1-n=S_{n-1}^2-(n-1), $$ as required.