Is the zero set of a function open if the function is continuous on $\mathbb R$? $f: \mathbb R \to \mathbb R$ is continuous on $\mathbb R$. $S:= \{x \in\mathbb R, f(x) = 0\}$. Is $S$ open if the function is continuous on $\mathbb R$?
I tried to pick up an arbitrary point $\alpha$ in $S$.
Since the function is continuous on $\mathbb R$.
I get $\forall \varepsilon >0, \exists \delta > 0$, such that $| f (x) - f (\alpha) | < \varepsilon, \forall x \in V \delta (\alpha)$.
Since $f(\alpha)=0$, $0\le| f(x) |< \varepsilon$.
Then $f(x) = 0, x \in$ S, $\forall x \in V \delta (\alpha)$.
Thus $\exists \delta >0, V \delta (\alpha) \subseteq S , \forall \alpha \in S$, which means $S$ is open.
Is this well-proved or is there anything wrong?
 A: There is something wrong. In fact $S$ is closed if $f$ is continuous, because $S$ is the preimage of the closed set $\{0\}$.
The mistake in your argument comes in the jump from $0 \le |f(x)| < \epsilon$ to $f(x) = 0$. You had the inequality $|f(x)| < \epsilon$ for a specific $\epsilon$, not for all $\epsilon$. If you chose a smaller $\epsilon'$ you may have needed a smaller $\delta'$, for which $x \notin V\delta'(\alpha)$, so $|f(x)|$ is not necessarily less than $\epsilon'$.
A: 
First approach

$\{0\}$ is finite and closed in $\mathbb R$.
$f$ is continuous $\implies S=f^{-1}(\{0\})$ is also closed in $\mathbb R$.

Second approach

let $(x_n)$ be a sequence of elements in $S$  which converges to $x$.
we have
$$(\forall n\in\mathbb N)\;\; f(x_n)=0$$
and  $f$ is continuous, 
$$\implies \lim_{n\to+\infty}f(x_n)=f(x)=0$$
thus, $\;\;x\in S$ which means that $S$ is closed.
A: $f$ is continuous and $\mathbb{R}\setminus\{0\}$ is an open set, so $T:=f^{-1}(\mathbb{R}\setminus\{0\})$ must be open. As $$\mathbb{R}=f^{-1}(\mathbb{R})=T\cup S$$
and as $S$ and $T$ must be disjoint this implies that $S=\mathbb{R}\setminus T$; i.e. $S$ is closed. If follows that $S$ is open if and only if $S=\mathbb{R}$ or $S=\phi $.
