The set of all continuous functions on a locally compact Hausdorff space. I am reading a book about C*-algebra. There is a example that i could not understand. Let $X$ be a locally compact Hausdorff space and $C_{0}(X)$ be the set of all continuous functions vanishing at infinity. Define $f^{*}(t)=\overline{f(t)}$ (for $t\in X$). It is known that $C_{0}(X)$ is a *-algebra. And then 
$C_{0}(X)$ is unital if only if X is compact.
I do not know how to explain this proposition. 
 A: Let $e \in C_0(X)$ be the unit. For each $x \in X%$ there is a $f \in C_0(X)$ with $f(x) \ne 0$. As $e(x)f(x) = f(x)$ we must have $e(x) = 1$. So $e$ is the constant function $e=1$. But $1$ "vanishes at infinity" only if $X$ as compact: By definition there is a compact $K$ such that $1 = |1(x)| \le \frac 12$ outside $K$, i. e. on $X \setminus K$, so we must have $X \setminus K = \emptyset$ and $X= K$ is compact. 

Addendum:
Let $f \colon X \to \mathbb C$ be continuous. We have $f \in C_0(X)$ iff "$f$ vanishes at infinity", that is 
$$\tag{+} \forall \epsilon > 0\>\> \exists \text{compact }K \subseteq X\>\>\def\abs#1{\left|#1\right|}\forall x\in X\setminus K : \abs{f(x)}\le \epsilon $$
Another way to describe  $f \in C_0(X)$ is to say that "$f$ is small outside compact sets". Now lets consider a constant function $f = \lambda$. As $f$ is continuous, we have $f\in C_0(X)$ iff $(+)$ holds. $(+)$ states for our constant $f$ that 
$$\tag{$+_\lambda$} \forall \epsilon > 0\>\> \exists \text{compact }K \subseteq X\>\>\def\abs#1{\left|#1\right|}\forall x\in X\setminus K : \abs{\lambda}\le \epsilon $$
If $X$ is compact, we may choose $K := X$ and $(+_\lambda)$ is true (as in this case the condition $\forall x \in \emptyset$ is empty). 
If $X$ is not compact and $\lambda \ne 0$, let's apply this for $\epsilon = \frac{\abs{\lambda}}2$, we get some $K \subsetneq X$ such that
$$ \exists x \in X \setminus K \>\> \abs\lambda \le \frac{\lambda}2 $$ 
which is nonsense. So non-zero constant functions aren't members of $C_0(X)$ in the non-compact case.
