# Is the set of isolated zeros of a continuous function closed?

If $$f:\mathbb R\to\mathbb R$$ is continuous, is $$B:=\left\{x\in\mathbb R:x\text{ is an isolated point of }f^{-1}\left(\left\{0\right\}\right)\right\}$$ closed? It's clear that $$B$$ is countable, but since a countable set doesn't to be closed ($$\left\{\frac1n:n\in\mathbb N\right\}$$ being a counterexample), that doesn't yield the claim. (As usual, I'm assming $$\mathbb R$$ is equipped with the euclidean topology.)

No. For instance, let $$A\subseteq \mathbb{R}$$ be any closed set and let $$f(x)=d(x,A)$$. Then $$f^{-1}(\{0\})=A$$. But, the isolated points of $$A$$ do not need to be closed; for instance, $$A$$ could be $$\{0\}\cup\{1/n:n\in\mathbb{Z}_+\}$$.
• Thank you for your answer. I've asked the question in light of an answer to my other question. Can you tell me if there is anything special about the set $N$ in this answer (warning, the user redefined the symbol $N$ which was already used in the question) which allows us to conclude closedness of it? Commented May 2, 2019 at 19:34
• No, there is no reason that $N$ there should be closed. The argument does not seem to use the assumption that $N$ is closed anywhere, though. Commented May 2, 2019 at 19:39
• It is implicitly used, since in order to even talk about the derivative of $|h|'$ at $x$ we need that $|h|'$ is defined in a neighborhood of $x$. This is ensured by openness of $\mathbb R\setminus N$. Commented May 3, 2019 at 4:46
No. Take, for instance$$\begin{array}{rccc}f\colon&\mathbb R&\longrightarrow&\mathbb R\\&x&\mapsto&\begin{cases}x\sin\left(\frac1x\right)&\text{ if }x\neq0\\0&\text{ otherwise.}\end{cases}\end{array}$$Then the set of isolated zeros is $$\left\{\frac1{\pi n}\,\middle|\,n\in\mathbb Z\setminus\{0\}\right\}$$, which is not closed ($$0$$ belongs to its closure, but not to the set itslef).