Given $f$ continuous, find $g$ smooth such that $g→0$ when $f→0$ and vice versa 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.
 A: The answer is yes.
Lemma 1. (Partition of Unity) There is an increasing sequence of compact subspaces  $X_1\subset ... \subset X_n \subset ...$ whose union is $X$, such that $X_n$ is in the interior of $X_{n+1}$. There is also a sequence of smooth functions $g_1, g_2, ... ,g_n, ...$ with values in $[0,1]$ such that $\text{supp}(g_1) \subset X_1$, $\text{supp}(g_2) \subset X_2$, and $\text{supp}(g_n)\subset \text{cl}(X_n-X_{n-2})$ for $n\geq3$, and $\underset{n=1}{\overset{\infty}{\sum}}g_n=1$.
Lemma 2. (Good functions) There exists a smooth function $h_n$ on each $X_n$ such that $h_n$ and $f|_{X_n}$ have the same zeros, and $\frac{h_n}{f} \in [1/2,2]$ on $X_n$ whenever $|f| \geq 1/2^n$ or $|h_n| \geq 1/2^n$.
Proof of Lemma 2. By the construction of this post, we can find a smooth function $h$ on $X_n$ that has the same sign (positive, negative, zero) of $f$. The point is to match the signs of $c_j$ by the sign of $f$, as $f$ takes the same sign on each connected component on which $f$ is nonzero. We may multiply $h$ by a constant to make $|h| \leq 1/2^n$.
Let $k$ be a smooth function such that $|k-f|$ is always smaller than $1/2^{n+1}$. Let $h_n$ be a smooth function that is equal to $k$ when $|f| \geq 1/2^n$ and equal to $h$ when $|f| \leq 1/2^{n+1}$, and the value of $h_n$ is always between that of $k$ and $h$.
The function $h_n$ satisfies the conditions.
Proof. Extend the domain of $h_n$ to the whole $X$ and let $g=\underset{n=1}{\overset{\infty}{\sum}}g_nh_{n+1}$. It's clear that the function $g$ is smooth and does not depend on how the $h_n$ are extended.
Assume that the statement $\forall \epsilon>0. \exists \delta >0. \forall x \in X.(|f(x)|<\delta ⇒|g(x)|<\epsilon)$ is false, i.e. there exists an infinite sequence of points of $X$, $\{a_n\}$, such that $f(a_n) \rightarrow 0$ and $|g(a_n)|\geq \epsilon$.
Take $m$ such that $\epsilon/2 \geq 1/2^m$. As there are only finitely many points of $\{a_n\}$ in $X_{m+2}$, we may assume that all the $a_n$s are outside $X_{m+2}$.
Suppose $g(a_n) \geq \epsilon$. There are at most two nonzero summands in $\underset{k=1}{\overset{\infty}{\sum}}g_k(a_n)h_{k+1}(a_n)$, namely $g_k(a_n)h_{k+1}(a_n)$ and $g_{k+1}(a_n)h_{k+2}(a_n)$. As $a_n$ is outside $X_{m+2}$, we have $k\geq m$. By $g_k(a_n)+g_{k+1}(a_n)=1$, there is at least one of $h_{k+1}(a_n)$ and $h_{k+2}(a_n)$ that is larger than $\epsilon/2$. Call it $h_l(a_n)$. But by the definition of $h_l(a_n)$, we have $|f(a_n)| \geq |h_l(a_n)|/2 \geq \epsilon/4$.
By replacing $g(a_n)\geq \epsilon$ by $g(a_n) \leq -\epsilon$, we have $|f(a_n)| \geq \epsilon/4$ whenever $|g(a_n)| \geq \epsilon$. Contradiction.
Assume that the statement $\forall \epsilon>0. \exists \delta >0. \forall x \in X.(|g(x)|<\delta ⇒|f(x)|<\epsilon)$ is false, i.e. there exists an infinite sequence of points of $X$, $\{a_n\}$, such that $g(a_n) \rightarrow 0$ and $|f(a_n)|\geq \epsilon$.
Take $m$ such that $\epsilon \geq 1/2^m$. As there are only finitely many points of $\{a_n\}$ in $X_{m+2}$, we may assume that all the $a_n$s are outside $X_{m+2}$.
Suppose $f(a_n) \geq \epsilon$. There are at most two nonzero summands in $\underset{k=1}{\overset{\infty}{\sum}}g_k(a_n)h_{k+1}(a_n)$, namely $g_k(a_n)h_{k+1}(a_n)$ and $g_{k+1}(a_n)h_{k+2}(a_n)$. As $a_n$ is outside $X_{m+2}$, we have $k\geq m$. Both of $h_{k+1}(a_n)$ and $h_{k+2}(a_n)$ are larger than $f(a_n)/2$. So $g(a_n) \geq \epsilon/2$.
By replacing $f(a_n)\geq \epsilon$ by $f(a_n) \leq -\epsilon$, we have $|g(a_n)| \geq \epsilon/2$ whenever $|f(a_n)| \geq \epsilon$. Contradiction.
So $g$ satisfies both conditions.
A: 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.
