Here is the problem. If f and g are continuous and $f(x)\ge g(x)$ for all x in a dense set A, prove that $f(x)\ge g(x)$ for all x. Here is the proof I gave on my own attempt.
I will prove $f(x)\ge 0$ for all x using $f(x)\ge0$ for all x in A. Now in an earlier problem I already proved that if $f(x)=0$ for all x in A, then $f(x)=0$ for all x. So I only need to prove it for the case $f(x)\gt0$. Since f is continuous, for all $\epsilon\gt0$ there is some $\delta\gt0$ such that for all $x$ if $$\vert x-a \vert \lt \delta$$ then, $$\vert f(x)- f(a) \vert \lt \epsilon.$$ So there is some $a\in A$ in the interval $(x-\delta, x+\delta)$ since A is dense. Choosing $\epsilon=f(a)$ we obtain $$-f(a)\lt f(x)-f(a).$$ So $f(x)\ge0$ for all x. Applying this to the funtion $f(x)-g(x)$ we get the desired solution.
Now here is the books solution. It suffices to show that if $f$ is continuous and $f(x)\ge0$ for all x in A, then $f(x)\ge0$ for all x. Now there is a $\delta\gt0$ such that, for all x, if $$0\lt \vert x-a\vert \lt\delta,$$ then $$\vert f(x)-l \vert \lt \frac{\vert l \vert}{2}.$$ This implies that $$f(x)\lt l+ \frac{\vert l \vert}{2}.$$ Now if $l\lt0$, it would follow that $f(x)\lt0$, which would be false for those x in A which satisfy $0\lt \vert x-a \vert \lt \delta$.
So this brings me to my questions. Why is his proof correct? Couldn't $\frac{\vert l \vert}{2}=0$? Then it would not be an $\epsilon \gt0$. And also is my proof correct? I am guessing I did something wrong since it seems much cleaner than the one he gave and I would assume he would have used it if it is correct.