What are the conditions for the function that is two times differentiable and all partial derivatives existing $f$: $$f(B(t)^2,t)$$ to be a martingale?
I am able to show the conditions for $f(B(t),t)$ to be a martingale: this requires that $1/2f_{xx}(B(t),t)$ and $f_t(B(t),t))$ have to be zero, to ensure we don't have $dt$ terms. But how does it work for $f(B(t)^2,t)$?
Let $X_t = B_t^2$, so that by Itô's lemma we have $$dX_t = dt + 2B_t dB_t$$ For $f \in C^{2,1}$, we set $Z_t = f(X_t, t) = f(B_t^2,t)$ and apply Itô's lemma again to get: $$\begin{align*} dZ_t &= f_t(X_t, t) dt + f_x(X_t, t) dX_t + \frac{1}{2}f_{xx}(X_t, t)(dX_t)^2 \\ &= \left( f_t(X_t, t) + 2X_t f_{xx}(X_t, t) + f_x(X_t, t) \right) dt + 2B_tf_x(X_t, t) dB_t \\ &= \left( f_t(B_t^2, t) + 2B_t^2 f_{xx}(B_t^2, t) + f_x(B_t^2, t) \right) dt + 2B_tf_x(B_t^2, t) dB_t \end{align*}$$
Thus, for $Z_t$ to be driftless, you need $f_t(B_t^2, t) + 2B_t^2 f_{xx}(B_t^2, t) + f_x(B_t^2, t) = 0$, which is a PDE that can be solved for $f$. This guarantees that $Z_t$ is a local martingale. For $Z_t$ to be a true martingale, then a sufficient condition would be that $B_t f_x(B_t^2, t)$ is in $L^2$.