# Proving a bounded and continuous function $f: [a, b] \rightarrow \mathbb{R}$ assumes its maximum value on $[a, b].$

The proof starts like this:

Set $$M = \sup\{f(x) : x \in [a, b]\}.$$ For each $$n \in \mathbb{N}$$ there exists $$y_n \in [a, b]$$ s.t. $$M - \frac{1}{n} < f(y_n) \leq M.$$ Hence $$\displaystyle\lim_{n\to\infty} f(y_n) = M$$ by the squeeze lemma.

What I don't understand is why the left inequality in the second sentence is true. I haven't been able to logically reason why it's true nor do I have any intuition about why it's true. I understand that the right inequality holds since $$y_n$$ is in $$\{f(x) : x \in [a, b]\}$$ and $$M = \sup S$$.

Thank you for any help!

• What is your definition of compact? Closed and bounded? – Guido A. Oct 28 '18 at 20:43
• $M$ is the least upper bound. Therefore, $M-\frac{1}{n}$ is not an upper bound so you can find the $y_n$ that makes the inequality true. – John Douma Oct 28 '18 at 20:47
• @GuidoA. It doesn't matter which definition of compact is used. By the way, closed and bounded sets are only compact in complete metric spaces. – John Douma Oct 28 '18 at 20:48
• @JohnDouma I think you mean totally bounded and complete. Also, it does matter because it limits (or otherwise widens) the amount of resources to use in an (understandable) answer. This can be said without a mention of compactness, that I can agree on. – Guido A. Oct 28 '18 at 20:49
• @GuidoA. No. Consider $\{q\in\mathbb Q: 0\le q^2\le 2\}$. This is closed and bounded in $\mathbb Q$ but is not compact. Also, the definitions of compact are equivalent in a metric space. – John Douma Oct 28 '18 at 20:51

Indeed, suppose there were some $$n$$ such that for all $$y \in [a,b]$$, $$M - 1/n \geq f(y)$$. Then $$M - 1/n$$ would be an upper bound of $$f([a,b])$$ and strictly less than $$M$$. But that contradicts that $$M$$ is the least upper bound of $$f([a,b])$$.
The intuition is this: if you decrease the supremum of a set $$S$$ by "a little bit", then there's some member $$x$$ of the set that's then greater than the decreased value. If there weren't, then the decreased value would upper bound $$S$$ and be less than $$S$$'s supremum, which is a contradiction.
Look, it’s just a definition of supremum We can approach to it as close as we want: if $$M$$ is supremum then for any $$\epsilon > 0$$ we can find element $$x$$ from your set such that $$M-\epsilon
• In your case $1/n$ plays an epsilon role – Anton Zagrivin Oct 28 '18 at 20:47