TITLE: Tietze extension theorem in LCH spaces
QUESTION [10 upvotes]: Let $X$ be a locally compact Hausdorff space and $K$ be a compact subset of $X$. Then any function $f\in C(K)$ can be extended to a function in $C(X)$ which vanishes outside a compact set. 
I have searched several books for the proof. It seems that the authors believe it is just an exercise-level proposition. Since $X$ is an LCH space, we can always find open set $V$ containing $K$ with compact closure $\overline{V}$ and we can extend $f$ to $\overline{V}$ by classical Tietze extension theorem. I also know the fact that $f\in C(K)$ implies that the the range of $f$ is contained in a closed interval $[a,b]$, but how do we define a $F \in C(X)$ satisfying the requirements?

REPLY [6 votes]: This can be done in few steps:

First extend $f$ to $K\cup \partial V$, putting $0$ on $\partial V$.
Then use Tietze to extend this to whole $\overline V$ (using the fact that it is compact Hausdorff, so normal).
Finally put $0$ outside of $\overline V$, obtaining $\bar f\colon X\to {\bf R}$.

Check continuity by the definition (preimage of a closed set containing zero is the preimage by $\bar f$ restricted to $\overline V$ plus the entire $V^c$, while the preimage of any other closed set is just the preimage by $\bar f$ restricted to $\overline V$).