Let $X$ be some topological space. Let $Y$ be the set $\{a,b\}$ with the topology $\{ø,\{a\},\{a,b\}\}$.
Let $f,g:X\rightarrow Y$ be two continuous functions.
Let $O\subseteq X$ be a set in the topology on $X$.
My question:
If $f^{-1}(a)=g^{-1}(a)=O$, does that mean $f$ and $g$ are the same function?
I think yes, because $f^{-1}(ø)=g^{-1}(ø)=ø$ and $f^{-1}(Y)=g^{-1}(Y)=X$, so if there existed some open $V\subseteq X$, then there is nowhere for that $V$ to go except $Y$ (i.e. $f(V)=g(V)=Y$) because otherwise it wouldn't be true that $f^{-1}(ø)=g^{-1}(ø)=ø$ and $f^{-1}(a)=g^{-1}(a)=O$. Is this correct?
Yes. And we do not need topology at all, it suffices to have arbitrary maps $f,g\colon X\to Y$ with $f^{-1}(a)=g^{-1}(a)$:
Let $x\in X$. Then either $f(x)=a$ or $f(x)=b$.