# Let $f,g:X\rightarrow \mathbb{R}$ continuous functions .If $X$ is open set,then the following set is open:$A=\{x \in X;f(x)\neq g(x)\}$

Let $f,g:X\rightarrow \mathbb{R}$ continuous functions .If $X$ is open set,then the following set is open:$A=\{x \in X;f(x)\neq g(x)\}$.

And if $X$ is a closed set , then the following set is closed : $F=\{x \in X;f(x)= g(x)\}$.

I thought like this:

For the set A,$f(x) < g(x)$ or $f(x)>g(x)$.

Int he first case ,I did:

For every $a \in A$ ,there is an open interval $I_a$ ,with center $a$, such that :

$\{a\}\subset X\cap I_a\subset A.$ From that,we have:

$\bigcup _a_\in _A \{a\} \subset \bigcup _a_\in _A(X \cap I_a) \subset A$,that is:

$A\subset X(\bigcup_a_\in _A I_a) \subset A.$

But,how $X$ is open , then A is open.

In the set $F=X- \{x\in X;g(x)<f(x) \}$...Then ,I´m stucked in this problem...

-
The question says that $X$ is open. What kind of topological space is $X$? Or is $X$ just an open subset of $\mathbb{R}$, or $\mathbb{R}^n$? – André Nicolas Jul 17 '12 at 0:26
Just an open subset of R. – HipsterMathematician Jul 17 '12 at 0:28

Since the space has not been specified, we assume that $X$ is an open subset of the reals. The same proof works more generally.

Let $h(x)=f(x)-g(x)$. Let $x$ be any point such that $f(x)\ne g(x)$, that is, such that $h(x)=y\ne 0$. Let $U_y$ be an open interval about $y$ such that $U_y$ does not contain $0$.

Then by properties of continuous functions, $h^{-1}(U_y)$ is open. Thus there is an open neighbourhood of $x$ such that for all $u$ in that neighbourhood, $h(u)\ne 0$. (If $f$ and $g$ are continuous functions defined on the reals, instead of $h^{-1}(U)$, use the neighbourhood $h^{-1}(U)\cap X$.)

This implies that $\{x|h(x)\ne 0\}$ is open.

Remark: What follows is the answer to the first edition of the question, which did not assume continuity.

You need some continuity condition. Let $X=\mathbb{R}$. Then certainly $X$ is open. Let $h(x)=f(x)-g(x)$. Suppose that $h(0)=1$, and $h(x)=0$ for $x\ne 0$.

For example, we can take $f(0)=1$, $g(0)=0$, and $f(x)=0$, $g(x)=0$ for all $x\ne 0$.

Then $\{x|f(x)\ne g(x)\}$ is just the singleton $\{0\}$, which is not open.

The second question is equivalent to the first, since a se is closed if and only if its complement is open. So the second question succumbs to the same type of counterexample.

If we assume that $f$ and $g$ are continuous (or more weakly that $f-g$ is), there is a not difficult proof of the desired result.

-