Prove that a function is smooth if it is smooth in almost all directions

real-analysis

Question

So suppose we have a function $f:\mathbb R^2\to \mathbb R$ for which it is given that $x\mapsto f(x,g(x))$ is smooth (i.e., $C^\infty$) for all smooth functions $g:\mathbb R\to\mathbb R$. Can we prove that $f$ is smooth as well?

I don't know whether this statement is true and honestly I wouldn't be surprised either way.

What I've tried already

Fix a point $(x_0,y_0)$. Intuitively, by taking $g(x) = \lambda x$ with $\lambda\in\mathbb R$ we see that $f$ should be at least differentiable along all directions $(1,\lambda)$ at $(x_0,y_0)$. This follows for instance by considering the curve $t\mapsto (x_0+t, y_0+\lambda t)$. Thus the only direction that is non-trivial is the vertical direction $(0,1)$. If we can show that $f$ is also differentiable in that direction then I'm confident that it will be possible to show that $f$ is differentiable. But how can we show whether $f$ is differentiable along $(0,1)$? We cannot do it directly from the fact that $f(x,g(x))$ is smooth, but perhaps we can use a limiting argument, letting the slope of the curve $(t,g(t))$ tend to infinity?

When we know that $f$ is differentiable, it will probably be possible using an inductive argument to prove that $f$ is smooth (i.e., $C^\infty$).

Any help is appreciated.

EDIT. If found a closely related result, namely Boman's theorem, which says basically says that $f$ is smooth if and only if $f\circ\gamma$ is smooth for all smooth curves $\gamma:\mathbb R\to\mathbb R^2$. I feel like the statement of my question should probably be reducible to this theorem. The only difficulty is that we don't necessarily know if our $f$ is differentiable along vertical curves, but perhaps this follows in some way.

Best Answer

It need not even be continuous. Let $f(x,y) = \frac{xy^2}{x^2+y^4}$ for $(x,y)\neq (0,0)$ and $f(0,0) = 0$. This is discontinuous, since $\lim_{t\rightarrow 0} f(t^2,t) = \frac{t^4}{t^4+t^4} = \frac{1}{2} \neq 0$. Now, $f(x,g(x))$ is clearly smooth whenever $g(0) \neq 0$, so it remains to check the case $g(0)=0$. Then, $g(x) = x\int_0^1g'(xt)dt =: xh(x)$, and $h$ is clearly smooth. Now for $x\neq 0$, $$f(x,g(x)) = \frac{xg(x)^2}{x^2+g(x)^4} = \frac{x^3h(x)}{x^2(1+x^2h(x)^2)} = x\frac{h(x)}{1+x^2h(x)^2},$$ which smoothly extends to $f(0,g(0)) = 0$, since $1+x^2h(x)^2\geq1$.

Related Question