Continuous function with no max in closed and bounded set Okay guys, I have this question that troubles me a lot. Is there an example of a function that is continuous on a closed and bounded set but achieves no maxima?
My take is, that apparently cannot be in Euclidean space. I think of bounded sequences, L-inf'ty, where seqs are bounded and closed (all limits contained) but my puzzle is then why not to have a maximum (i.e. subseqs will not also converge to the limit contained)? Plus that I cannot come up with an example of such a function.
Thanks a lot.
P.S. THis is my first post and I am a rookie in math, so I apologise if I don't express something very clearly.
Edit: Thanks a lot for your super quick responses! I forgot to mention that I consider a sup metric in L-inf'ty space I mention. Of course this is just an example.
 A: You can easily verify that $\mathbb{R}$ equiped with the metric $d: \mathbb{R} \times \mathbb{R} \to \mathbb{R}$ defined as
$$d(x,y) = \begin{cases}0,\; x=y \\1,\; \text{otherwise}  \end{cases}$$
is indeed a metric space. In particular, every set is both open and closed. Now consider the function $f: ([-1,1], d) \to (\mathbb{R}, d_{\text{euc}})$ given by
$$f(x) = \begin{cases} \frac{1}{x}, \; x \neq 0 \\ 0, \; \text{otherwise} \end{cases}$$
where $d_\text{euc}$ is the usual metric on $\mathbb{R}$. Now $f$ is continuous since the inverse image of every open set is open and $[-1,1]$ is closed and bounded but $f$ is unbounded (and in particular achieves no maximum value).
A: I'll add an example along your original thoughts: Consider, for every $n\in \mathbb{N}$, the sequence $X_n\in \ell_\infty$ given by
$$
X_n=(0, \ldots, 0, 1-\frac{1}{n}, 0, \ldots),
$$
where the only nonzero term is in the $n$-th place. Now let your set be
$$
E=\{ X_1, X_2,\ldots\}\subset \ell^\infty.
$$
Clearly $E$ is bounded since $\| X_n\|_\infty =1-1/n \leq 1$. It's also closed, since the only possible accumulation point would have all entries 0 but at the same time $\ell_\infty$ norm 1 which is clearly not possible.
Then $f:E\to \mathbb{R}$ given by $X\mapsto \| X\|_\infty$ doesn't attain a maximum.
