I am wondering, polynomials like


$S\_n^4-6n S\_n^2+3n^2+2n$ for $$S\_n=\sum\_{i=1}^n{X\_i}$$ where $$\mathbb{P}(X\_i=1)=\mathbb{P}(X\_i=-1)=\frac{1}{2}$$ is a martingale (under the conventional filtration). While $$B\_t^4-6t B\_t^2+3t^2$$ for Brownian motion $B\_t$ is also a martingale. 


Note the difference between the two, and the similarity!


What's the general conclusion about the polynomials of $S\_n$ and $n$, also about $B\_t$ and $t$, to make them into martingales?


Thanks.



Martingales in both discrete and continuous setting
One knows that $P(S\_n,n)$ is a martingale if and only if $P(s+1,n+1)+P(s-1,n+1)=2P(s,n)$ and
that $Q(B\_t,t)$ is a martingale if and only if $2\partial\_tQ(x,t)+\partial^2\_{xx}Q(x,t)=0$.


Assume that $P(S\_n,n)$ is a martingale and, for a given $d$ and for every $h>0$, let 
$$
Q\_h(x,t)=h^{d}P(x/\sqrt{h},t/h),
$$ 
in the sense that one evaluates $P(s,n)$ at the integer parts $s$ and $n$ of $x/\sqrt{h}$ and $t/h$. 


If $Q\_h\to Q$ when $h\to0$, writing $\partial\_t$ and $\partial^2\_{xx}$ as limits of finite differences of orders $1$ and $2$, one sees that $2\partial\_tQ+\partial^2\_{xx}Q=0$, hence $Q(B\_t,t)$ is a martingale.


Example: $P(s,n)=s^2-n$. For $d=1$, $Q\_h(x,t)=x^2-t$ hence $Q(x,t)=x^2-t$.


Other example:
$P(s,n)=s^4-6ns^2+3n^2+2n$. For $d=2$, $Q\_h(x,t)=x^4-6tx^2+3t^2+2ht$ hence $Q(x,t)=x^4-6tx^2+3t^2$.


In the other direction, to deduce a martingale in $S\_n$ and $n$ from a martingale in $B\_t$ and $t$, one should probably replace each monomial by a sum of its first derivative. This means something like replacing $q(t)=3t^2$ by $\displaystyle\sum\_{k=1}^n(\partial\_tq)(k)=3n^2+3n$ but I did not look into the details.




---


**Edit** (Thanks to The Bridge for a comment on the part of this answer above this line) 


Recall that a natural way to build in one strike a full family of martingales that are polynomial functions of $(B\_t,t)$ is to consider so-called *exponential martingales*. For every parameter $u$,
$$
M^u\_t=\exp(uB\_t-u^2t/2)
$$ 
is a martingale hence every "coefficient" of its expansion as a series of multiples of $u^i$ for nonnegative integers $i$ is also a martingale. This yields the well known fact that 
$$1,\ B\_t,\ B^2\_t-t,\ B^3\_t-3tB\_t,\ B^4\_t-6tB\_t^2+3t^2,
$$
etc., are all martingales. One recognizes the sequence of Hermite polynomials $H\_n(B\_t,t)$, a fact which is not very surprising since these polynomials may be defined precisely through the expansion of $\exp(ux-u^2t/2)$. 


So far, so good. But what could be an analogue of this for standard random walks? The exponential martingale becomes 
$$
D^u\_n=\exp(uS\_n-(\ln\cosh(u))n)
$$
and the rest is simultaneously straightforward (in theory) and somewhat messy (in practice): one should expand $\ln\cosh(u)$ along increasing powers of $u$ (warning, here comes the family of Bernoulli numbers), then deduce from this the expansion of $D^u\_n$ along increasing powers of $u$, and finally collect the resulting sequence of martingales polynomial in $(S\_n,n)$.


Let us see what happens in practice. Keeping only two terms in the expansion of $\ln\cosh(u)$ yields $\ln\cosh(u)=\frac12u^2-\frac1{12}u^4+O(u^6)$ hence 
$$
\exp(-(\ln\cosh(u))n)=1-\frac12u^2n+\frac1{24}u^4(2n+3n^2)+O(u^6).
$$
Multiplying this by
$$
\exp(uS\_n)=1+uS\_n+\frac12u^2S\_n^2+\frac16u^3S\_n^3+\frac1{24}u^4S\_n^4+\frac1{120}u^5S\_n^5+O(u^6),
$$
and looking for the coefficients of the terms $u^i$ in this expansion yields the martingales 
$$
1,\ S\_n,\ S\_n^2-n,\ S\_n^3-3nS\_n,
$$
and
$$
S\_n^4-6nS\_n^2+2n+3n^2,\
S\_n^5-10nS\_n^3+5(2n+3n^2)S\_n.
$$
Thus, in $M\_t^u$, $B\_t$ scales like $1/u$ and $t$ like $1/u^2$ hence Hermite polynomials are homogeneous when one replaces $t$ by $B\_t^2$. The analogues of Hermite polynomials for $(S\_n,n)$, from degree $4$ on, are not homogeneous in the sense of this dimensional analysis where $n$ is like $S\_n^2$. Ultimately, this is simply because in $D\_n^u$ one has to compensate $uS\_n$ by $(\ln\cosh(u))n$, which is not homogeneous in $u^2n$.


Note that this argument of *non homogeneity* carries through to continuous time processes. For instance, the exponential martingales for the standard Poisson process $(N\_t)\_t$ are
$$
\exp(uN\_t-(\mathrm{e}^u-1)t),
$$
and the rest of the argument is valid once one has noted that $\mathrm{e}^u-1$ is not a power of $u$.


