# Spivak Calculus. Why is the books proof valid? Is my attempt at a proof valid?

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.

• Is that the complete proof from the book? I'm surprised that the symbol $l$ is introduced in an inequality with no explanation of what it might signify. May 9, 2020 at 16:14
• @DavidK: Yeah that's the complete proof copied word for word. He does that with a lot of his proofs which makes it very hard to actually understand them sometimes... somebody below explained it to me though. It also confused me why he decided to throw in the $0\lt \vert x-a \vert$ since in every other proof involving continuity he has omitted greater than 0. May 9, 2020 at 16:22
• While the solution is missing a definition (let $a$ be such that $l = f(a) < 0$, your objection does not apply because we're only dealing with the case where $l < 0$
– Sam
May 9, 2020 at 16:38
• I see that this is actually part (c) of problem 6 at the end of chapter 8. The answer is in a separate book, in which the answer for part (a) is given in a terse but complete style (in particular, $l$ is defined as $\lim_{x\to a}f(x)$), which we're apparently supposed to remember for part (c). These are important parts of the context of this question. Indeed the proof of (c) does not really make sense unless you've first read parts (a) and (b) of the solution. May 9, 2020 at 17:26
• @DavidK: oh ok i see that now. You are correct. That explains it better. May 9, 2020 at 17:28

All these solutions look overcomplicated. Given $$x$$, choose a sequence $$(x_n)_n$$ in $$A$$ with $$x_n\to x$$. We have $$f(x_n)\geq g(x_n)$$ for all $$n$$. Letting $$n\to \infty$$ and using continuity of $$f,g$$, we obtain $$f(x)\geq g(x)$$.

• Nice proof which is direct. +1 May 9, 2020 at 15:30
• Ok this is way simpler. Also not the type of proof the book has shown me at all so it never would have crossed my mind. May 9, 2020 at 15:40
• @RyanSchardine: this proof uses a technique which goes by the name sequential continuity. And it is one of efficient techniques. May 9, 2020 at 15:47
• @ParamanandSingh: ok thank you. Just started getting into proof based math so I'll have to start building up my techniques. May 9, 2020 at 15:50
• Yes, while this is certainly a simpler proof, it relies on the theorem that continuity implies sequential continuity, which may not have been proved at that point in the book (although that direction is fairly simple to prove on its own...) May 9, 2020 at 23:48

I assume set $$A$$ is dense in $$\mathbb {R}$$ and that means that every real number is a limit point of $$A$$ (ie every interval contains infinitely many points of $$A$$).

Frankly speaking neither your argument nor the textbook solution appears well written. Specifically what is $$a$$ in both of them is not clear.

Here is an alternative approach. We are given that $$f(x) \geq 0$$ for all $$x\in A$$. On the contrary assume that there is a some real number $$c$$ with $$f(c) <0$$. Then by continuity of $$f$$ at $$c$$ there is a neighborhood $$I$$ of $$c$$ in which $$f$$ is negative. But $$I$$ contains infinitely many points of $$A$$ and at these points $$f$$ is non-negative. The contradiction proves the desired result.

After a re-reading of your question I finally figured out the book solution which is same as the proof mentioned above. The proof proceeds by taking $$a$$ as some arbitrary real number. And $$f(a) =l$$. If $$l=0$$ we have no issue. So let $$l\neq 0$$. Then one chooses $$\epsilon =|l|/2>0$$ and gets a $$\delta>0$$ (via continuity of $$f$$ at $$a$$) such that $$|x-a|<\delta\implies |f(x) - l|<|l|/2$$ so that if $$l<0$$ then $$f(x) for all $$x$$ with $$|x-a|<\delta$$. But in this interval $$(a-\delta, a+\delta)$$ there are many points of $$A$$ at which $$f$$ is non-negative and therefore we can't have $$l<0$$. Thus we must have $$l=f(a) >0$$.

So this textbook proof explains why $$f(c) <0$$ implies that $$f$$ is also negative in some neighborhood of $$c$$ (used in my proof).

• Also a nice proof. +1 May 9, 2020 at 15:33
• @ε-δ: and you have a very analytical username :) May 9, 2020 at 15:34
• Haha, by lack of inspiration. I do like algebra as well :) May 9, 2020 at 15:35
• This is definitely cleaner than both of the ones I showed. Thanks. The books especially seemed weird and hard to follow. Despite my proof not being well written does it seem correct or not? May 9, 2020 at 15:43
• @RyanSchardine: see updated part of my answer below the fold. May 9, 2020 at 15:45

Other answers have provided good proofs, but I'd like to tackle the other aspect of your question:

Is my attempt at a proof valid?

Unfortunately not, in at least two ways:

• Your proof breaks the condition "$$f(x)≥0$$ for all $$x$$ in $$A$$" into two cases, namely "$$f(x)=0$$ for all $$x$$ in $$A$$" (a case that you're previously tackled) and "$$f(x)>0$$ for all $$x$$ in $$A$$" (the case that you tackle here); but in fact, those are not the only possible cases: it's also possible that $$f(x)=0$$ for all $$x$$ in some subset of $$A$$ and $$f(x)>0$$ for all $$x$$ in the rest of $$A$$.
• For the case where $$f(x)>0$$ for all $$x$$ in $$A$$, your proof concludes that $$f(x)>0$$ for all $$x$$. But that's not true: consider the counterexample of $$f(x) = (x - \pi)^2$$ and $$A = \mathbb{Q}$$, which satisfies the condition (since $$(x - \pi)^2 > 0$$ for any rational $$x$$) but not the conclusion (since $$(x - \pi)^2 = 0$$ when $$x = \pi$$). This counterexample "slips through" your proof because you don't fix the $$a$$, $$\epsilon$$, etc., for each $$x$$; every neighborhood of every $$x$$ contains some $$a$$ in $$A$$, and every $$a$$ in $$A$$ has some neighborhood on which $$f$$ is positive, but these two neighborhoods needn't be the same.
• Ok I see my mistake with the first part. Though I'm not entirely sure what you mean in the second part. Very new to constructing proofs so there are still many gaps in my knowledge with them. What exactly do you mean by fixing the a, $\epsilon$, etc? May 10, 2020 at 16:19
• @RyanSchardine: To "fix" a variable is to choose a specific (often arbitrary) value and proceed with it. For example, a proof of "For all x in S, [...]" might have the form "Let x be an element of S. Then [...]"; the "let x be an element of S" part is "fixing" x, making clear that we'll be talking about the same value x for the rest of the proof (or the rest of that part of the proof). But in your proof, you don't fix your variables in a coherent order: you fix ϵ based on a, and a based on δ; but δ depends on ϵ by definition. So you end up with [continued] May 10, 2020 at 17:21
• [continued] multiple or inconsistent "copies" of these variables (or at least one of them), where the final ϵ can't be the same as the original ϵ, or else the final a can't be the same as the original a, or else the final δ can't be the same as the original δ. Do you see what I mean? May 10, 2020 at 17:22
• Yes that makes sense thank you for the response. May 10, 2020 at 17:29
• @RyanSchardine: You're welcome! May 10, 2020 at 17:30