# Intuition that $A=\{x\in M|\space f(x)\neq g(x)\}$ is open given $f,g$ continuous

Let $M,N$ be two metric spaces and $f,g:M\rightarrow N$ continuous functions. Show that the set $A=\{x\in M|\space f(x)\neq g(x)\}$ is open in $M$.

Well, I understand that if $h(x)=d_{N}(f(x),g(x))$ it is only left to prove, that $h$ is continuous and then the set $A=\{x\in M|\space h(x)>0\}$ is open. My question is, what was the 'mind process' to get to the conclusion that I should use $h$ instead of something else to prove that proposition. What was the intuition behind creating that function.

I hope you guys understand what Im trying to ask, thanks so much in advance.

• Do you mean just $a=b\iff d(a,b) = 0$, or equivalently, $a\neq b\iff d(a,b)>0$?
– MPW
Commented Aug 2, 2018 at 22:58
• Note, that the function is called $h$ and not $h(x)$. $h(x)$ is a point in the image of $h$. Also you did not say, where $h$ is defined. Therefor something like $h: A\to B$ with $h(x)=d_N(f(x),g(x))$. Commented Aug 2, 2018 at 23:01
• I think it's important to note that, in this case, you really don't need this trick; you can easily prove directly that $A=\{f\neq g\}$ is open. Let $x\in A$, that is, $f(x)\neq g(x)$. If $x$ were not in the interior of $A$, you would be able to construct a sequence $x_n$ converging to $x$ such that $f(x_n)=g(x_n)$, and it would follow by the continuity of $f$ and $g$ that $f(x)=g(x)$. (Actually, what I did here was to show that ${f=g}$ is closed, which is the same anyway.) Commented Aug 2, 2018 at 23:37
• In the end, I believe that, as much as it's important to know the "standard tricks" and get used to them, it's also important to be able to prove these simple results using whatever method you think is intuitive for you, and then you will, little by little, acquire intuition about the standard tricks. Commented Aug 2, 2018 at 23:39
• I remember there is a proof for this that generalised to Hausdorff spaces, and thus only using the topological properties of the metric. Commented Aug 3, 2018 at 3:18

This proof is what is often called a follow your nose proof --- at each step you do the only thing that you can with the given information, and you end up at the result. For this problem, it goes as follows:

1. I observe that the goal is to prove that $A$ is open. So what am I given? All I am given is information about continuous functions from $M$ to $N$. This suggests that I will need to show that $A$ is the pre-image of an open set in under some continuous function.
2. I need to actually find a continuous function $h$ and an open set $B$ such that $A = h^{-1}(B)$. Clearly, that function must be in terms of $f$ and $g$, since they are all I have to work with, and also clearly it can't be just one of them, since $A$ is defined in terms of both.
3. So what combination of $f$ and $g$ could produce a function that has to do with $A$? Well, we haven't actually used either of the metrics $d_M$ or $d_N$ yet, so let's look there. I go back to my definition of metric space and notice that $d(a,b) > 0 \iff a \ne b$. I notice that $a \ne b$ looks like $f(x) \ne g(x)$. That is, our metric space definition says that $f(x) \ne g(x) \iff d_N(f(x),g(x)) > 0$. Hence, $h : M \to \mathbb{R}_{\ge 0}$ defined as $h(x) = d_N(f(x),g(x))$ looks like it may be a good candidate for $h$.
4. There's really no more work to do --- just verify that we followed our nose to the correct place: letting $h(x) = d_N(f(x), g(x))$, and observe that this forces $B = (0,\infty)$, which we can confirm is open. And $h$ is clearly continuous. So $A$ is open!

If the spaces were Euclidean spaces, then you could define $h(x)=f(x)-g(x)$. Then $h$ would be continuous, its zero set would be closed, and the complement would be open. Done.

You cannot subtract functions on general metric spaces. But since we want the zero set, then the next best thing is to use the distance in the codomain.

IMO, this is sort of thing is a "basic trick" — you try it out simply because it's one of the standard things you check to see if it applies to your problem.

Actually, there are two basic tricks here:

• the idea of encoding "equal / not equal" via the metric
• identifying inequality constraints between real numbers as open sets (or equality constraints as closed sets) so you can use general topological properties of such things