Let $(f(x))^2$ and $(f(x))^3$ are $C^{\infty}$. Prove or disprove that $f$ is $C^{\infty}$. 
Suppose $f(x), -\infty < x < +\infty$, is a real valued function such that both $(f(x))^2$ and $(f(x))^3$ are $C^{\infty}$.
Must $f$ be $C^{\infty}$?

I had seen this exercise somewhere on internet long ago, it is quite disturbing to post exercises where I block completely (and this is not lack of trying).
Someone could just give me a way to solve it ?
Thanks.
 A: This is a very nice problem. It has also been asked on MO, where it can be found here. It is a particular case of a theorem due to Henri Joris, in 

Henri Joris. Une $C^\infty$-application non-immersive qui possède la propriété universelle des immersions, Arch. Math. (Basel), 39 (3), (1982), 269–277.

His result is as follows:

Theorem. If $f:\mathbb R\to\mathbb R$, $m,n$ are relatively prime natural numbers, and $f^m$ and $f^n$ are $C^\infty$, then so is $f$. 

For a more accessible argument (still a bit more sketchy than it would be ideal), see

Robert Myers. An elementary proof of Joris's theorem. Amer. Math. Monthly, 112 (9), (2005), 829–831.

For the specific case of $f^2$ and $f^3$, there is also a nice write-up by Tao, available here. 
The idea of Myers's proof is simple, but some care is needed: We have $f=f^3/f^2$ in the open set $\{x\mid f(x)\ne0\}$, so $f$ is $C^\infty$ there, and we are left to argue that the expression makes appropriate sense at those points where $f(x)=0$, and is infinitely differentiable there as well. Myers argues by induction on $n$ that $f^{(n)}$ exists and is continuous at $x$. This requires an analysis by cases, depending on whether such a point $x$ is isolated or limit of other such points. The second case is easy and is essentially an application of Rolle's theorem. The first case is harder, and Myers splits it into two subcases, depending on whether all the derivatives of $f^3$ vanish at the point $x$. The case where this happens is handled easily, and we are left with the other possibility, that Myers deals with elegantly via Taylor's theorem applied to $f^3$.
