$f$ be a smooth function on real line , $f(0)=0$ , $f(x)>0, \forall x \ne 0$ and any $f^{(n)}(0)=0$ ; is $\sqrt f$ smooth?

EDIT. It turns out that my proof contains an error: $f'(x)$ may take zero infinitely often as $x \to 0$. Then the L'Hospital argument breaks down.

Also, the reference in @levap's comment claims that $g$ need not be smooth, citing

$$ f(t) = \begin{cases} \mathrm{e}^{-1/|t|} (\sin^2 (\pi/|t|) + \mathrm{e}^{-1/t^2}), & t \neq 0 \\ 0, & t = 0 \end{cases} $$

as a counter-example.

Heuristics of the above example. The original reference is French, which I barely know, that I was unable to check how they came up with this counter-example. But I guess that this function is designed so that the following asymptotics is true:

$$ g(t) = \sqrt{\smash[b]{f(t)}} \approx \mathrm{e}^{-1/2|t|} |\sin(\pi/|t|)|.$$

Of course, the wedges appearing in the graph of $\mathrm{e}^{-1/2|t|} |\sin(\pi/|t|)|$ is mollified by the extra term $\mathrm{e}^{-1/t^2}$ so that $g$ is smooth away from $t = 0$. But such contribution is so small, even compared to the main envelope term $\mathrm{e}^{-1/2|t|}$, that the effect is almost negligible as $t \to 0$. So $g'(t)$ has 'almost-jump' at each point where $\sin(\pi/t)$ vanishes:

enter image description here

(Green line: derivative of $\mathrm{e}^{-1/2|t|} |\sin(\pi/|t|)|$, Red line: $g'(t)$)

This causes $g''(t)$ to have a train of high picks near $t = \frac{1}{n}$ ($n = 1, 2, \cdots$) and thus prevents $g''(t)$ from being differentiable. Actual computation shows that $g''(1/n)$ grows super-exponentially as $n \to \infty$, confirming the heuristics.


OLD ANSWER. I checked that $g$ is twice differentiable and $g''(0) = 0$. I think my computation will generalize to prove the smoothness of $g$, but I have no clean idea how to proceed.

Here is an observation that simplifies the computation:

Observation. Let $h$ be a real-valued function defined on a neighborhood of $0$. Then $$\lim_{x\to0} h(x) = 0 \qquad \text{ if and only if } \qquad \lim_{x\to0} h(x)^2 = 0.$$

The proof is straightforward from the $\epsilon$-$\delta$ definition of the limit.

Step 1. $g'(0)$ exists and is equal to $0$.

Proof. Since $g(0) = 0$, it suffices to prove that $g(x)/x \to 0$ as $x \to 0$. By the lemma, we may instead prove that $g(x)^2/x^2 \to 0$ as $x \to 0$. But we know $g(x)^2 = f(x) = \mathcal{O}(x^3)$ from the Taylor's theorem, and hence the claim follows.

Step 2. $g''(0)$ exists and is equal to $0$.

Proof. As before, it suffices to prove that $g'(x)^2/x^2 \to 0$ as $x \to 0$. Using the fact that $f'(x)/x \to 0$ as $x \to 0$, we can apply the L'Hospital's theorem and

$$ \lim_{x\to0} \frac{g'(x)^2}{x^2} = \lim_{x\to0} \frac{\left( \frac{f'\smash{(x)^2}}{4x^2} \right)}{f(x)} \underset{\text{L'Hospital}}{=} \lim_{x\to0} \frac{\left( \frac{f'(x)( xf''(x) - f'(x))}{2x^3}\right)}{f'(x)} = \lim_{x\to0} \frac{xf''(x) - f'(x)}{2x^3} = 0. $$


I'm not sure about the general case yet, but the first derivative does exist. Put $g = \sqrt{f}$. By Taylor's theorem, for any $x > 0$ and positive $n$, there exists $\xi \in (0,x)$ such that $$ f(x) = \sum_{k=0}^{n-1}\frac{f^{(k)}(0)}{k!}x^k + \frac{f^{(n)}(\xi)}{n!}x^n = \frac{f^{(n)}(\xi)}{n!}x^n. $$ Since $f^{(n)}$ is bounded near $0$, $f(x) \leq C_nx^n$ for some constant $C_n> 0$. Take $n=4$, we have $$ \lim_{x\to 0^+} \frac{g(x)}{x} \leq \sqrt{C_4} \lim_{x\to 0^+} \frac{x^2} {x} = 0. $$ The case $x<0$ can be dealt with likewise. This proves that $g'(0) = 0$.