TITLE: If every continuous $f:X\to X$ has $\text{Fix}(f)\subseteq X$ closed, must $X$ be Hausdorff?
QUESTION [35 upvotes]: Given a function $f:X\to X$, let $\text{Fix}(f)=\{x\in X\mid x=f(x)\}$.
In a recent comment, I wondered whether
$X$ is Hausdorff $\iff$ $\text{Fix}(f)\subseteq X$ is closed for every continuous $f:X\to X$ (the forwards implication is a simple, well-known result). At first glance it seemed plausible to me, but I don't have any particular reason for thinking so. I'll also repost Qiaochu's comment to me below for reference: 

I would be very surprised if this were true, but it doesn't seem easy to construct a counterexample. Any counterexample needs to be infinite and $T_1$, but not Hausdorff, and I don't have good constructions for such spaces which don't result in a huge collection of endomorphisms...

Is there a non-Hausdorff space $X$ for which $\text{Fix}(f)\subseteq X$ is closed for every continuous $f:X\to X$?

REPLY [3 votes]: This is a remark related to the question.
Theorem : let $X$ be a topological space. Suppose that for every space $Y$ and pair of maps $f,g : Y \rightarrow X$, the subset $\{ y \in Y : f(y)=g(y) \}$ is closed. Then $X$ is Hausdorf.
It is easy to prove by considering the $2$ projections $X \times X \rightarrow X$. In algebraic geometry, a (pre)variety which satisfies this axiom is called separated (see for example Milne's note on page 61 http://www.jmilne.org/math/CourseNotes/ag.html). This notion was introduced because algebraic varieties are not Hausdorff, and if we work with separated varieties, then maps are determined on dense subset.