Let $W, V$ be topological spaces, and let $f: W \rightarrow X$ and $g: W \rightarrow X$ be continuous functions. Define the coincidence set of $f$ & $g$ to be the subset $$c(f,g) = \{w \in W | f(w) = g(w)\}$$ of $W$. Prove that if $X$ is Hausdorff then $c(f,g)$ is closed in $W$.
Define $\bar{c}(f,g) = \{(w_1, w_2) \in W \times W | w_1, w_2 \in c(f,g)\}$.
Suppose that $X$ is Hausdorff. Consider the function $\phi := f \times g: W \times W \rightarrow X \times X$. Then $\phi(\bar{c(f,g)}) = \{(f(w),g(w')) | w, w' \in c(f,g) \}$. Since $X$ is Hausdorff, it is also T1. So each $(f(w), g(w)) \in \phi(\bar{c(f,g)})$ is closed. Since the union of closed sets is closed, $\phi(\bar{c(f,g)})$ must be closed.
Since $f$ and $g$ are continuous, $f \times g$ is also continuous. So $\phi(\bar{c(f,g)})$ closed in $X \times X$ $\implies$ $\phi^{-1}\phi(\bar{c(f,g)})$ is closed in $W \times W$.
Then I showed that $\bar{c}(f,g) = \phi^{-1}\phi(c(f,g))$. So $c(f,g)$ must be closed in $W$.
Do you think my approach is correct?
Thanks in advance
Others have pointed out in comments the main problem with your argument: arbitrary unions of closed sets need not be closed. There is a proof using your function $\varphi$ and the fact that since $X$ is Hausdorff, the diagonal in $X\times X$ is closed, but you can also simply show directly that $W\setminus c(f,g)$ is open.
HINT: Suppose that $w\in W\setminus c(f,g)$; then $f(w)\ne g(w)$. $X$ is Hausdorff, so there are open sets $U$ and $V$ in $X$ such that $f(w)\in U$, $g(w)\in V$, and $U\cap V=\varnothing$; now consider the set $f^{-1}[U]\cap g^{-1}[V]$.