3
$\begingroup$

I noticed the following statement on a comprehensive exam, and I am having trouble proving it. Can anyone help?

If $X$ is a non-compact metric space, then there exists a continuous function $f: X \rightarrow \mathbb{R}$ such that $f(X)$ is dense in $\mathbb{R}$.

Thanks in advance!

  • 1
    @user29999 Fix an enumeration of the rationals $r_n$ define a map $f: \mathbb N \rightarrow \mathbb R$ by $f(n)=r_n$. Since $\mathbb N$ has the discrete topology any map with it as the domain is continuous. Thereby $f$ is a continuous map with dense image. This is also a step in Nate's hint.2012-09-03

1 Answers 1

5

Hint: If $X$ is not compact, it contains an infinite set $E$ with no limit point. Try defining $f : E \to \mathbb{R}$ so that $f(E)$ is dense. Then show that you can extend $f$ continuously to $X$.