$(f(X_n))_{n \in \mathbb{N}_0}$ martingale implies $f'' = 0$?

Suppose that $x<y<z$ and $\lambda\in(0,1)$ is such that $\lambda x+(1-\lambda z) = y$. Let $X_1$ be a random variable with $P[X_1 = x]=\lambda = 1-P[X_1=z]$. Put $X_0=y$. Then $(X_0,X_1,X_1,\ldots)$ is a martingale. By the hypothesis, $f(\lambda x+(1-\lambda) z) = f(y) = \lambda f(x)+(1-\lambda)f(z)$. Vary $x,z$, and $\lambda$ and you see that $f(x) = mx+b$.


Alternative solution, which only shows that $f'' \equiv 0$ and not that $f(x) = mx+b$.

We only consider the case where $X=B$ is a Brownian Motion. By Ito's Lemma, we obtain $$df(B_t) = f'(B_t)dB_t + \frac{1}{2}f''(B_t)dt$$ since it is a martingale, we obtain that almost surely $\int_0^tf''(B_s)ds = 0$ for every $t \in \mathbb{R}_{\geq 0}$. Since $f''$ is continuous, this implies $f''(B_t) = 0$ for every $t$, and thus $f''\equiv0$.