If all continuous functions $f: X\subset \mathbb{R}\to \mathbb{R}$ are bounded then $X$ is compact I'm trying to show that in $\mathbb{R}$ a pseudocompact set is compact. That is, if $X\subset \mathbb{R}$ is such that all continuous functions $f: X\to \mathbb{R}$ are bounded, then $X$ is compact.
One possible proof that I've seem sometimes is just to assume there is a sequence with no convergent subsequence, and then construct one function which is continuous but which is not bounded.
The possible constructions I've seem are quite non intuitive and hard to grasp. Is there any other proof of this result without needing to in fact construct a function which is not bounded? Isn't there any way to just show that such a function would exist if $X$ were not compact?
If this can't be done and the construction is required, how can one understand how to construct such function? That is, how can one find that functions instead of just showing it and saying: "it works"?
 A: Constructing an unbounded function really does seem to me to be the easiest approach. One very natural way to do this is to find a countably infinite, closed, discrete subset $D=\{x_n:n\in\Bbb N\}$ of $X$. If we can do this, we the function $f:D\to\Bbb R:x_n\mapsto n$ will be continuous (since $D$ is discrete), and by the Tietze extension theorem it will have a continuous extension $g$ to all of $X$ (since $D$ is closed in $X$). Clearly this $g$ is unbounded.
At this point you can use some general results:


*

*A metric space is compact if and only if it is countably compact.  

*A $T_1$ space is countably compact if each infinite subset of $X$ has a limit point.


Thus, if $X$ is not compact, then it’s not countably compact, and therefore it has an infinite closed discrete subset $D_0$. We can then take $D$ to be any countably infinite subset of $D_0$.
Alternatively, you can get your hands dirty and directly construct the desired set $D$. If $X$ is not compact, then either $X$ is unbounded, or $X$ is not closed. 
If $X$ is not bounded, we can assume without loss of generality that it contains arbitrarily large positive real numbers. Let $x_0$ be one of these. Given $x_n$, there is an $x_{n+1}\in X$ such that $x_{n+1}\ge x_n+1$. In this way we can recursively construct the set $D=\{x_n:n\in\Bbb N\}$, and it’s easy to check that $D$ is a closed, discrete subset of $X$ (and indeed of $\Bbb R$).
If $X$ is not closed, let $x\in(\operatorname{cl}X)\setminus X$. Pick $x_0\in X$ arbitrarily. Given $x_n\in X$, let $r_n=|x_n-x|$; $x$ is in the closure of $X$, so there is an $x_{n+1}\in B\left(x,\frac{r_n}2\right)\cap X$. Thus we can recursively construct a sequence $\sigma=\langle x_n:n\in\Bbb N\rangle$ of distinct points of $X$ such that $\sigma$ converges to $x$. Now let $D=\{x_n:n\in\Bbb N\}$; the only limit point of $D$ in $\Bbb R$ is $x$, which is not in $X$, so $D$ is a closed, discrete subset of $X$ (in the relative topology on $X$). 
A: Hint: It is enough to show that $X$ is closed and bounded so use $f(x)=x$ and $g(x)=\frac{1}{x-x_0}$
