A non-compact topological space where every continuous real map attains max and min 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.
 A: I'm looking for more references, but I recall the statement isn't true in general. There exist Hausdorff spaces whose only continuous maps are constant. An example of a countably compact space(which is weaker than compact) can be found here. Another example can be found at this link.
A: 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.

Example 1: The ordinal space $\omega_1 = [ 0 , \omega_1 )$ is countably compact but not compact.  
details. 
  
  
*
  
*If $\langle \alpha _n \rangle_{n \in \mathbb{N}}$ is a one-to-one sequence in $\omega_1$, then by moving to a subsequence if necessary we may assume that $\langle \alpha _n \rangle_{n \in \mathbb{N}}$ is strictly increasing.  Then there is a least $\beta \in \omega$ such that $\alpha_n < \beta$ for all $n \in \mathbb{N}$, and it isn't difficult to show that $\beta = \lim_n \alpha_n$.  Therefore $\omega_1$ is countably compact.  
  
*The cover $\{ [ 0 , \alpha ] : \alpha \in \omega \}$ is an (uncountable) open cover without a finite subcover.  (In fact, it has no countable subcover!)
  



Example 2: The deleted Tychonoff plank is pseudocompact but not countably compact.
details. 
  
  
*
  
*The Tychonoff plank is the product $\hat{X} = ( \omega_1 + 1) \times ( \omega + 1 ) = [ 0 , \omega_1 ] \times [ 0 , \omega ]$, and the deleted Tychonoff plank is the subspace $X = \hat{X} \setminus \{ \langle \omega_1 , \omega \rangle \}$
  
*It can be shown that every continuous $f : X \to \mathbb{R}$ has a continuous extension $\hat{f} :  \hat{X} \to \mathbb{R}$, and since $\hat{X}$ is compact then $\hat{f}$ is bounded, and thus so, too, is $f$.  Therefore $X$ is pseudocompact.
  
*The countably infinite subset $\{ \langle \omega_1 , n \rangle : n \in \omega \}$ has no accumulation point in $X$, and so $X$ is not countably compact.
  

