Locally compact Hausdorff space and indicators This is exercise 6 from  Tao's notes on locally compact Hausdorff spaces. Let $X$ be such a space and assume $K \subset U$ where $K$ compact and $U$ open. We want to find a function $f:X \to  \mathbb R$ with compact support and $1_K \leq f \leq 1_U$ on $X$.
As he describes, there exists an open set $V$ with $K \subset V \subset \overline V \subset U$ where $\overline V$ is compact. Now, $\overline V$ is a compact Hausdorff space and hence (Urysohn) there is a function $f:\overline V \to [0,1]$ which is $1$ on $K$ and $0$ on $\overline V \setminus V$. I thought that $f$ can be extended to $X$ by saying $f = 0$ on $X \setminus \overline V$. Is this $f$ now continuous ? 
I have the following problem: If $I$ is an open subset of $\mathbb R$, then the preimage of $I$ under my extension is of the form $W \cap \overline V \cup X \setminus \overline V$ with $W$ open in $X$. The $X \setminus \overline V$ term only appears if $0 \in I$. But this union has not to be open in $X$ ?
 A: Note that your extended $f$ is continuous when restricted to the closed set $\overline{V}$ (since this is just the original $f$) and also when restricted to the closed set $X \setminus V$ (this is just the constant function $0$). So the pasting lemma implies that your extended $f$ is continuous. If you want to prove it directly, the hint is to consider inverse images of closed (instead of open) subsets of $\mathbb{R}$.
A: You have the right idea: for LCH spaces, $K\subset U$ compact, there is $V\supset K$ such that $K\subset V\subset \overline{V}\subset U$ with $\overline{V}$ compact. Then by Urysohn's theorem (since $\overline{V}$ is compact, it is normal), there is $f\in C(\overline{V},[0,1])$ such that $f=1$ on $K$, $0<f(x)<1$ on $V\setminus K$ and $f=0$ on $\overline{V}\setminus V$. Then we extend to $F\in C(X,[0,1])$ such that $F=0$ on $\overline{V}$ (and we may as well extend the range to $\mathbb{R}$, although $F(X)\subset [0,1]$). Continuity is not obvious, but it can be shown easily:
If $U\subset [0,1]^c$ is open, then $F^{-1}(U)=\emptyset$, so we reduce to the case inside $[0,1]$. Let $C\subset [0,1]$ closed and suppose $0\not\in C$. Then $F^{-1}(C)=f^{-1}(C)$, where $f$ is continuous, so $F^{-1}(C)$ is closed. If $0\in C$, then $F^{-1}(C)=f^{-1}(C)\cup \overline{V}^c=f^{-1}(C)\cup V^c$. Note $\overline{V}=V\cup \partial V$, so $\overline{V}^c=V^c\cap \partial V^c$. Now note $\partial V\subset f^{-1}(C)$, so $\partial V\cap f^{-1}(C)^c=\emptyset$. Then \begin{align*}f^{-1}(C)\cup\overline{V}^c&=f^{-1}(C)\cup (V^c\cap \partial V^c)=(f^{-1}(C)\cup V^c)\cap (f^{-1}(C)\cup \partial V^c)\\&=(f^{-1}(C)\cup V^c)\cap (f^{-1}(C)^c\cap \partial V)^c=f^{-1}(C)\cup V^c\cap \emptyset^c\\&f^{-1}(C)\cup V^c\cap X=f^{-1}(C)\cup V^c\end{align*}
So $F^{-1}(C)$ is closed, thus $F$ is continuous.
