# Existence of continuous function with a compact support and nontrivial on given compact set in $\sigma$-compact space

The following fact is trivial to see:

Let $X$ be a separable and locally compact metric space, then for each compact set $K\subset X$ there is a continuous function with compact support and such that $f|K=1$.

Indeed, $X=\bigcup \limits_{n=1}^{\infty} U_n$, where $\{U_n\}$ is a increasing sequence of open and precompact subset of $X$ (from the Lindelöf theorem). So there is an $m\in \mathbb{N}$, such that $K\subset U_m$. Now, applying Urysohn's theorem to the sets $K$ and $X \setminus U$, we find the suitable function (with support contained in $\operatorname{cl} U_m$, with is compact).

If something like that (or similar) would be true, when $X$ was a $\sigma$-compact Polish space?

• I'm not sure I understand what you mean by "something like that (or similarly)". Given $K$ there is a continuous function with $f|K = 1$ and compact support (if and) only if $K$ is contained in a locally compact open subset $U$ of $X$ (take $U = f^{-1}((1/2,\infty))$). Of course, in general you can take the support of $f$ to be contained in as small (in a metric sense) a neighborhood of $K$ as you want, but that's obvious. – t.b. Jul 11 '11 at 21:01
• So reffering to your comment the question may formulated like this: Is there locally compact open subset $U$ of $\sigma$-compact polish space $X$ , such that $K \subset U$? – Dawid C. Jul 11 '11 at 21:40
• Again, I'm not sure what you want to know. If you want this to hold for all $K$ then your space is necessarily locally compact, as my argument shows. (Apply it to $K = \{x\}$ for each $x \in X$). – t.b. Jul 11 '11 at 21:43
• Ok, now i understand, unfortunately i need this for all compact set $K$, thanks very much. – Dawid C. Jul 11 '11 at 21:57

Let $X$ be a Hausdorff space. Let $C_{c}(X)$ be the space of continuous functions $f$ with compact support. Put $$Y = \bigcup_{f \in C_{c}(X)} \{|f| \gt 0\}.$$ Then $Y \subset X$ is an open locally compact subspace.
Indeed if $Y = \emptyset$ this is clear. Otherwise for each $y \in Y$ we have $|f(y)| \gt 0$ for some $f \in C_{c}(X)$. But then $U = \{|f| \geq |f(y)|/2\}$ is a compact neighborhood of $y$.
In other words, if $K \subset X$ is compact there exists a continuous function $f$ with compact support such that $f\,|_{K} = 1$ if and only if $K \subset Y$.
Since you said in a comment that you want to have such a function for all compact $K \subset X$ we must have $Y = X$ and thus $X$ must be locally compact.