Showing that $X$ is Hausdorff space if for $x \not = y \in X$, exists a continuous function going to a Hausdorff Space.

Let $X$ be a topological space. We suppose that for $\forall x \not = y \in X$, exists a continuous function mapping from $X$ to $Y$, such that $f(x) \neq f(y)$ where $Y$ is a Hausdorff space. Show then that $X$ is a Hausdorff space.

Here's my attempt. Let $x \not = y \in X$, then $\exists f : X \rightarrow Y$ that is continuous. As $f(x), f(y) \in Y$, then there exists $V_{f(x)}, V_{f(y)}$ disjoint neighbourhoods of $f(x), f(y)$. As $f$ is continuous, we have $f^{-1}(V_{f(x)})$ a neighbourhood of $x$, and $f^{-1}(V_{f(y)})$ a neighbourhood of $y$. Suppose that $f^{-1}(V_{f(x)}) \cap f^{-1}(V_{f(y)}) \not = \emptyset$, then for a $x \in f^{-1}(V_{f(x)}) \cap f^{-1}(V_{f(y)})$, $f(x) \in V_{f(x)} \cap V_{f(y)}$, which is absurd. Thus $X$ is a Hausdorff space.

• Your assumption makes no sense as written. There is always a continuous function mapping $X$ to a Hausdorff space $Y$, e.g. a constant function. I suspect you mean a continuous function $f$ mapping $X$ to $Y$ such that $f(x) \ne f(y)$. – Robert Israel Dec 4 '17 at 20:23
• @RobertIsrael Yes, I made a mistake while copying the exercise. – John Mayne Dec 4 '17 at 20:25
• @DonAntonio I cleared up in my edit. – John Mayne Dec 4 '17 at 20:25
• Looks fine to me after the edit. :) – stressed out Dec 4 '17 at 20:27
• The proof looks fine to me – DonAntonio Dec 4 '17 at 20:33

The proof you gave is fine. You could use that $f^{-1}[V] \cap f^{-1}[W] = f^{-1}[V \cap W]$ and $f^{-1}[\emptyset] =\emptyset$ e.g. to see that the inverse image of disjoint sets is disjoint as well.