Question
In a proof about continuous $\mathbb C$-Automorphisms, it was used that two continuous functions $\mathbb C \rightarrow \mathbb C$ agreeing on a dense subset must be equal. I was curious to figure out whether that holds for topological spaces in general. I could prove the following
Lemma: Let $B$ be Hausdorff. If two continuous functions $f,g: A\rightarrow B$ agre on a dense subset $D\subset A$, they agree on the whole space $A$.
Proof. Assume there was a point $a\in A$ where they differed. By the Hausdorff axiom, we can find two disjoint open sets $F\ni f(a),G\ni g(a)$. Since the intersection of their preimages must be open and $D$ is dense, there must be a point $x \in f^{-1}(F)\cap g^{-1}(G)$ on which $f$ and $g$ agree, so $f(x)\in F$ and $f(x)=g(x)\in G$, contradicting the assumed disjointness.
Since the Hausdorff axiom is quite a strong restriction, I tried to look for counterexamples in general topological spaces and found this:
Example Consider the topological space $\mathcal T:=\left([0,2],\,\{\emptyset,[0,1),[0,2]\}\right)$ and $$f:=id\vert_{\mathcal T},\quad g:x\mapsto\begin{cases}x,& x\in [0,1)\\ 2,&\mathrm{else.}\end{cases}$$ We note that both functions are continuous, agree on the dense subset $\{1,2\}$, but are not equal.
Since this on the other hand is a very weak example ($\mathcal T$ is not even $T_0$), I was wondering:
What is the minimum separation axiom that must be fulfilled by $B$ in order for this to hold?
Edit: Answer
These are the conclusions I reached by clarifying parts of @user87690's answer. Upon writing this, I noted that this very question has been asked here before, effectively rendering this a duplicate.
Recall the following
Definition. A point $x$ is called isolated if $\{x\}$ is open.
We immediately observe the following
Lemma. Let $B:=(X, \mathcal T)$ be a topological space, $x\in X$. $U\setminus\{x\}$ is dense in $B$ if and only if $x$ is isolated.
Theorem. Let $B:=(X, \mathcal T)$ be a non-Hausdorff space. There is a space $A$ and continuous functions $f, g$ agreeing on a dense subset of $A$ that are not equal.
Proof. Let $x, y\in X$ be non-separable points. One of them is non-isolated, WLOG $x$. We will define (as set-functions) $$f := id\vert_X, \quad g: p\mapsto \cases{ y,\quad p=x\\ p,\quad else, }$$ in other words, $p$ differs from the identity by mapping $x$ to $y$.
Note that although the initial topology would make $f,g$ continuous, it is uninteresting in the sense that $U\setminus\{x\}$, the set on which both agree, is not dense (because $x$ is isolated). Instead we will use the coarsest topology making $f$ an $g$ continuous, which is the topology generated by $\mathcal T \cup g^{-1} [\mathcal T]$.
As we will prove in the next lemmata, $x$ is not isolated in this topology, and so $X\setminus \{x\}$ is dense . $\tag*{$\blacksquare$}$
Lemma. Let $x\in X$. If two $\cap$-stable generators $\mathcal G, \mathcal G^\prime \subset \mathcal P (X)$ don't contain $\{x\}$, $x$ will not be isolated in $\langle \mathcal G\cup \mathcal G^\prime \rangle$ if and only if for every choice $A\in \mathcal G, B\in \mathcal G^\prime$, $A\cap B \neq \{x\}$.
Proof. By $U_c$ we mean the hull operator taking countable unions, and by $I_f$ we mean the hull operator taking finite intersections. If a set $\mathcal G$ is $\cap$-stable, by induction over set cardinality we have $I_f(\mathcal G) = \mathcal G$. The coarsest topology containing a generating set $\mathcal G$ can be constructed explicitly by applying both hull operators and adding $\{X, \emptyset\}$.
We now note that $U \in I_f(\mathcal G \cup \mathcal G^\prime)$ can be represented as $$U = \bigcap_{i=1\\G_i\in \mathcal G}^n G_i \cap \bigcap_{i=1\\G_i\in \mathcal G^\prime \setminus \mathcal G} G_i,$$ and due to $I_f$-Stability of both sets, we can choose \begin{align} A&:=\bigcap_{i=1\\G_i\in \mathcal G}^n G_i \in \mathcal G \\ B&:=\bigcap_{i=1\\G_i\in \mathcal G^\prime \setminus \mathcal G}^n G_i \in \mathcal G^\prime, \end{align} So $U = A \cap B$ where $A, B$ are either empty or in $\mathcal G, \mathcal G^\prime$, respectively. This leaves us with $$I_f(\mathcal G \cup \mathcal G^\prime) = \mathcal G \cup \mathcal G^\prime \cup \{A\cap B\,\vert A\in \mathcal G, B\in\mathcal G^\prime \}.$$ We can now observe \begin{align} \{x\} &\in \langle \mathcal G\cup \mathcal G^\prime \rangle = \{X, \emptyset\} \cup U_c(I_f(\mathcal G \cup \mathcal G^\prime))\\ \Leftrightarrow \{x\} &\in U_c(I_f(\mathcal G \cup \mathcal G^\prime))\\ \Leftrightarrow \{x\} &\in I_f(\mathcal G \cup \mathcal G^\prime)\\ &= \mathcal G \cup \mathcal G^\prime \cup \{A\cap B\,\vert A\in \mathcal G, B\in\mathcal G^\prime \}\\ \Leftrightarrow \exists A\in \mathcal G, B\in\mathcal G^\prime:\ \{x\}&= A\cap B\\ \end{align} $\tag*{$\blacksquare$}$
We observe that \begin{align} g^{-1}[\mathcal T] &= \{U\setminus\{x\} \,\vert x\in U\not\ni y\}\\ &\cup \{U\cup\{x\} \,\vert x\not\in U\ni y\}\\ &\cup \{U \,\vert x\not\in U\not\ni y\}\\ &\cup \{U \,\vert x\in U\ni y\}\\ \end{align} Where the last two sets are already contained in $\mathcal T$. Therefore, our topology can be written as $\langle \mathcal T \cup \mathcal S \rangle$ where $$\mathcal S := \mathcal S_1 \cup \mathcal S_2 := \{U\setminus\{x\} \,\vert x\in U\not\ni y\} \cup \{U\cup\{x\} \,\vert x\not\in U\in y\}$$
We can now observe (proof omitted, do a case distinction as done with $U$ above) that
- $\mathcal S$ is $\cap$-stable
- no intersection of $A\in \mathcal G$ and $B\in \mathcal G^\prime$ yields $\{x\}$
Both of which can be used to deduce that $x$ cannot be isolated in our topology, completing the above proof of our theorem. $\tag*{$\blacksquare$}$