I'm sure this is pretty elementary but I am intellectually needy.

I need to show that with $\displaystyle f,g :X \rightarrow Y$ both continuous and with $\displaystyle Y$ in the order topology, the set $\displaystyle \{x \ | \ f(x) \leq g(x) \}$ is closed.

My work so far: I am trying to show that the complement is open. If we denote the given set by $\displaystyle A$, then the complement is $\displaystyle A^c = \{x \ | \ f(x) > g(x) \}$. For a particular $\displaystyle x$ satisfying $\displaystyle f(x) > g(x)$ we have one of two cases:

(1) $\displaystyle f(x)$ is the immediate successor of $\displaystyle g(x)$. In this case, let $\displaystyle U \subset Y$ be defined by $\displaystyle U = \{y \ | \ y > g(x)\}$, and let $\displaystyle V \subset Y$ be defined by $\displaystyle V = \{y \ | \ y < f(x) \}$.

(2) There exists some $\displaystyle y_0$ satisfying $\displaystyle f(x) > y_0 > g(x) $; in this case, define $\displaystyle U \subset Y$ as $\displaystyle U = \{y \ | \ y > y_0\}$, and define $\displaystyle V \subset Y$ as $\displaystyle V = \{y \ | \ y < y_0\}$ for some such $\displaystyle y_0$.

Inbothof these cases, $\displaystyle U,V$ are open sets (since $\displaystyle Y$ has the order topology), and since $\displaystyle f,g$ are continuous, we have that $\displaystyle f^{-1}(U)$ and $\displaystyle g^{-1}(V)$ are both open in $\displaystyle X$.

That's the work that I've done so far, with some coaching from a professor. Now what I would like to do is create a collection of sets $\displaystyle \{U_x\}_{x \in X}$, and then claim that since $\displaystyle f^{-1}(U_x)$ is open for each $\displaystyle x$ ($\displaystyle U_x$ is open and $\displaystyle f$ is continuous), we can take the union $\displaystyle \bigcup_{x \in X} U_x $ and claim it to be open in $\displaystyle X$. This is where my reasoning gets a little blurry, though. Is this union really the same as $\displaystyle \{x \ | \ f(x) > g(x)\}$? It seems in a certain sense that it is, since each $\displaystyle f^{-1}(U)$ produces the set of inputs such that the outputs of $\displaystyle f(x)$ are greater than the outputs of $\displaystyle g(x)$for that particular$\displaystyle x$. But in another sense it seems obvious that this does NOT compose the set in question, since if we allow $\displaystyle x$ to range over all possible values then the union will include a great many values for which in general it is not true that $\displaystyle f(x) > g(x)$. ALSO, and perhaps more vexingly, the current argument does not make use of the continuity of $\displaystyle g$.

Can anyone help with this? Thanks!

-Steve