# Should the distance between $\{x: f(x)=0\}$ and $\{x:f(x)<0\}$ be $0$ ($f$ may not be continuous, $x$ in some metric space)?

Suppose I have a function (which may or may not be continuous) $$f: X\rightarrow\mathbb{R}$$

where $X$ is a metric space, with distance $d: X\times X\rightarrow \mathbb{R}$. By abuse of notation, we also define the distance between a point in $X$ and a subset $X'\subset X$. As usual, $$d(x,X')\overset{\text{def}}{=} \inf\{d(x,x')\mid x'\in X'\}$$

Let $x\in X$ be a zero of $f$, i.e., $f(x)=0$, and we define the set $A$ as $$A\overset{\text{def}}=\{x\in X\mid f(x)< 0 \}$$ We assume $A\neq \emptyset$. Then, is it correct to claim that $d(x, A)=0$ (so x is in the closure of $A$)? Any counter-example?

• Since you place it in a general metric space then, even if $f$ is continuous and $$A\overset{\text{def}}=\{x\in X\mid f(x)\not = 0 \},$$ there would be no reason to imagine that $d(x,A)=0$ must hold. Nov 10, 2015 at 20:33

A continuous counterexample is $f(x)=x^2(1-x^2)$. We have $f(0)=0$ but $f(x)\geq 0$ in $[-1,1]$.
Suppose $f$ is a real valued function of a real variable that's $0$ at $0$, $1$ everywhere else in $(-1, 1)$ and $-1$ everywhere else ...