TITLE: Given $f$ continuous, find $g$ smooth such that $g→0$ when $f→0$ and vice versa
QUESTION [11 upvotes]: Let $X$ be a smooth manifold (where, throughout, “smooth” means “$C^\infty$”).  Consider the following statement:

For all $f\colon X\to\mathbb{R}$ continuous there exists $g\colon X\to\mathbb{R}$ smooth such that both of the following hold:

$\forall \varepsilon>0.\; \exists \delta>0.\; \forall x\in X.\; (|f(x)|<\delta \Rightarrow |g(x)|<\varepsilon)$

$\forall \varepsilon>0.\; \exists \delta>0.\; \forall x\in X.\; (|g(x)|<\delta \Rightarrow |f(x)|<\varepsilon)$



Question: Is this statement true?  If so, what is a proof?  Is it a standard fact?  If so, what is a reference?
Comments:

The statement is of the form $\forall f. \exists g. \forall \varepsilon$.  This is not an error.  (I state this explicitly, because everyone I asked initially seems to want to read it as $\forall f. \forall \varepsilon. \exists g$ instead.)

With a slight abuse of notation/terminology, we might rephrase the question as: “for every continuous $f$, there exists $g$ smooth such that both $g\to 0$ when $f\to 0$ and conversely”.  This explains the title of this question and I hope helps to make it seem more natural.

For the significance of the conditions on $g$, see this answer (note that we can assume w.l.o.g. that $f$ is bounded, and we can demand w.l.o.g. that $g$ is: then they say $Z(\tilde f) \subseteq Z(\tilde g)$ and $Z(\tilde f) \supseteq Z(\tilde g)$ respectively, where $\tilde f,\tilde g$ are the continuous extensions of $f,g$ to the Stone-Čech compactification $\beta X$ of $X$).

Two special cases of the above statement are worth noting (and are indeed proven as follows):

