Let $\displaystyle f$ be a continuous real valued function on the metric space $\displaystyle (X,d)$. Let $f$ be a continuous real valued function on the metric space $(X,d)$.  Let $A$ be the set of all $x\in M$ such that $f(x)\geq 0$.  Show that $A$ is closed.
$(1) Proof:$  To show that $A$ is closed, it suffices to show that $A^c$ is open.  That is, we must show $A^c=\{x\in M : f(x)<0 \}$ is open.  Let $y\in A^c$.  Then $f(y)<0$.  Because $f$ is continuous, for any given $\epsilon>0$ there exists a $\delta$ (dependent on $\epsilon$) such that $|f(x)-f(y)|<\epsilon$ whenever $d(x,y)<\delta$ and $x\in M$.  Let $\epsilon=\frac{f(y)}{2}$.  Then there exists a $\delta^*$ such that $|f(x)-f(y)|<\frac{f(y)}{2}$ whenever $d(x,y)<\delta^*$ and $x\in M$.  I claim that the $\delta^*$-neighborhood about $y$ is completely contained within $A^c$.  Let $z\in N_{\delta^*}(y)$.  Then $|f(z)-f(y)|<\frac{f(y)}{2}$, and thus $f(z)\in(f(y)-\frac{f(y)}{2},f(y)+\frac{f(y)}{2})\subset(\frac{3f(y)}{2},0)$, and thus $z\in A^c$.  Thus, $A^c$ is open, and therefore $A$ is closed.
$(2) Proof:$  To show that $A$ is closed, it suffices to show that $A$ contains all of its limits points.  Let $x$ be a limit point of $A$.  Then for any $\delta>0$, $N_{\delta}^*(x) \cap A \neq \emptyset$.  That is, there exists an element $r\in M$ such that $r\in N_{\delta}^*(x)$ and $r\in A$.  Because $r\in N_{\delta}^*(x)$, we know $d(x,r)<\delta$.  Because $r\in A$, we know $f(r)\geq 0$.  Because $f$ is continuous, we can choose an appropriate $\delta$ such that $d(r,x)<\delta$ and $d(f(r),f(x))<\epsilon$ for any given $\epsilon>0$.  If $f(r)>0$, then because the continuity of $f$ and the fact that $x$ is a limit point implies that $f(x)\geq 0$, and thus $x\in A$.  If $f(r)=0$...?
I'm comfortable with proof 1 (but if you have any comments, see anything wrong with it, or think it can be made more concise, please speak up).  However, as an exercise, I thought I would try and construct another proof.  Proof 2 is that other proof.  I've broken it down into two cases: $f(r)>0$ and $f(r)=0$.  I'm stuck with the second case.  Any suggestions?
 A: As for the additional proofs, you could also prove it as following:


*

*Take a point $x$ from the closure of $A$. Hence there exists a sequence $(x_{n})_{n=1}^{\infty}\subseteq A$ so that $x_{n}\to x$. Since $f$ is continuous, then $f(x_{n})\to f(x)$, and since $f(x_{n})\geq 0$ for all $n$, then $f(x)\geq 0$. Hence $x\in A$. This shows that $A$ equals its closure and thus $A$ is closed.

*Or alternatively, note that $A=f^{-1}[0,\infty)$, which is a closed set as the preimage of a closed set under a continuous function.
A: There is a problem with proof 2. You are picking an element $r$ within the neighborhood of radius $\delta$, then shrinking $\delta$ again to make it small enough to apply an appropriate continuity argument. Once you have picked $\delta$, you cannot choose to shrink it.
To see more clearly why this approach fails, suppose that we considered instead the set where $f(x) > 0$. Actually, let's take $f(x) = x^2$ and our metric space to be $\mathbb{R}$. Your attempted proof would show that $f(0) = 0^2 = 0 > 0$. How so? Around each neighborhood of $0$ there is a point $r$ for which $f(r) > 0$, and so by continuity just take $\delta$ small enough, etc. But now the flaw becomes more apparent! Suppose I take $\delta = 1/2$. Then I might have $r = 1/2$, and $f(r) = 1/4 > 0$. But the neighborhood where $f$ changes by less than $1/4$ must have $\delta < 1/2$, and so when we shrink to accommodate our new $\delta$, we lose $r$.
A: Proof 2 is good up almost until the end: "...for any given $\varepsilon > 0$." From there, you should finish the proof as follows:
Since $r \in A$, $f(r) \geq 0$, and it follows that $f(x) > f(r) - \varepsilon \geq -\varepsilon$. But $\varepsilon$ was arbitrary, and so this implies that $f(x) \geq 0$.
