Not every compact subset of $\mathbb{R}$ is the support of a continuous function

compactnessreal-analysissolution-verification

I saw a question on an analysis exam asking whether every compact subset of $\mathbb{R}$ is the support of a continuous real-valued function. The solution that was provided noted that a counterexample was the Cantor ternary set. I thought a single point would serve as a counterexample, but given the solution I saw I am now doubting my solution.

The set $\{a\}$ is compact for any $a\in\mathbb{R}$. Suppose that there exists $f\in C(\mathbb{R}$) such that $\operatorname{supp}f=\{a\}$. Then $f\equiv0$ outside $\{a\}$. Continuity requires that $\lim_{x\to a}f(x)=f(a)=0;$ but this is a contradiction, since this would imply that $f$ is identically zero and so $\operatorname{supp}f=\varnothing$.

Is there any flaw in this argument?

Best Answer

Your solution is fine. A continuous function that vanishes on a dense subset of its domain vanishes everywhere, and indeed $\mathbb{R}\setminus \{a\}$ is dense in $\mathbb{R}$.

Related Question