Continuity on a Set Suppose f is continuous on a S $\subset$ R. Show that  the set $$D = \{ x ∈S: f(x) = 0\} $$ is closed
I'm having trouble proving this. I tried the epsilon-delta definition of continuity:
Since, f is cont. on S, i then used the limit definition of continuity for the elements of D.
$$\forall \epsilon \gt 0, \exists \delta \gt 0\;     s.t.  
\\if\; 0<|x-x_o|<\delta\; then\; |f(x)-0|\lt \epsilon $$
But we can use $(0<|x-x_o|<\delta) \bigcap S$ as the deleted neighborhood of $x_o$
and that $-\epsilon \lt f(x)=0 \lt \epsilon $. So, we can say that since the deleted neighborhood is in S which is also in D then it contain all its limit points. Therefore, D is closed.
I'm quite iffy about my solution. Any thoughts, comments, better solution?
 A: Topologically, the preimage of a continuous function preserves closure. Now, since $\{0\}$ is closed in $S$
$$D = f^{-1}(\{0\})$$
is also closed. So the proof is complete.
A: You note that $\lbrace x \in S:f (x)=0\rbrace$ is equal to $f^{-1} (0)$, but each point is closed in $\mathbb { R }$(it is an Haudorff space) then $\lbrace x \in S:f (x)=0\rbrace$ it is closed because it is inverse immagine of a closed subspace.
A: How you organize the proof depends on how your definitions are given.  As some other answers have noted, if you define a continuous function as one under which the preimage of every closed set is closed, then the proof is immediate, but that's not the definition that you're using, which makes the proof a little more involved.  So let me first clarify the definitions that you seem to be using:


*

*A real-valued function $ f $ from a set $ S $ of real numbers is continuous if, for each element $ x _ 0 $ of $ S $, for each positive real number $ \epsilon $, for some positive real number $ \delta $, for each element $ x $ of $ S $, if $ 0 < \lvert x - x _ 0 \rvert < \delta $, then $ \lvert f ( x ) - f ( x _ 0 ) \rvert < \epsilon $.

*A real number $ x _ 0 $ is a limit point of a set $ D $ of real numbers if, for each positive real number $ \delta $, for some element $ x $ of $ D $, $ 0 < \lvert x - x _ 0 \rvert < \delta $.  In other words, for each such $ \delta $, the deleted $ \delta $-neighbourhood of $ x _ 0 $ meets $ D $.

*A set $ D $ of real numbers is closed relative to a superset $ S $ if, for each element $ x _ 0 $ of $ S $, if $ x _ 0 $ is a limit point of $ D $, then $ x $ belongs to $ D $.


Then assuming that $ f $ is continuous and defining $ D $ to be the preimage of $ 0 $ under $ f $, you want to show that $ D $ is closed (relative to $ S $).  To prove this directly (and a direct proof is possible, so you may as well use one), you need to start with a limit point $ x _ 0 $ of $ D $ in $ S $.  You said that you started with an element of $ D $, so you should change that bit.  Then you need to prove that $ x _ 0 $ belongs to $ D $, in other words that $ f ( x _ 0 ) = 0 $.  One way to do this is to prove that $ \lvert f ( x _ 0 ) \rvert < \epsilon $ for every positive real number $ \epsilon $.  You didn't say that explicitly, but you do cite the definition of continuity, which is the right thing to do next.  That gives you a $ \delta $, then you can use the definition of a limit point to get an $ x $ such that $ 0 < \lvert x - x _ 0 \rvert < \delta $ and $ x \in D $ (or as you almost put it, the deleted neighbourhood $ \{ x \mid 0 < \lvert x - x _ 0 \rvert < \delta \} $ meets $ D $), and continuity tells you that $ \lvert f ( x ) - f ( x _ 0 ) \rvert < \epsilon $.  I say ‘almost’ in ‘as you almost put it’ because, besides fixing your set-builder notation, I didn't take the intersection with $ S $.  That's because there's nothing relative about being a limit point of a subset; indeed, $ \{ x \mid 0 < \lvert x - x _ 0 \rvert < \delta \} \cap S $ meets $ D $ if and only if $ \{ x \mid 0 < \lvert x - x _ 0 \rvert < \delta \} $ itself meets $ D $ (because $ D $ is a subset of $ S $).  There is one more correction for the final step:  You're not using that $ \lvert f ( x ) \rvert < \epsilon $; you're using that $ f ( x ) = 0 $ to get that $ \lvert f ( x _ 0 ) \rvert < \epsilon $ (for each $ \epsilon $, so that $ f ( x _ 0 ) = 0 $).
So your argument is basically correct, although you could add more details, and you should at least make three corrections:


*

*Change ‘for elements of $ D $’ to ‘for limit points of $ D $ in $ S $’ (or even to ‘for elements of $ S $’, since the definition applies to all of those).

*Remove the spurious intersection with $ S $ (which is not exactly wrong but complicates things unnecessarily).

*Change ‘and that $ - \epsilon < f ( x ) = 0 < \epsilon $’ to ‘so that $ - \epsilon < f ( x _ 0 ) = f ( x _ 0 ) - f ( x ) < \epsilon $’ (or even ‘so that $ \lvert f ( x _ 0 ) \rvert = \lvert f ( x ) - f ( x _ 0 ) \rvert < \epsilon $’, since all of your other compound inequalities were phrased using absolute values).


One last thing:  You said that the goal was to prove that $ D $ is closed, but that's not necessarily true!  (For example, if $ S $ is a non-closed set, and $ f $ takes the constant value $ 0 $, then $ D $ is all of $ S $, which is not closed.)  What is actually true, and what your argument actually proves, is that $ D $ is closed relative to $ S $.  (This is why I started with a limit of point of $ D $ in $ S $, rather than any limit point of $ D $, and this allowed us to refer to $ f ( x _ 0 ) $ throughout, which would otherwise not make sense.)
