TITLE: Continuity in a compact metric space.
QUESTION [7 upvotes]: Let $(X,d)$ be a compact metric space and let $f, g: X \rightarrow \mathbb{R}$ be continuous such that $$f(x) \neq g(x), \forall x\in X.$$
  Show that there exists an $\epsilon$ such that $$|f(x) - g(x)| \geq \epsilon, \forall x \in X.$$

I'm assuming he means $\epsilon > 0$. Well, suppose to the contrary that for all $\epsilon > 0$, there exists an $x' \in X$ such that $|f(x') - g(x')| < \epsilon.$ Since $f(x')$ and $g(x')$ are fixed values, we must have $f(x') = g(x')$, a contradiction. 
Seems uh... too easy? I didn't even have to use continuity or compactness? So seems wrong? (I'm really sick, so terrible at math this week, but is this right?)

REPLY [6 votes]: The problem with your proof is that you cannot fix $x'$ and vary $\epsilon$. This is because $x'$ is conditioned on your given $\epsilon$.
As for a correct solution note that $|f(x) - g(x)|$ is a continuous function from $X$ to $\mathbb{R}$. What do you know about the minimum of a continuous function from a compact space to $\mathbb{R}$?

REPLY [3 votes]: Denying we have: given $k > 0$ there exist's $x_k$ such that $|f(x_k) - g(x_k)| < \frac{1}{k}.$
Make $x = (x_k).$ Since $M$ is compact, we have that $x$ must have a convergent subsequence to some $y \in M$. Then passing to the subsequence we must have, using continuity of $f,$ and $g$, that $g(y) = f(y)$. What is a contradiction.