Find constants such that transformed simple symmetric random walk is martingale Let $$S_0 :=0, \quad S_n = X_1 + ... + X_n \quad \forall n \in \mathbb{N}$$ be the simple symmetric random walk on $\mathbb{Z}$, i.e. the $X_i$ are i.i.d. with $$P[X_i = +1] = P[X_i = -1] = 1/2.$$
Now we can choose an $a \in \mathbb{N}_{\geq 1}$ and define the stopping time $$ T_a := \inf\{k \geq 1 \ \vert \ S_k \notin (-a,a) \}.$$ One can show that $E[T]=a²$.
Now I want to do two things. First, I want to find constants $b,c$ such that $$ Y_n := S_n^4-6nS_n^2
 + bn² + cn $$ is a martingale with respect to the filtration $(\sigma(X_1,...,X_n))_{n\geq 0}$. Second, I want to somehow use this to compute $E[T^2]$. 
I am really not sure, how to do any of those two steps; in particular, I don't see a connection between the $Y_n$ and the expectation of $T$.
Thanks for any advice!
 A: Let $\varphi(\theta)=\mathbb E[e^{\theta X_1}]$ be the moment generating function and $\psi(\theta)=\log\varphi(\theta)$ the cumulant generating function of $X_1$. We compute
$$ \varphi(\theta) = e^{-\theta}\mathbb P(X_1=-1)+e^{\theta}\mathbb P(X_1=1)=\frac12\left(e^{-\theta}+e^{\theta}\right)$$
and
$$\psi(\theta) = \log\left(\frac 12 \left(e^{-\theta}+e^{\theta}\right)\right)=\log\frac12 +\log\left(e^{-\theta}+e^{\theta}\right). $$
Define $M_n(\theta)=e^{\theta S_n-n\psi(\theta)}$ for $n=1,2,\ldots$. Then
\begin{align}
\mathbb E[|M_n(\theta)|] &= \mathbb E\left[e^{\theta S_n-n\psi(\theta)}\right]\\
&=\mathbb E\left[e^{\theta S_n} \right]e^{-n\left(\log\frac12+\log\left(e^{-\theta}+e^{\theta}\right) \right)}\\
&= \mathbb E[e^{\theta X_1}]^ne^{-n\left(\log\frac12+\log\left(e^{-\theta}+e^{\theta}\right) \right)}\\
&= \left(\frac12\left(e^{-\theta}+e^{\theta}\right)\right)^ne^{-n\left(\log\frac12+\log\left(e^{-\theta}+e^{\theta}\right) \right)}\\
&= \left(\frac{e^{-\theta}+e^\theta}{2e^{\log\frac12 +\log\left(e^{-\theta}+e^\theta\right)}} \right)^n\\
&=\left(\frac{e^{-\theta}+e^\theta}{e^{-\theta}+e^\theta}\right)^n\\
&=1
\end{align}
and \begin{align}
\mathbb E[M_{n+1}(\theta)\mid\mathcal F_n] &= \mathbb E\left[e^{\theta S_{n+1}-(n+1)\psi(\theta)}\mid \mathcal F_n \right]\\
&= e^{\theta S_n}e^{-n\psi(\theta)}\mathbb E\left[e^{-\psi(\theta)}\right]\\
&= e^{\theta S_n-n\psi(\theta)}\\
&= M_n(\theta),
\end{align}
so that $\{M_n(\theta)\}$ is a martingale. By Taylor's theorem we have
$$\psi(\theta) = \frac12\theta^2 -\frac1{12}\theta^4 + O(\theta^6) $$
and hence
$$e^{-n\psi(\theta)} = 1 - \frac12 \theta^2 n+\frac1{24}\theta^4(2n+3n^2). $$
Multiplying by
$$e^{-\theta S_n} = \sum_{n=0}^\infty \frac{(-\theta S_n)^n}{n!}, $$ we find that the coefficient of $\theta^4$ is $S_n^4-6nS_n^2+3n^2+2n$. It follows that $b=3$, $c=2$. Indeed,
\begin{align}
\mathbb E\left[ S_{n+1}^4-6(n+1)S_{n+1}^2+3(n+1)^2+2(n+1)\mid\mathcal F_n\right] &= \mathbb E\left[(S_n+X_{n+1})^4-6(n+1)(S_n+X_{n+1})^2\mid\mathcal F_n \right] + 3n^2+8n+5\\
&= S_n^4 +6S_n^2+1-6nS_n^2-6n-6S_n-6+3n^2+8n+5\\
&= S_n^4 -6nS_n^2 +3n^2+2n\\
&= Y_n.
\end{align}
Since $$\mathbb E[Y_1] = \mathbb E[X_1^4]-6\mathbb E[X_1^2]+3+2=0, $$ by optional stopping we have $\mathbb E[Y_{T_a}]=\mathbb E[Y_1]$, so
\begin{align}
\mathbb E[Y_{T_a}] &= \mathbb E[S_{T_a}^4-6T_a S_{T_a}^2+3T_a^2+2T_a]=0.
\end{align}
I don't see a way to compute $\mathbb E[T_a]$ from $Y_n$ either...to be continued.
