$K\subseteq \mathbb{R}^n$ is a compact space iff every continuous function in $K$ is bounded. I need to prove that $K\subseteq \mathbb{R}^n$ is a compact space iff every continuous function  in $K$ is bounded.
One direction is obvious because of Weierstrass theorem. How can i prove the other direction?
I tried to assume the opposite but it didn't work for me.
Thanks a lot. 
 A: A topological space $X$ is called pseudocompact if every continuous function $f: X \rightarrow \mathbb{R}$ is bounded.  
The aforelinked wikipedia article does a good job of comparing this condition to other versions of compactness.  In particular:
$\bullet$ compact $\implies$ countably compact (i.e., every countable cover has a finite subcover; equivalently, every infinite subset has an $\omega$-accumulation point) $\implies$ pseudocompact.
$\bullet$ A normal Hausdorff space is pseudocompact iff it is countably compact iff it is limit point compact (every infinite subset has an accumulation point).  
One of the big theorems in undergraduate analysis is that a metrizable space is limit point compact iff it is compact iff it is sequentially compact, so all notions of compactness mentioned here coincide on the class of metrizable spaces.  This provides a more general answer to your question.
A: Let $K$ be a set which is such that every continuous function on it is bounded.
Clearly $K$ itself is bounded, for the function «distance to the origin» is bounded by hypothesis.
Suppose $K$ is not closed, so that there is a point $x$ which is in the closure of $K$ but not in $K$. Consider the function $$f:y\in K\mapsto \frac{1}{d(x,y)}\in\mathbb R,$$ which is clearly well defined and continuous. The choice of $x$ implies more or less immediately that $f$ is not bounded on $K$, so something's amiss...
A: If $K$ is not compact, there exists a subset $D\subseteq K$ which is discrete and infinite.
On the other hand, if $D$ is a discrete subset of $\Bbb R^n$ any function on $D$ can be extended to a continuous function on $\Bbb R^n$.
So, just take an unbounded function $f$ on $D$ (which certainly exists) and consider the restriction to $K$ of a continuous extension of $f$ to $\Bbb R^n$.
A: This is in GRE 0568 #62 for $\mathbb R^n, n>1$
Charles Rambo and DM Ashura aka Bill Shillito prove that $K$ is compact by choosing $f(x)=||x||$ and $f(x)=\frac{1}{||x-a||}$ to deduce, resp, bounded and closed and then conclude by Heine-Borel theorem which works in $\mathbb R^n$ and metric spaces in general. Ian Coley says the condition in $(II)$ is pseudo compactness which in metric spaces is compactness.
