Let $(Y_n, n\ge 1)$ is the sequence of independent, uniformly distributed on the interval $[-1, 1]$ random variables. $S_n = Y_1 + Y_2 + ... + Y_n,$ $n\ge 1$ and $S_0 = 0.$
If the sequences:
a) $X_n = \sum_{k=1}^n S_{k-1}^2 Y_k$, $X_0 = 0$,
b) $X_n = S_n^2 - \frac{n}{3}$, $X_0 = 0$
are martingales?
My solution I started from b):
$\mathbb E[X_{n+1} | S_0, ..., S_n]=\mathbb E[(S_{n}+Y_{n+1})^2 - \frac{n-1}{3} | S_0, ..., S_n]=\mathbb E[S_{n}^2+2S_n Y_{n+1} + Y_{n+1}^2- \frac{n-1}{3} | S_0, ..., S_n]=S_{n}^2 +2S_n \mathbb E[Y_{n+1} | S_0, ..., S_n] + \mathbb E[Y_{n+1}^2| S_0, ..., S_n] - \frac{n-1}{3}=S_n^2 + \frac{1}{3} - \frac{n-1}{3} = X_n.$
Is it correct? How to solve a)?
Your solution to (b) looks fine.
You can solve (a) in a similar fashion, but it may be easier to first note that $X_n$ is a function of $S_0, \dots, S_n$ (write $Y_k = S_k - S_{k-1}$). Then to show it is a martingale, it is equivalent to show that $\mathbb{E}[X_{n+1} - X_n \mid S_0, \dots, S_n] = 0$, which saves you from having to work with the sum.
Each of these illustrates a common way of creating martingales. (a) is an example of a martingale transform or discrete stochastic integral. For (b), the key is that $S_n$ is also a Markov chain, and the function $f(x,n) = x^2-n/3$ solves the discrete-time backward heat equation corresponding to the transition function of $S_n$.