How to prove $\left\{ \omega|X(\omega)=Y(\omega)\right\} \in\mathcal{F}$ is measurable, if $X$ and $Y$ are measurable? Given a probability space $(\Omega ,\mathcal{F} ,\mu)$. Let $X$ and $Y$ be $\mathcal{F}$-measurable real valued random variables.  How would one proove that $\left\{ \omega|X(\omega)=Y(\omega)\right\} \in\mathcal{F}$ is measurable.
My thoughts: Since $X$ and $Y$ are measurable, it is true, that for each $x\in\mathbb{R}:$ $\left\{ \omega|X(\omega)<x\right\} \in\mathcal{F}$ and $\left\{ \omega|Y(\omega)<x\right\} \in\mathcal{F}$.
It follows that $\left\{ \omega|X(\omega)-Y(\omega)\leq x\right\} \in\mathcal{F}$
Therefore $\left\{ -\frac{1}{n}\leq\omega|X(\omega)-Y(\omega)\leq \frac{1}{n} \right\} \in\mathcal{F}$, for $n\in\mathbb{N}$.
Therefore $0=\bigcap_{n\in\mathbb{N}}\left\{ -\frac{1}{n}\leq\omega|X(\omega)-Y(\omega)\leq \frac{1}{n} \right\} \in\mathcal{F}$.
Am working towards the correct direction? I appreciate any constructive answer!

We would want to try to do something like this:

If $X$, $Y$ are $\mathcal F-$measurable, then $X^{-1}(B), Y^{-1}(B) \in \mathcal F$ for any $B \in \mathscr B(\mathbb R)$. Choose $B = \{b\}$ for some $b \in \mathbb R$.
Then $$\{X=Y\} = \bigcup_{b \in \mathbb R} \{X=Y=b\} = \bigcup_{b \in \mathbb R} [\{X=b\} \cap \{Y=b\}]$$
Now $\{X=Y\} \in \mathcal F \iff \{X \ne Y\} \in \mathcal F$

Unfortunately, our union is uncountable, and $\sigma-$algebra's, for good reason, aren't closed under uncountable unions. So, let's try something with a countable set like $b \in \mathbb Z$. The ranges of $X$ or $Y$ could be non-$\mathbb Z$ valued so we'll have to choose a non-singleton for $B$ namely $(-\infty,b]$ and its complement.
Then $$\{X<Y\} = \bigcup_{b \in \mathbb Z} [\{X \le b\} \cap \{Y>b\}]$$ and $$\{X>Y\} = \bigcup_{b \in \mathbb Z} [\{X > b\} \cap \{Y \le b\}]$$ and $$\{X<Y\} \cup \{X>Y\} = \{X \ne Y\}$$
