Under which conditions a non-compact and connected space possesses a non-constant continuous real-valued function

general-topology

Is there an example of a non-compact and connected space $X$ such that constant functions are the only continuous functions from $X$ to $\mathbb{R}$ with the usual topology?

If the answer is "yes", I wonder under which conditions a non-compact and connected space possesses a non-constant continuous real-valued function.

Here are the related questions: Existence of non-constant continuous functions and Topological space $X$ which the set of non-constant real-valued continuous function on $X$ is empty.

Thank you.

Best Answer

Here is a easy example: An uncountable $X$ equipped with the cocountable topology is connected noncompact and the only continuous real-valued functions are constants. The proof is almost the same as the cofinite case.

Indeed, to admit a nonconstant $\mathbb{R}$-valued function means there is a nontrivial Hausdorff quotient $X\to f(X)$, and of course you can impose compactness there too since you can cut off $f$.

Related Question