[Math] Prove that the set of all roots of a continuous function is closed

real-analysis

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?

Best Answer

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.