Given that $X$ is an arbitrary topological space, $Y$ is a totally ordered set in the order topology, and $f$, $g \colon X \to Y$ are continuous functions, how to show that the subset $A$ of $X$ given by $$ A \colon= \left\{ \ x \in X \ \colon \ f(x) \leq g(x) \ \right\} $$ is closed in $X$?
Edit based on the answer by Hagen von Eitzen:
Let $U \colon= \{ u \times v \in Y \times Y \ \colon \ u < v \ \}$. We show that $U$ is open in $Y \times Y$.
Let $u \times v \in U$. Then $u < v$.
Case I. If there is some $y \in Y$ such that $u < y < v$, then $u \times v \in (-\infty, y) \times (y, +\infty) \subset U$.
Case 2. If $(u,v)$ is empty, then $u \in (-\infty, v)$ and $v \in (u, +\infty)$, and so $u \times v \in (-\infty, v) \times (u, +\infty)$.
Moreover, if $a \times b \in (-\infty, v) \times (u, +\infty)$, then we must have $a < v$ and $b> u$. So $a \leq u < v \leq b$, which implies that $a < b$ and so $a \times b \in U$.
Thus, $u \times v \in (-\infty, v) \times (u, +\infty) \subset U$.
So $U$ is open in $Y \times Y$.
Similarly, we can show that the set $$V \colon= \left\{ \ u \times v \in Y \times Y \ \colon \ u > v \ \right\}$$ is open in $Y \times Y$.
Thus, it follows that the set $A \colon= \{ \ u \times v \in Y \times Y \ \colon \ u \leq v \ \}$ is closed in $Y \times Y$.
Now since the maps $f \colon X \to Y$ and $g \colon X \to Y$ are continuous, so is the map $f \times g \colon X \to Y \times Y$ defined as $$(f \times g)(x) \colon= f(x) \times g(x) \ \mbox{ for all } \ x \in X.$$
Thus, the inverse image under $f \times g$ of the set $A$ is closed in $X$.
But $$ \begin{align} (f \times g)^{-1} (A) &= \left\{ \ x \in X \ \colon \ (f \times g)(x) \in A \ \right\} \\ &= \left\{ \ x \in X \ \colon \ f(x) \times g(x) \in A \ \right\} \\ &= \left\{ \ x \in X \ \colon \ f(x) \leq g(x) \ \right\}. \end{align} $$