If $X$ is compact, then the conditions on $g$ simply state that $g$ vanishes exactly when $f$ does (viꝫ. $Z(g) = Z(f)$), i.e., the statement is that every zero-set the zero-set of a smooth function.  This is indeed the case: see here and here (I don't know a printed reference even for this particular case, so if you know one, please suggest).

If $f$ does not vanish, then the statement can be proved as follows: we can assume w.l.o.g. that $f>0$ (by considering the clopen sets $\{f>0\}$ and $\{f<0\}$ separately).  By a standard approximation theorem (Hirsch, Differential Geometry (1976, Springer GTM 33), chapter 2, theorem 2.2 on page 44), there exists a smooth function $v$ such that $|u-v|<1$ on $X$, where $u := \log f$: then $0 < C_1 f < g < C_2 f$ for some constants $0<C_1<C_2$ (viꝫ. $\frac{1}{e}$ and $e$), which implies the required conditions.



My initial motivation for asking is that a positive answer implies a positive answer to the PS in this answer (in short: that the maximal ideals of the ring of bounded smooth functions on $X$ are in bijective correspondence with those of the ring of bounded continuous functions, by the map which simply takes an ideal of the latter to its intersection with the former ring).  But I think the question has independent interest.

REPLY [2 votes]: Yes.
For notational simplicity, if $f,g:X\rightarrow\mathbb{R}$, then we shall write
$Z(\overline{f})=Z(\overline{g})$ for the statement
$\forall\epsilon>0\exists\delta>0\forall x\in X(|f(x)|<\delta\rightarrow|g(x)<\epsilon|)\wedge (|g(x)|<\delta\rightarrow|f(x)<\epsilon|).$ See my answer to the previous question for an explanation of this notation.
I claim that for every paracompact smooth manifold $X$ and continuous function $f:X\rightarrow\mathbb{R}$, there is a smooth function $h:X\rightarrow\mathbb{R}$ such that $Z(\overline{f})=Z(\overline{h}).$
Suppose that $X$ is a manifold, and $f:X\rightarrow[0,\infty)$ is continuous (we can assume $0\leq f(x)$ everywhere because we can just replace $f$ with $x\mapsto\min(1,|f(x)|)$). Then whenever $c_{1}<c_{2}$, there exists a continuous function $g:X\rightarrow[0,\infty)$ such that $Z(f)=Z(g)$, $g$ is smooth on the set $X\setminus Z(f)$, and where
$c_{1}f(x)<g(x)<c_{2}f(x)$ whenever $x\in X\setminus Z(f)$.
Now, suppose that $H:\mathbb{R}\rightarrow\mathbb{R}$ is a smooth increasing bijective function such that $H(0)=0$. Then  $Z(\overline{f})=Z(\overline{g})=Z(\overline{H\circ g}).$
I claim we can construct a function $H$ such that $H\circ g$ is smooth, but we will first need a lemma.
Lemma: Suppose that $f_{n}:\mathbb{R}\setminus\{0\}\rightarrow\mathbb{R}$ is a continuous function for each natural number $n$. Suppose furthermore that $W_{n}:[0,\infty)\rightarrow[0,\infty)$ is a continuous increasing function with $W_{n}(0)=0$ for each $n$.
Then there exists a smooth increasing bijective function $H:\mathbb{R}\rightarrow\mathbb{R}$ with $H(0)=0$ such that for each $n$, we have $$\lim_{x,y\rightarrow 0,|y|\leq W_{n}(x)}f_{n}(x)H^{(k)}(y)=0.$$
Theorem: Suppose that $g:X\rightarrow\mathbb{R}$ is a continuous function such that $g$ is smooth on the set $\{x\in X\mid g(x)\neq 0\}$. Then there exists a smooth increasing bijective function $H:\mathbb{R}\rightarrow\mathbb{R}$ such that $H(0)=0$ and where $H\circ g$ is smooth everywhere.
Proof: The idea behind this proof is to make $H^{(k)}(x)\rightarrow 0$ as $x\rightarrow 0$ quickly enough for $k\geq 0$ so that $H\circ g$ is 'flat' enough around points $x\in X$ with $g(x)=0$.
Suppose that $X$ has dimension $N$, and $C\subseteq U\subseteq\mathbb{R}^{N}$ with $C$ compact and $U$ open. Let $\iota:U\rightarrow X$ be a smooth coordinate chart. Let $G=g\circ\iota$. Suppose that $C^{\circ}\cap Z(G)\neq\emptyset$.
The function $G$ is smooth on the set $U\setminus\partial Z(G)$. For each multi-index $\alpha$, the derivative $D^{\alpha}G$ is continuous on the set $C\setminus\partial Z(G)$. Therefore, for each $\delta>0$, and multi-index $\alpha$, the function $D^{\alpha}G$ is bounded on the set $\{c\in C\mid d(c,C\cap\partial Z(G))\geq\delta\}$. Therefore, let $M(\iota,C,\alpha,\delta)$ be the maximum of $|D^{\alpha}G|$ on the set $\{c\in C\mid d(c,C\cap\partial Z(G))\geq\delta\}$.
For each multi-index $\alpha$,
there are polynomials $P_{\alpha,0},\dots,P_{\alpha,k}$ with non-negative coefficients where
$D^{\alpha}H\circ G(\mathbf{x})=\sum_{k=0}^{|\alpha|}H^{(k)}(G(\mathbf{x}))P_{\alpha,k}((G_{\beta}(\mathbf{x}))_{\beta\leq\alpha})$
(a more explicit computation of these polynomials is obtained from the Faà di Bruno's formula).
Therefore, $$|D^{\alpha}H\circ G(\mathbf{x})|\leq \sum_{k=0}^{|\alpha|}|H^{(k)}(G(\mathbf{x}))|\cdot P_{\alpha,k}((M(\iota,C,\beta,d(x,C\cap Z(G))))_{\beta\leq\alpha}).$$
Now, let $\omega:[0,\infty)\rightarrow[0,\infty)$ be a continuous increasing function such that $|G(x)-G(y)|\leq\omega(\|x-y\|)$ whenever $x,y\in C$. In particular, if $\|x-c\|=d(x,C\cap Z(G))$, then
$$|G(x)|=|G(x)-G(c)|\leq\omega(\|x-c\|)=\omega(d(x,C\cap Z(G))).$$
Suppose now that for each $n$, there is an open set $U_{n}\subseteq\mathbb{R}^{n}$, a compact set $C_{n}$ and a chart $\iota_{n}:U_{n}\rightarrow X$ such that $X=\bigcup_{n}\iota[C_{n}^{\circ}]$. For simplicity, assume that $\iota[C_{n}^{\circ}]\cap Z(g)\neq\emptyset$ for all $n$.
For each $n$, let $\omega_{n}:[0,\infty)\rightarrow[0,\infty)$ be a continuous increasing function with $\omega_{n}(0)=0$ ​and where $|(g\circ\iota_{n})(x)|\leq\omega_{n}(d(x,C_{n}\cap Z(g\circ\iota_{n}))$ whenever $x\in C_{n}$.
Therefore,
$$|D^{\alpha}H\circ g\circ\iota_{n}(x)|\leq
\sum_{k=0}^{|\alpha|}|H^{(k)}\circ g\circ\iota_{n}(x)|\cdot P_{\alpha,k}((M(\iota_{n},C_{n},\beta,d(x,C_{n}\cap Z(g\circ\iota_{n}))))_{\beta\leq\alpha}).$$
By the above lemma, one can choose the function $H$ so that
$$\lim_{x\rightarrow 0^{+},y\rightarrow 0,|y|\leq\omega_{n}(|x|)}\sum_{k=0}^{|\alpha|}|H^{(k)}(y)|\cdot P_{\alpha,k}(M(\iota_{n},C_{n},\beta,x)))|x|^{-1}=0.$$
In this case, if $x_{0}\in C_{n}\cap Z(g\circ\iota_{n})$, then
$$\lim_{x\rightarrow x_{0}}\sum_{k=0}^{|\alpha|}|H^{(k)}\circ g\circ\iota_{n}(x)|\cdot P_{\alpha,k}((M(\iota_{n},C_{n},\beta,d(x,C_{n}\cap Z(g\circ\iota_{n}))))_{\beta\leq\alpha})\cdot\|x-x_{0}\|^{-1}=0.$$
Therefore,
$$\lim_{x\rightarrow x_{0}}|D^{\alpha}(H\circ g\circ\iota_{n})(x)|\cdot\|x-x_{0}\|^{-1}=0.$$
We conclude that $H\circ g\circ\iota_{n}$ is smooth on $C_{n}^{\circ}\cap Z(G)$.
Therefore, $H\circ g\circ\iota_{n}$ is smooth on $C_{n}^{\circ}$, so
$H\circ g$ is smooth on $\iota[C_{n}^{\circ}]$. We conclude that $H\circ g$ is smooth everywhere.
Q.E.D.