Prove that the set of all roots of a continuous function is closed Let f be continuous, and let $S=\{x \in \mathbb{R}: f(x)=0\}$ be the set of all roots of $f$, prove that $S$ is closed set.
The hint is to show every convergent sequence $(x_n)_{n\in\mathbb{N}} \subset S$, $\lim_{n\to\infty} x_n$ is also in $S$.
My method is : let $x_n$ is $S$ converges to $c$, need $f(c)=0$
by definition, $x_n$ is in $(c-\delta, c+\delta)$,
by continuity, $|f(x)-f(c)|<$ every epsilon,
but $f(x)=0$, so $|f(c)|<$ every epsilon,  so $f(c)=0$
Is my proof right, could you give me a clearer answer?
 A: Let it be that $x_n\in S$ for each $n$ and $x_{n}\rightarrow x$. Then  $f\left(x_{n}\right)\rightarrow f\left(x\right)$. This because $f$ is continuous.
Here for every $n$ you have $f\left(x_{n}\right)=0$ so $f\left(x_{n}\right)\rightarrow f\left(x\right)$
can only be true if $f\left(x\right)=0$ or equivalently $x\in S$. This shows that every convergent sequence in $S$ has a limit in $S$. That implies that $S$ is closed.
addendum:
Also there is the observation that $S$ as preimage of closed set $\{0\}$ under continuous $f$ is closed.
A: I don't know if you can apply this result:

If $f$ is a continuous function and the the terms of a convergent sequence $\{x_n\}$ are in $Dom(f)$, then $\lim f(x_n)=f(\lim x_n)$.

If you can, you don't have to talk about epsilons and deltas, since if $f(x_n)=0$ for all $n$ then
$$f(c)=f(\lim x_n)=\lim f(x_n)=\lim 0=0$$
A: The inverse image of an open set is open, by the definition of continuity. Take the open set to be $\Bbb R\setminus \{0\}$. Then the inverse image is $\{x\in\Bbb R:f(x)\ne0\}=\Bbb R\setminus S$, which must then be open. Thus $S$ is closed. 
