TITLE: Functions separting points in Hausdorff spaces
QUESTION [13 upvotes]: A colleague in algebra asked me this, and I couldn't answer it.  On the Wikipedia page for "epimorphism" it is claimed that in the category of Hausdorff spaces and continuous maps, a function is epi if and only if it has dense range.  The "if" case is easy, but I couldn't justify the "only if" case.
This boils down to: let Y be a Hausdorff space, and let X in Y be a closed subset not equal to Y, and not empty.  Can you find a Hausdorff space Z and functions f,g:Y->Z such that f and g agree on X, but are not equal.  I think, by using a quotient argument, you can assume that X is just a point.

REPLY [9 votes]: This is really a comment on t3suji's answer, but it's too long to be a comment as such.  
t3suji's answer is the canonical one in the following precise sense.  Let $e: X \to Y$ be a morphism in any category.  It's an elementary exercise to show that the following conditions on $e$ are equivalent:

$e$ is an epimorphism
the square 
$$
\begin{array}{ccc}
X    &\stackrel{e}{\to} &Y \\
e\downarrow &                  &\downarrow 1_Y \\
Y    &\stackrel{1_Y}{\to} &Y
\end{array}
$$
is a pushout
for some morphism $f: Y \to Z$, the square
$$
\begin{array}{ccc}
X    &\stackrel{e}{\to} &Y \\
e\downarrow &                  &\downarrow f \\
Y    &\stackrel{f}{\to} &Z
\end{array}
$$
is a pushout.

I'll only use the equivalence 1 $\iff$ 3 here.  The other implications are just scene-setting.
Suppose we want to show that a particular morphism $e$ is not epi.  Assuming that there are enough pushouts around, we can argue as follows.  Form the pushout square
 $$
\begin{array}{ccc}
X    &\stackrel{e}{\to} &Y \\
e\downarrow &                  &\downarrow f \\
Y    &\stackrel{g}{\to} &Z.
\end{array}
$$
If $f \neq g$ then the implication 1 $\Rightarrow$ 3 tells us that $e$ is not epi.  Moreover, this strategy is bound to work, in the sense that if $f = g$ then the implication 3 $\Rightarrow$ 1 tells us that $e$ is epi after all.
It only remains to see that this is indeed what t3suji did.  In his/her situation, $e$ was the inclusion $X \to Y$.  He/she then took the coequalizer of the two obvious maps $X \to Y + Y$ (where $+$ means coproduct, i.e. disjoint union).  For elementary and totally general reasons, this is the same thing as taking the pushout just mentioned.  The morphisms that t3suji called $\iota_1$ and $\iota_2$, I called $f$ and $g$.  Finally, although t3suji's pushout is in the category of all topological spaces, he/she then verified that the space $Z$ is indeed Hausdorff, from which it follows that it's also a pushout in Hausdorff spaces.
So now you know, in principle, how to answer any question of the form "prove that such-and-such a morphism isn't epi".