TITLE: Square root of a positive $C^\infty$ function.
QUESTION [41 upvotes]: 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.

REPLY [41 votes]: The answer is "no". This is covered in great detail here:
http://www.math.polytechnique.fr/~bony/BBCP_jfa.pdf

REPLY [31 votes]: 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.