How to show that $E=\{x \in X: f (x) \neq g(x)\}$ is an open set? Let $X, Y$ be metric spaces. Let $f,g: X \rightarrow Y$ be continuous. Show that the set $E =\{x \in X: f (x) \neq g(x)\}$ is open in $X$.  
My work: Let $x \in E$ and choose two open sets $V$ and $W$ such that $f(x) \in V$ and $g(x) \in W$ with $V \cap W = \emptyset$. Then $f^{-1}(V)$ and $g^{-1}(W)$ is open since $f$ and $g$ are continuous. Then $x \in U=f^{-1}(V) \cap g^{-1}(W)$ is open and contains $x$ hence $f(U) \subset V$ and $g(U) \subset W$. Since $V \cap W = \emptyset$ then $f(U) \cap g(U) = \emptyset$. 
Now I don't know what to do next. How do I arrive at the conclusion that $E$ is open?
 A: You're on the right track. You have shown $x \in U$ and $U$ is open. Now all you need to show is $U \subseteq E$ to conclude $E$ is open. To that end, let $z \in U,$ then $f(z) \in U$ and $g(z) \in W.$ Since $U \cap W=\emptyset,$ therefore $f(z)\neq g(z)$ and hence $z \in E.$ This proves $U \subseteq E.$
A: Let's show the complement $\{f=g \}:= \{x \in X: f(x) = g(x)\}$ is closed. To see this, let $x \in \overline{\{f=g\}}$. Our goal is to show that $x \in \{f=g\}$
, i.e. $f(x) = g(x)$.
Since we work with metric spaces, there is a sequence $(x_n)_{n=1}^\infty$ in $X$ with $f(x_n) = g(x_n)$  for all $n \geq 1$ and such that $\lim_n x_n = x$. But by continuity of $f$ and $g$, we get $\lim_n f(x_n) = f(x)$  and $\lim_n g(x_n) = g(x)$. Since $f(x_n) = g(x_n)$ for all $n \geq 1$, we must have $f(x)= g(x)$.
Remark: the same proof works in arbitrary topological spaces if we use nets instead of sequences.
A: A more "metric" proof can be found by observing that $f(x) \neq g(x) \iff d_Y(f(x), g(x)) > 0$ and considering the sets $E_n = \{ x \in X \ | \ d_Y(f(x), g(x)) > \frac{1}{n} \}$. 
We claim $E_n$ is open. Indeed, choose $x \in E_n$ and let $s = d_Y(f(x), g(x))$. Given $\epsilon > 0$, by continuity of both $f$ and $g$, there is a $\delta > 0$ such that $d_X(x, y) < \delta \implies d_Y(f(x), f(y)) + d_Y(g(x), g(y)) < \epsilon$.
By triangular inequality, we have
$$
s = d_Y(f(x), g(x)) \le d_Y(f(x), f(y)) + d_Y(f(y), g(y)) + d_Y(g(y), g(x)) < \epsilon + d_Y(f(y), g(y))
$$
Now, choosing $\epsilon = s - \frac{1}{n}$, we have that $y \in E_n$.
Since $E = \cup E_n$, it follows that $E$ is open as well.
