Let $X$ be a topological space. Suppose $\forall p \in X, \, \exists f \in C(X,\mathbb{R})$ s.t. $f^{-1}(0) = \{p\}$. Show $X$ Hausdorff. An exercise from John Lee's Introduction to Topological Manifolds: 

Suppose $X$ is a topological space, and for every $p\in X$ there
  exists a continuous function $f:X \to \mathbb{R}$ such that
  $f^{-1}(0)=\{p\}.$ Show that $X$ is Hausdorff.

I'm struggling to get started on this one. 
 A: Hint Consider $q\neq p$. $f(q)\neq 0$, separate $0$ and $f(q)$ and take preimages.
A: I believe the solution is to take $f(q)=\epsilon$, and then $f^{-1}(-\epsilon/3, \epsilon/3)$ and $f^{-1}(2\epsilon/3, 4\epsilon/3)$ will separate the two points $p$ and $q$.
A: Solution:
Consider distinct points $p_1, p_2 \in X$. We want to show there exists neighborhoods $U_1 \subset X$ and $U_2 \subset X$ for $p_1$ and $p_2$, respectively, such that $U_1 \cap U_2 = \varnothing$.
Consider the continuous function $f$ such that $f^{-1}(\{0\})=\{p_1\}$, which exists by hypothesis. Then $f(p_1)=0$ and $f(p_2) =r\ne 0$. Since $\mathbb R$ is Hausdorff, there exists disjoint open neighborhoods $V_1$ for $0$ and $V_2$ for $r$ such that $V_1 \cap V_2 =\varnothing$. Now, $p_1 \in f^{-1}(V_1)$, $\ p_2 \in f^{-1}(V_2)$ and since $f$ is continuous $f^{-1}(V_1)$ and $f^{-1}(V_2)$ are open in $X$. Furthermore,
$$f^{-1}(V_1)\cap f^{-1}(V_2) = f^{-1}(V_1\cap V_2)=f^{-1}(\varnothing)=\varnothing.$$
So, $f^{-1}(V_1)$ and $f^{-1}(V_2)$ are disjoint open neighborhoods of $p_1$ and $p_2$. Thus, $X$ is Hausdorff.
