# The difference set of two continuous functions is open

Let $f,g:X\to Y$ be continuous functions on topological spaces $X,Y$. Then the set $\{f\ne g\}:=\{x\in X:f(x)\ne g(x)\}$ is open.

This statement seems to be true under some mild extra hypotheses on the topological space, but I'd like to know if it is true in general.

Suppose additionally that $Y$ is Hausdorff. Then if $x\in\{f\ne g\}$, there exist disjoint open sets $U,V$ in $Y$ such that $f(x)\in U$ and $g(x)\in Y$, and $f^{-1}(U),g^{-1}(V)$ are open in $X$ by continuity. Thus if $y\in W=f^{-1}(U)\cap g^{-1}(V)$, we have $f(y)\in U, g(y)\in V$ so that $y\in\{f\ne g\}$. Thus $W\subseteq\{f\ne g\}$ and $\{f\ne g\}$ is open.

Is the assumption of $Y$ Hausdorff necessary here?

A space $X$ is Hausdorff if and only if the diagonal $\Delta=\{(x,x):x\in X\}$ is closed in $X\times X$ with the product topology. Suppose that $f,g:X\to Y$ are continuous. Define $h:X\to Y\times Y$ by $h(x)=(f(x),g(x))$. Then $h$ is continuous, and $h^{-1}(\Delta)=\{x\in X: f(x)=g(x)\}$, so this is closed if $Y$ is Hausdorff. Now suppose that given any space $X$ and any pair of continuous functions $f,g:X\to Y$, $h^{-1}(\Delta)$ is closed. If we take $X=Y\times Y$ and $f=\pi_1,g=\pi_2$, we get that $h={\rm id}_{Y\times Y}$ so $\Delta=h^{-1}(\Delta)$ is closed, so $Y$ is Hausdorff.

• Hausdorff-tastic!! +1 – Omnomnomnom Feb 15 '15 at 0:24
• @user46944 no. He proved that $Y$ is Haussdorff iff for every continuous $f,g:X \to Y$, $\{f \neq g\}$ is open. – Omnomnomnom Feb 15 '15 at 0:34
• @user46944 I proved that $Y$ is Hausdorff if and only if for every space $X$ and every pair of continuous functions $f,g:X\to Y$, that set is open. – Pedro Tamaroff Feb 15 '15 at 0:34
• @user46944 Quantifiers. – Pedro Tamaroff Feb 15 '15 at 0:34
• @user46944 yes. Easy mistake to make. You also fixed $X$. – Omnomnomnom Feb 15 '15 at 0:40

At least some sort of separation axiom is necessary.

Take $X = \Bbb R$, $Y = \Bbb R \cup \{0^*\}$, where $0^*$ is a point that is topologically indistinguishable from $0 \in \Bbb R$. Define $f(x) = x$ and $$g(x) = \begin{cases} x & x \neq 0\\ 0^* & x = 0 \end{cases}$$ We have $\{f \neq g\} = \{0\}$, which is not open.

• What do you mean by topologically indistinguishable? Do you mean for every open set containing $0$, it contains $0^{*}$, and for every open set containing $0^{*}$, it contains $0$? That's just a guess. – layman Feb 14 '15 at 23:55
• @user46944 That's exactly right. Perhaps this condition can be relaxed, though. – Omnomnomnom Feb 14 '15 at 23:56
• Hmm...What if we equip $\Bbb R \cup \{ 0^{*} \}$ with a topology that's $T1$? Would that somehow make $\{f \neq g \}$ open in your example? Even in that case, $\{ f \neq g \} = \{0 \}$ by construction of $f$ and $g$. Maybe $g$ won't be continuous in such a space? Is $Y = \Bbb R \cup \{ 0^{*} \}$ equipped with the standard topology of $\Bbb R$? – layman Feb 14 '15 at 23:59
• @user46944 I think you're right. That being said, I'm having a hard time on saying exactly what should hold in order to prevent such a counterexample from existing. – Omnomnomnom Feb 15 '15 at 0:04
• @Omnomnomnom Hausdorffsity is enough! =D – Pedro Tamaroff Feb 15 '15 at 0:14