# Why is the set $\{x \mid f(x) \not= g(x)\}$ measurable in a topological hausdorff space?

assuming i have a measure space $$(X, \mathscr{M}_X, \mu)$$ and a measurable space $$(Y,\mathscr{M}_Y)$$, two measurable mappings $$f,g:X \to Y$$ and it holds that $$Y$$ is a topological hausdorff space with a countable base. (I think i am supposed to assume that $$\mathscr{M}_Y$$ is the Borel-$$\sigma$$-Algebra generated by the open/closed subsets of Y)

Now i am wonderung: Why exactly is the set $$\{x \in X \mid f(x) \not= g(x)\}$$ measurable? in other words why is $$\{x \in X \mid f(x) \not= g(x)\} \in \mathscr{M}_X$$

I know that the diagonal $$\Delta Y = \{(y,y)\mid y \in Y\}\subset Y \times Y$$ is closed in any hausdorff space.

I also know that since $$\Delta Y$$ is closed in $$Y \times Y$$, its complement $$(Y \times Y)\setminus \Delta Y$$ is open.

However, $$\{(f(x),g(x)\mid x \in X, f(x) \not= g(x) \}$$ is only a subset of $$(Y \times Y)\setminus \Delta Y$$ for which i can't say whether it is open or closed.

The only idea that's left was to try this:

Pick an arbitrary point $$p = (f(x),g(x))$$ for which $$f(x)\not= g(x)$$ in $$Y\times Y$$. Since $$Y$$ is a Hausdorff space, we can find disjoint open neighbourhoods $$U$$ around $$f(x)$$ and $$V$$ around $$g(x)$$ such that $$U \times V$$ is an open neighbourhood of $$(f(x),g(x))$$ with $$U \times V \cap \Delta Y = \emptyset$$

Since $$\{(f(x),g(x)\mid x \in X, f(x) \not= g(x) \}$$ is a union of all such open neighbourhoods $$U\times V$$ of points $$(f(x),g(x))$$ with $$f(x) \not= g(x)$$ it is open in $$Y\times Y$$. (is this correct?)

If the last paragraph would be correct, i'd be finished.

Thank you very much for any of your help.

EDIT: New summary of what i gathered so far with the help of the recent comments and answers:

As pointed out in the comments, i did the mistake to purely focus on $$B:= \{(f(x),g(x)\mid f(x) \not= g(x), x \in X\}$$ and tried to conclude that its preimage is measurable iff $$B$$ is open which was a wrong assumption in the first place.

Therefore, i do not need $$B$$ itself to be open. It's sufficient to show that the union of all open disjoint neighbourhoods $$U\times V$$ of arbitrary points $$f(x),g(x)$$ for which $$f(x) \not= g(x)$$ is an open set; because what matters is its preimage and not the set (image) itself. Let $$B' := \bigcup\{U \times V \mid U, V \in \mathcal{B}\ ;\ U \cap V = \emptyset\}$$

$$B'$$ is obviously an open set, therefore its preimage is mesaurable.

For the preimage of open disjoint neighbourhoods $$U,V$$ of $$f(x)$$ and $$g(x)$$ respectively, it holds that

$$(f\times g)^{-1}(U\times V) = \{x \mid f(x)\in U \wedge g(x) \in V\} = f^{-1}(U)\cap g^{-1}(V)$$ (this is something i actually didnt know, it didn't know the definition of cartesian products of mappings, that's also the reason i didnt understand alex's question right away)

Since $$U\times V$$ is open, $$(f\times g)^{-1}(U \times V)$$ is measurable. Since $$\mathcal{B}$$ is a countable base the set

$$\{x \in X\mid f(x) \not= g(x) \} = \bigcup \{ (f\times g)^{-1}(U\times V) \mid U, V \in \mathcal{B}, U \cap V = \emptyset\} = \bigcup\{ f^{-1}(U)\cap g^{-1}(V)\mid U, V \in \mathcal{B}, U \cap V = \emptyset\}$$ is a countable union of measurable sets and therefore measurable itself.

• There is obviously a typo in the expression $\{(f(x),g(x)\mid x \in X\}$ which occurs at the start of the 5th and 8th paragraphs. For one thing the opening parenthesis remains unclosed. If $\{(f(x),g(x))\mid x \in X\}$ is what was meant, then I don't see why it would necessarily be a subset of $(Y \times Y)\setminus \Delta Y$, since there's nothing in the definition of the set to eliminate those $\ x\$ for which $\ f(x) = g(x)\$. Was it supposed to have been $\{(f(x),g(x))\mid x \in X, f(x) \ne g(x) \}\$ ? – lonza leggiera Jan 26 '19 at 11:00
• hello @lonzaleggiera, you're right, that's a typo. thanks for pointing out. i will edit my question immediately. – Zest Jan 26 '19 at 17:28

In answer to the question asked, about whether the argument in the last paragraph is correct, I don't believe that it is at it stands.

The problem is with the assertion $$"\ \{( \,f(x),g(x)\ )\mid x \in X, f(x) \not= g(x) \}\$$ is a union of all such open neighbourhoods $$\dots\$$ ." If you take the union of all the open neighbourhoods you describe you will certainly get an open set containing $$\ \{( \,f(x),g(x)\ )\mid x \in X,\, f(x) \not= g(x) \}\$$, but I don't see why it should be equal to it, and I believe I can give a counterexample to the general statement that $$\ \{( \,f(x),g(x)\ )\mid x \in X,\, f(x) \not= g(x) \}\$$ must be open under the hypotheses given

Nevertheless, I think Alex Ravsky's proof shows that the basic idea underlying the argument was sound.

Take $$\ X = Y = \mathbb R\$$—the set of real numbers—, and $$\ \mathscr{M}_X ,\mathscr{M}_Y\ \$$ both to be the Borel sets of $$\ \mathbb R\$$. Let $$\ f\left(x\right)= 0\ \mbox{ and }\ g\left(x\right)= x\ \mbox{ for all } x\in\mathbb R\$$. Then $$\ \{( \,f(x),g(x)\ )\mid x \in X,\, f(x) \not= g(x) \}\$$ is the punctured line segment $$\ \left\{\ \left(\,0,x\,\right)\ \mid\ x\ne0\ \right\}\$$ of $$\ \mathbb R^2\$$, which is not an open set.

Comment on proposed new proof: Apart from some probable typos, itemised below, the new revised proof by Zest seems to me to be correct.

The following appear likely to me to be typos:

• $$B' = \bigcup \left\{ U\times V\mid U,V\in B, U\cap V=\emptyset\right\}\ .$$ This should be $$B' = \bigcup \left\{ U\times V\mid U,V\in{\mathcal B}, U\cap V=\emptyset\right\}$$
• I'm not sure what the observation "Since $$\ B\$$ is a countable base $$\ \mathcal B\ \dots\$$" is trying to say. As far as I can see, all that's necessary here is the observation that $$\ \mathcal B\$$ is a countable base.
• A union sign is missing from the last term on the left of the final series of equations. That is, $$\ \left\{\,f^{-1}\left(U\right)\cap g^{-1}\left(V\right)\mid U,V\in{\mathcal B}, U\cap V=\emptyset\right\}\$$ should be $$\ \bigcup\left\{\,f^{-1}\left(U\right)\cap g^{-1}\left(V\right)\mid U,V\in{\mathcal B}, U\cap V=\emptyset\right\}\$$

The nice observation Alex Ravsky and Zest have made here, and which I had missed, is that $$\ \left\{\,x\in X \mid f\left(x\right)\neq g\left(x\right)\,\right\}\$$ is actually equal to $$\ \left(f\times g\right)^{-1}\left(B'\right)\$$ rather than being a strict subset of it. Since this isn't immediately obvious—at least it wasn't to me, although the proof is fairly straightforward once the fact is realised—I'd like to see a brief proof of that fact included in any formal writeup.

• thanks for your help. well, the union of open sets is open, thus if in fact the set $\{(f(x),g(x)) \mid x \in X, f(x) \not= g(x)\}$ is a union of disjoint open neighbourhood, it is open. – Zest Jan 26 '19 at 23:53
• But how did you get that the set $\{( \,f(x),g(x)\ )\mid x \in X, f(x) \not= g(x) \}$ is a union of disjoint open neighbourhoods? If $\ U\$ and $\ V\$ are disjoint open neighbourhoods around $\ f(x)\$ and $\ g(x)\$ respectively, $\ U\$ may well contain an element $\ u\$ that isn't in the image of $\ f\$, and $\ V\$ an element $\ v\$ that isn't in the image of $\ g\$. The point $\ (u, v)\$ will be in any union that includes $\ U\times V\$ but *not* in $\{( \,f(x),g(x)\ )\mid x \in X, f(x) \not= g(x) \}\$, because there is no $\ x \in X\$ with $\ (f(x),g(x)) = (u,v)$ . – lonza leggiera Jan 27 '19 at 0:18
• you're right. i didnt consider that. i will think about it again! thanks for the clarification. – Zest Jan 27 '19 at 0:25
• i have another question. is it possible that we don't even need $B := \{ f(x),g(x) \mid x \in X, f(x)\not= g(x)\}$ to be open in $Y$? what matters it that even if $B$ might only be a subset of an open set as you suggested, lets say $B\subset B'$ and $B'$ is the union of all disjoint open neighbourhoods of $f,g$ for which $f\not=g$ then we can still conclude that the preimage of $B'$ is measurable, can't we? – Zest Jan 27 '19 at 9:36
• Yes, I think you've done it. There appear to be some typos in your revised proof, but otherwise it seems to me to be correct. Well done – lonza leggiera Jan 27 '19 at 13:33

$$h(x)=(f(x),g(x))$$ is measurable and $$\{x:f(x)\neq g(x)\}=h^{-1}(Y\times Y-\Delta)$$ is measurable since $$\Delta$$ is closed, $$(Y\times Y)-\Delta$$ is open.

• $h$ is measurable strictly follows from $f,g$ both measurable, right? was my proof correct or did i do mistakes along the way? – Zest Jan 23 '19 at 3:39

I think all presented proofs are incomplete (for instance, they don’t use the fact that $$Y$$ has a countable base $$\mathcal B$$). I also assume that $$\mathcal M_X$$ is closed with respect to intersections and countable unions.

Let $$A=\{x\in X|f(x)\ne g(x)\}$$. Let $$x\in A$$ be any point. Since $$f(x)\ne g(x)$$ and $$Y$$ is Hausdorff, there exists disjoint neighborhoods $$U,V\in\mathcal B$$ of $$f(x)$$ and $$g(x)$$, respectively. Thus

$$A=\bigcup \{f^{-1}(U)\cap g^{-1}(V): U,V\in\mathcal B, U\cap V=\varnothing\}$$

is measurable.

• hello alex, thanks for your consideration. Where did you use the fact that $Y$ has a countable base? And why exactly is $A$ measurable in your answer? – Zest Jan 26 '19 at 23:59
• @Zest Since $Y$ has a countable base the union for $A$ is countable. Then $A$ is measurable, because (as I assumed) $\mathcal M_X$ is closed with respect to (finite) intersections and countable unions. – Alex Ravsky Jan 27 '19 at 0:11
• i see, thank you very much. I might return with questions tomorrow, highly appreciating your help. – Zest Jan 27 '19 at 0:23
• hello alex, i just edited my question and added my own summary of everything i learned with your help. would you mind taking a look and tell me if my proof is correct? it is very detailed but i am on undergruadate level and it helps me sometimes getting a better idea of everything. – Zest Jan 27 '19 at 10:42