Suppose I have a smooth function $f(x):\mathbb{R}\to\mathbb{R}\geq 0.$ Does there always exist a differentiable $g(x):\mathbb{R}\to\mathbb{R}$ with $g(x)^2 = f(x)$?
If so, clearly $g(x) = \epsilon(x)\sqrt{f(x)}$ for $\epsilon(x)\in\{\pm1\}$. Is there an explicit formula for $\epsilon$? Intuitively, I want it to flip sign each time $f$ becomes 0.