If every real-valued continuous function is bounded on $X$ (metric space), then $X$ is compact. Let $X$ be a metric space. Prove that if every continuous function $f: X \rightarrow \mathbb{R}$ is bounded, then $X$ is compact.
This has been asked before, but all the answers I have seen prove the contrapositive. Realistically, this may be the way to go, but is there way to exhibit an unbounded continuous function (under the assumption $X$ is not compact) without appealing to results beyond introductory real analysis (e.g., the solution I've seen involves the Tietze Extension theorem)?
Because we're working with metric spaces, it's clear that the assumption that $X$ is noncompact (towards proving contrapositive) will lead us to extract a sequence of points in the space with no convergent subsequences. But how can we infer the existence of an unbounded continuous on the space knowing only about some sequence of points in this space (without using anything too advanced)?
 A: 
But how can we infer the existence of an unbounded continuous on the space knowing only about some sequence of points in this space

By using the sequence to construct an unbounded continuous function.
Since the sequence - call it $(x_n)_{n\in\mathbb{N}}$ - has no convergent subsequence, every point occurs only finitely many times in the sequence. Passing to a subsequence, we may assume all the $x_n$ are distinct.
For every $m\in\mathbb{N}$, the distance of $x_m$ to the rest of the sequence is positive,
$$\delta_m := \inf \left\{ d(x_m,x_k) : k \in \mathbb{N}\setminus \{m\}\right\} > 0,$$
for if $\delta_m = 0$, then $(x_n)$ would have a subsequence converging to $x_m$.
Now consider the functions
$$f_m(x) = \left(1 - \frac{3}{\delta_m}d(x_m,x)\right)^+,$$
where $u^+$ is the positive part of $u$, $u^+ = \max \{u,0\}$. These functions are continuous since the maximum of two continuous functions is continuous. The function
$$f(x) = \sum_{m=0}^\infty m\cdot f_m(x)$$
is, if well-defined, unbounded, since $f(x_m) \geqslant m$.
It remains to see that $f$ is well-defined and continuous. That follows if we can show that every point $x\in X$ has a neighbourhood on which at most one of the $f_m$ attains values $\neq 0$.
If $x = x_m$ for some $m\in\mathbb{N}$, then $f_k\lvert B_{\delta_m/3}(x_m) \equiv 0$ for all $k\neq m$: Suppose we had $f_k(y)\neq 0$ for some $y\in B_{\delta_m/3}(x_m)$ and some $k\neq m$. Then
$$\max \{\delta_k,\delta_m\} \leqslant d(x_m,x_k) \leqslant d(x_m,y) + d(y,x_k) \leqslant \frac{\delta_m}{3} + \frac{\delta_k}{3} \leqslant 2\frac{\max \{\delta_m,\delta_k\}}{3} < \max \{\delta_k,\delta_m\},$$
so that is impossible.
If $x \neq x_m$ for all $m$, the argument is similar. Let $\delta = \inf \{ d(x,x_n) : n\in\mathbb{N}\}$. Then $\delta > 0$ for otherwise the sequence would have a subsequence converging to $x$. Then on $B_{\delta/4}(x)$ at most one $f_m$ can attain a nonzero value. Suppose again it weren't so, and also $f_k$ attained a nonzero value there. Then we have $y,z \in B_{\delta/4}(x)$ with $f_m(y) \neq 0$ and $f_k(z) \neq 0$. That implies $\frac{3}{4}\delta < \frac{1}{3}\min \{ \delta_m,\delta_k\}$ since $d(y,x_m) \geqslant d(x,x_m) - d(x,y) \geqslant \frac{3}{4}\delta$ and similarly for $x_k$. But then we would have
$$0 < \max \{ \delta_m,\delta_k\} \leqslant d(x_m,x_k) \leqslant d(x_m,y) + d(y,z) + d(z,x_k) \leqslant \frac{\delta_m}{3} + \frac{1}{2}\delta + \frac{\delta_k}{3} < \max \{\delta_m,\delta_k\}.$$
Since every point has a neighbourhood on which at most one $f_k$ does not identically vanish, $f$ is well-defined and continuous.
A: Another approach: Assume $X$ is not compact, so that there exists a sequence $a_n$ in $X$ that has no converging subsequence, and denote $A$ to be the underlying set of this sequence. Define $f:A\to R$ via $f(a_n)=n$. It is continuous on A, and $A\subset X$ is a closed set, so by the Tietze extension theorem $f$ extends to a (non-bounded) function on all of $X$. 
A: You can say the following: consider a sequence $(x_n)$, which has no convergent subsequence. Then, inductively, you can construct a sequence of positive numbers $\varepsilon_n$ such that $\overline{B(x_n,\varepsilon_n)}\cap\overline{B(x_m,\varepsilon_m)}=\emptyset$ for all $n\neq m$. Then, define a function $f$ as follows: $$f(x)=\left\{\begin{array}{c l}n\left(1-\frac{d(x,x_n)}{\varepsilon_n}\right), & x\in B(x_n,\varepsilon_n)\\ 0, & {\rm otherwise}\end{array}\right.$$ Then $f$ is continuous and not bounded.
