Prove that a metric space is compact iff every continuous real function on it is bounded.
$\ f: X \mapsto Y$; $f[X]=A$;
If X is compact, then we can find a sequence in X, $x \mapsto a$. Because f is onto A, there exists $f(x) \mapsto f(a)$. Thus, $f[X]$ is compact, and bounded.
The other way around I have trouble starting from a bounded function and proving compactness. How do we get closedness?
One way is to show that $X$ is complete and totally bounded.
If $y \in X, \epsilon>0$, let $f_{y,\epsilon}(x) = \max(0,1-{2 \over \epsilon} d(x,y))$. Note that $f_{y,\epsilon}$ is continuous, and $f_{y,\epsilon}(x) = 0$ for $x \notin B(y,{1 \over 2} \epsilon)$. Furthermore, $f_{y,\epsilon}(y) = 1$.
Totally bounded is straightforward:
Suppose there is some $\epsilon>0$ such that $X$ does not have a finite $\epsilon$-net. Then $X$ contains a countable collection of disjoint balls $B(x_n,\epsilon)$. Define $f = \sum_n n f_{x_n,\epsilon}$. It is straightforward to show that $f$ is continuous and $f(x_n) = n$, which contradicts the original assumption. Hence there is a finite $\epsilon$-net for all $\epsilon>0$.
Completeness is a little messier:
Suppose $x_n$ is Cauchy. (Recall that if a subsequence of a Cauchy sequence converges, then the whole sequence converges.) Let $P = \{x_n\}$.
So, suppose $x_n$ has no convergent subsequence. Then we see that $P$ is discrete, that is, closed and each point is isolated.
Hence there are $\delta_k >0$ such that $B(x_k,3\delta_k) \cap P = \{ x_k\}$ (note the 3).
Now let $\epsilon_1 = \delta_1, \epsilon_n = \min(\delta_n, \epsilon_{n-1}, {1 \over n})$ and define $\Delta_k = B(x_k, \epsilon_n)$, $\Delta = \cup_k \Delta_k$, and $f = \sum_k k f_{x_k, \epsilon_k}$. (Note that $\epsilon_n \to 0$.)
Note that the $\Delta_k$ are pairwise disjoint, so $f$ is finite and $f(x_k) = k$. If we can show that $f$ is continuous then we have a contradiction, since $f$ is unbounded. If $x \in \Delta_k$, then $f(x) = f_{x_k, \epsilon_k}(x)$ and hence $f$ is continuous at $x$.
Now suppose $x \notin \Delta$. Then I claim that there is some $n$ such that $B(x,{1 \over n})$ intersects at most a finite number of $\Delta_k$. If this is true, then it follows that $f$ is continuous (since the sum of a finite number of continuous functions is continuous).
So, suppose that $B(x,{1 \over n})$ intersects an infinite number of $\Delta_k$ for all $n$. Then we can find $y_n \in B(x,{1 \over n})$ and an unbounded (this is the important part) subsequence $n \mapsto k_n$ such that $y_n \in \Delta_{k_n}$. In particular, $d(x,x_{k_n}) \le d(x,y_n)+ d(y_n, x_{k_n}) < {1 \over n} + \epsilon_{k_n}$ and hence some further subsequence of $x_{k_n}$ converges to $x$, which contradicts the assumption that $B(x,{1 \over n})$ intersects an infinite number of $\Delta_k$ for all $n$, and so $f$ is continuous.