Today I learnt in class that if $X$ is compact then any continuous map $f:X\to\mathbb{R}$ attains max and min. I was thinking if the converse is true:
If every continuous map $f:X\to\mathbb{R}$ attains max and min, then $X$ is compact.
And I use open cover compactness definition or sequential compactness definition. I could not prove it and I suspect there might be counter-examples but I'm yet to find one.
Best Answer
Spaces in which all continuous real-valued functions achieve their extrema are called pseudocompact. (Note that if $X$ is pseudocompact and $f : X \to \mathbb{R}$ is continuous with $\alpha = \inf f [ X ]$ and $\beta = \sup f [ X ]$, then if, say, $\alpha \notin f[X]$ we may compose $f$ with a homeomorphism between $( \alpha , \beta + 1 )$ and $\mathbb{R}$ to obtain an unbounded continuous real-valued function.)
The general theory shows that compact $\Rightarrow$ countably compact $\Rightarrow$ pseudocompact, and neither arrow reverses.