Suppose $f$ is a $C^\infty$ function from the reals to the reals that is never negative. Does it have a $C^\infty$ square root? Clearly the only problem points are those at which $f$ vanishes.

8A natural extension of the question is whether every nonnegative smooth function is the sum of finitely many squares of smooth functions. The standard anwser from the literature seems to be "there is an unpublished counterexample by S.Cohen and D.Epstein". Does anybody know what this counterexample look like ? – Guillaume Aubrun Aug 27 '12 at 15:11
The answer is "no". This is covered in great detail here:

There is a famous open problem, whose solution is attributed to Paul Cohen, but no published paper seems to be available: there exists $f\in C^\infty(\mathbb R,\mathbb R_+)$ such that $f$ is not a finite sum of squares of smooth functions. That could be a relevant question for MO. – Bazin Aug 31 '12 at 20:18
The function $$f(x) = \begin{cases} \sin^2 \left(\frac{1}{x} \right) e^{1/x} + e^{2/x} & \text{if $x > 0$,}\\ 0 & \text{if $x \leq 0$,} \end{cases}$$ is $C^\infty$ but has no $C^2$ square root. I found this example in the paper Choosing roots of polynomials smoothly by Alekseevsky, Kriegl, Losik, and Michor (available freely here). This example appears to have come from Frank Warner's (unpublished) 1963 dissertation.

Yes, and functions of this type are discussed in section 2 of the reference I gave in my answer. – Dick Palais Aug 25 '12 at 4:17

1Both answers were helpful. It appears that the answer is yes if you add the additional assumption that $f^3$ has a square root. Of course, a square root of $f$ is a square root of $f^3$ divided by $f$, but while you can easily show such a function is continuous, it is not so easy to show it $C^\infty$. But thanks to both of you. I wish I could check both. – Michael Barr Aug 25 '12 at 11:15
