Suppose $f: \mathbb{R} \rightarrow \mathbb{R} $ is differentiable and $g: \mathbb{R} \rightarrow \mathbb{R} $ is infinitely differentiable, i.e. $ g \in C^{\infty}(\mathbb{R})$, where we know $f'(x) = g(f(x)) $ on $\mathbb{R}$. Show that $ f \in C^{\infty}(\mathbb{R})$.
Thus I have to show that $f$ is infinitely differentiable, that is, derivatives of all orders exist. I can assume by induction that all derivatives of order less than, say $n$, exist, and have to show that the $nth$ derivative exists for $f$.
I came up with this: $f^{n}(x) = (g \circ f)^{n-1}(x)$. I somehow have to show that the $(n-1)th$ derivative for this composite function exists. I tried using the chain rule, but it just seems to become more ugly as I continue taking more derivatives. Obviously, I have to use the fact that $g$ is infinitely differentiable as well as the inductive assumption, although I'm not sure how to complete this line of reasoning. Maybe induction isn't even the right way to proceed.
Ideas?