Continuous function on complete bounded metric space need not be bounded I came across the following old qual problem:

Suppose $(X,d)$ is a complete metric space with finite diameter.  Is every continuous function on $X$ bounded?

It seems like the function $1/x$ on the interval $(0,1)$ with the discrete metric is a counterexample.  Is it this simple, or am I missing something?
 A: Yes, your example is valid. Another example which captures the  same essence as yours a bit more compactly would be the identity function on $\mathbb N$ with the discrete metric. (Considering the range of the map to be $\mathbb N$ with the usual metric)
A: If all that’s wanted is a counterexample, yours is sufficient. Using the same basic idea, you could take $\Bbb N$ with the discrete metric and use the function $f(n)=n$. A different approach is to define a metric $d$ on $\Bbb R$ by $d(x,y)=\min\{|x-y|,1\}$ and use $f(x)=x$.
A more complete answer is that if the space is not compact, such a function always exists. If $X$ is complete but not compact, then $X$ is not totally bounded. This means that there is an $\epsilon>0$ such that no finite set of $\epsilon$-balls covers $X$. If follows that $X$ has an infinite closed, discrete subset $D$. Let $D_0=\{x_n:n\in\Bbb N\}$ be a countably infinite subset of $D$. Let $f:D_0\to\Bbb R:x_n\mapsto n$; $f$ is a continuous function on $D_0$, and $D_0$ is a closed subset of $X$, so by the Tietze extension theorem $f$ has a continuous extension $F:X\to\Bbb R$. Clearly $F$ is not bounded.
