Prove that the below set is closed in X! Let $(X,μ)$ be a topological space,
$g, f:X\longrightarrow\Bbb R$ continuous functions.
Prove that $\{ x\in X: g(x)=f(x)\}$ is closed in $X$.
I tried to prove that with the definitions of a continuous and a closed function, and with theories about a continuous function (between two spaces), but i got nothing.
I said that since f and g are both continuous so for every closed set ${K}$ in ${R}$ , $f^{-1}{K}$ is closed in X , same about g.
I also looked at $g\circ f^{-1}:\Bbb R\longrightarrow R$.
$g\circ f^{-1}(K) = g(f^{-1}(K)$ is closed in $X$.
Then $g\circ f^{-1}(K)=\operatorname{id}(K)=K$ is closed in ${X}$, but that did not help me to prove that the given set is closed.
 A: Let your set of interest be $I = \{x \in X \mid f(x) = g(x)\}$ ($I$ for "intersection").  We claim that $I$ is closed by showing its complement is open.
Take a point $x \notin I$ so that $x \in X$ and $f(x) \neq g(x)$.  Then we can find open sets $U$ and $V$ in $\mathbb{R}$ with $U$ surrounding $f(x)$, $V$ surrounding $g(x)$, and $U \cap V = \varnothing$.  Now pull back $U$ and $V$ under $f$ and $g$ respectively to get the open set $W=f^{-1}(U) \cap g^{-1}(V)$.  Clearly $x \in W$ and no point of $W$ can belong to your set $I$. 
For instance, if $x \in I$ and $x \in W$ then $f(x) = g(x) \in U \cap V$, which is impossible as $U$ and $V$ are disjoint.  This $W$ gives a neighborhood around $x$ that stays within $X-I$, so $X-I$ must be open.  Hence $I$ is closed, as desired. 
Note: this argument generalizes to functions $f, g: X \to Y$, where $Y$ can be any Hausdorff space.
A: If $f$ and $g$ are continuous, then $h(x)=f(x)-g(x)$ is also continuous.  $K=\{ x \in X \mid f(x)=g(x) \} = h^{-1}(\{ 0 \})$ is the inverse image of a closed set under a continuous function, so it is closed.  (Alternatively, $K = X \setminus h^{-1}(\Bbb R \setminus  \{ 0 \})$ is the complement of the inverse image of an open set under a continuous function, so it's the complement of an open set, so it's closed.)
A: Note that $\Delta=\{(x,x): x \in \Bbb R\}$ is closed in $\Bbb R^2$.
When $f$ and $g$ are continuous, so is $f \nabla g: X \to \Bbb R^2$ defined by $(f \nabla g)(x)=(f(x),g(x))$.
Now $$\{x \in X: f(x)=g(x)\}=(f \nabla g)^{-1}[\Delta]$$ is closed as the inverse image of a closed set under a continuous map.
A: Put $h=f-g$.
Your set is 
$$h^{-1}(\{0\})$$
which is colsed  as reciprocal image of the closed $\{0\}$ by a continuous function.
